Datasets:
Add files using upload-large-folder tool
Browse files- md/train/2LdBqxc1Yv/2LdBqxc1Yv.md +330 -0
- md/train/37nvvqkCo5/37nvvqkCo5.md +631 -0
- md/train/AAWuCvzaVt/AAWuCvzaVt.md +267 -0
- md/train/B1e0X3C9tQ/B1e0X3C9tQ.md +270 -0
- md/train/BJ--gPcxl/BJ--gPcxl.md +221 -0
- md/train/BJJLHbb0-/BJJLHbb0-.md +340 -0
- md/train/BJfvAoC9YQ/BJfvAoC9YQ.md +291 -0
- md/train/BkXmYfbAZ/BkXmYfbAZ.md +293 -0
- md/train/Bye9LiR9YX/Bye9LiR9YX.md +365 -0
- md/train/BylEqnVFDB/BylEqnVFDB.md +329 -0
- md/train/D9I3drBz4UC/D9I3drBz4UC.md +353 -0
- md/train/H1Y8hhg0b/H1Y8hhg0b.md +341 -0
- md/train/H1efEp4Yvr/H1efEp4Yvr.md +517 -0
- md/train/H1gza2NtwH/H1gza2NtwH.md +559 -0
- md/train/H1meywxRW/H1meywxRW.md +239 -0
- md/train/HJ0UKP9ge/HJ0UKP9ge.md +285 -0
- md/train/HyGySsAct7/HyGySsAct7.md +175 -0
- md/train/Hye-LiR5Y7/Hye-LiR5Y7.md +349 -0
- md/train/Hygab1rKDS/Hygab1rKDS.md +0 -0
- md/train/HylTBhA5tQ/HylTBhA5tQ.md +314 -0
- md/train/Hyp3i2xRb/Hyp3i2xRb.md +325 -0
- md/train/HyxAfnA5tm/HyxAfnA5tm.md +333 -0
- md/train/LT0KSFnQDWF/LT0KSFnQDWF.md +0 -0
- md/train/LhY8QdUGSuw/LhY8QdUGSuw.md +526 -0
- md/train/Lpfh1Bpqfk/Lpfh1Bpqfk.md +148 -0
- md/train/OQ08SN70M1V/OQ08SN70M1V.md +294 -0
- md/train/PS3IMnScugk/PS3IMnScugk.md +628 -0
- md/train/QkljT4mrfs/QkljT4mrfs.md +219 -0
- md/train/RJ7XFI15Q8f/RJ7XFI15Q8f.md +267 -0
- md/train/S11KBYclx/S11KBYclx.md +258 -0
- md/train/SkPoRg10b/SkPoRg10b.md +0 -0
- md/train/Sklsm20ctX/Sklsm20ctX.md +322 -0
- md/train/SkyQWDcex/SkyQWDcex.md +294 -0
- md/train/Syhr6pxCW/Syhr6pxCW.md +238 -0
- md/train/SyxAb30cY7/SyxAb30cY7.md +529 -0
- md/train/SyxKrySYPr/SyxKrySYPr.md +394 -0
- md/train/TScOKQW67Mj/TScOKQW67Mj.md +401 -0
- md/train/_X_4Akcd8Re/_X_4Akcd8Re.md +398 -0
- md/train/eaAM_bdW0Q/eaAM_bdW0Q.md +259 -0
- md/train/fLnsj7fpbPI/fLnsj7fpbPI.md +300 -0
- md/train/nzpLWnVAyah/nzpLWnVAyah.md +344 -0
- md/train/r1Chut9xl/r1Chut9xl.md +342 -0
- md/train/r1YNw6sxg/r1YNw6sxg.md +424 -0
- md/train/rJe10iC5K7/rJe10iC5K7.md +339 -0
- md/train/rkdU7tCaZ/rkdU7tCaZ.md +251 -0
- md/train/rkeiQlBFPB/rkeiQlBFPB.md +0 -0
- md/train/ryF7rTqgl/ryF7rTqgl.md +270 -0
- md/train/ryUlhzWCZ/ryUlhzWCZ.md +345 -0
- md/train/rygeHgSFDH/rygeHgSFDH.md +493 -0
- md/train/xyGFYKIPTDJ/xyGFYKIPTDJ.md +0 -0
md/train/2LdBqxc1Yv/2LdBqxc1Yv.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Variational Diffusion Models
|
| 2 |
+
|
| 3 |
+
Diederik P. Kingma⇤, Tim Salimans⇤, Ben Poole, Jonathan Ho Google Research
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Diffusion-based generative models have demonstrated a capacity for perceptually impressive synthesis, but can they also be great likelihood-based models? We answer this in the affirmative, and introduce a family of diffusion-based generative models that obtain state-of-the-art likelihoods on standard image density estimation benchmarks. Unlike other diffusion-based models, our method allows for efficient optimization of the noise schedule jointly with the rest of the model. We show that the variational lower bound (VLB) simplifies to a remarkably short expression in terms of the signal-to-noise ratio of the diffused data, thereby improving our theoretical understanding of this model class. Using this insight, we prove an equivalence between several models proposed in the literature. In addition, we show that the continuous-time VLB is invariant to the noise schedule, except for the signal-to-noise ratio at its endpoints. This enables us to learn a noise schedule that minimizes the variance of the resulting VLB estimator, leading to faster optimization. Combining these advances with architectural improvements, we obtain state-of-the-art likelihoods on image density estimation benchmarks, outperforming autoregressive models that have dominated these benchmarks for many years, with often significantly faster optimization. In addition, we show how to use the model as part of a bits-back compression scheme, and demonstrate lossless compression rates close to the theoretical optimum.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Likelihood-based generative modeling is a central task in machine learning that is the basis for a wide range of applications ranging from speech synthesis [Oord et al., 2016], to translation [Sutskever et al., 2014], to compression [MacKay, 2003], to many others. Autoregressive models have long been the dominant model class on this task due to their tractable likelihood and expressivity, as shown in Figure 1. Diffusion models have recently shown impressive results in image [Ho et al., 2020, Song et al., 2021b, Nichol and Dhariwal, 2021] and audio generation [Kong et al., 2020, Chen et al., 2020] in terms of perceptual quality, but have yet to match autoregressive models on density estimation benchmarks. In this paper we make several technical contributions that allow diffusion models to challenge the dominance of autoregressive models in this domain. Our main contributions are as follows:
|
| 12 |
+
|
| 13 |
+
• We introduce a flexible family of diffusion-based generative models that achieve new stateof-the-art log-likelihoods on standard image density estimation benchmarks (CIFAR-10 and ImageNet). This is enabled by incorporating Fourier features into the diffusion model and using a learnable specification of the diffusion process, among other modeling innovations. • We improve our theoretical understanding of density modeling using diffusion models by analyzing their variational lower bound (VLB), deriving a remarkably simple expression in terms of the signal-to-noise ratio of the diffusion process. This result delivers new insight into the model class: for the continuous-time (infinite-depth) setting we prove a novel invariance of the generative model and its VLB to the specification of the diffusion process, and we show that various diffusion models from the literature are equivalent up to a trivial time-dependent rescaling of the data.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Autoregressive generative models were long dominant in standard image density estimation benchmarks. In contrast, we propose a family of diffusion-based generative models, Variational Diffusion Models (VDMs), that outperforms contemporary autoregressive models in these benchmarks. See Table 1 for more results and comparisons.
|
| 17 |
+
|
| 18 |
+
# 2 Related work
|
| 19 |
+
|
| 20 |
+
Our work builds on diffusion probabilistic models (DPMs) [Sohl-Dickstein et al., 2015], or diffusion models in short. DPMs can be viewed as a type of variational autoencoder (VAE) [Kingma and Welling, 2013, Rezende et al., 2014], whose structure and loss function allows for efficient training of arbitrarily deep models. Interest in diffusion models has recently reignited due to their impressive image generation results [Ho et al., 2020, Song and Ermon, 2020].
|
| 21 |
+
|
| 22 |
+
Ho et al. [2020] introduced a number of model innovations to the original DPM, with impressive results on image generation quality benchmarks. They showed that the VLB objective, for a diffusion model with discrete time and diffusion variances shared across input dimensions, is equivalent to multiscale denoising score matching, up to particular weightings per noise scale. Further improvements were proposed by Nichol and Dhariwal [2021], resulting in better log-likelihood scores. Gao et al. [2020] show how diffusion can also be used to efficiently optimize energy-based models (EBMs) towards a close approximation of the log-likelihood objective, resulting in high-fidelity samples even after long MCMC chains.
|
| 23 |
+
|
| 24 |
+
Song and Ermon [2019] first proposed learning generative models through a multi-scale denoising score matching objective, with improved methods in Song and Ermon [2020]. This was later extended to continuous-time diffusion with novel sampling algorithms based on reversing the diffusion process [Song et al., 2021b].
|
| 25 |
+
|
| 26 |
+
Concurrent to our work, Song et al. [2021a], Huang et al. [2021], and Vahdat et al. [2021] also derived variational lower bounds to the data likelihood under a continuous-time diffusion model. Where we consider the infinitely deep limit of a standard VAE, Song et al. [2021a] and Vahdat et al. [2021] present different derivations based on stochastic differential equations. Huang et al. [2021] considers both perspectives and discusses the similarities between the two approaches. An advantage of our analysis compared to these other works is that we present an intuitive expression of the VLB in terms of the signal-to-noise ratio of the diffused data, leading to much simplified expressions of the discrete-time and continuous-time loss, allowing for simple and numerically stable implementation. This also leads to new results on the invariance of the generative model and its VLB to the specification of the diffusion process. We empirically compare to these works, as well as others, in Table 1.
|
| 27 |
+
|
| 28 |
+
Previous approaches to diffusion probabilistic models fixed the diffusion process; in contrast optimize the diffusion process parameters jointly with the rest of the model. This turns the model into a type of VAE [Kingma and Welling, 2013, Rezende et al., 2014]. This is enabled by directly parameterizing the mean and variance of the marginal $q ( \mathbf { z } _ { t } | \mathbf { z } _ { 0 } )$ , where previous approaches instead parameterized the individual diffusion steps $q ( \mathbf { z } _ { t + \epsilon } | \mathbf { z } _ { t } )$ . In addition, our denoising models include several architecture changes, the most important of which is the use of Fourier features, which enable us to reach much better likelihoods than previous diffusion probabilistic models.
|
| 29 |
+
|
| 30 |
+
# 3 Model
|
| 31 |
+
|
| 32 |
+
We will focus on the most basic case of generative modeling, where we have a dataset of observations of $\mathbf { x }$ , and the task is to estimate the marginal distribution $p ( \mathbf { x } )$ . As with most generative models, the described methods can be extended to the case of multiple observed variables, and/or the task of estimating conditional densities $p ( \mathbf { x } | \mathbf { y } )$ . The proposed latent-variable model consists of a diffusion process (Section 3.1) that we invert to obtain a hierarchical generative model (Section 3.3). As we will show, the model choices below result in a surprisingly simple variational lower bound (VLB) of the marginal likelihood, which we use for optimization of the parameters.
|
| 33 |
+
|
| 34 |
+
# 3.1 Forward time diffusion process
|
| 35 |
+
|
| 36 |
+
Our starting point is a Gaussian diffusion process that begins with the data $\mathbf { x }$ , and defines a sequence of increasingly noisy versions of $\mathbf { x }$ which we call the latent variables $\mathbf { z } _ { t }$ , where $t$ runs from $t = 0$ (least noisy) to $t = 1$ (most noisy). The distribution of latent variable $\mathbf { z } _ { t }$ conditioned on $\mathbf { x }$ , for any $t \in [ 0 , 1 ]$ is given by:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
q ( \mathbf { z } _ { t } | \mathbf { x } ) = \mathcal { N } \left( \alpha _ { t } \mathbf { x } , \sigma _ { t } ^ { 2 } \mathbf { I } \right) ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where $\alpha _ { t }$ and $\sigma _ { t } ^ { 2 }$ are strictly positive scalar-valued functions of $t$ . Furthermore, let us define the signal-to-noise ratio (SNR):
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\mathrm { S N R } ( t ) = \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } .
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
We assume that the $\mathrm { S N R } ( t )$ is strictly monotonically decreasing in time, i.e. that $\mathrm { S N R } ( t ) < \mathrm { S N R } ( s )$ for any $t > s$ . This formalizes the notion that the $\mathbf { z } _ { t }$ is increasingly noisy as we go forward in time. We also assume that both $\alpha _ { t }$ and $\sigma _ { t } ^ { 2 }$ are smooth, such that their derivatives with respect to time $t$ are finite. This diffusion process specification includes the variance-preserving diffusion process as used by [Sohl-Dickstein et al., 2015, Ho et al., 2020] as a special case, where $\alpha _ { t } = \sqrt { 1 - \sigma _ { t } ^ { 2 } }$ . Another special case is the variance-exploding diffusion process as used by [Song and Ermon, 2019, Song et al., 2021b], where $\alpha _ { t } ^ { 2 } = 1$ . In experiments, we use the variance-preserving version.
|
| 49 |
+
|
| 50 |
+
The distributions $q ( \mathbf { z } _ { t } | \mathbf { z } _ { s } )$ for any $t > s$ are also Gaussian, and given in Appendix A. The joint distribution of latent variables $\left( { \bf z } _ { s } , { \bf z } _ { t } , { \bf z } _ { u } \right)$ at any subsequent timesteps $0 \leq s < t < u \leq 1$ is Markov: $q ( { \bf z } _ { u } | { \bf z } _ { t } , { \bf z } _ { s } ) = q ( { \bf z } _ { u } | { \bf z } _ { t } )$ . Given the distributions above, it is relatively straightforward to verify through Bayes rule that ${ \dot { q } } ( \mathbf { z } _ { s } | \mathbf { z } _ { t } , \mathbf { x } )$ , for any $0 \leq s < t \leq 1$ , is also Gaussian. This distribution is also given in Appendix A.
|
| 51 |
+
|
| 52 |
+
# 3.2 Noise schedule
|
| 53 |
+
|
| 54 |
+
In previous work, the noise schedule has a fixed form (see Appendix $_ \mathrm { H }$ , Fig. 4a). In contrast, we learn this schedule through the parameterization
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\sigma _ { t } ^ { 2 } = \mathrm { s i g m o i d } ( \gamma _ { \eta } ( t ) )
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\gamma _ { \eta } ( t )$ is a monotonic neural network with parameters $\eta$ , as detailed in Appendix H.
|
| 61 |
+
|
| 62 |
+
Motivated by the equivalence discussed in Section 5.1, we use $\alpha _ { t } = \sqrt { 1 - \sigma _ { t } ^ { 2 } }$ in our experiments for both the discrete-time and continuous-time models, i.e. variance-preserving diffusion processes. It is straightforward to verify that $\alpha _ { t } ^ { 2 }$ and $\mathrm { S N R } ( t )$ , as a function of $\gamma _ { \eta } ( t )$ , then simplify to:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\begin{array} { r } { \alpha _ { t } ^ { 2 } = \mathrm { s i g m o i d } ( - \gamma _ { \pm } ( t ) ) } \\ { \mathrm { S N R } ( t ) = \exp ( - \gamma _ { \pm } ( t ) ) } \end{array}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
# 3.3 Reverse time generative model
|
| 69 |
+
|
| 70 |
+
We define our generative model by inverting the diffusion process of Section 3.1, yielding a hierarchical generative model that samples a sequence of latents $\mathbf { z } _ { t }$ , with time running backward from $t = 1$ to $t = 0$ . We consider both the case where this sequence consists of a finite number of steps $T$ , as well as a continuous time model corresponding to $T \to \infty$ . We start by presenting the discrete-time case.
|
| 71 |
+
|
| 72 |
+
Given finite $T$ , we discretize time uniformly into $T$ timesteps (segments) of width $\tau = 1 / T$ . Defining $s ( i ) = ( i - 1 ) / T$ and $t ( i ) = i / T$ , our hierarchical generative model for data $\mathbf { x }$ is then given by:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
p ( \mathbf { x } ) = \int _ { \mathbf { z } } p ( \mathbf { z } _ { 1 } ) p ( \mathbf { x } | \mathbf { z } _ { 0 } ) \prod _ { i = 1 } ^ { T } p ( \mathbf { z } _ { s ( i ) } | \mathbf { z } _ { t ( i ) } ) .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
With the variance preserving diffusion specification and sufficiently small SNR(1), we have that $q ( \mathbf { z } _ { 1 } | \mathbf { x } ) \approx \mathcal { N } ( \mathbf { z } _ { 1 } ; \bar { 0 , } \mathbf { I } )$ . We therefore model the marginal distribution of $\mathbf { z } _ { 1 }$ as a spherical Gaussian:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
p ( \mathbf { z } _ { 1 } ) = \mathcal { N } ( \mathbf { z } _ { 1 } ; 0 , \mathbf { I } ) .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
We wish to choose a model $p ( \mathbf { x } | \mathbf { z } _ { 0 } )$ that is close to the unknown $q ( \mathbf { x } | \mathbf { z } _ { 0 } )$ . Let $x _ { i }$ and $z _ { 0 , i }$ be the $i$ -th elements of $\mathbf { x } , \mathbf { z } _ { 0 }$ , respectively. We then use a factorized distribution of the form:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
p ( \mathbf { x } | \mathbf { z } _ { 0 } ) = \prod _ { i } p ( x _ { i } | z _ { 0 , i } ) ,
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
where we choose $p ( x _ { i } | z _ { 0 , i } ) \propto q ( z _ { 0 , i } | x _ { i } )$ , which is normalized by summing over all possible discrete values of $x _ { i }$ (256 in the case of 8-bit image data). With sufficiently large $\mathrm { S N R } ( 0 )$ , this becomes a very close approximation to the true $q ( \mathbf { x } | \mathbf { z } _ { 0 } )$ , as the influence of the unknown data distribution $q ( \mathbf { x } )$ is overwhelmed by the likelihood $q ( \mathbf { z } _ { 0 } | \mathbf { x } )$ . Finally, we choose the conditional model distributions as
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
p ( \mathbf { z } _ { s } | \mathbf { z } _ { t } ) = q ( \mathbf { z } _ { s } | \mathbf { z } _ { t } , \mathbf { x } = \hat { \mathbf { x } } _ { \theta } \big ( \mathbf { z } _ { t } ; t \big ) \big ) ,
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
i.e. the same as $q ( \mathbf { z } _ { s } | \mathbf { z } _ { t } , \mathbf { x } )$ , but with the original data $\mathbf { x }$ replaced by the output of a denoising model $\hat { \mathbf { x } } _ { \pmb { \theta } } ( \mathbf { z } _ { t } ; t )$ that predicts $\mathbf { x }$ from its noisy version $\mathbf { z } _ { t }$ . Note that in practice we parameterize the denoising model as a function of a noise prediction model (Section 3.4), bridging the gap with previous work on diffusion models [Ho et al., 2020]. The means and variances of $p ( \mathbf { z } _ { s } | \mathbf { z } _ { t } )$ simplify to a remarkable degree; see Appendix A.
|
| 97 |
+
|
| 98 |
+
# 3.4 Noise prediction model and Fourier features
|
| 99 |
+
|
| 100 |
+
We parameterize the denoising model in terms of a noise prediction model $\hat { \epsilon } _ { \theta } ( { \bf z } _ { t } ; t )$
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ; t ) = ( \mathbf { z } _ { t } - \sigma _ { t } \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ; t ) ) / \alpha _ { t } ,
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
where $\hat { \epsilon } _ { \theta } ( { \bf z } _ { t } ; t )$ is parameterized as a neural network. The noise prediction models we use in experiments closely follow Ho et al. [2020], except that they process the data solely at the original resolution. The exact parameterization of the noise prediction model and noise schedule is discussed in Appendix B.
|
| 107 |
+
|
| 108 |
+
Prior work on diffusion models has mainly focused on the perceptual quality of generated samples, which emphasizes coarse scale patterns and global consistency of generated images. Here, we optimize for likelihood, which is sensitive to fine scale details and exact values of individual pixels. To capture the fine scale details of the data, we propose adding a set of Fourier features to the input of our noise prediction model. Let $\mathbf { x }$ be the original data, scaled to the range $[ - 1 , 1 ]$ , and let $\mathbf { z }$ be the resulting latent variable, with similar magnitudes. We then append channels $\sin ( 2 ^ { n } \pi \mathbf { z } )$ and $\cos ( 2 ^ { n } \pi \mathbf { z } )$ , where $n$ runs over a range of integers $\{ n _ { m i n } , . . . , n _ { m a x } \}$ . These features are high frequency periodic functions that amplify small changes in the input data $\mathbf { z } _ { t }$ ; see Appendix C for further details. Including these features in the input of our denoising model leads to large improvements in likelihood as demonstrated in Section 6 and Figure 5, especially when combined with a learnable SNR function. We did not observe such improvements when incorporating Fourier features into autoregressive models.
|
| 109 |
+
|
| 110 |
+
# 3.5 Variational lower bound
|
| 111 |
+
|
| 112 |
+
We optimize the parameters towards the variational lower bound (VLB) of the marginal likelihood, which is given by
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { r } { - \log p ( \mathbf { x } ) \leq - \mathrm { V L B } ( \mathbf { x } ) = \underbrace { D _ { K L } \big ( q ( \mathbf { z } _ { 1 } | \mathbf { x } ) | | p ( \mathbf { z } _ { 1 } ) \big ) } _ { \mathrm { P r i o r ~ l o s s } } + \underbrace { { \mathbb { E } _ { q ( \mathbf { z } _ { 0 } | \mathbf { x } ) } } \left[ - \log p ( \mathbf { x } | \mathbf { z } _ { 0 } ) \right] } _ { \mathrm { R e c o n s t u r c i t o n ~ l o s s } } + \underbrace { \mathcal { L } _ { T } ( \mathbf { x } ) . } _ { \mathrm { D i f f u s i o n ~ l o s s } } } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
The prior loss and reconstruction loss can be (stochastically and differentiably) estimated using standard techniques; see [Kingma and Welling, 2013]. The diffusion loss, $\mathcal { L } _ { T } ( \mathbf { x } )$ , is more complicated, and depends on the hyperparameter $T$ that determines the depth of the generative model.
|
| 119 |
+
|
| 120 |
+
# 4 Discrete-time model
|
| 121 |
+
|
| 122 |
+
In the case of finite $T$ , using $s ( i ) = ( i - 1 ) / T , t ( i ) = i / T$ , the diffusion loss is:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\mathcal { L } _ { T } ( \mathbf { x } ) = \sum _ { i = 1 } ^ { T } \mathbb { E } _ { q ( \mathbf { z } _ { t ( i ) } \mid \mathbf { x } ) } D _ { K L } \big [ q ( \mathbf { z } _ { s ( i ) } \vert \mathbf { z } _ { t ( i ) } , \mathbf { x } ) \vert \big \vert p ( \mathbf { z } _ { s ( i ) } \vert \mathbf { z } _ { t ( i ) } ) \big ] .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
In appendix $\mathrm { E }$ we show that this expression simplifies considerably, yielding:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\mathcal { L } _ { T } ( \mathbf { x } ) = \frac { T } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) , i \sim U \{ 1 , T \} } \left[ \left( \mathrm { S N R } ( s ) - \mathrm { S N R } ( t ) \right) | | \mathbf { x } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ; t ) | | _ { 2 } ^ { 2 } \right] ,
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $U \{ 1 , T \}$ is the uniform distribution on the integers $\{ 1 , \ldots , T \}$ , and ${ \bf z } _ { t } = \alpha _ { t } { \bf x } + \sigma _ { t } \epsilon$ . This is the general discrete-time loss for any choice of forward diffusion parameters $\left( \sigma _ { t } , \alpha _ { t } \right)$ . When plugging in the specifications of $\sigma _ { t } , \alpha _ { t }$ and $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ; t )$ that we use in experiments, given in Sections 3.2 and 3.4, the loss simplifies to:
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\mathcal { L } _ { T } ( \mathbf { x } ) = \frac { T } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) , i \sim U \lbrace 1 , T \rbrace } \left[ ( \exp ( \gamma _ { \eta } ( t ) - \gamma _ { \eta } ( s ) ) - 1 ) \| \epsilon - \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ; t ) \| _ { 2 } ^ { 2 } \right]
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
where $\mathbf { z } _ { t } = \mathrm { s i g m o i d } ( - \gamma _ { \eta } ( t ) ) \mathbf { x } + \mathrm { s i g m o i d } ( \gamma _ { \eta } ( t ) ) \pmb { \epsilon }$ . In the discrete-time case, we simply jointly optimize $\eta$ and $\pmb \theta$ by maximizing the VLB through a Monte Carlo estimator of Equation 14.
|
| 141 |
+
|
| 142 |
+
Note that $\exp ( . ) - 1$ has a numerically stable primitive $e x p m 1 ( . )$ in common numerical computing packages; see figure 6. Equation 14 allows for numerically stable implementation in 32-bit or lower-precision floating point, in contrast with previous implementations of discrete-time diffusion models (e.g. [Ho et al., 2020]), which had to resort to 64-bit floating point.
|
| 143 |
+
|
| 144 |
+
# 4.1 More steps leads to a lower loss
|
| 145 |
+
|
| 146 |
+
A natural question to ask is what the number of timesteps $T$ should be, and whether more timesteps is always better in terms of the VLB. In Appendix F we analyze the difference between the diffusion loss with $T$ timesteps, $\mathcal { L } _ { T } ( \mathbf { x } )$ , and the diffusion loss with double the timesteps, $\mathcal { L } _ { 2 T } ( \mathbf { x } )$ , while keeping the SNR function fixed. We then find that if our trained denoising model $\hat { \mathbf { x } } _ { \pmb { \theta } }$ is sufficiently good, we have that $\mathcal { L } _ { 2 T } ( \mathbf { x } ) < \mathcal { L } _ { T } ( \mathbf { x } )$ , i.e. that our VLB will be better for a larger number of timesteps. Intuitively, the discrete time diffusion loss is an upper Riemann sum approximation of an integral of a strictly decreasing function, meaning that a finer approximation yields a lower diffusion loss. This result is illustrated in Figure 2.
|
| 147 |
+
|
| 148 |
+
# 5 Continuous-time model: $T \to \infty$
|
| 149 |
+
|
| 150 |
+
Since taking more time steps leads to a better VLB, we now take $T \to \infty$ , effectively treating time $t$ as continuous rather than discrete. The model for $p ( \mathbf { z } _ { t } )$ can in this case be described as a continuous time diffusion process [Song et al., 2021b] governed by a stochastic differential equation; see Appendix D. In Appendix E we show that in this limit the diffusion loss $\mathcal { L } _ { T } ( \mathbf { x } )$ simplifies further. Letting $\mathrm { S N R } ^ { \prime } ( t ) = d \hat { \mathrm { S N R } } ( t ) / d t$ , we have, with ${ \bf z } _ { t } = \alpha _ { t } { \bf x } + \sigma _ { t } \epsilon$ :
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
\begin{array} { l } { \displaystyle \mathcal { L } _ { \infty } ( \mathbf { x } ) = - \frac { 1 } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) } \int _ { 0 } ^ { 1 } \mathrm { S N R } ^ { \prime } ( t ) \left\| \mathbf { x } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ; t ) \right\| _ { 2 } ^ { 2 } d t , } \\ { \displaystyle \quad \quad = - \frac { 1 } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) , t \sim \mathcal { U } ( 0 , 1 ) } \left[ \mathrm { S N R } ^ { \prime } ( t ) \left\| \mathbf { x } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ; t ) \right\| _ { 2 } ^ { 2 } \right] . } \end{array}
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 2: Illustration of the diffusion loss with few segments $T$ (left), more segments $T$ (middle), and infinite segments $T$ (continuous time, right). The continuous-time loss (Equation 18) is an integral of mean squared error (MSE) over SNR, here visualized as a black curve. The black curve is strictly decreasing when the model is sufficiently well trained, so the discrete-time loss (Equation 13) is an upper bound (an upper Riemann sum approximation) of this integral that becomes better when segments are added.
|
| 158 |
+
|
| 159 |
+
This is the general continuous-time loss for any choice of forward diffusion parameters $\left( \sigma _ { t } , \alpha _ { t } \right)$ . When plugging in the specifications of $\sigma _ { t } , \alpha _ { t }$ and $\hat { \mathbf { x } } _ { \pmb { \theta } } ( \mathbf { z } _ { t } ; t )$ that we use in experiments, given in Sections 3.2 and 3.4, the loss simplifies to:
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\mathcal { L } _ { \infty } ( \mathbf { x } ) = \frac { 1 } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) , t \sim \mathcal { U } ( 0 , 1 ) } \left[ \gamma _ { \eta } ^ { \prime } ( t ) \left. \epsilon - \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ; t ) \right. _ { 2 } ^ { 2 } \right] ,
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
where $\gamma _ { \pmb { \eta } } ^ { \prime } ( t ) = d \gamma _ { \pmb { \eta } } ( t ) / d t$ . We use the Monte Carlo estimator of this loss for evaluation and optimization.
|
| 166 |
+
|
| 167 |
+
# 5.1 Equivalence of diffusion models in continuous time
|
| 168 |
+
|
| 169 |
+
The signal-to-noise function $\mathrm { S N R } ( t )$ is invertible due to the monotonicity assumption in Section 3.1. Due to this invertibility, we can perform a change of variables, and make everything a function of $v \equiv \operatorname { S N R } ( t )$ instead of $t$ , such that $t = \mathrm { S N R } ^ { - \mathrm { \bar { 1 } } } ( v )$ . Let $\alpha _ { v }$ and $\sigma _ { v }$ be the functions $\alpha _ { t }$ and $\sigma _ { t }$ evaluated at $t = \mathrm { S N R } ^ { - 1 } ( v )$ , and correspondingly let $\mathbf { z } _ { v } = \alpha _ { v } \mathbf { x } + \sigma _ { v } \mathbf { \epsilon }$ . Similarly, we rewrite our noise prediction model as $\tilde { \mathbf { x } } _ { \pmb { \theta } } ( \mathbf { z } , v ) \equiv \hat { \mathbf { x } } _ { \pmb { \theta } } ( \mathbf { z } , \mathrm { S N R } ^ { - 1 } ( v ) )$ . With this change of variables, our continuous-time loss in Equation 15 can equivalently be written as:
|
| 170 |
+
|
| 171 |
+
$$
|
| 172 |
+
\mathcal { L } _ { \infty } ( \mathbf { x } ) = \frac { 1 } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) } \int _ { \mathrm { S N R } _ { \operatorname* { m i n } } } ^ { \mathrm { S N R } _ { \operatorname* { m a x } } } \left\| \mathbf { x } - \tilde { \mathbf { x } } _ { \pmb { \theta } } ( \mathbf { z } _ { v } , v ) \right\| _ { 2 } ^ { 2 } d v ,
|
| 173 |
+
$$
|
| 174 |
+
|
| 175 |
+
where instead of integrating w.r.t. time $t$ we now integrate w.r.t. the signal-to-noise ratio $v$ , and where $\mathrm { S N R } _ { \operatorname* { m i n } } = \mathrm { S N R } ( 1 )$ and $\mathrm { S N R } _ { \operatorname* { m a x } } = \mathrm { S N R } ( 0 )$ .
|
| 176 |
+
|
| 177 |
+
What this equation shows us is that the only effect the functions $\alpha ( t )$ and $\sigma ( t )$ have on the diffusion loss is through the values $\mathrm { S N R } ( t ) = \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 }$ at endpoints $t = 0$ and $t = 1$ . Given these values $\operatorname { S N R } _ { \operatorname* { m a x } }$ and $\mathrm { { S N R } _ { \operatorname* { m i n } } }$ , the diffusion loss is invariant to the shape of function $\mathrm { S N R } ( t )$ between $t = 0$ and $t = 1$ . The VLB is thus only impacted by the function $\mathrm { S N R } ( t )$ through its endpoints $\mathrm { { S N R } _ { \operatorname* { m i n } } }$ and $\operatorname { S N R } _ { \operatorname* { m a x } }$ .
|
| 178 |
+
|
| 179 |
+
Furthermore, we find that the distribution $p ( \mathbf { x } )$ defined by our generative model is also invariant to the specification of the diffusion process. Specifically, let $p ^ { A } ( \mathbf { \bar { x } } )$ denote the distribution defined by the combination of a diffusion specification and denoising function $\{ \alpha _ { v } ^ { A } , \sigma _ { v } ^ { A } , \tilde { \mathbf { x } } _ { \theta } ^ { A } \}$ , and similarly let $p ^ { B } ( \mathbf { x } )$ {be the distribution defined through a different specification $\{ \alpha _ { v } ^ { B } , \sigma _ { v } ^ { B } , \tilde { \mathbf { x } } _ { \theta } ^ { B } \}$ , where both specifications have equal $\mathrm { { S N R } _ { \operatorname* { m i n } } }$ , $\operatorname { S N R } _ { \operatorname* { m a x } }$ ; as shown in Appendix G, we then have that $p ^ { A } ( \mathbf { x } ) =$ $p ^ { \mathbf { \hat { \cal B } } } ( \mathbf { x } )$ if $\tilde { \mathbf { x } } _ { \pmb { \theta } } ^ { B } ( \mathbf { z } , v ) \equiv \hat { \tilde { \mathbf { x } } } _ { \pmb { \theta } } ^ { A } ( ( \alpha _ { v } ^ { A } / \alpha _ { v } ^ { B } ) \mathbf { z } , v )$ . The distribution on all latents $\mathbf { z } _ { v }$ is then also the same under both specifications, up to a trivial rescaling. This means that any two diffusion models satisfying the mild constraints set in 3.1 (which includes e.g. the variance exploding and variance preserving specifications considered by Song et al. [2021b]), can thus be seen as equivalent in continuous time.
|
| 180 |
+
|
| 181 |
+
# 5.2 Weighted diffusion loss
|
| 182 |
+
|
| 183 |
+
This equivalence between diffusion specifications continues to hold even if, instead of the VLB, these models optimize a weighted diffusion loss of the form:
|
| 184 |
+
|
| 185 |
+
$$
|
| 186 |
+
\mathcal { L } _ { \infty } ( \mathbf { x } , w ) = \frac { 1 } { 2 } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) } \int _ { \mathrm { S N R } _ { \operatorname* { m i n } } } ^ { \mathrm { S N R } _ { \operatorname* { m a x } } } \ d w ( v ) \left. \mathbf { x } - \tilde { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { v } , v ) \right. _ { 2 } ^ { 2 } d v ,
|
| 187 |
+
$$
|
| 188 |
+
|
| 189 |
+
Table 1: Summary of our findings for density modeling tasks, in terms of bits per dimension (BPD) on the test set. Model types are autoregressive (AR), normalizing flows (Flow), variational autoencoders (VAE), or diffusion models (Diff). Our results were obtained using the continuous-time formulation of our model. CIFAR-10 data augmentations are: (A) extensive, (B) small translations, or (C) horizontal flips. The numbers for VDM are variational bounds, and can likely be improved by estimating the marginal likelihood through importance sampling, or through evaluation of the corresponding continuous normalizing flow as done by Song et al. [2021a].
|
| 190 |
+
|
| 191 |
+
<table><tr><td>Model (Bits per dim on test set)</td><td>Type</td><td>CIFAR10 no data aug.</td><td>CIFAR10 data aug.</td><td>ImageNet 32x32</td><td>ImageNet 64x64</td></tr><tr><td>Previous work</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ResNet VAE with IAF [Kingma et al., 2016]</td><td>VAE</td><td>3.11</td><td></td><td></td><td></td></tr><tr><td>Very Deep VAE [Child,2020]</td><td>VAE</td><td>2.87</td><td></td><td>3.80</td><td>3.52</td></tr><tr><td>NVAE [Vahdat and Kautz,2020]</td><td>VAE</td><td>2.91</td><td></td><td>3.92</td><td></td></tr><tr><td>Glow [Kingma and Dhariwal, 2018]</td><td>Flow</td><td></td><td>3.35(B)</td><td>4.09</td><td>3.81</td></tr><tr><td>Flow++ [Ho et al.,2019a]</td><td>Flow</td><td>3.08</td><td></td><td>3.86</td><td>3.69</td></tr><tr><td>PixelCNN [Van Oord et al., 2016]</td><td>AR</td><td>3.03</td><td></td><td>3.83</td><td>3.57</td></tr><tr><td>PixelCNN++ [Salimans et al.,2017]</td><td>AR</td><td>2.92</td><td></td><td></td><td></td></tr><tr><td>Image Transformer [Parmar et al., 2018]</td><td>AR</td><td>2.90</td><td></td><td>3.77</td><td></td></tr><tr><td>SPN [Menick and Kalchbrenner, 2018]</td><td>AR</td><td></td><td></td><td></td><td>3.52</td></tr><tr><td>Sparse Transformer [Child et al.,2019]</td><td>AR</td><td>2.80</td><td></td><td></td><td>3.44</td></tr><tr><td>Routing Transformer [Roy et al., 2021]</td><td>AR</td><td></td><td></td><td></td><td>3.43</td></tr><tr><td>Sparse Transformer + DistAug [Jun et al.,2020]</td><td>AR</td><td></td><td>2.53(4)</td><td></td><td></td></tr><tr><td>DDPM [Ho et al., 2020]</td><td>Diff</td><td></td><td>3.69(C)</td><td></td><td></td></tr><tr><td>EBM-DRL [Gao et al., 2020]</td><td>Diff</td><td></td><td>3.18(C)</td><td></td><td></td></tr><tr><td>Score SDE [Song et al., 2021b]</td><td>Diff</td><td>2.99</td><td></td><td></td><td></td></tr><tr><td>Improved DDPM [Nichol and Dhariwal, 2021]</td><td>Diff</td><td>2.94</td><td></td><td></td><td>3.54</td></tr><tr><td>Concurrent work</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CR-NVAE [Sinha and Dieng,2021]</td><td>VAE</td><td></td><td>2.51(4)</td><td></td><td></td></tr><tr><td>LSGM [Vahdat et al., 2021]</td><td>Diff</td><td>2.87</td><td></td><td></td><td></td></tr><tr><td>ScoreFlow [Song et al.,2O21a] (variational bound)</td><td>Diff</td><td></td><td>2.90(C)</td><td>3.86</td><td></td></tr><tr><td>ScoreFlow [Song et al.,202la] (cont. norm. flow)</td><td>Diff</td><td>2.83</td><td>2.80(C)</td><td>3.76</td><td></td></tr><tr><td>Our work</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VDM (variational bound)</td><td>Diff</td><td>2.65</td><td>2.49(A)</td><td>3.72</td><td>3.40</td></tr></table>
|
| 192 |
+
|
| 193 |
+
which e.g. captures all the different objectives discussed by Song et al. [2021b], see Appendix K. Here, $w ( v )$ is a weighting function that generally puts increased emphasis on the noisier data compared to the VLB, and which thereby can sometimes improve perceptual generation quality as measured by certain metrics like FID and Inception Score. For the models presented in this paper, we further use $w ( v ) = 1$ as corresponding to the (unweighted) VLB.
|
| 194 |
+
|
| 195 |
+
# 5.3 Variance minimization
|
| 196 |
+
|
| 197 |
+
Lowering the variance of the Monte Carlo estimator of the continuous-time loss generally improves the efficiency of optimization. We found that using a low-discrepancy sampler for $t$ , as explained in Appendix I.1, leads to a significant reduction in variance. In addition, due to the invariance shown in Section 5.1 for the continous-time case, we can optimize the schedule between its endpoints w.r.t. to minimize the variance of our estimator of loss, as detailed in Appendix I. The endpoints of the noise schedule are simply optimized w.r.t. the VLB.
|
| 198 |
+
|
| 199 |
+
# 6 Experiments
|
| 200 |
+
|
| 201 |
+
We demonstrate our proposed class of diffusion models, which we call Variational Diffusion Models (VDMs), on the CIFAR-10 [Krizhevsky et al., 2009] dataset, and the downsampled ImageNet [Van Oord et al., 2016, Deng et al., 2009] dataset, where we focus on maximizing likelihood. For our result with data augmentation we used random flips, 90-degree rotations, and color channel swapping. More details of our model specifications are in Appendix B.
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 3: Non cherry-picked unconditional samples from our Imagenet $6 4 \mathrm { x } 6 4$ model, trained in continuous time and generated using $T = 1 0 0 0$ . The model’s hyper-parameters and parameters are optimized w.r.t. the likelihood bound, so the model is not optimized for synthesis quality.
|
| 205 |
+
|
| 206 |
+
# 6.1 Likelihood and samples
|
| 207 |
+
|
| 208 |
+
Table 1 shows our results on modeling the CIFAR-10 dataset, and the downsampled ImageNet dataset. We establish a new state-of-the-art in terms of test set likelihood on all considered benchmarks, by a significant margin. Our model for CIFAR-10 without data augmentation surpasses the previous best result of 2.80 about $1 0 \mathrm { x }$ faster than it takes the Sparse Transformer to reach this, in wall clock time on equivalent hardware. Our CIFAR-10 model, whose hyper-parameters were tuned for likelihood, results in a FID (perceptual quality) score of 7.41. This would have been state-of-the-art until recently, but is worse than recent diffusion models that specifically target FID scores [Nichol and Dhariwal, 2021, Song et al., 2021b, Ho et al., 2020]. By instead using a weighted diffusion loss, with the weighting function $w ( \mathbf { S N R } )$ used by Ho et al. [2020] and described in Appendix K, our FID score improves to 4.0. We did not pursue further tuning of the model to improve FID instead of likelihood. A random sample of generated images from our model is provided in Figure 3. We provide additional samples from this model, as well as our other models for the other datasets, in Appendix M.
|
| 209 |
+
|
| 210 |
+
# 6.2 Ablations
|
| 211 |
+
|
| 212 |
+
Next, we investigate the relative importance of our contributions. In Table 2 we compare our discretetime and continuous-time specifications of the diffusion model: When evaluating our model with a small number of steps, our discretely trained models perform better by learning the diffusion schedule to optimize the VLB. However, as argued theoretically in Section 4.1, we find experimentally that more steps $T$ indeed gives better likelihood. When $T$ grows large, our continuously trained model performs best, helped by training its diffusion schedule to minimize variance instead.
|
| 213 |
+
|
| 214 |
+
Minimizing the variance also helps the continuous time model to train faster, as shown in Figure 5. This effect is further examined in Table 4b, where we find dramatic variance reductions compared to our baselines in continuous time. Figure 4a shows how this effect is achieved: Compared to the other schedules, our learned schedule spends much more time in the high $\mathrm { S N R } ( t )$ / low $\bar { \sigma } _ { t } ^ { 2 }$ range.
|
| 215 |
+
|
| 216 |
+
In Figure 5 we further show training curves for our model including and excluding the Fourier features proposed in Appendix C: with Fourier features enabled our model achieves much better likelihood. For comparison we also implemented Fourier features in a PixelCNN++ model [Salimans et al., 2017], where we do not see a benefit. In addition, we find that learning the SNR is necessary to get the most out of including Fourier features: if we fix the SNR schedule to that used by Ho et al. [2020], the maximum log-SNR is fixed to approximately 8 (see figure 7), and test set negative likelihood stays above 4 bits per dim. When learning the SNR endpoints, our maximum log-SNR ends up at 13.3, which, combined with the inclusion of Fourier features, leads to the SOTA test set likelihoods reported in Table 1.
|
| 217 |
+
|
| 218 |
+
# 6.3 Lossless compression
|
| 219 |
+
|
| 220 |
+
For a fixed number of evaluation timesteps $T _ { e v a l }$ , our diffusion model in discrete time is a hierarchical latent variable model that can be turned into a lossless compression algorithm using bits-back coding [Hinton and Van Camp, 1993]. As a proof of concept of practical lossless compression, Table 2 reports net codelengths on the CIFAR10 test set for various settings of $T _ { e v a l }$ using BB
|
| 221 |
+
|
| 222 |
+
<table><tr><td>SNR(t) schedule</td><td>Var(BPD)</td></tr><tr><td>Learned (ours)</td><td>0.53</td></tr><tr><td>log SNR-linear</td><td>6.35</td></tr><tr><td>β-Linear [1]</td><td>31.6</td></tr><tr><td>α-Cosine [2]</td><td>31.1</td></tr></table>
|
| 223 |
+
|
| 224 |
+
(b) Variance of VLB estimate
|
| 225 |
+
|
| 226 |
+

|
| 227 |
+
Figure 4: Our learned continuous-time variance-minimizing noise schedule $\mathrm { S N R } ( t )$ for CIFAR-10, compared to its log-linear initialization and to schedules from the literature: [1] The $\beta$ -Linear schedule from Ho et al. [2020], [2] The $\alpha$ -Cosine schedule from Nichol and Dhariwal [2021]. All schedules were scaled and shifted on the log scale such that the resulting $\mathrm { { S N R } _ { \operatorname* { m i n } } }$ , $\operatorname { S N R } _ { \operatorname* { m a x } }$ were the equal to our learned endpoints, resulting in the same VLB estimate of 2.66. We report the variance of our VLB estimate per data point, computed on the test set, and conditional on the data: This does not include the noise due to sampling minibatches of data.
|
| 228 |
+
|
| 229 |
+
Table 2: Discrete versus continuous-time training and evaluation with CIFAR-10, in terms of bits per dimension (BPD).
|
| 230 |
+
|
| 231 |
+
<table><tr><td>Ttrain</td><td>Teual</td><td>BPD</td><td>Bits-Back Net BPD</td></tr><tr><td>10</td><td>10</td><td>4.31</td><td></td></tr><tr><td>100</td><td>100</td><td>2.84</td><td></td></tr><tr><td>250</td><td>250</td><td>2.73</td><td></td></tr><tr><td>500</td><td>500</td><td>2.68</td><td></td></tr><tr><td>1000</td><td>1000</td><td>2.67</td><td></td></tr><tr><td>10000</td><td>10000</td><td>2.66</td><td></td></tr><tr><td>8</td><td>10</td><td>7.54</td><td>7.54</td></tr><tr><td>8</td><td>100</td><td>2.90</td><td>2.91</td></tr><tr><td>8</td><td>250</td><td>2.74</td><td>2.76</td></tr><tr><td>8</td><td>500</td><td>2.69</td><td>2.72</td></tr><tr><td>8</td><td>1000</td><td>2.67</td><td>2.72</td></tr><tr><td>8</td><td>10000</td><td>2.65</td><td></td></tr><tr><td>8</td><td>8</td><td>2.65</td><td></td></tr></table>
|
| 232 |
+
|
| 233 |
+

|
| 234 |
+
Figure 5: Test set likelihoods during training, with/without Fourier features, and with/without learning the noise schedule to minimize variance.
|
| 235 |
+
|
| 236 |
+
ANS [Townsend et al., 2018], an implementation of bits-back coding based on asymmetric numeral systems [Duda, 2009]. Details of our implementation are given in Appendix N. We achieve state-ofthe-art net codelengths, proving our model can be used as the basis of a lossless compression algorithm. However, for large $T _ { e v a l }$ a gap remains with the theoretically optimal codelength corresponding to the negative VLB, and compression becomes computationally expensive due to the large number of neural network forward passes required. Closing this gap with more efficient implementations of bits-back coding suitable for very deep models is an interesting avenue for future work.
|
| 237 |
+
|
| 238 |
+
# 7 Conclusion
|
| 239 |
+
|
| 240 |
+
We presented state-of-the-art results on modeling the density of natural images using a new class of diffusion models that incorporates a learnable diffusion specification, Fourier features for fine-scale modeling, as well as other architectural innovations. In addition, we obtained new theoretical insight into likelihood-based generative modeling with diffusion models, showing a surprising invariance of the VLB to the forward time diffusion process in continuous time, as well as an equivalence between various diffusion processes from the literature previously thought to be different.
|
| 241 |
+
|
| 242 |
+
# Acknowledgments
|
| 243 |
+
|
| 244 |
+
We thank Yang Song, Kevin Murphy and Mohammad Norouzi for feedback on drafts of this paper.
|
| 245 |
+
|
| 246 |
+
# References
|
| 247 |
+
|
| 248 |
+
Nanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. arXiv preprint arXiv:2009.00713, 2020.
|
| 249 |
+
|
| 250 |
+
Rewon Child. Very deep VAEs generalize autoregressive models and can outperform them on images. arXiv preprint arXiv:2011.10650, 2020.
|
| 251 |
+
|
| 252 |
+
Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
|
| 253 |
+
|
| 254 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
|
| 255 |
+
|
| 256 |
+
Jarek Duda. Asymmetric numeral systems. arXiv preprint arXiv:0902.0271, 2009.
|
| 257 |
+
|
| 258 |
+
Ruiqi Gao, Yang Song, Ben Poole, Ying Nian Wu, and Diederik P Kingma. Learning energy-based models by diffusion recovery likelihood. arXiv preprint arXiv:2012.08125, 2020.
|
| 259 |
+
|
| 260 |
+
Geoffrey E Hinton and Drew Van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the Sixth Annual Conference on Computational Learning Theory, pages 5–13, 1993.
|
| 261 |
+
|
| 262 |
+
Jonathan Ho, Xi Chen, Aravind Srinivas, Yan Duan, and Pieter Abbeel. Flow $^ { + + }$ : Improving flowbased generative models with variational dequantization and architecture design. In International Conference on Machine Learning, pages 2722–2730. PMLR, 2019a.
|
| 263 |
+
|
| 264 |
+
Jonathan Ho, Evan Lohn, and Pieter Abbeel. Compression with flows via local bits-back coding. In Advances in Neural Information Processing Systems, pages 3874–3883, 2019b.
|
| 265 |
+
|
| 266 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
|
| 267 |
+
|
| 268 |
+
Chin-Wei Huang, Jae Hyun Lim, and Aaron Courville. A variational perspective on diffusion-based generative models and score matching. arXiv preprint arXiv:2106.02808, 2021.
|
| 269 |
+
|
| 270 |
+
Heewoo Jun, Rewon Child, Mark Chen, John Schulman, Aditya Ramesh, Alec Radford, and Ilya Sutskever. Distribution augmentation for generative modeling. In International Conference on Machine Learning, pages 5006–5019. PMLR, 2020.
|
| 271 |
+
|
| 272 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
|
| 273 |
+
|
| 274 |
+
Diederik P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. arXiv preprint arXiv:1807.03039, 2018.
|
| 275 |
+
|
| 276 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. International Conference on Learning Representations, 2013.
|
| 277 |
+
|
| 278 |
+
Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In Advances in Neural Information Processing Systems, pages 4743–4751, 2016.
|
| 279 |
+
|
| 280 |
+
Friso Kingma, Pieter Abbeel, and Jonathan Ho. Bit-swap: Recursive bits-back coding for lossless compression with hierarchical latent variables. In International Conference on Machine Learning, pages 3408–3417. PMLR, 2019.
|
| 281 |
+
|
| 282 |
+
Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. arXiv preprint arXiv:2009.09761, 2020.
|
| 283 |
+
|
| 284 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 285 |
+
|
| 286 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 287 |
+
|
| 288 |
+
David JC MacKay. Information theory, inference and learning algorithms. Cambridge university press, 2003.
|
| 289 |
+
|
| 290 |
+
Jacob Menick and Nal Kalchbrenner. Generating high fidelity images with subscale pixel networks and multidimensional upscaling. arXiv preprint arXiv:1812.01608, 2018.
|
| 291 |
+
|
| 292 |
+
Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. arXiv preprint arXiv:2102.09672, 2021.
|
| 293 |
+
|
| 294 |
+
Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
|
| 295 |
+
|
| 296 |
+
Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, pages 4055–4064. PMLR, 2018.
|
| 297 |
+
|
| 298 |
+
Danilo J Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pages 1278–1286, 2014.
|
| 299 |
+
|
| 300 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pages 234–241. Springer, 2015.
|
| 301 |
+
|
| 302 |
+
Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. Transactions of the Association for Computational Linguistics, 9:53–68, 2021.
|
| 303 |
+
|
| 304 |
+
Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017.
|
| 305 |
+
|
| 306 |
+
Samarth Sinha and Adji B Dieng. Consistency regularization for variational auto-encoders. arXiv preprint arXiv:2105.14859, 2021.
|
| 307 |
+
|
| 308 |
+
Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pages 2256–2265, 2015.
|
| 309 |
+
|
| 310 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020.
|
| 311 |
+
|
| 312 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, pages 11895–11907, 2019.
|
| 313 |
+
|
| 314 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 315 |
+
|
| 316 |
+
Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. Maximum likelihood training of score-based diffusion models. arXiv e-prints, pages arXiv–2101, 2021a.
|
| 317 |
+
|
| 318 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-Based Generative Modeling Through Stochastic Differential Equations. In International Conference on Learning Representations, 2021b.
|
| 319 |
+
|
| 320 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. arXiv preprint arXiv:1409.3215, 2014.
|
| 321 |
+
|
| 322 |
+
Matthew Tancik, Pratul P Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. arXiv preprint arXiv:2006.10739, 2020.
|
| 323 |
+
|
| 324 |
+
James Townsend, Thomas Bird, and David Barber. Practical lossless compression with latent variables using bits back coding. In International Conference on Learning Representations, 2018.
|
| 325 |
+
James Townsend, Thomas Bird, Julius Kunze, and David Barber. HiLLoC: lossless image compression with hierarchical latent variable models. In International Conference on Learning Representations, 2020.
|
| 326 |
+
Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. arXiv preprint arXiv:2007.03898, 2020.
|
| 327 |
+
Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. arXiv preprint arXiv:2106.05931, 2021.
|
| 328 |
+
Aaron Van Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In International Conference on Machine Learning, pages 1747–1756, 2016.
|
| 329 |
+
Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011.
|
| 330 |
+
Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
md/train/37nvvqkCo5/37nvvqkCo5.md
ADDED
|
@@ -0,0 +1,631 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LONG-TAIL LEARNING VIA LOGIT ADJUSTMENT
|
| 2 |
+
|
| 3 |
+
Aditya Krishna Menon, Sadeep Jayasumana, Ankit Singh Rawat, Himanshu Jain Andreas Veit & Sanjiv Kumar
|
| 4 |
+
|
| 5 |
+
Google Research
|
| 6 |
+
New York, NY
|
| 7 |
+
{adityakmenon,sadeep,ankitsrawat,himj,aveit,sanjivk}@google.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Real-world classification problems typically exhibit an imbalanced or long-tailed label distribution, wherein many labels have only a few associated samples. This poses a challenge for generalisation on such labels, and also makes naïve learning biased towards dominant labels. In this paper, we present a statistical framework that unifies and generalises several recent proposals to cope with these challenges. Our framework revisits the classic idea of logit adjustment based on the label frequencies, which encourages a large relative margin between logits of rare positive versus dominant negative labels. This yields two techniques for long-tail learning, where such adjustment is either applied post-hoc to a trained model, or enforced in the loss during training. These techniques are statistically grounded, and practically effective on four real-world datasets with long-tailed label distributions.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Real-world classification problems typically exhibit a long-tailed label distribution, wherein most labels are associated with only a few samples (Van Horn & Perona, 2017; Buda et al., 2017; Liu et al., 2019). Owing to this paucity of samples, generalisation on such labels is challenging; moreover, naïve learning on such data is susceptible to an undesirable bias towards dominant labels. This problem has been widely studied in the literature on learning under class imbalance (Kubat et al., 1997; Chawla et al., 2002; He & Garcia, 2009), and the related problem of cost-sensitive learning (Elkan, 2001).
|
| 16 |
+
|
| 17 |
+
Recently, long-tail learning has received renewed interest in the context of neural networks. Two active strands of work involve post-hoc normalisation of the classification weights (Zhang et al., 2019; Kim & Kim, 2019; Kang et al., 2020; Ye et al., 2020), and modification of the underlying loss to account for varying class penalties (Zhang et al., 2017; Cui et al., 2019; Cao et al., 2019; Tan et al., 2020). Each of these strands are intuitive, and have proven empirically successful. However, they are not without limitation: e.g., weight normalisation crucially relies on the weight norms being smaller for rare classes; however, this assumption is sensitive to the choice of optimiser (see $\textrm { \tiny \begin{array} { r l } { \ S } & { { } \mathbf { \sigma } } \end{array} } )$ . On the other hand, loss modification sacrifices the consistency that underpins the canonical softmax cross-entropy (see $\textrm { \ s } )$ ). Consequently, such techniques may prove suboptimal even in simple settings (see $\ S 6 . 1 \ r ,$ ).
|
| 18 |
+
|
| 19 |
+
In this paper, we establish a statistical framework for long-tail learning that offers a unified view of post-hoc normalisation and loss modification techniques, while overcoming their limitations. Our framework revisits the classic idea of logit adjustment based on label frequencies (Provost, 2000; Zhou & Liu, 2006; Collell et al., 2016), which encourages a large relative margin between a pair of rare positive and dominant negative labels. Such adjustment can be achieved by shifting the learned logits post-hoc, or augmenting the softmax cross-entropy with a pairwise label margin (cf. (11)). While similar in nature to recent techniques, our logit adjustment approaches additionally have a firm statistical grounding: they are Fisher consistent for minimising the balanced error (cf. (2)), a common metric in long-tail settings which averages the per-class errors. This statistical grounding translates into strong empirical performance on four real-world datasets with long-tailed label distributions.
|
| 20 |
+
|
| 21 |
+
In summary, our contributions are:
|
| 22 |
+
|
| 23 |
+
(i) we establish a statistical framework for long-tail learning (§3) based on logit adjustment that provides a unified view of post-hoc correction and loss modification
|
| 24 |
+
|
| 25 |
+
Table 1: Comparison of approaches to long-tail learning. Weight normalisation re-scales the classification weights; by contrast, we add per-label offsets to the logits. Margin approaches uniformly increase the margin between a rare positive and all negatives (Cao et al., 2019), or decrease the margin between all positives and a rare negative (Tan et al., 2020) to prevent rare labels’ gradient suppression. By contrast, we increase the margin between a rare positive and a dominant negative.
|
| 26 |
+
|
| 27 |
+
<table><tr><td>Method</td><td>Procedure</td><td>Consistent?</td><td>?Reference</td></tr><tr><td>Weight normalisation</td><td>Post-hoc weight scaling</td><td>×</td><td>(Kang et al., 2020)</td></tr><tr><td>Adaptive margin</td><td>Softmax with rare +ve upweighting</td><td>×</td><td>(Cao et al., 2019)</td></tr><tr><td>Equalised margin</td><td>Softmax with rare -ve downweighting</td><td>×</td><td>(Tan et al., 2020)</td></tr><tr><td>Logit-adjusted threshold</td><td>1Post-hoc logit translation</td><td>√</td><td>This paper (cf. (9))</td></tr><tr><td>Logit-adjusted loss</td><td>Softmax with logit translation</td><td>√</td><td>This paper (cf.(10))</td></tr></table>
|
| 28 |
+
|
| 29 |
+
(ii) we present two realisations of logit adjustment, applied either post-hoc (§4.1) or during training (§5.1); unlike recent proposals (Table 1), these are consistent for minimising the balanced error
|
| 30 |
+
(iii) we confirm the efficacy of the proposed logit adjustment techniques compared to several baselines on four real-world datasets with long-tailed label distributions $( \ S 6 )$ .
|
| 31 |
+
|
| 32 |
+
# 2 PROBLEM SETUP AND RELATED WORK
|
| 33 |
+
|
| 34 |
+
Consider a multiclass classification problem with instances $\mathcal { X }$ and labels $\mathcal { Y } = [ L ] \doteq \{ 1 , 2 , \ldots , L \}$ . Given a sample $S = \{ ( x _ { n } , y _ { n } ) \} _ { n = 1 } ^ { N } \dot { \bf \Phi } \sim { \mathbb P } ^ { N }$ for unknown distribution $\mathbb { P }$ over $\mathcal X \times \mathcal Y$ , our goal is to learn a scorer $f \colon \mathcal { X } \to \mathbb { R } ^ { L }$ that minimises the misclassification error $\mathbb { P } _ { x , y } \big ( y \notin \operatorname { a r g m a x } _ { y ^ { \prime } \in \mathcal { Y } } f _ { y ^ { \prime } } ( x ) \big )$ . Typically, one minimises a surrogate loss $\ell \colon \mathcal { Y } \times \mathbb { R } ^ { L } \to \mathbb { R }$ such as the softmax cross-entropy,
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\ell ( y , f ( x ) ) = \log \left[ \sum _ { y ^ { \prime } \in [ L ] } e ^ { f _ { y ^ { \prime } } ( x ) } \right] - f _ { y } ( x ) = \log \left[ 1 + \sum _ { y ^ { \prime } \not = y } e ^ { f _ { y ^ { \prime } } ( x ) - f _ { y } ( x ) } \right] .
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
We may view the resulting softmax probabilities $p _ { y } ( x ) \propto e ^ { f _ { y } ( x ) }$ as estimates of $\mathbb { P } ( y \mid x )$
|
| 41 |
+
|
| 42 |
+
The setting of learning under class imbalance or long-tail learning is where the distribution $\mathbb { P } ( y )$ is highly skewed, so that many rare (or “tail”) labels have a low probability of occurrence. Here, the misclassification error is not a suitable measure of performance: a trivial predictor which classifies every instance to the majority label will attain a low misclassification error. To cope with this, a natural alternative is the balanced error (Chan & Stolfo, 1998; Brodersen et al., 2010; Menon et al., 2013), which averages each of the per-class error rates: under a uniform label distribution
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\mathrm { B E R } ( f ) \doteq \frac { 1 } { L } \sum _ { y \in [ L ] } \mathbb { P } _ { x | y } \big ( y \notin \mathrm { a r g m a x } _ { y ^ { \prime } \in \mathcal { Y } } f _ { y ^ { \prime } } ( x ) \big ) .
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
This can be seen as implicitly using a balanced class-probability function $\mathbb { P } ^ { \mathrm { b a l } } ( y \mid x ) \propto \frac { 1 } { L } \cdot \mathbb { P } ( x \mid y )$ as opposed to the native $\mathbb { P } ( y \mid x ) \propto \mathbb { P } ( y ) \cdot \mathbb { P } ( x \mid y )$ that is employed in the misclassification error.1
|
| 49 |
+
|
| 50 |
+
Broadly, extant approaches to coping with class imbalance modify:
|
| 51 |
+
|
| 52 |
+
(i) the inputs to a model, for example by over- or under-sampling (Kubat & Matwin, 1997; Chawla et al., 2002; Wallace et al., 2011; Mikolov et al., 2013; Mahajan et al., 2018; Yin et al., 2018);
|
| 53 |
+
(ii) the outputs of a model, for example by post-hoc correction of the decision threshold (Fawcett & Provost, 1996; Collell et al., 2016) or weights (Kim & Kim, 2019; Kang et al., 2020); or
|
| 54 |
+
(iii) the training procedure of a model, for example by modifying the loss function (Zhang et al., 2017; Cui et al., 2019; Cao et al., 2019; Tan et al., 2020; Jamal et al., 2020).
|
| 55 |
+
|
| 56 |
+
One may easily combine approaches from the first stream with those from the latter two. Consequently, we focus on the latter two in this work, and describe some representative recent examples from each.
|
| 57 |
+
|
| 58 |
+
Post-hoc weight normalisation. Suppose $f _ { y } ( x ) = w _ { y } ^ { \top } \Phi ( x )$ for classification weights $w _ { y } \in \mathbb { R } ^ { D }$ and representations $\Phi \colon \mathcal { X } \mathbb { R } ^ { D }$ , as learned by a neural network. (We may add per-label bias terms to $f _ { y }$ by adding a constant feature to $\Phi$ .) A fruitful avenue of exploration involves decoupling of representation and classifier learning (Zhang et al., 2019). Concretely, we first learn $\{ w _ { y } , \Phi \}$ via standard training on the long-tailed training sample $S$ , and then for $x \in { \mathcal { X } }$ predict the label
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 1: Mean and standard deviation of per-class weight norms $\| w _ { y } \| _ { 2 }$ over 5 runs for a ResNet-32 under momentum and Adam optimisers. We use long-tailed (“LT”) versions of CIFAR-10 and CIFAR-100, and sort classes in descending order of frequency; the first class is $1 0 0 \times$ more likely to appear than the last class (see $\begin{array} { r l } { \ S } & { { } \} } \end{array}$ ). Both optimisers yield comparable balanced error. However, the weight norms have incompatible trends: under momentum, the norms are strongly correlated with class frequency, while with Adam, the norms are anti-correlated or independent of the class frequency. Consequently, weight normalisation under Adam is ineffective for combatting class imbalance.
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\begin{array} { r } { \mathrm { a r g m a x } _ { y \in [ L ] } w _ { y } ^ { \top } \Phi ( x ) / \nu _ { y } ^ { \tau } = \mathrm { a r g m a x } _ { y \in [ L ] } f _ { y } ( x ) / \nu _ { y } ^ { \tau } , } \end{array}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
for $\tau > 0$ , where $\nu _ { y } = \mathbb { P } ( y )$ in Kim & Kim (2019); Ye et al. (2020) and $\nu _ { y } = \| w _ { y } \| _ { 2 }$ in Kang et al. (2020). Intuitively, either choice of $\nu _ { y }$ upweights the contribution of rare labels through weight normalisation. The choice $\nu _ { y } = \| w _ { y } \| _ { 2 }$ is motivated by the observations that $\| w _ { y } \| _ { 2 }$ tends to correlate with $\mathbb { P } ( y )$ . Further to the above, one may enforce $\| w _ { y } \| _ { 2 } = 1$ during training (Kim & Kim, 2019).
|
| 68 |
+
|
| 69 |
+
Loss modification. A classic means of coping with class imbalance is to balance the loss, wherein $\ell ( y , f ( x ) )$ is weighted by $\mathbb { P } ( y ) ^ { - 1 }$ (Xie & Manski, 1989; Morik et al., 1999): e.g., applied to (1),
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\ell ( y , f ( x ) ) = { \frac { 1 } { \mathbb { P } ( y ) } } \cdot \log \left[ 1 + \sum _ { y ^ { \prime } \neq y } e ^ { f _ { y ^ { \prime } } ( x ) - f _ { y } ( x ) } \right] .
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
While intuitive, balancing has minimal effect in separable settings: solutions that achieve zero training loss will necessarily remain optimal even under weighting (Byrd $\&$ Lipton, 2019). Intuitively, one would instead like to shift the separator closer to a dominant class. Li et al. (2002); Wu et al. (2008); Masnadi-Shirazi $\&$ Vasconcelos (2010) thus proposed to add per-class margins into the hinge loss. Cao et al. (2019) similarly proposed to add a per-class margin into the softmax cross-entropy:
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\ell ( y , f ( x ) ) = \log \Big [ 1 + \sum _ { y ^ { \prime } \neq y } e ^ { \delta _ { y } } \cdot e ^ { f _ { y ^ { \prime } } ( x ) - f _ { y } ( x ) } \Big ] ,
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $\delta _ { y } \propto \mathbb { P } ( y ) ^ { - 1 / 4 }$ . This upweights rare “positive” $y$ to encourage a larger gap $f _ { y } ( x ) - f _ { y ^ { \prime } } ( x )$ i.e., the margin between $y$ and any “negative” $y ^ { \prime } \ne y$ . Separately, Tan et al. (2020) proposed
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\ell ( y , f ( x ) ) = \log \Big [ 1 + \sum _ { y ^ { \prime } \neq y } e ^ { \delta _ { y ^ { \prime } } } \cdot e ^ { f _ { y ^ { \prime } } ( x ) - f _ { y } ( x ) } \Big ] ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $\delta _ { y ^ { \prime } } \leq 0$ is a non-decreasing transform of $\mathbb { P } ( y ^ { \prime } )$ . Note that in the original softmax cross-entropy with $\delta _ { y ^ { \prime } } = 0$ , a rare label often receives a strong inhibitory gradient signal as it disproportionately appear as a negative for dominant labels. This can be modulated by letting $\delta _ { y ^ { \prime } } \ll 0$ .
|
| 88 |
+
|
| 89 |
+
# 2.1 LIMITATIONS OF EXISTING APPROACHES
|
| 90 |
+
|
| 91 |
+
Each of the above methods are intuitive, and have shown strong empirical performance. However, a closer analysis identifies some subtle limitations.
|
| 92 |
+
|
| 93 |
+
Limitations of weight normalisation. Post-hoc weight normalisation with $\nu _ { y } = \| w _ { y } \| _ { 2 }$ per Kang et al. (2020) is motivated by the observation that the weight norm $\| w _ { y } \| _ { 2 }$ tends to correlate with $\mathbb { P } ( y )$ However, this assumption is highly dependent on the choice of optimiser, as Figure 1 illustrates: for
|
| 94 |
+
|
| 95 |
+
ResNet-32 models trained on long-tailed versions of CIFAR-10 and CIFAR-100, when using the Adam optimiser, the norms are either anti-correlated or independent of $\mathbb { P } ( y )$ . Weight normalisation thus cannot achieve the desired effect of boosting rare labels’ scores. One may hope to side-step this by simply using $\nu _ { y } = \mathbb { P } ( y )$ ; unfortunately, this choice has more subtle limitations (see $\ S 4 . 2$ ).
|
| 96 |
+
|
| 97 |
+
Limitations of loss modification. Enforcing a per-label margin per (5) and (6) is intuitive, as it allows for shifting the decision boundary away from rare classes. However, when doing so, it is important to ensure Fisher consistency (Lin, 2004) (or classification calibration (Bartlett et al., 2006)) of the resulting loss for the balanced error. That is, the minimiser of the expected loss (equally, the empirical risk in the infinite sample limit) should result in a minimal balanced error. Unfortunately, both (5) and (6) are not consistent in this sense, even for binary problems; see $\ S 5 . 1$ , $\ S 6 . 1$ for details.
|
| 98 |
+
|
| 99 |
+
# 3 LOGIT ADJUSTMENT FOR LONG-TAIL LEARNING: A STATISTICAL VIEW
|
| 100 |
+
|
| 101 |
+
The above suggests that there is scope for improving performance on long-tail problems, both in terms of post-hoc correction and loss modification. We now show how a statistical perspective suggests simple procedures of each type, both of which overcome the limitations discussed above.
|
| 102 |
+
|
| 103 |
+
Recall that our goal is to minimise the balanced error (2). A classical result is that the best possible or Bayes-optimal scorer for this problem, i.e., $f ^ { * } \in \mathrm { a r g m i n } _ { f }$ : $\mathcal { X } { } \mathbb { R } ^ { L } \operatorname { B E R } ( f )$ , satisfies the following (Menon et al., 2013), (Koyejo et al., 2014, Corollary 4), (Collell et al., 2016, Theorem 1):
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\begin{array} { r } { \operatorname * { a r g m a x } _ { y \in [ L ] } f _ { y } ^ { * } ( x ) = \operatorname * { a r g m a x } _ { y \in [ L ] } \mathbb { P } ^ { \mathrm { b a l } } ( y \mid x ) = \operatorname * { a r g m a x } _ { y \in [ L ] } \mathbb { P } ( x \mid y ) , } \end{array}
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where $\mathbb { P } ^ { \mathrm { b a l } }$ is the balanced class-probability as per $\ S 2$ . In words, the Bayes-optimal prediction is the label under which the given instance $x \in { \mathfrak { X } }$ is most likely. Consequently, for fixed class-conditionals $\mathbb { P } ( x \mid y )$ , varying the class priors $\mathbb { P } ( y )$ arbitrarily will not affect the optimal scorers. This is intuitively desirable: the balanced error is agnostic to the level of imbalance in the label distribution.
|
| 110 |
+
|
| 111 |
+
To further probe (7), suppose the underlying class-probabilities $\mathbb { P } ( y \mid x ) \propto \exp ( s _ { y } ^ { * } ( x ) )$ , for scorer $s ^ { * } \colon \mathcal { X } \to \mathbb { R } ^ { L }$ . Since by definition $\mathbb { P } ^ { \mathrm { b a l } } ( y \mid x ) \propto \mathbb { P } ( y \mid x ) / \mathbb { P } ( y )$ , (7) becomes
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\begin{array} { r } { \mathrm { a r g m a x } _ { y \in [ L ] } \mathbb { P } ^ { \mathrm { b a l } } ( y \mid x ) = \mathrm { a r g m a x } _ { y \in [ L ] } \exp ( s _ { y } ^ { * } ( x ) ) / \mathbb { P } ( y ) = \mathrm { a r g m a x } _ { y \in [ L ] } s _ { y } ^ { * } ( x ) - \ln \mathbb { P } ( y ) , } \end{array}
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
i.e., we translate the optimal logits based on the class priors. Equation 8 provides the ideal predictions for optimising the balanced error, which necessarily rely on unknown quantities $s _ { y } ^ { * } ( x ) , \mathbb { P } ( y )$ that depend on the underlying distribution. Nonetheless, we may seek to approximate these quantities based on our training sample. Concretely, (8) suggests two means of optimising for the balanced error:
|
| 118 |
+
|
| 119 |
+
(i) train a model to estimate the standard $\mathbb { P } ( y \mid x )$ (e.g., by minimising the standard softmax-cross entropy on the long-tailed data), and then explicitly modify its logits post-hoc as per (8) (ii) train a model to estimate the balanced $\mathbb { P } ^ { \mathrm { b a l } } ( y \mid x )$ , whose logits are implicitly modified as per (8).
|
| 120 |
+
|
| 121 |
+
Such logit adjustment techniques — which have been a classic approach to class-imbalance (Provost, 2000) — neatly align with the post-hoc and loss modification streams discussed in $\ S$ . However, unlike most previous techniques from these streams, logit adjustment is endowed with a clear statistical grounding: by construction, the optimal solution under such adjustment coincides with the Bayes-optimal solution (7) for the balanced error, i.e., it is Fisher consistent for minimising the balanced error. We now study each of the techniques (i) and (ii) in turn.
|
| 122 |
+
|
| 123 |
+
# 4 POST-HOC LOGIT ADJUSTMENT
|
| 124 |
+
|
| 125 |
+
We now propose a post-hoc logit adjustment scheme for a classifier trained on long-tailed data. We further show this has subtle advantages over recent weight normalisation schemes.
|
| 126 |
+
|
| 127 |
+
# 4.1 THE POST-HOC LOGIT ADJUSTMENT PROCEDURE
|
| 128 |
+
|
| 129 |
+
When employing the softmax cross-entropy to train a neural network, we aim to approximate the underlying $\mathbb { P } ( y \mid x )$ with $p _ { y } ( x ) \propto \exp ( f _ { y } ( { \bar { x } } ) )$ for logits $f _ { y } ( x ) = w _ { y } ^ { \top } \Phi ( x )$ . Given learned $\{ w , \Phi \}$ ,
|
| 130 |
+
|
| 131 |
+
one typically predicts the label $\mathrm { a r g m a x } _ { y \in [ L ] } f _ { y } ( x )$ , i.e., the most likely label under the model’s $\mathbb { P } ( y \mid x )$ . In post-hoc logit adjustment, we propose to instead predict, for suitable $\tau > 0$ :
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { r } { \mathrm { a r g m a x } _ { y \in [ L ] } \exp ( w _ { y } ^ { \top } \Phi ( x ) ) / \pi _ { y } ^ { \tau } = \mathrm { a r g m a x } _ { y \in [ L ] } f _ { y } ( x ) - \tau \cdot \log \pi _ { y } , } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $\pi \in \Delta _ { L }$ (for simplex $\Delta$ ) are estimates of the class priors $\mathbb { P } ( y )$ , e.g., the empirical frequencies on the training sample $S$ . Effectively, (9) adds a label-dependent offset to each of the logits.
|
| 138 |
+
|
| 139 |
+
When $\tau = 1$ , this can be seen as applying (8) with a plugin estimate of $\mathbb { P } ( y \mid x )$ , i.e., $p _ { y } ( x ) \propto$ $\exp ( w _ { y } ^ { \top } \Phi ( x ) )$ . When $\tau \neq 1$ , this can be seen as applying (8) to temperature scaled estimates $\bar { p } _ { y } ( x ) \overset { \cdot } { \propto } \exp ( \tau ^ { - 1 } \cdot w _ { y } ^ { \top } \Phi ( x ) )$ . To unpack this, recall that (8) justifies post-hoc logit thresholding given access to the true probabilities $\mathbb { P } ( y \mid x )$ . In practice, high-capacity neural networks often produce uncalibrated estimates of these probabilities (Guo et al., 2017). Temperature scaling is a means to calibrate the estimates, and is routinely employed for distillation (Hinton et al., 2015).
|
| 140 |
+
|
| 141 |
+
One may treat $\tau$ as a tuning parameter to be chosen based on holdout calibration, e.g., the expected calibration error (Murphy & Winkler, 1987; Guo et al., 2017), probabilistic sharpness (Gneiting et al., 2007; Kuleshov et al., 2018), or a proper scoring rule such as the log-loss or squared error (Gneiting & Raftery, 2007). One may alternately fix $\tau = 1$ and aim to learn inherently calibrated probabilities, e.g., via label smoothing (Szegedy et al., 2016; Müller et al., 2019).
|
| 142 |
+
|
| 143 |
+
Post-hoc logit adjustment with $\tau = 1$ is not a new idea in the classical label imbalance literature (Fawcett & Provost, 1996; Provost, 2000; Maloof, 2003; Zhou & Liu, 2006; Collell et al., 2016); however, it has had limited exploration in the recent long-tail learning literature. Further, the case $\tau \neq 1$ is important in practical usage of neural networks, owing to their typical lack of probabilistic calibration (Guo et al., 2017). Interestingly, post-hoc logit adjustment also has an important advantage over recently proposed weight normalisation techniques, as we now discuss.
|
| 144 |
+
|
| 145 |
+
# 4.2 COMPARISON TO POST-HOC WEIGHT NORMALISAITON
|
| 146 |
+
|
| 147 |
+
Recall that weight normalisation involves learning logits $f _ { y } ( x ) = w _ { y } ^ { \top } \Phi ( x )$ , and then post-hoc normalising the weights via $w _ { y } / \nu _ { y } ^ { \tau }$ for $\tau > 0$ . We demonstrated in $\ S$ that using $\nu _ { y } = \| w _ { y } \| _ { 2 }$ may be ineffective when using adaptive optimisers. However, even with $\nu _ { y } = \pi _ { y }$ , there is a subtle contrast to post-hoc logit adjustment: while the former performs a multiplicative update to the logits, the latter performs an additive update. The two techniques may thus yield different orderings over labels, since
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
w _ { 1 } ^ { \top } \Phi ( x ) / \pi _ { 1 } < w _ { 2 } ^ { \top } \Phi ( x ) / \pi _ { 2 } \stackrel { } { } \exp ( w _ { 1 } ^ { \top } \Phi ( x ) ) / \pi _ { 1 } < \exp ( w _ { 2 } ^ { \top } \Phi ( x ) ) / \pi _ { 2 } .
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
Observe that if a rare label $y$ has a negative score $w _ { y } ^ { \top } \Phi ( x ) < 0$ , and there is another label with a positive score, then it is impossible for the weight normalisation to give $y$ the highest score. By contrast, under logit adjustment, $w _ { y } ^ { \top } \Phi ( x ) - \ln \pi _ { y }$ will be lower for dominant classes, regardless of the original sign. Weight normalisation is thus not consistent for the balanced error, unlike logit adjustment.
|
| 154 |
+
|
| 155 |
+
# 5 THE LOGIT ADJUSTED SOFTMAX CROSS-ENTROPY
|
| 156 |
+
|
| 157 |
+
We now show how to directly encode logit adjustment into the softmax cross-entropy. The resulting approach has an intuitive relation to existing loss modification techniques.
|
| 158 |
+
|
| 159 |
+
# 5.1 THE LOGIT ADJUSTED LOSS
|
| 160 |
+
|
| 161 |
+
From $\ S$ , the second approach to optimising for the balanced error is to directly model $\mathbb { P } ^ { \mathrm { b a l } } ( y \mid x ) \propto$ $\mathbb { P } ( y \mid x ) / \mathbb { P } ( y )$ . To do so, consider the following logit adjusted softmax cross-entropy loss for $\tau > 0$ :
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\ell ( y , f ( x ) ) = - \log { \frac { e ^ { f _ { y } ( x ) + \tau \cdot \log { \pi _ { y } } } } { \sum _ { y ^ { \prime } \in [ L ] } e ^ { f _ { y ^ { \prime } } ( x ) + \tau \cdot \log { \pi _ { y ^ { \prime } } } } } } = \log \left[ 1 + \sum _ { y ^ { \prime } \neq y } \left( { \frac { \pi _ { y ^ { \prime } } } { \pi _ { y } } } \right) ^ { \tau } \cdot e ^ { f _ { y ^ { \prime } } ( x ) - f _ { y } ( x ) } \right] .
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
Given a scorer that minimises the above, we now predict $\mathrm { a r g m a x } _ { y \in [ L ] } f _ { y } ( x )$ as usual.
|
| 168 |
+
|
| 169 |
+
Compared to the standard softmax cross-entropy (1), the above applies a label-dependent offset to each logit. Compared to (9), we directly enforce the class prior offset while learning the logits, rather than doing this post-hoc. The two approaches have a deeper connection: observe that (10) is equivalent to using a scorer of the form $g _ { y } ( x ) = f _ { y } ( x ) + \tau \cdot \log \pi _ { y }$ , with $\mathrm { a r g m a x } _ { y \in [ L ] } f _ { y } ( x ) =$ $\mathrm { a r g m a x } _ { y \in [ L ] } g _ { y } ( x ) - \tau \cdot \log \pi _ { y }$ . Consequently, one can equivalently view learning with this loss as learning a standard scorer $g ( x )$ , and post-hoc adjusting its logits. For non-convex objectives, as encountered in neural networks, the bias endowed by adding $\tau \cdot \log \pi _ { y }$ to the logits is likely to result in a different local minima, typically with improved performance.
|
| 170 |
+
|
| 171 |
+
# 5.2 COMPARISON TO LOSS MODIFICATION TECHNIQUES
|
| 172 |
+
|
| 173 |
+
For more insight into the logit adjusted loss, consider the following pairwise margin loss
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
\ell ( y , f ( x ) ) = \alpha _ { y } \cdot \log { \Big [ 1 + \sum _ { y ^ { \prime } \neq y } e ^ { \Delta _ { y y ^ { \prime } } } \cdot e ^ { ( f _ { y ^ { \prime } } ( x ) - f _ { y } ( x ) ) } \Big ] } ,
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
for label weights $\alpha _ { y } > 0$ , and pairwise label margins $\Delta _ { y y ^ { \prime } }$ representing the desired gap between scores for $y$ and $y ^ { \prime }$ . For $\tau = 1$ , our logit adjusted loss (10) corresponds to (11) with $\alpha _ { y } = 1$ and $\begin{array} { r } { \Delta _ { y y ^ { \prime } } = \log { \left( \frac { \pi _ { y ^ { \prime } } } { \pi _ { y } } \right) } } \end{array}$ . This demands a larger margin between rare positive $( \pi _ { y } \sim 0 )$ ) and dominant negative $\mathit { \Pi } _ { \pi _ { y ^ { \prime } } } \sim 1 $ ) labels, so that scores for dominant classes do not overwhelm those for rare ones.
|
| 180 |
+
|
| 181 |
+
Existing loss modification techniques can be viewed as special cases of (11). For example, $\alpha _ { y } =$ $1 / \pi _ { y }$ and $\Delta _ { y y ^ { \prime } } = 0$ yields the balanced loss (4). When $\alpha _ { y } ~ = ~ 1$ , the choice $\Delta _ { y y ^ { \prime } } = \pi _ { y } ^ { - 1 / 4 }$ yields (5). Finally, $\bar { \Delta _ { y y ^ { \prime } } } = \log F ( \pi _ { y ^ { \prime } } )$ yields (6), where $F \colon [ 0 , 1 ] ( 0 , 1 ]$ is some non-decreasing function. These losses thus either consider the frequency of the positive $y$ or negative $y ^ { \prime }$ , but not both. Remarkably, the specific choice that leads to our loss in (10) has a firm statistical grounding: it ensures Fisher consistency (in the sense of, e.g., Bartlett et al. (2006)) for the balanced error. Proofs for all results are in the supplementary.
|
| 182 |
+
|
| 183 |
+
Theorem 1. For any $\delta \in \mathbb { R } _ { + } ^ { L }$ , the pairwise loss in (11) is Fisher consistent with weights and margins
|
| 184 |
+
|
| 185 |
+
$$
|
| 186 |
+
\begin{array} { r } { \alpha _ { y } = \delta _ { y } / \mathbb { P } ( y ) \qquad \Delta _ { y y ^ { \prime } } = \log \left( \delta _ { y ^ { \prime } } / \delta _ { y } \right) . } \end{array}
|
| 187 |
+
$$
|
| 188 |
+
|
| 189 |
+
Letting $\delta _ { y } = \pi _ { y }$ , we immediately deduce that the logit-adjusted loss of (10) is consistent, provided our $\pi _ { y }$ is a consistent estimate of $\mathbb { P } ( y )$ . Similarly, $\delta _ { y } = 1$ recovers the classic result that the balanced loss is consistent. While Theorem 1 only provides a sufficient condition in multi-class setting, one can provide a necessary and sufficient condition that rules out other choices of $\Delta$ in the binary case.
|
| 190 |
+
|
| 191 |
+
Theorem 2. Suppose $\mathcal { Y } = \{ \pm 1 \}$ . Let $\delta _ { y } \doteq \Delta _ { y , - y }$ , and $\sigma ( z ) = ( 1 + \exp ( z ) ) ^ { - 1 }$ . Then, the pairwise margin loss in (11) is Fisher consistent for the balanced error iff
|
| 192 |
+
|
| 193 |
+
$$
|
| 194 |
+
\frac { \alpha _ { + 1 } } { \alpha _ { - 1 } } \cdot \frac { \sigma ( \delta _ { + 1 } ) } { \sigma ( \delta _ { - 1 } ) } = \frac { 1 - \mathbb { P } ( y = + 1 ) } { \mathbb { P } ( y = + 1 ) } .
|
| 195 |
+
$$
|
| 196 |
+
|
| 197 |
+
# 5.3 DISCUSSION AND EXTENSIONS
|
| 198 |
+
|
| 199 |
+
Our pairwise margin loss in (11) subsumes several existing loss-correction approaches in the literature. Further, it suggests the exploration of new choices of $\Delta$ . For example, we shall see the efficacy of combining the $\Delta$ implicit in the adaptive loss of Cao et al. (2019) with our proposed $\Delta$ . One may also generalise the formulation in Theorem 1, and employ $\Delta _ { y y ^ { \prime } } = \tau _ { 1 } \cdot \log \pi _ { y } - \tau _ { 2 } \cdot \log \pi _ { y ^ { \prime } }$ , where $\tau _ { 1 } , \tau _ { 2 } > 0$ . This interpolates between our loss $\tau _ { 1 } = \tau _ { 2 }$ ) and a version of the equalised loss $\mathit { \check { \tau } _ { 1 } = 0 }$ ).
|
| 200 |
+
|
| 201 |
+
For $\tau = - 1$ , a similar loss to (10) has been considered in the context of negative sampling for scalability (Yi et al., 2019): here, one samples a subset of negatives based on $\pi$ , and corrects the logits to obtain an unbiased estimate of the loss based on all negatives (Bengio & Senecal, 2008). Losses of the general form (11) have also been explored for structured prediction (Pletscher et al., 2010).
|
| 202 |
+
|
| 203 |
+
Cao et al. (2019, Theorem 2) provides a rigorous generalisation bound for the adaptive margin loss under the assumption of separable data with binary labels. The inconsistency of the loss with respect to the balanced error concerns the more general scenario of non-separable multiclass data, which may occur, e.g., owing to label noise or limited model capacity. We shall subsequently demonstrate that encouraging consistency is not merely of theoretical interest, and can lead to gains in practice.
|
| 204 |
+
|
| 205 |
+

|
| 206 |
+
Figure 2: Results on synthetic binary classification problem. Our logit adjusted loss tracks the Bayes-optimal solution and separator (left & middle panel). Post-hoc logit adjustment matches the Bayes performance with suitable scaling (right panel); however, any weight normalisation fails.
|
| 207 |
+
|
| 208 |
+
# 6 EXPERIMENTAL RESULTS
|
| 209 |
+
|
| 210 |
+
We now present experiments confirming our main claims: (i) on simple binary problems, existing weight normalisation and loss modification techniques may not converge to the optimal solution (§6.1); (ii) on real-world datasets, our post-hoc logit adjustment generally outperforms weight normalisation, and one can obtain further gains via our logit adjusted softmax cross-entropy $( \ S 6 . 2 )$ .
|
| 211 |
+
|
| 212 |
+
# 6.1 RESULTS ON SYNTHETIC DATASET
|
| 213 |
+
|
| 214 |
+
We begin with a binary classification task, wherein samples from class $y \in \{ \pm 1 \}$ are drawn from a 2D Gaussian with isotropic covariance and means $\mu _ { y } = y \cdot ( + 1 , + 1 )$ . We introduce class imbalance by setting $\mathbb { P } ( y = + 1 ) = \bar { 5 } \%$ . The Bayes-optimal classifier for the balanced error is (see Appendix F)
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
f ^ { * } ( x ) = + 1 \ \Longleftrightarrow \ \mathbb { P } ( x \mid y = + 1 ) > \mathbb { P } ( x \mid y = - 1 ) \ \Longleftrightarrow \ ( \mu _ { 1 } - \mu _ { - 1 } ) ^ { \top } x > 0 ,
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
i.e., it is a linear separator passing through the origin. We compare this separator against those found by several margin losses based on (11): standard ERM $\Delta _ { y y ^ { \prime } } = 0 \rangle$ , the adaptive loss (Cao et al., 2019) $( \Delta _ { y y ^ { \prime } } = \pi _ { y } ^ { - 1 / 4 } )$ −1/4y ), an instantiation of the equalised loss (Tan et al., 2020) (∆yy0 = log πy0 ), and our logit adjusted loss $\begin{array} { r } { ( \Delta _ { y y ^ { \prime } } = \log { \frac { \pi _ { y ^ { \prime } } } { \pi _ { y } } } ) } \end{array}$ ). For each loss, we train an affine classifier on a sample of $1 0 , 0 0 0$ instances, and evaluate the balanced error on a test set of 10, 000 samples over 100 independent trials.
|
| 221 |
+
|
| 222 |
+
Figure 2 confirms that the logit adjusted margin loss attains a balanced error close to that of the Bayes-optimal, which is visually reflected by its learned separator closely matching that in (12). This is in line with our claim of the logit adjusted margin loss being consistent for the balanced error, unlike other approaches. Figure 2 also compares post-hoc weight normalisation and logit adjustment for varying scaling parameter $\tau$ (c.f. (3), (9)). Logit adjustment is seen to approach the performance of the Bayes predictor; any weight normalisation is however seen to hamper performance. This verifies the consistency of logit adjustment, and inconsistency of weight normalisation (§4.2).
|
| 223 |
+
|
| 224 |
+
# 6.2 RESULTS ON REAL-WORLD DATASETS
|
| 225 |
+
|
| 226 |
+
We present results on the CIFAR-10, CIFAR-100, ImageNet and iNaturalist 2018 datasets. Following prior work, we create “long-tailed versions” of the CIFAR datasets by suitably downsampling examples per label following the EXP profile of Cui et al. (2019); Cao et al. (2019) with imbalance ratio $\rho = \mathrm { m a x } _ { y } \mathbb { P } ( y ) / \mathrm { m i n } _ { y } \mathbb { P } ( y ) = 1 0 0$ . Similarly, we use the long-tailed version of ImageNet produced by Liu et al. (2019). We employ a ResNet-32 for CIFAR, and a ResNet-50 for ImageNet and iNaturalist. All models are trained using SGD with momentum; see Appendix C for more details. See also Appendix D.3 for results on CIFAR under the STEP profile also considered in the literature.
|
| 227 |
+
|
| 228 |
+
Baselines. We consider several representative baselines: (i) empirical risk minimisation (ERM) on the long-tailed data, (ii) post-hoc weight normalisation (Kang et al., 2020) per (3) (using $\nu _ { y } = \| w _ { y } \| _ { 2 } )$ applied to ERM, (iii) the class-balanced loss of Cui et al. (2019), (iv) the adaptive margin loss (Cao et al., 2019) per (5), including with the “deferred reweighting” (DRW) training scheme, and (v) the equalised loss (Tan et al., 2020) per (6), with $\delta _ { y ^ { \prime } } = F ( \pi _ { y ^ { \prime } } )$ for the threshold-based $F$ of Tan et al. (2020). Where possible, we report numbers for the baselines from the respective papers.
|
| 229 |
+
|
| 230 |
+
Table 2: Test set balanced error (averaged over 5 trials) on real-world datasets. Here, $^ { \dag } , ^ { \star } , ^ { \ddag }$ are numbers for $\mathrm { \cdot _ { L D A M } + S G D ^ { \mathrm { 3 } } }$ and “LDAM $^ +$ DRW” from Cao et al. (2019, Table 2, 3); “ $\tau$ -normalised” from Kang et al. (2020, Table 3, 7); and “Class-Balanced” from Cui et al. (2019, Table 2, 3). Here, $\tau = \tau ^ { * }$ refers to using the best possible tuning parameter $\tau$ ; see Figure 3 for results on various $\tau$ . Highlighted cells denote the best performing method for a given dataset.
|
| 231 |
+
|
| 232 |
+
<table><tr><td>Method</td><td>CIFAR-10-LT</td><td>CIFAR-100-LT</td><td>ImageNet-LT</td><td>iNaturalist</td></tr><tr><td>ERM</td><td>27.16</td><td>61.64</td><td>53.11</td><td>38.66</td></tr><tr><td>Weight normalisation (T = 1) (Kang et al., 2020)</td><td>24.02</td><td>58.89</td><td>52.00</td><td>48.05</td></tr><tr><td>Weight normalisation (T = T*) (Kang et al., 2020)</td><td>21.50</td><td>58.76</td><td>49.37</td><td>34.40*</td></tr><tr><td>Class-balanced (Cui et al., 2019)</td><td>25.43t</td><td>60.40t</td><td>53.21</td><td>35.84</td></tr><tr><td>Adaptive (Cao et al., 2019)</td><td>26.65t</td><td>60.40†</td><td>52.15</td><td>33.31</td></tr><tr><td>Adaptive + DRW (Cao et al., 2019)</td><td>22.97†</td><td>57.96†</td><td>49.85</td><td>32.00t</td></tr><tr><td>Equalised (Tan et al., 2020)</td><td>26.02</td><td>57.26</td><td>54.02</td><td>38.37</td></tr><tr><td>Logit adjustment post-hoc (T = 1)</td><td>22.60</td><td>58.24</td><td>49.66</td><td>33.98</td></tr><tr><td>Logit adjustment loss (T = 1)</td><td>22.33</td><td>56.11</td><td>48.89</td><td>33.64</td></tr><tr><td>Logit adjustment plus adaptive loss (T = 1)</td><td>22.42</td><td>55.92</td><td>51.25</td><td>31.56</td></tr></table>
|
| 233 |
+
|
| 234 |
+

|
| 235 |
+
Figure 3: Comparison of balanced error for post-hoc correction techniques when varying scaling parameter $\tau$ (c.f. (3), (9)). Post-hoc logit adjustment consistently outperforms weight normalisation.
|
| 236 |
+
|
| 237 |
+
We compare the above methods against our proposed post-hoc logit adjustment (9), and logit adjusted loss (10). For post-hoc logit adjustment, we fix the scalar $\tau = 1$ for our basic results; we analyse the effect of tuning this in Figure 3. We additionally evaluate a combination of our logit adjusted softmax cross-entropy with the adaptive margin of Cao et al. (2019); this uses (11) with $\Delta _ { y y ^ { \prime } } = \log ( \pi _ { y ^ { \prime } } / \pi _ { y } ) + \pi _ { y } ^ { - 1 / 4 }$ . We do not perform any further tuning of our techniques. For all methods, we report the balanced error on the test set. (Note that since the test sets are all balanced for these benchmarks, the balanced error is equivalent to the misclassification error.) For all methods, we pre-compute $\pi$ as the empirical label frequency on the entire training set.
|
| 238 |
+
|
| 239 |
+
Results and analysis. Table 2 demonstrates that our proposed logit adjustment techniques consistently outperform existing methods. Indeed, weight normalisation with $\tau = 1$ is generally improved significantly by post-hoc logit adjustment (e.g., $8 \%$ relative reduction on CIFAR-10). Similarly, loss correction techniques are generally outperformed by our logit adjusted softmax cross-entropy (e.g., $6 \%$ relative reduction on iNaturalist). Cao et al. (2019) observed that their loss benefits from a deferred reweighting scheme (DRW), wherein class-weighting is applied after a fixed number of epochs. Table 2 indicates this is consistently outperformed by suitable variants of logit adjustment.
|
| 240 |
+
|
| 241 |
+
Table 2 only reports the results for logit adjustment with scalar $\tau = 1$ . In practice, tuning $\tau$ can significantly improve performance further. Figure 3 studies the effect of tuning $\tau$ for post-hoc weight normalisation (using $\nu _ { y } = \| w _ { y } \| _ { 2 } )$ and post-hoc logit adjustment. Even without any scaling, post-hoc logit adjustment generally offers superior performance to the best result from weight normalisation (cf. Table 2); with scaling, this is further improved. In practice, one may choose $\tau$ via cross-validation against the balanced error on the training set. For example, on CIFAR-10-LT, we estimate $\tau ^ { * } = 2 . 6$ for post-hoc logit adjustment, for which the resulting balanced test error of $\mathbf { 1 8 . 7 3 \% }$ is superior to that of weight normalisation for any $\tau$ .
|
| 242 |
+
|
| 243 |
+
To better understand the gains, Figure 4 reports errors on a per-group basis, where following Kang et al. (2020) we construct three groups of classes — “Many”, “Medium”, and “Few” — comprising those with $\geq 1 0 0$ , between (20, 100), and $\leq 2 0$ training examples respectively. Logit adjustment shows consistent gains over the “Medium” and “Few” groups, albeit at some expense in “Many” group performance. See Appendix D.2 for a finer-grained breakdown.
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
Figure 4: Comparison of per-group errors for loss modification techniques. We construct three groups of classes: “Many”, comprising those with at least 100 training examples; “Medium”, comprising those with at least 20 and at most 100 training examples; and “Few”, comprising those with at most 20 training examples.
|
| 247 |
+
|
| 248 |
+
While both logit adjustment techniques perform similarly, there is a slight advantage to the loss function version. Nonetheless, the strong performance of post-hoc logit adjustment corroborates the ability to decouple representation and classifier learning in long-tail settings (Zhang et al., 2019). A reference implementation of our methods is planned for release at:
|
| 249 |
+
|
| 250 |
+
https://github.com/google-research/google-research/tree/master/logit_adjustment.
|
| 251 |
+
|
| 252 |
+
# 7 DISCUSSION AND FUTURE WORK
|
| 253 |
+
|
| 254 |
+
Table 2 shows the advantage of logit adjustment over recent proposals, under standard setups from the literature. Further improvements are possible by fusing complementary ideas, and we remark on a few such options. First, one may use a more complex base architecture; e.g., Kang et al. (2020) found gains by employing a ResNet-152, and training for 200 epochs. Table 3 (Appendix) confirms that logit adjustment similarly benefits from this choice, achieving a balanced error of $\mathbf { 3 0 . 1 2 \% }$ on iNaturalist, and $\mathbf { 2 8 . 0 2 \% }$ when combined with the adaptive margin. Second, the DRW training scheme (which applies to any loss) may result in further gains for our techniques. Third, incorporating developments in meta-learning (Wang et al., 2017; Jamal et al., 2020) is also a promising avenue. While further exploring such variants are of empirical interest, we hope to have illustrated the conceptual and empirical value of logit adjustment, and leave this for future work.
|
| 255 |
+
|
| 256 |
+
# REFERENCES
|
| 257 |
+
|
| 258 |
+
Peter L. Bartlett, Michael I. Jordan, and Jon D. McAuliffe. Convexity, classification, and risk bounds. Journal of the American Statistical Association, 101(473):138–156, 2006.
|
| 259 |
+
Y. Bengio and J. S. Senecal. Adaptive importance sampling to accelerate training of a neural probabilistic language model. Trans. Neur. Netw., 19(4):713–722, April 2008. ISSN 1045-9227.
|
| 260 |
+
Kay H. Brodersen, Cheng Soon Ong, Klaas E. Stephan, and Joachim M. Buhmann. The balanced accuracy and its posterior distribution. In Proceedings of the International Conference on Pattern Recognition (ICPR), pp. 3121–3124, Aug 2010.
|
| 261 |
+
Mateusz Buda, Atsuto Maki, and Maciej A. Mazurowski. A systematic study of the class imbalance problem in convolutional neural networks. arXiv:1710.05381 [cs, stat], October 2017.
|
| 262 |
+
Jonathon Byrd and Zachary Chase Lipton. What is the effect of importance weighting in deep learning? In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pp. 872–881, 2019.
|
| 263 |
+
Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems, 2019.
|
| 264 |
+
|
| 265 |
+
Philip K. Chan and Salvatore J. Stolfo. Learning with non-uniform class and cost distributions: Effects and a distributed multi-classifier approach. In KDD-98 Workshop on Distributed Data Mining, 1998.
|
| 266 |
+
|
| 267 |
+
Nitesh V. Chawla, Kevin W. Bowyer, Lawrence O. Hall, and W. Philip Kegelmeyer. SMOTE: Synthetic minority over-sampling technique. Journal of Artificial Intelligence Research (JAIR), 16: 321–357, 2002.
|
| 268 |
+
|
| 269 |
+
Guillem Collell, Drazen Prelec, and Kaustubh R. Patil. Reviving threshold-moving: a simple plug-in bagging ensemble for binary and multiclass imbalanced data. CoRR, abs/1606.08698, 2016.
|
| 270 |
+
|
| 271 |
+
Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. Class-balanced loss based on effective number of samples. In CVPR, 2019.
|
| 272 |
+
|
| 273 |
+
Charles Elkan. The foundations of cost-sensitive learning. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), 2001.
|
| 274 |
+
|
| 275 |
+
Tom Fawcett and Foster Provost. Combining data mining and machine learning for effective user profiling. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pp. 8–13. AAAI Press, 1996.
|
| 276 |
+
|
| 277 |
+
Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association, 102(477):359–378, 2007.
|
| 278 |
+
|
| 279 |
+
Tilmann Gneiting, Fadoua Balabdaoui, and Adrian E. Raftery. Probabilistic forecasts, calibration and sharpness. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 69(2): 243–268, 2007.
|
| 280 |
+
|
| 281 |
+
Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
|
| 282 |
+
|
| 283 |
+
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 1321–1330, 2017.
|
| 284 |
+
|
| 285 |
+
Haibo He and Edwardo A. Garcia. Learning from imbalanced data. IEEE Transactions on Knowledge and Data Engineering, 21(9):1263–1284, 2009.
|
| 286 |
+
|
| 287 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 288 |
+
|
| 289 |
+
Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. CoRR, abs/1503.02531, 2015.
|
| 290 |
+
|
| 291 |
+
Muhammad Abdullah Jamal, Matthew Brown, Ming-Hsuan Yang, Liqiang Wang, and Boqing Gong. Rethinking class-balanced methods for long-tailed visual recognition from a domain adaptation perspective, 2020.
|
| 292 |
+
|
| 293 |
+
Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In Eighth International Conference on Learning Representations (ICLR), 2020.
|
| 294 |
+
|
| 295 |
+
Byungju Kim and Junmo Kim. Adjusting decision boundary for class imbalanced learning, 2019.
|
| 296 |
+
|
| 297 |
+
Vladimir Koltchinskii, Dmitriy Panchenko, and Fernando Lozano. Some new bounds on the generalization error of combined classifiers. In T. K. Leen, T. G. Dietterich, and V. Tresp (eds.), Advances in Neural Information Processing Systems 13, pp. 245–251. MIT Press, 2001.
|
| 298 |
+
|
| 299 |
+
Oluwasanmi Koyejo, Nagarajan Natarajan, Pradeep Ravikumar, and Inderjit S. Dhillon. Consistent binary classification with generalized performance metrics. In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 2, NIPS’14, pp. 2744–2752, Cambridge, MA, USA, 2014. MIT Press.
|
| 300 |
+
|
| 301 |
+
Miroslav Kubat and Stan Matwin. Addressing the curse of imbalanced training sets: One-sided selection. In Proceedings of the International Conference on Machine Learning (ICML), 1997.
|
| 302 |
+
|
| 303 |
+
Miroslav Kubat, Robert Holte, and Stan Matwin. Learning when negative examples abound. In Maarten van Someren and Gerhard Widmer (eds.), Proceedings of the European Conference on Machine Learning (ECML), volume 1224 of Lecture Notes in Computer Science, pp. 146–153. Springer Berlin Heidelberg, 1997. ISBN 978-3-540-62858-3.
|
| 304 |
+
|
| 305 |
+
Volodymyr Kuleshov, Nathan Fenner, and Stefano Ermon. Accurate uncertainties for deep learning using calibrated regression. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2796–2804, Stockholmsmässan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
|
| 306 |
+
|
| 307 |
+
M. Lapin, M. Hein, and B. Schiele. Analysis and optimization of loss functions for multiclass, top-k, and multilabel classification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40 (7):1533–1554, July 2018.
|
| 308 |
+
|
| 309 |
+
Yaoyong Li, Hugo Zaragoza, Ralf Herbrich, John Shawe-Taylor, and Jaz S. Kandola. The perceptron algorithm with uneven margins. In Proceedings of the Nineteenth International Conference on Machine Learning, ICML ’02, pp. 379–386, San Francisco, CA, USA, 2002. Morgan Kaufmann Publishers Inc. ISBN 1558608737.
|
| 310 |
+
|
| 311 |
+
Yi Lin. A note on margin-based loss functions in classification. Statistics & Probability Letters, 68 (1):73 – 82, 2004. ISSN 0167-7152.
|
| 312 |
+
|
| 313 |
+
Ziwei Liu, Zhongqi Miao, Xiaohang Zhan, Jiayun Wang, Boqing Gong, and Stella X. Yu. Large-scale long-tailed recognition in an open world. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 2537–2546. Computer Vision Foundation / IEEE, 2019.
|
| 314 |
+
|
| 315 |
+
Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Vittorio Ferrari, Martial Hebert, Cristian Sminchisescu, and Yair Weiss (eds.), Computer Vision – ECCV 2018, pp. 185–201, Cham, 2018. Springer International Publishing. ISBN 978-3-030-01216-8.
|
| 316 |
+
|
| 317 |
+
Marcus A. Maloof. Learning when data sets are imbalanced and when costs are unequal and unknown. In ICML 2003 Workshop on Learning from Imbalanced Datasets, 2003.
|
| 318 |
+
|
| 319 |
+
Hamed Masnadi-Shirazi and Nuno Vasconcelos. Risk minimization, probability elicitation, and costsensitive SVMs. In Proceedings of the 27th International Conference on International Conference on Machine Learning, ICML’10, pp. 759–766, Madison, WI, USA, 2010. Omnipress. ISBN 9781605589077.
|
| 320 |
+
|
| 321 |
+
Aditya Krishna Menon, Harikrishna Narasimhan, Shivani Agarwal, and Sanjay Chawla. On the statistical consistency of algorithms for binary classification under class imbalance. In Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013, pp. 603–611, 2013.
|
| 322 |
+
|
| 323 |
+
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In Proceedings of the 26th International Conference on Neural Information Processing Systems, NIPS’13, pp. 3111–3119, Red Hook, NY, USA, 2013. Curran Associates Inc.
|
| 324 |
+
|
| 325 |
+
Katharina Morik, Peter Brockhausen, and Thorsten Joachims. Combining statistical learning with a knowledge-based approach - a case study in intensive care monitoring. In Proceedings of the Sixteenth International Conference on Machine Learning (ICML), pp. 268–277, San Francisco, CA, USA, 1999. Morgan Kaufmann Publishers Inc. ISBN 1-55860-612-2.
|
| 326 |
+
|
| 327 |
+
Rafael Müller, Simon Kornblith, and Geoffrey E. Hinton. When does label smoothing help? In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, 8-14 December 2019, Vancouver, BC, Canada, pp. 4696–4705, 2019.
|
| 328 |
+
|
| 329 |
+
Allan H. Murphy and Robert L. Winkler. A general framework for forecast verification. Monthly Weather Review, 115(7):1330–1338, 1987.
|
| 330 |
+
|
| 331 |
+
Patrick Pletscher, Cheng Soon Ong, and Joachim M. Buhmann. Entropy and margin maximization for structured output learning. In José Luis Balcázar, Francesco Bonchi, Aristides Gionis, and Michèle Sebag (eds.), Machine Learning and Knowledge Discovery in Databases, pp. 83–98, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg.
|
| 332 |
+
|
| 333 |
+
Foster Provost. Machine learning from imbalanced data sets 101. In Proceedings of the AAAI-2000 Workshop on Imbalanced Data Sets, 2000.
|
| 334 |
+
|
| 335 |
+
Mark D. Reid and Robert C. Williamson. Composite binary losses. Journal of Machine Learning Research, 11:2387–2422, 2010.
|
| 336 |
+
|
| 337 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 2818–2826, 2016.
|
| 338 |
+
|
| 339 |
+
J. Tan, C. Wang, B. Li, Q. Li, W. Ouyang, C. Yin, and J. Yan. Equalization loss for long-tailed object recognition. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 11659–11668, 2020.
|
| 340 |
+
|
| 341 |
+
Keiji Tatsumi and Tetsuzo Tanino. Support vector machines maximizing geometric margins for multi-class classification. TOP, 22(3):815–840, 2014.
|
| 342 |
+
|
| 343 |
+
Keiji Tatsumi, Masashi Akao, Ryo Kawachi, and Tetsuzo Tanino. Performance evaluation of multiobjective multiclass support vector machines maximizing geometric margins. Numerical Algebra, Control & Optimization, 1:151, 2011. ISSN 2155-3289.
|
| 344 |
+
|
| 345 |
+
Grant Van Horn and Pietro Perona. The devil is in the tails: Fine-grained classification in the wild. arXiv preprint arXiv:1709.01450, 2017.
|
| 346 |
+
|
| 347 |
+
B.C. Wallace, K.Small, C.E. Brodley, and T.A. Trikalinos. Class imbalance, redux. In Proc. ICDM, 2011.
|
| 348 |
+
|
| 349 |
+
Yu-Xiong Wang, Deva Ramanan, and Martial Hebert. Learning to model the tail. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 7029–7039. Curran Associates, Inc., 2017.
|
| 350 |
+
|
| 351 |
+
Shan-Hung Wu, Keng-Pei Lin, Chung-Min Chen, and Ming-Syan Chen. Asymmetric support vector machines: Low false-positive learning under the user tolerance. In Proceedings of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’08, pp. 749–757, New York, NY, USA, 2008. Association for Computing Machinery. ISBN 9781605581934.
|
| 352 |
+
|
| 353 |
+
Yu Xie and Charles F. Manski. The logit model and response-based samples. Sociological Methods & Research, 17(3):283–302, 1989.
|
| 354 |
+
|
| 355 |
+
Han-Jia Ye, Hong-You Chen, De-Chuan Zhan, and Wei-Lun Chao. Identifying and compensating for feature deviation in imbalanced deep learning, 2020.
|
| 356 |
+
|
| 357 |
+
Xinyang Yi, Ji Yang, Lichan Hong, Derek Zhiyuan Cheng, Lukasz Heldt, Aditee Kumthekar, Zhe Zhao, Li Wei, and Ed Chi. Sampling-bias-corrected neural modeling for large corpus item recommendations. In Proceedings of the 13th ACM Conference on Recommender Systems, RecSys ’19, pp. 269–277, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450362436.
|
| 358 |
+
|
| 359 |
+
Xi Yin, Xiang Yu, Kihyuk Sohn, Xiaoming Liu, and Manmohan Chandraker. Feature transfer learning for deep face recognition with long-tail data. CoRR, abs/1803.09014, 2018.
|
| 360 |
+
|
| 361 |
+
Junjie Zhang, Lingqiao Liu, Peng Wang, and Chunhua Shen. To balance or not to balance: A simple-yet-effective approach for learning with long-tailed distributions, 2019.
|
| 362 |
+
|
| 363 |
+
X. Zhang, Z. Fang, Y. Wen, Z. Li, and Y. Qiao. Range loss for deep face recognition with long-tailed training data. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 5419–5428, 2017.
|
| 364 |
+
|
| 365 |
+
Zhi-Hua Zhou and Xu-Ying Liu. Training cost-sensitive neural networks with methods addressing the class imbalance problem. IEEE Transactions on Knowledge and Data Engineering (TKDE), 18(1), 2006.
|
| 366 |
+
|
| 367 |
+
# Supplementary material for “Long tail learning via logit adjustment”
|
| 368 |
+
|
| 369 |
+
A PROOFS OF RESULTS IN BODY
|
| 370 |
+
|
| 371 |
+
Proof of Theorem 1. Denote $\eta _ { y } ( x ) = \mathbb { P } ( y \mid x )$ . Suppose we employ a margin $\Delta _ { y y ^ { \prime } } = \log { \frac { \delta _ { y ^ { \prime } } } { \delta _ { y } } }$ . Then, the loss is
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
\ell ( y , f ( x ) ) = - \log \frac { \delta _ { y } \cdot e ^ { f _ { y } ( x ) } } { \sum _ { y ^ { \prime } \in [ L ] } \delta _ { y ^ { \prime } } \cdot e ^ { f _ { y ^ { \prime } } ( x ) } } = - \log \frac { e ^ { f _ { y } ( x ) + \log \delta _ { y } } } { \sum _ { y ^ { \prime } \in [ L ] } e ^ { f _ { y ^ { \prime } } ( x ) + \log \delta _ { y ^ { \prime } } } } .
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
Consequently, under constant weights $\alpha _ { y } = 1$ , the Bayes-optimal score will satisfy $f _ { y } ^ { * } ( x ) + \log \delta _ { y } =$ $\log \eta _ { y } ( x )$ , or $\begin{array} { r } { f _ { y } ^ { * } ( x ) = \log \frac { \eta _ { y } ( x ) } { \delta _ { y } } } \end{array}$
|
| 378 |
+
|
| 379 |
+
Now suppose we use generic weights $\alpha \in \mathbb { R } _ { + } ^ { L }$ . The risk under this loss is
|
| 380 |
+
|
| 381 |
+
$$
|
| 382 |
+
\begin{array} { r l } { \mathbb { E } _ { x , y } \left[ \ell _ { \alpha } ( y , f ( x ) ) \right] = \displaystyle \sum _ { y \in [ L ] } \pi _ { y } \cdot \mathbb { E } _ { x | y = y } \left[ \ell _ { \alpha } ( y , f ( x ) ) \right] } & { } \\ { = \displaystyle \sum _ { y \in [ L ] } \pi _ { y } \cdot \mathbb { E } _ { x | y = y } \left[ \ell _ { \alpha } ( y , f ( x ) ) \right] } & { } \\ { = \displaystyle \sum _ { y \in [ L ] } \pi _ { y } \cdot \alpha _ { y } \cdot \mathbb { E } _ { x | y = y } \left[ \ell ( y , f ( x ) ) \right] } & { } \\ { \propto \displaystyle \sum _ { y \in [ L ] } \pi _ { y } \cdot \mathbb { E } _ { x | y = y } \left[ \ell ( y , f ( x ) ) \right] , } \end{array}
|
| 383 |
+
$$
|
| 384 |
+
|
| 385 |
+
where $\bar { \pi } _ { y } \propto \pi _ { y } \cdot \alpha _ { y }$ . Consequently, learning with the weighted loss is equivalent to learning with the original loss, on a distribution with modified base-rates $\bar { \pi }$ . Under such a distribution, we have class-conditional distribution
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
{ \bar { \eta } } _ { y } ( x ) = { \bar { \mathbb { P } } } ( y \mid x ) = { \frac { \mathbb { P } ( x \mid y ) \cdot { \bar { \pi } } _ { y } } { { \bar { \mathbb { P } } } ( x ) } } = \eta _ { y } ( x ) \cdot { \frac { { \bar { \pi } } _ { y } } { \pi _ { y } } } \cdot { \frac { \mathbb { P } ( x ) } { { \bar { \mathbb { P } } } ( x ) } } \propto \eta _ { y } ( x ) \cdot \alpha _ { y } .
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
Consequently, suppose $\begin{array} { r } { \alpha _ { y } = \frac { \delta _ { y } } { \pi _ { y } } } \end{array}$ . Then, $\begin{array} { r } { f _ { y } ^ { * } ( x ) = \log \frac { \bar { \eta } _ { y } ( x ) } { \delta _ { y } } = \log \frac { \eta _ { y } ( x ) } { \pi _ { y } } + C ( x ) } \end{array}$ , where $C ( x )$ does not depend on y. Consequently, argmaxy∈[L] f∗y (x) = argmaxy∈[L] πy , which is the Bayes-optimal prediction for the balanced error.
|
| 392 |
+
|
| 393 |
+
In sum, a consistent family can be obtained by choosing any set of constants $\delta _ { y } > 0$ and setting
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
\begin{array} { c } { \displaystyle \alpha _ { y } = \frac { \delta _ { y } } { \pi _ { y } } } \\ { \displaystyle \Delta _ { y y ^ { \prime } } = \log \frac { \delta _ { y ^ { \prime } } } { \delta _ { y } } . } \end{array}
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
Proof of Theorem 2. We establish a more general result in Lemma 3 of the next section, which allows for a temperature parameter in the loss. This allows for interpolating between the standard softmax cross-entropy and margin based losses. □
|
| 400 |
+
|
| 401 |
+
# B ON THE CONSISTENCY OF BINARY MARGIN-BASED LOSSES
|
| 402 |
+
|
| 403 |
+
It is instructive to study the pairwise margin loss (11) in the binary case. Endowing the loss with a temperature parameter $\gamma > 0$ , we get2
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
\begin{array} { l } { \ell ( + 1 , f ) = \displaystyle \frac { \omega _ { + 1 } } { \gamma } \cdot \log ( 1 + e ^ { \gamma \cdot \delta _ { + 1 } } \cdot e ^ { - \gamma \cdot f } ) } \\ { \ell ( - 1 , f ) = \displaystyle \frac { \omega _ { - 1 } } { \gamma } \cdot \log ( 1 + e ^ { \gamma \cdot \delta _ { - 1 } } \cdot e ^ { \gamma \cdot f } ) } \end{array}
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
for constants $\omega _ { \pm 1 } , \gamma > 0$ and $\delta _ { \pm 1 } \in \mathbb { R }$ . Here, we have used $\delta _ { + 1 } = \Delta _ { + 1 , - 1 }$ and $\delta _ { - 1 } = \Delta _ { - 1 , + 1 }$ for simplicity. The choice $\omega _ { \pm 1 } = 1 , \delta _ { \pm 1 } = 0$ recovers the temperature scaled binary logistic loss. Evidently, as $\gamma + \infty$ , these converge to weighted hinge losses with variable margins, i.e.,
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
\begin{array} { l } { \ell ( + 1 , f ) = \omega _ { + 1 } \cdot [ \delta _ { + 1 } - f ] _ { + } } \\ { \ell ( - 1 , f ) = \omega _ { - 1 } \cdot [ \delta _ { - 1 } + f ] _ { + } . } \end{array}
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
We study two properties of this family losses. First, under what conditions are the losses Fisher consistent for the balanced error? We shall show that in fact there is a simple condition characterising this. Second, do the losses preserve properness of the original binary logistic loss? We shall show that this is always the case, but that the losses involve fundamentally different approximations.
|
| 416 |
+
|
| 417 |
+
# B.1 CONSISTENCY OF THE BINARY PAIRWISE MARGIN LOSS
|
| 418 |
+
|
| 419 |
+
Given a loss $\ell$ , its Bayes optimal solution is $f ^ { * } \in \mathrm { a r g m i n } _ { f }$ : $\boldsymbol { x } _ { \ u { } \mathbb { R } } \mathbb { E } [ \ell ( y , f ( x ) ) ]$ . For consistency with respect to the balanced error in the binary case, we require this optimal solution $f ^ { * }$ to satisfy $f ^ { * } ( x ) > 0 \iff \eta ( x ) > \pi$ , where $\eta ( x ) \doteq \mathbb { P } ( y = 1 \mid x )$ and $\pi \doteq \mathbb { P } ( y = 1 )$ (Menon et al., 2013). This is equivalent to a simple condition on the weights $\omega$ and margins $\delta$ of the pairwise margin loss.
|
| 420 |
+
|
| 421 |
+
Lemma 3. The losses in (13) are consistent for the balanced error iff
|
| 422 |
+
|
| 423 |
+
$$
|
| 424 |
+
\frac { \omega _ { + 1 } } { \omega _ { - 1 } } \cdot \frac { \sigma ( \gamma \cdot \delta _ { + 1 } ) } { \sigma ( \gamma \cdot \delta _ { - 1 } ) } = \frac { 1 - \pi } { \pi } ,
|
| 425 |
+
$$
|
| 426 |
+
|
| 427 |
+
where $\sigma ( z ) = ( 1 + \exp ( z ) ) ^ { - 1 }$
|
| 428 |
+
|
| 429 |
+
Proof of Lemma 3. Denote $\eta ( x ) \doteq \mathbb { P } ( y = + 1 \mid x )$ , and $\pi \doteq \mathbb { P } ( y = + 1 )$ . From Lemma 4 below, the pairwise margin loss is proper composite with invertible link function $\Psi : [ 0 , 1 ] \to \mathbb { R } \cup \{ \pm \infty \}$ . Consequently, since by definition the Bayes-optimal score for a proper composite loss is $f ^ { * } ( x ) =$ $\Psi ( \eta ( x ) )$ (Reid & Williamson, 2010), to have consistency for the balanced error, from (14), (15), we require
|
| 430 |
+
|
| 431 |
+
$$
|
| 432 |
+
\begin{array} { r l } & { \Psi ^ { - 1 } ( 0 ) = \pi \iff \frac { 1 } { 1 - \frac { \ell ^ { \prime } ( + 1 , 0 ) } { \ell ^ { \prime } ( - 1 , 0 ) } } = \pi } \\ & { \qquad \iff 1 - \frac { \ell ^ { \prime } ( + 1 , 0 ) } { \ell ^ { \prime } ( - 1 , 0 ) } = \frac { 1 } { \pi } } \\ & { \qquad \iff - \frac { \ell ^ { \prime } ( + 1 , 0 ) } { \ell ^ { \prime } ( - 1 , 0 ) } = \frac { 1 - \pi } { \pi } } \\ & { \qquad \iff \frac { \omega _ { + 1 } } { \omega _ { - 1 } } \cdot \frac { \sigma ( \gamma \cdot \delta _ { + 1 } ) } { \sigma ( \gamma \cdot \delta _ { - 1 } ) } = \frac { 1 - \pi } { \pi } . } \end{array}
|
| 433 |
+
$$
|
| 434 |
+
|
| 435 |
+
From the above, some admissible parameter choices include:
|
| 436 |
+
|
| 437 |
+
• $\textstyle \omega _ { + 1 } = { \frac { 1 } { \pi } }$ , $\begin{array} { r } { \omega _ { - 1 } = \frac { 1 } { 1 - \pi } } \end{array}$ , $\delta _ { \pm 1 } = 1$ ; i.e., the standard weighted loss with a constant margin • $\omega _ { \pm 1 } = 1$ , $\begin{array} { r } { \delta _ { + 1 } = \frac { 1 } { \gamma } \cdot \log \frac { 1 - \pi } { \pi } } \end{array}$ , $\begin{array} { r } { \delta _ { - 1 } = \frac { 1 } { \gamma } \cdot \log \frac { \pi } { 1 - \pi } } \end{array}$ ; i.e., the unweighted loss with a margin biased towards the rare class, as per our logit adjustment procedure
|
| 438 |
+
|
| 439 |
+
The second example above is unusual in that it requires scaling the margin with the temperature; consequently, the margin disappears as $\gamma + \infty$ . Other combinations are of course possible, but note that one cannot arbitrarily choose parameters and hope for consistency in general. Indeed, some inadmissible choices are naïve applications of the margin modification or weighting, e.g.,
|
| 440 |
+
|
| 441 |
+
• $\textstyle \omega _ { + 1 } = { \frac { 1 } { \pi } }$ , $\begin{array} { r } { \omega _ { - 1 } = \frac { 1 } { 1 - \pi } } \end{array}$ , $\begin{array} { r } { \delta _ { + 1 } = \frac { 1 } { \gamma } \cdot \log \frac { 1 - \pi } { \pi } } \end{array}$ , $\begin{array} { r } { \delta _ { - 1 } = \frac { 1 } { \gamma } \cdot \log \frac { \pi } { 1 - \pi } } \end{array}$ ; i.e., combining both weighting and margin modification • $\omega _ { \pm 1 } = 1$ $\begin{array} { r } { = 1 , \delta _ { + 1 } = \frac { 1 } { \gamma } \cdot ( 1 - \pi ) , \delta _ { - 1 } = \frac { 1 } { \gamma } \cdot \pi } \end{array}$ ; i.e., specific margin modification
|
| 442 |
+
|
| 443 |
+
Note further that the choices of Cao et al. (2019); Tan et al. (2020) do not meet the requirements of Lemma 3.
|
| 444 |
+
|
| 445 |
+
We make two final remarks. First, the above only considers consistency of the result of loss minimisation. For any choice of weights and margins, we may apply suitable post-hoc correction to the predictions to account for any bias in the optimal scores. Second, as $\gamma \to + \infty$ , any constant margins $\delta _ { \pm 1 } > 0$ will have no effect on the consistency condition, since $\sigma ( \gamma \cdot \delta _ { \pm 1 } ) 1$ . The condition will be wholly determined by the weights $\omega _ { \pm 1 }$ . For example, we may choose $\textstyle \omega _ { + 1 } = { \frac { 1 } { \pi } }$ , $\begin{array} { r } { \omega _ { - 1 } = \frac { 1 } { 1 - \pi } } \end{array}$ , $\delta _ { + 1 } = 1$ , and $\begin{array} { r } { \delta _ { - 1 } = \frac { \pi } { 1 - \pi } } \end{array}$ ; the resulting loss will not be consistent for finite $\gamma$ , but will become so in the limit $\gamma \to + \infty$ .
|
| 446 |
+
|
| 447 |
+
# B.2 PROPERNESS OF THE PAIRWISE MARGIN LOSS
|
| 448 |
+
|
| 449 |
+
In the above, we appealed to the pairwise margin loss being proper composite, in the sense of Reid & Williamson (2010). Intuitively, this specifies that the loss has Bayes-optimal score of the form $f ^ { * } ( x ) = \Psi ( \eta ( x ) )$ , where $\Psi$ is some invertible function, and $\eta ( x ) = \mathbb { P } ( y = 1 \mid x )$ . We have the following general result about properness of any member of the pairwise margin family.
|
| 450 |
+
|
| 451 |
+
Lemma 4. The losses in (13) are proper composite, with link function
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\Psi ( p ) = \frac { 1 } { \gamma } \cdot \log \left[ \left( \frac { a \cdot b } { q } - c \right) \pm \sqrt { \left( \frac { a \cdot b } { q } - c \right) ^ { 2 } + 4 \cdot \frac { a } { q } } \right] - \log 2 ,
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
where $\begin{array} { r } { a = \frac { \omega _ { + 1 } } { \omega _ { - 1 } } \cdot \frac { e ^ { \gamma \cdot \delta _ { + 1 } } } { e ^ { \gamma \cdot \delta _ { - 1 } } } } \end{array}$ , $b = e ^ { \gamma \cdot \delta _ { - 1 } }$ , $c = e ^ { \gamma \cdot \delta _ { + 1 } }$ , and $\begin{array} { r } { q = \frac { 1 - p } { p } } \end{array}$ .
|
| 458 |
+
|
| 459 |
+
Proof of Lemma 4. The above family of losses is proper composite iff the function
|
| 460 |
+
|
| 461 |
+
$$
|
| 462 |
+
f \mapsto { \frac { 1 } { 1 - { \frac { \ell ^ { \prime } ( + 1 , f ) } { \ell ^ { \prime } ( - 1 , f ) } } } }
|
| 463 |
+
$$
|
| 464 |
+
|
| 465 |
+
is invertible (Reid & Williamson, 2010, Corollary 12); the resulting inverse is the link function $\Psi$ . We have
|
| 466 |
+
|
| 467 |
+
$$
|
| 468 |
+
\begin{array} { l } { { \ell ^ { \prime } ( + 1 , f ) = - \omega _ { + 1 } \cdot \frac { e ^ { \gamma \cdot \delta _ { + 1 } } \cdot e ^ { - \gamma \cdot f } } { 1 + e ^ { \gamma \cdot \delta _ { + 1 } } \cdot e ^ { - \gamma \cdot f } } } } \\ { { \ell ^ { \prime } ( - 1 , f ) = + \omega _ { - 1 } \cdot \frac { e ^ { \gamma \cdot \delta _ { - 1 } } \cdot e ^ { \gamma \cdot f } } { 1 + e ^ { \gamma \cdot \delta _ { - 1 } } \cdot e ^ { \gamma \cdot f } } . } } \end{array}
|
| 469 |
+
$$
|
| 470 |
+
|
| 471 |
+
The invertibility of (14) is immediate. To compute the link function $\Psi$ , note that
|
| 472 |
+
|
| 473 |
+
$$
|
| 474 |
+
\begin{array} { r l } { p = \cfrac { 1 } { 1 - \cfrac { \ell ^ { \prime } ( + 1 , f ) } { \ell ^ { \prime } ( - 1 , f ) } } \iff \frac { 1 } { p } = 1 - \cfrac { \ell ^ { \prime } ( + 1 , f ) } { \ell ^ { \prime } ( - 1 , f ) } } \\ { \iff - \cfrac { \ell ^ { \prime } ( + 1 , f ) } { \ell ^ { \prime } ( - 1 , f ) } = \cfrac { 1 - p } { p } } \\ { \iff \frac { \omega _ { + 1 } } { \omega _ { - 1 } } \cdot \cfrac { e ^ { \gamma \cdot \delta _ { + 1 } } \cdot e ^ { - \gamma \cdot f } } { 1 + e ^ { \gamma \cdot \delta _ { + 1 } } \cdot e ^ { - \gamma \cdot f } } \cdot \cfrac { 1 + e ^ { \gamma \cdot \delta _ { - 1 } } \cdot e ^ { \gamma \cdot f } } { e ^ { \gamma \cdot \delta _ { - 1 } } \cdot e ^ { \gamma \cdot f } } = \cfrac { 1 - p } { p } } \end{array}
|
| 475 |
+
$$
|
| 476 |
+
|
| 477 |
+
$$
|
| 478 |
+
\begin{array} { l } { { \iff \frac { \omega _ { + 1 } } { \omega _ { - 1 } } \cdot \frac { e ^ { \gamma \cdot \delta _ { + 1 } } } { e ^ { \gamma \cdot \delta _ { - 1 } } } \cdot \frac { 1 } { e ^ { \gamma \cdot f } + e ^ { \gamma \cdot \delta _ { + 1 } } } \cdot \frac { 1 + e ^ { \gamma \cdot \delta _ { - 1 } } \cdot e ^ { \gamma \cdot f } } { e ^ { \gamma \cdot f } } = \frac { 1 - p } { p } } } \\ { { \iff a \cdot \frac { 1 + b \cdot g } { g ^ { 2 } + c \cdot g } = q , } } \end{array}
|
| 479 |
+
$$
|
| 480 |
+
|
| 481 |
+
where $\begin{array} { r } { a = \frac { \omega _ { + 1 } } { \omega _ { - 1 } } \cdot \frac { e ^ { \gamma \cdot \delta _ { + 1 } } } { e ^ { \gamma \cdot \delta _ { - 1 } } } } \end{array}$ , $b = e ^ { \gamma \cdot \delta _ { - 1 } }$ , $c = e ^ { \gamma \cdot \delta _ { + 1 } }$ , $g = e ^ { \gamma \cdot f }$ , and $\begin{array} { r } { q = \frac { 1 - p } { p } } \end{array}$ . Thus,
|
| 482 |
+
|
| 483 |
+
$$
|
| 484 |
+
\begin{array} { r l } & { a \cdot \frac { 1 + b \cdot g } { g ^ { 2 } + c \cdot g } = q \iff \frac { g ^ { 2 } + c \cdot g } { 1 + b \cdot g } = \frac { a } { q } } \\ & { \iff g ^ { 2 } + \left( c - \frac { a \cdot b } { q } \right) \cdot g - \frac { a } { q } = 0 } \\ & { \iff g = \frac { \left( \frac { a \cdot b } { q } - c \right) \pm \sqrt { \left( \frac { a \cdot b } { q } - c \right) ^ { 2 } + 4 \cdot \frac { a } { q } } } { 2 } . } \end{array}
|
| 485 |
+
$$
|
| 486 |
+
|
| 487 |
+
As a sanity check, suppose $a = b = c = \gamma = 1$ . This corresponds to the standard logistic loss. Then,
|
| 488 |
+
|
| 489 |
+
$$
|
| 490 |
+
\Psi ( p ) = \log { \frac { \left( { \frac { 1 } { q } } - 1 \right) \pm { \sqrt { \left( { \frac { 1 } { q } } - 1 \right) ^ { 2 } + 4 \cdot { \frac { 1 } { q } } } } } { 2 } } = \log { \frac { p } { 1 - p } } ,
|
| 491 |
+
$$
|
| 492 |
+
|
| 493 |
+
which is the standard logit function.
|
| 494 |
+
|
| 495 |
+
Figure 5 and 6 compares the link functions for a few different settings:
|
| 496 |
+
|
| 497 |
+
• the balanced loss, where $\begin{array} { r } { \omega _ { + 1 } = \frac { 1 } { \pi } } \end{array}$ , $\begin{array} { r } { \omega _ { - 1 } = \frac { 1 } { 1 - \pi } } \end{array}$ , and $\delta _ { \pm 1 } = 1$ • an unequal margin loss, where $\omega _ { \pm 1 } = 1$ , $\begin{array} { r } { \delta _ { + 1 } = \frac { 1 } { \gamma } \cdot \log \frac { 1 - \pi } { \pi } } \end{array}$ , and $\begin{array} { r } { \delta _ { - 1 } = \frac { 1 } { \gamma } \cdot \log \frac { \pi } { 1 - \pi } } \end{array}$ • a balanced $^ +$ margin loss, where $\textstyle \omega _ { + 1 } = { \frac { 1 } { \pi } }$ , $\begin{array} { r } { \omega _ { - 1 } = \frac { 1 } { 1 - \pi } } \end{array}$ , $\delta _ { + 1 } = 1$ , and $\begin{array} { r } { \delta _ { - 1 } = \frac { \pi } { 1 - \pi } } \end{array}$ .
|
| 498 |
+
|
| 499 |
+
The property $\Psi ^ { - 1 } ( 0 ) = \pi$ for $\pi = \mathbb { P } ( y = 1 )$ holds for the first two choices with any $\gamma > 0$ , and the third choice as $\gamma \to + \infty$ . This indicates the Fisher consistency of these losses for the balanced error. However, the precise way this is achieved is strikingly different in each case. In particular, each loss implicitly involves a fundamentally different link function.
|
| 500 |
+
|
| 501 |
+
To better understand the effect of parameter choices, Figure 7 illustrates the conditional Bayes risk curves, i.e.,
|
| 502 |
+
|
| 503 |
+
$$
|
| 504 |
+
\underline { { \mathsf { L } } } ( p ) = p \cdot \ell ( + 1 , \Psi ( p ) ) + ( 1 - p ) \cdot \ell ( + 1 , \Psi ( p ) ) .
|
| 505 |
+
$$
|
| 506 |
+
|
| 507 |
+
We remark here that for the balanced error, this function takes the form $\begin{array} { r } { \underline { { \mathrm { L } } } ( p ) = p \cdot \left[ \left[ p < \pi \right] \right] + ( 1 - } \end{array}$ $p ) \cdot \mathbb { \left[ p > \pi \right] }$ , i.e., it is a “tent shaped” concave function with a maximum at $p = \pi$ .
|
| 508 |
+
|
| 509 |
+
For ease of comparison, we normalise this curves to have a maximum of 1. Figure 7 shows that simply applying unequal margins does not affect the underlying conditional Bayes risk compared to the standard log-loss; thus, the change here is purely in terms of the link function. By contrast, either balancing the loss or applying a combination of weighting and margin modification results in a closer approximation to the conditional Bayes risk curve for the cost-sensitive loss with cost $\pi$ .
|
| 510 |
+
|
| 511 |
+

|
| 512 |
+
Figure 5: Comparison of link functions for various losses assuming $\pi = 0 . 2$ , with $\gamma = 1$ (left) and $\gamma = 8$ (ried t). The balanced l margin loss uses $\begin{array} { r } { \omega _ { y } = \frac { 1 } { \pi _ { y } } } \end{array}$ , margin loss uses . $\begin{array} { r } { \delta _ { y } = \frac { 1 } { \gamma } \cdot \log \frac { 1 - \pi } { \pi } } \end{array}$ . The $^ +$ $\begin{array} { r } { \delta _ { - 1 } = \frac { \pi } { 1 - \pi } } \end{array}$ $\delta _ { + 1 } = 1$ $\begin{array} { r } { \omega _ { + 1 } = \frac { 1 } { \pi } } \end{array}$
|
| 513 |
+
|
| 514 |
+

|
| 515 |
+
Figure 6: Comparison of link functions for various losses assuming $\pi = 0 . 2$ , with $\gamma = 1$ (left) and $\gamma = 8$ (right). The balanced loss uses $\begin{array} { r } { \omega _ { y } = \frac { 1 } { \pi _ { y } } } \end{array}$ . The unequal margin loss uses $\begin{array} { r } { \delta _ { y } = \frac { 1 } { \gamma } \cdot \log \frac { 1 - \pi _ { y } } { \pi _ { y } } } \end{array}$ The balanced $^ +$ margin loss uses $\begin{array} { r } { \delta _ { - 1 } = \frac { \pi } { 1 - \pi } } \end{array}$ , $\delta _ { + 1 } = 1$ , $\begin{array} { r } { \omega _ { + 1 } = \frac { 1 } { \pi } } \end{array}$ .
|
| 516 |
+
|
| 517 |
+

|
| 518 |
+
Figure 7: Comparison of conditional Bayes risk functions for various losses assuming $\pi = 0 . 2$ , with $\gamma = 1$ (left) and $\gamma = 8$ (right). The balanced loss uses $\begin{array} { r } { \omega _ { y } = \frac { 1 } { \pi _ { y } } } \end{array}$ . The unequal margin loss uses $\begin{array} { r } { \delta _ { y } = \frac { 1 } { \gamma } \cdot \log \frac { 1 - \pi _ { y } } { \pi _ { y } } } \end{array}$ . The first balanced $^ +$ margin loss uses $\delta _ { - 1 } = \pi$ , $\delta _ { + 1 } = 1$ , $\begin{array} { r } { \omega _ { + 1 } = \frac { 1 } { \pi } } \end{array}$ . The second balanced $^ +$ y margin loss uses $\begin{array} { r } { \delta _ { - 1 } = \frac { \pi } { 1 - \pi } } \end{array}$ , $\delta _ { + 1 } = 1$ , $\textstyle \omega _ { + 1 } = { \frac { 1 } { \pi } }$ .
|
| 519 |
+
|
| 520 |
+
# C EXPERIMENTAL SETUP
|
| 521 |
+
|
| 522 |
+
Intending a fair comparison, we use the same setup for all the methods for each dataset. Unless otherwise specified, all networks are trained with SGD with a momentum value of 0.9, a linear learning rate warm-up in the first 5 epochs to reach the base learning rate, and a weight decay of $1 0 ^ { - 4 }$ . Other dataset specific details are given below.
|
| 523 |
+
|
| 524 |
+
CIFAR-10 and CIFAR-100: We use a CIFAR ResNet-32 model trained for 120K steps with a batch size of 128. The base learning rate is 0.1, with a linear warmup for the first 2000 steps, and a decay of 0.1 at 60K, 90K, and 110K steps.3 We also use the standard CIFAR data augmentation procedure used in previous works such as Cao et al. (2019); He et al. (2016), where 4 pixels are padded on each size and a random $3 2 \times 3 2$ crop is taken. Images are horizontally flipped with a probability of 0.5.
|
| 525 |
+
|
| 526 |
+
ImageNet: We use a ResNet-50 model trained for 90 epochs with batch size of 512. The base learning rate is 0.4, with cosine learning rate decay and Nesterov momentum. We use a weight decay of $5 \times \bar { 1 } 0 ^ { - 4 }$ following Kang et al. (2020). Additionally, we apply the standard data augmentation comprising of random cropping and flipping as described in Goyal et al. (2017).
|
| 527 |
+
|
| 528 |
+
iNaturalist: We use a ResNet-50 trained for 90 epochs with a batch size of 1024. (Note however that for the ResNet-152 experiments in Appendix D.1, we use a batch size of 512.) The base learning rate is 0.4, with cosine learning rate decay. The data augmentation procedure is the same as used in ImageNet.
|
| 529 |
+
|
| 530 |
+
# D ADDITIONAL EXPERIMENTS
|
| 531 |
+
|
| 532 |
+
We present here additional experiments:
|
| 533 |
+
|
| 534 |
+
(i) we present a detailed table of results with a more complex base architecture and number of training epochs for ImageNet-LT and iNaturalist;
|
| 535 |
+
(ii) we present results for CIFAR-10 and CIFAR-100 on the STEP profile (Cao et al., 2019) with $\rho = 1 0 0$ .
|
| 536 |
+
(iii) we present results on synthetic data with varying imbalance ratios.
|
| 537 |
+
|
| 538 |
+
# D.1 RESULTS WITH MORE COMPLEX BASE ARCHITECTURE
|
| 539 |
+
|
| 540 |
+
Table 3 presents results when using a ResNet-152, trained for either 90 or 200 epochs, on the larger ImageNet-LT and iNaturalist datasets. Consistent with the findings in Kang et al. (2020), training with a more complex architecture for longer generally yields significant gains. Logit adjustment, potentially when combined with the adaptive margin, is generally superior to baselines with the sole exception of results for ResNet-152 with 200 epochs on iNaturalist.
|
| 541 |
+
|
| 542 |
+
Table 3: Test set balanced error (averaged over 5 trials) on real-world datasets with more complex base architectures. Employing a ResNet-152 systematically improves all methods’ performance, with logit adjustment remaining superior to existing approaches. The final row reports the results of combining logit adjustment with the adaptive margin loss of Cao et al. (2019), which yields further gains on iNaturalist.
|
| 543 |
+
|
| 544 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">ImageNet-LT</td><td colspan="2">iNaturalist</td><td></td></tr><tr><td>ResNet-50</td><td>ResNet-152</td><td>ResNet-50 90 epochs</td><td>ResNet-152 90 epochs</td><td>ResNet-152 200 epochs</td></tr><tr><td>ERM</td><td>53.11</td><td>53.30</td><td>38.66</td><td>35.88</td><td>34.38</td></tr><tr><td>Weight normalisation (T = 1) (Kang et al., 2020)</td><td>52.00</td><td>51.49</td><td>48.05</td><td>45.17</td><td>45.33</td></tr><tr><td>Weight normalisation (T = T*) (Kang et al.,2020)</td><td>49.37</td><td>48.97</td><td>34.10</td><td>31.85</td><td>30.34</td></tr><tr><td>Learnable weight scaling (LWS) (Kang et al., 2020)</td><td>52.30</td><td>49.50</td><td>34.10</td><td>30.90</td><td>27.90</td></tr><tr><td>Classifier retraining (cRT) (Kang et al., 2020)</td><td>52.70</td><td>49.90</td><td>34.80</td><td>31.50</td><td>28.80</td></tr><tr><td>Adaptive (Cao et al., 2019)</td><td>52.15</td><td>53.34</td><td>35.42</td><td>31.18</td><td>29.46</td></tr><tr><td>Equalised (Tan et al., 2020)</td><td>54.02</td><td>51.38</td><td>38.37</td><td>35.86</td><td>34.53</td></tr><tr><td>Logit adjustment post-hoc (T =1)</td><td>49.66</td><td>49.25</td><td>33.98</td><td>31.46</td><td>30.15</td></tr><tr><td>Logit adjustment post-hoc (T = T*)</td><td>49.56</td><td>49.15</td><td>33.80</td><td>31.08</td><td>29.74</td></tr><tr><td>Logit adjustment loss (T = 1)</td><td>48.89</td><td>47.86</td><td>33.64</td><td>31.15</td><td>30.12</td></tr><tr><td>Logit adjustment plus adaptive loss (T = 1)</td><td>51.25</td><td>50.46</td><td>31.56</td><td>29.22</td><td>28.02</td></tr></table>
|
| 545 |
+
|
| 546 |
+
# D.2 PER-CLASS ERROR RATES
|
| 547 |
+
|
| 548 |
+
Figure 8 breaks down the per-class accuracies on CIFAR-10, CIFAR-100, and iNaturalist. On the latter two datasets, for ease of visualisation, we aggregate the classes into ten groups based on their frequency-sorted order (so that, e.g., group 0 comprises the top $\frac { L } { 1 0 }$ most frequent classes). As expected, dominant classes generally see a lower error rate with all methods. However, the logit adjusted loss is seen to systematically improve performance over ERM, particularly on rare classes.
|
| 549 |
+
|
| 550 |
+
# D.3 RESULTS ON CIFAR-LT WITH STEP-100 PROFILE
|
| 551 |
+
|
| 552 |
+
Table 4 summarises results on the STEP-100 profile. Here, with $\tau = 1$ , weight normalisation slightly outperforms logit adjustment. However, with $\tau > 1$ , logit adjustment is again found to be superior (54.80); see Figure 9.
|
| 553 |
+
|
| 554 |
+
# D.4 RESULTS ON SYNTHETIC DATA WITH VARYING IMBALANCE RATIO
|
| 555 |
+
|
| 556 |
+
Figure 10 shows results on the synthetic data of $\ S$ for varying choice of $\mathbb { P } ( y = + 1 )$ . As expected, we see that as $\mathbb { P } ( y = + 1 )$ increases, all methods become equitable in terms of performance. We
|
| 557 |
+
|
| 558 |
+

|
| 559 |
+
Figure 8: Per-class error rates of loss modification techniques. For (b) and (c), we aggregate the classes into 10 groups. ERM displays a strong bias towards dominant classes (lower indices). Our proposed logit adjusted softmax loss achieves significant gains on rare classes (higher indices).
|
| 560 |
+
|
| 561 |
+
Table 4: Test set balanced error (averaged over 5 trials) on CIFAR-10-LT and CIFAR-100-LT under the STEP-100 profile; lower is better. On CIFAR-100-LT, weight normalisation edges out logit adjustment. See Figure 9 for a demonstrated that tuned versions of the same outperfom weight normalisation.
|
| 562 |
+
|
| 563 |
+
<table><tr><td>Method</td><td>CIFAR-10-LT</td><td>CIFAR-100-LT</td></tr><tr><td>ERM</td><td>36.54</td><td>60.23</td></tr><tr><td>Weight normalisation (T = 1)</td><td>30.86</td><td> 55.19</td></tr><tr><td>Adaptive</td><td>34.61</td><td>58.86</td></tr><tr><td>Equalised</td><td>31.42</td><td>57.82</td></tr><tr><td>Logit adjustment post-hoc (T = 1)</td><td>28.66</td><td>55.82</td></tr><tr><td>Logit adjustment (loss)</td><td>27.57</td><td>55.52</td></tr></table>
|
| 564 |
+
|
| 565 |
+
generally find a consistent trend in the relative performance of the various methods, which matches the results in the body.
|
| 566 |
+
|
| 567 |
+

|
| 568 |
+
Figure 9: Post-hoc adjustment on STEP-100 profile, CIFAR-10-LT and CIFAR-100-LT. Logit adjustment outperforms weight normalisation with suitable tuning.
|
| 569 |
+
|
| 570 |
+

|
| 571 |
+
Figure 10: Results on synthetic data with varying imbalance ratio.
|
| 572 |
+
|
| 573 |
+
# E DOES WEIGHT NORMALISATION INCREASE MARGINS?
|
| 574 |
+
|
| 575 |
+
Suppose that one uses SGD with a momentum, and finds solutions where $\| w _ { y } \| _ { 2 }$ tracks the class priors. One intuition behind normalisation of weights is that, drawing inspiration from the binary case, this ought to increase the classification margins for tail classes. Unfortunately, as discussed below, this intuition is not necessarily borne out.
|
| 576 |
+
|
| 577 |
+
Consider a scorer $f _ { y } ( x ) = w _ { y } ^ { \top } \Phi ( x )$ , where $w _ { y } \in \mathbb { R } ^ { d }$ and $\Phi \colon \mathcal { X } \mathbb { R } ^ { d }$ . The functional margin for an example $( x , y )$ is (Koltchinskii et al., 2001)
|
| 578 |
+
|
| 579 |
+
$$
|
| 580 |
+
\gamma _ { f } ( x , y ) \doteq w _ { y } ^ { \top } \Phi ( x ) - \operatorname* { m a x } _ { y ^ { \prime } \ne y } w _ { y ^ { \prime } } ^ { \top } \Phi ( x ) .
|
| 581 |
+
$$
|
| 582 |
+
|
| 583 |
+
This generalises the classical binary margin, wherein by convention $\mathcal { Y } = \{ \pm 1 \}$ , $w _ { - 1 } = - w _ { 1 }$ , and
|
| 584 |
+
|
| 585 |
+
$$
|
| 586 |
+
\gamma _ { \mathrm { f } } ( x , y ) \doteq y \cdot w _ { 1 } ^ { \top } \Phi ( x ) = \frac { 1 } { 2 } \cdot \left( w _ { y } ^ { \top } \Phi ( x ) - w _ { - y } ^ { \top } \Phi ( x ) \right) ,
|
| 587 |
+
$$
|
| 588 |
+
|
| 589 |
+
which agrees with (16) upto scaling. One may also define the geometric margin in the binary case to be the distance of $( x , y )$ from its classifier:
|
| 590 |
+
|
| 591 |
+
$$
|
| 592 |
+
\gamma _ { g , \mathrm { b } } ( x ) \doteq \frac { | w _ { 1 } \cdot \Phi ( x ) | } { \| w _ { 1 } \| _ { 2 } } .
|
| 593 |
+
$$
|
| 594 |
+
|
| 595 |
+
Clearly, γg,b(x) = |γf (x,y)|k k , and so for fixed functional margin, one may increase the geometric margin by minimising $\lVert \boldsymbol { w } _ { 1 } \rVert _ { 2 }$ . However, the same is not necessarily true in the multiclass setting, since here the functional and geometric margins do not generally align (Tatsumi et al., 2011; Tatsumi & Tanino, 2014). In particular, controlling each $\| w _ { y } \| _ { 2 }$ does not necessarily control the geometric margin.
|
| 596 |
+
|
| 597 |
+
# F BAYES-OPTIMAL CLASSIFIER UNDER GAUSSIAN CLASS-CONDITIONALS
|
| 598 |
+
|
| 599 |
+
Derivation of (12). Suppose
|
| 600 |
+
|
| 601 |
+
$$
|
| 602 |
+
\mathbb { P } ( x \mid y ) = { \frac { 1 } { { \sqrt { 2 \pi } } \sigma } } \cdot \exp \left( - { \frac { \| x - \mu _ { y } \| ^ { 2 } } { 2 \sigma ^ { 2 } } } \right)
|
| 603 |
+
$$
|
| 604 |
+
|
| 605 |
+
for suitable $\mu _ { y }$ and $\sigma$ . Then,
|
| 606 |
+
|
| 607 |
+
$$
|
| 608 |
+
\begin{array} { r l } & { \mathbb { P } ( x \mid y = + 1 ) > \mathbb { P } ( x \mid y = - 1 ) \iff \exp \left( - \frac { \| x - \mu _ { + 1 } \| ^ { 2 } } { 2 \sigma ^ { 2 } } \right) > \exp \left( - \frac { \| x - \mu _ { - 1 } \| ^ { 2 } } { 2 \sigma ^ { 2 } } \right) } \\ & { \iff \frac { \| x - \mu _ { + 1 } \| ^ { 2 } } { 2 \sigma ^ { 2 } } < \frac { \| x - \mu _ { - 1 } \| ^ { 2 } } { 2 \sigma ^ { 2 } } } \\ & { \iff \| x - \mu _ { + 1 } \| ^ { 2 } < \| x - \mu _ { - 1 } \| ^ { 2 } } \\ & { \iff 2 \cdot ( \mu _ { + 1 } - \mu _ { - 1 } ) ^ { \top } x > \| \mu _ { + 1 } \| ^ { 2 } - \| \mu _ { - 1 } \| ^ { 2 } . } \end{array}
|
| 609 |
+
$$
|
| 610 |
+
|
| 611 |
+
Now use the fact that in our setting, $\| \mu _ { + 1 } \| ^ { 2 } = \| \mu _ { - 1 } \| ^ { 2 }$ .
|
| 612 |
+
|
| 613 |
+
We now explicate that the class-probability function for the synthetic dataset in $\ S$ is exactly in the family assumed by the logistic regression. This implies that logistic regression is well-specified for this problem, and thus can perfectly model $\mathbb { P } ( y = \bar { + } 1 \mid x )$ in the infinite sample limit. Note that
|
| 614 |
+
|
| 615 |
+
$$
|
| 616 |
+
{ \begin{array} { r l } & { \mathbb { P } ( y = + 1 \mid x ) = { \frac { \mathbb { P } ( x \mid y = + 1 ) \cdot \mathbb { P } ( y = + 1 ) } { \mathbb { P } ( x ) } } } \\ & { \qquad = { \frac { \mathbb { P } ( x \mid y = + 1 ) \cdot \mathbb { P } ( y = + 1 ) } { \sum _ { y ^ { \prime } } \mathbb { P } ( x \mid y ^ { \prime } ) \cdot \mathbb { P } ( y ^ { \prime } ) } } } \\ & { \qquad = { \frac { 1 } { 1 + { \frac { \mathbb { P } ( x \mid y = - 1 ) \cdot \mathbb { P } ( y = - 1 ) } { \mathbb { P } ( x \mid y = + 1 ) \cdot \mathbb { P } ( y = + 1 ) } } } } . } \end{array} }
|
| 617 |
+
$$
|
| 618 |
+
|
| 619 |
+
Now,
|
| 620 |
+
|
| 621 |
+
$$
|
| 622 |
+
\begin{array} { r l } & { \frac { \mathbb { P } ( x \mid y = - 1 ) } { \mathbb { P } ( x \mid y = + 1 ) } = \exp \left( \frac { \| x - \mu _ { + 1 } \| ^ { 2 } - \| x - \mu _ { - 1 } \| ^ { 2 } } { 2 \sigma ^ { 2 } } \right) } \\ & { \quad \quad \quad = \exp \left( \frac { \| \mu _ { + 1 } \| ^ { 2 } - \| \mu _ { - 1 } \| ^ { 2 } - 2 \cdot ( \mu _ { + 1 } - \mu _ { - 1 } ) ^ { \top } x } { 2 \sigma ^ { 2 } } \right) } \\ & { \quad \quad \quad = \exp \left( \frac { - ( \mu _ { + 1 } - \mu _ { - 1 } ) ^ { \top } x } { \sigma ^ { 2 } } \right) . } \end{array}
|
| 623 |
+
$$
|
| 624 |
+
|
| 625 |
+
Thus,
|
| 626 |
+
|
| 627 |
+
$$
|
| 628 |
+
\mathbb { P } ( y = + 1 \mid x ) = \frac { 1 } { 1 + \exp ( - w _ { * } ^ { \top } x + b _ { * } ) } ,
|
| 629 |
+
$$
|
| 630 |
+
|
| 631 |
+
where w∗ = 1σ2 · (µ+1 − µ−1), and b∗ = log P(y=−1)P(y=+1) . This implies that a sigmoid model for $\mathbb { P } ( y = + 1 \mid x )$ , as employed by logistic regression, is well-specified for the problem. Further, the bias term $b _ { * }$ is seen to take the form of the log-odds of the class-priors per (8), as expected.
|
md/train/AAWuCvzaVt/AAWuCvzaVt.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Diffusion Models Beat GANs on Image Synthesis
|
| 2 |
+
|
| 3 |
+
Prafulla Dhariwal⇤ OpenAI prafulla@openai.com
|
| 4 |
+
|
| 5 |
+
Alex Nichol⇤
|
| 6 |
+
OpenAI
|
| 7 |
+
alex@openai.com
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
We show that diffusion models can achieve image sample quality superior to the current state-of-the-art generative models. We achieve this on unconditional image synthesis by finding a better architecture through a series of ablations. For conditional image synthesis, we further improve sample quality with classifier guidance: a simple, compute-efficient method for trading off diversity for fidelity using gradients from a classifier. We achieve an FID of 2.97 on ImageNet $1 2 8 \times 1 2 8$ , 4.59 on ImageNet $2 5 6 \times 2 5 6$ , and 7.72 on ImageNet $5 1 2 \times 5 1 2$ , and we match BigGAN-deep even with as few as 25 forward passes per sample, all while maintaining better coverage of the distribution. Finally, we find that classifier guidance combines well with upsampling diffusion models, further improving FID to 3.94 on ImageNet $2 5 6 \times 2 5 6$ and 3.85 on ImageNet $5 1 2 \times 5 1 2$ .
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Selected samples from our best ImageNet $5 1 2 \times 5 1 2$ model (FID 3.85)
|
| 17 |
+
|
| 18 |
+
Over the past few years, generative models have gained the ability to generate human-like natural language $\mathbf { \partial } [ \mathbf { \overline { { 9 } } } ]$ , high-quality synthetic images [8, 34, 57] and highly diverse human speech and music [70, 17]. These models can be used in a variety of ways, such as generating images from text prompts [78, 56] or learning useful feature representations [18, 10]. While these models are already capable of producing realistic images and sound, there is still much room for improvement beyond the current state-of-the-art, and better generative models could have wide-ranging impacts on graphic design, games, music production, and countless other fields.
|
| 19 |
+
|
| 20 |
+
GANs $\lVert 2 5 \rVert$ currently hold the state-of-the-art on most image generation tasks $\textcircled { 1 8 } \textcircled { 7 4 } \textcircled { 3 4 } \textcircled { 1 }$ as measured by sample quality metrics such as FID $\left[ \left[ 2 9 \right] \right]$ , Inception Score $\pmb { \mathbb { \left| 6 1 \right| } }$ and Precision $\textcircled { 1 3 8 } \textcircled { 1 }$ . However, some of these metrics do not fully capture diversity, and it has been shown that GANs capture less diversity than state-of-the-art likelihood-based models [57, 49, 48]. Furthermore, GANs are often difficult to train, collapsing without carefully selected hyperparameters and regularizers $ { \mathbb { R } } , { \mathbb { G } } { \mathbb { Z } } , { \mathbb { Z } } { \mathbb { I } }$ . While GANs hold the state-of-the-art, their drawbacks make them difficult to scale and apply to new domains. As a result, much work has been done to achieve GAN-like sample quality with likelihood-based models $\pmb { \bigtriangledown } 2 2 \mathbf { l }$ 57, 31, 48, 12]. While these models capture more diversity and are typically easier to scale and train than GANs, they still fall short in terms of visual fidelity. Furthermore, except for VAEs, sampling from these models is slower than GANs in terms of wall-clock time.
|
| 21 |
+
|
| 22 |
+
Diffusion models are a class of likelihood-based models which have recently been shown to produce high-quality images $\pmb { \mathbb { B } } 3 \pmb { \mathbb { B } } 6 2 \pmb { \mathbb { B } } \pmb { \mathbb { B } } \pmb { \mathbb { B } }$ while offering desirable properties such as distribution coverage, a stationary training objective, and easy scalability. These models generate samples by gradually removing noise from a signal, and their training objective can be expressed as a reweighted variational lower-bound $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ . This class of models already holds the state-of-the-art $\pmb { \Vert 6 7 \Vert }$ on CIFAR-10 [37], but still lags behind GANs on difficult generation datasets like LSUN and ImageNet. We hypothesize that this gap exists for at least two reasons: first, that the model architectures used by recent GAN literature have been heavily explored and refined; second, that GANs are able to trade off diversity for fidelity, producing high quality samples but not covering the whole distribution. We aim to bring these benefits to diffusion models, first by improving model architecture and then by devising a scheme for trading off diversity for fidelity.
|
| 23 |
+
|
| 24 |
+
The rest of the paper is organized as follows. In Section $^ { 2 , }$ we give a brief background of diffusion models based on Ho et al. [31] and the improvements from Nichol and Dhariwal [49] and Song et al. $\pmb { \mathbb { \lVert 6 4 \rVert } }$ , and we describe our evaluation setup. In Section ${ \overline { { 3 , } } }$ we introduce simple architecture improvements that give a substantial boost to FID. In Section $^ { 4 , }$ we describe a method for using gradients from a classifier to guide a diffusion model during sampling. Finally, in Section 5 we show that models with our improved architecture achieve state-of-the-art on unconditional image synthesis tasks, and with classifier guidance achieve state-of-the-art on conditional image synthesis.
|
| 25 |
+
|
| 26 |
+
# 2 Background
|
| 27 |
+
|
| 28 |
+
In this section, we provide a brief overview of diffusion models. For a more detailed mathematical description, we refer the reader to Appendix $\boxplus$ On a high level, diffusion models sample from a distribution by reversing a gradual noising process. In particular, sampling starts with noise $x _ { T }$ and produces gradually less-noisy samples $x _ { T - 1 } , x _ { T - 2 } , . . .$ until reaching a final sample $x _ { 0 }$ . In particular, a diffusion model learns to produce a slightly more “denoised” $x _ { t - 1 }$ from $x _ { t }$ . $\mathbb { H o } \operatorname { e t } { \mathrm { a l } } .$ $\bar { \big \| } 3 1 \big \|$ parameterize this model using a function $\epsilon _ { \theta } ( x _ { t } , t )$ which predicts the noise component of a noisy sample $x _ { t }$ . To train this function, each sample in a minibatch is produced by randomly drawing a data sample $x _ { 0 }$ , a timestep $t$ , and noise $\epsilon$ , which together give rise to a noised sample $x _ { t }$ (Equation 3, Appendix $\mathrm { ^ C } )$ . The training objective is then $| | \epsilon _ { \theta } ( x _ { t } , t ) - \mathbf { \bar { \epsilon } } \epsilon | | ^ { 2 }$ , i.e. a simple mean-squared error loss between the true noise and the predicted noise (Equation 12, Appendix $\bigtriangledown$ .
|
| 29 |
+
|
| 30 |
+
Ho et al. [31] show that, under reasonable assumptions, we can then model the denoising distribution $\overline { { p _ { \theta } ( x _ { t - 1 } | } } x _ { t } )$ of $x _ { t - 1 }$ given $x _ { t }$ as a diagonal Gaussian $\mathcal { N } ( x _ { t - 1 } ; \mu _ { \theta } ( x _ { t } , t ) , \Sigma _ { \theta } ( x _ { t } , t ) )$ , where the mean $\mu _ { \theta } ( x _ { t } , t )$ can be calculated as a function of $\epsilon _ { \theta } ( x _ { t } , t )$ (Equation $^ { 1 3 , }$ Appendix $\underset { . } { \mathbf { C } } )$ Ho et al. [31] observe that the simple mean-squared error objective, $L _ { \mathrm { s i m p l e } }$ , works better in practice than the actual variational lower bound $L _ { \mathrm { v l b } }$ that can be derived from interpreting the denoising diffusion model as a VAE. They also note that training with this objective and using their corresponding sampling procedure is equivalent to the denoising score matching model from $\boxed { \mathrm { S o n g ~ a n d ~ E r m o n } } \boxed { \overline { { 6 5 } } }$ , who use Langevin dynamics to sample from a denoising model trained with multiple noise levels to produce high quality image samples. We often use “diffusion models” as shorthand to refer to both classes of models.
|
| 31 |
+
|
| 32 |
+
Following the breakthrough work of Song and Ermon [65] and Ho et al. [31], several recent papers have proposed improvements to diffusion models. Nichol and Dhariwal [49] find that fixing the variance $\Sigma _ { \theta } ( x _ { t } , t )$ to a constant as done in Ho et al. $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ is sub-optimal for sampling with fewer diffusion steps, and propose to parameterize $\overline { { \Sigma _ { \theta } ( x _ { t } , t ) } }$ as a neural network whose output $v$ is interpolated as $\Sigma _ { \theta } ( x _ { t } , t ) = \exp ( v \log \beta _ { t } + ( 1 - v ) \log \tilde { \beta } _ { t } )$ . Here, $\beta _ { t }$ and $\tilde { \beta } _ { t }$ (Equation ${ \mathfrak { s } } ,$ Appendix $\mathbf { C } )$ are the variances in Ho et al. $\pmb { \mathbb { B } } \pmb { \mathbb { 1 } }$ corresponding to upper and lower bounds for the reverse process variances. Additionally, Nichol and Dhariwal $\textcircled { \lVert { 4 9 } \rVert }$ propose a hybrid objective for training both $\epsilon _ { \theta } ( x _ { t } , t )$ and $\Sigma _ { \theta } ( x _ { t } , t )$ using the weighted sum $\overline { { L } } _ { \mathrm { s i m p l e } } + \lambda L _ { \mathrm { v l b } }$ . Learning the reverse process variances with their hybrid objective allows sampling with fewer steps without much drop in sample quality. We adopt this objective and parameterization, and use it throughout our experiments.
|
| 33 |
+
|
| 34 |
+
Song et al. [64] propose DDIM, which formulates an alternative non-Markovian noising process that has the same forward marginals as DDPM, but allows producing different reverse samplers by changing the variance of the reverse noise. By setting this noise to 0, they provide a way to turn any model $\epsilon _ { \theta } ( x _ { t } , t )$ into a deterministic mapping from latents to images, and find that this provides an alternative way to sample with fewer steps. We adopt this sampling approach when using fewer than 50 sampling steps, since Nichol and Dhariwal [49] found it to be beneficial in this regime.
|
| 35 |
+
|
| 36 |
+
Sample Quality Metrics: For comparing sample quality across models, we perform quantitative evaluations using the following metrics. While these metrics are often used in practice and correspond well with human judgement, they are not a perfect proxy, and finding better metrics for sample quality evaluation is still an open problem.
|
| 37 |
+
|
| 38 |
+
We use FID $\pmb { \mathbb { Z } } 9 \|$ as our default metric for overall sample quality comparisons as it captures both fidelity and diversity and has been the de facto standard metric for state-of-the-art generative models [33, 34, 8, 31]. We use Precision and Recall $[ [ 3 8 ] ]$ as proxies for separately measuring fidelity and diversity, respectively. We include sFID $\lVert \overline { { 4 8 } } \rVert$ as a metric that better captures spatial relationships than FID, and also include Inception Score (IS) $\pmb { \mathbb { \left[ 6 1 \right] } }$ as another proxy for fidelity. When comparing against other methods, we re-compute these metrics using public samples or models whenever possible. This is for two reasons: first, some papers [33, 34, 31] compare against arbitrary subsets of the training set which are not readily available; and second, subtle implementation differences can affect the resulting FID values $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ . For consistent comparisons, we use the full training set as the reference batch [29, $\textcircled { 8 } ]$ , and evaluate metrics for all models using the same codebase.
|
| 39 |
+
|
| 40 |
+
# 3 Architecture Improvements
|
| 41 |
+
|
| 42 |
+
Ho et al. [31] adopted the UNet architecture $\pmb { \Vert 5 8 \Vert }$ for diffusion models, which Jolicoeur-Martineau et al. [32] found to substantially improve sample quality over the previous architectures [65, 39] used for denoising score matching. The UNet model uses a stack of residual layers and downsampling convolutions, followed by a stack of residual layers with upsampling convolutions, with skip connections connecting the layers with the same spatial size. In addition, they use a global attention layer at the $1 6 \times 1 6$ resolution with a single head, and add a projection of the timestep embedding into each residual block. $\boxed { \mathrm { S o n g ~ e t ~ a l . } \parallel \boxed { 6 7 } }$ found that further changes to the UNet architecture improved performance on the CIFAR-10 [37] and CelebA-64 [40] datasets. We show the same result on ImageNet $1 2 8 \times 1 2 8$ , finding that architecture can indeed give a substantial boost to sample quality on a much larger and more diverse datasets at a higher resolution.
|
| 43 |
+
|
| 44 |
+
We explore the following architectural changes: increasing depth versus width, holding model size relatively constant; increasing the number of attention heads; using attention at $3 2 \times 3 2$ , $1 6 \times 1 6$ , and $8 \times 8$ resolutions rather than only at $1 6 \times 1 6$ ; using the BigGAN $\pmb { \Vert 8 \Vert }$ residual block for upsampling and downsampling the activations, following $ { \mathbb { I } } { \mathbb { I } }$ ; and finally; rescaling residual connections with $\scriptstyle { \frac { 1 } { \sqrt { 2 } } }$ , following [67, 33, 34].
|
| 45 |
+
|
| 46 |
+
We train models with the above architecture changes on ImageNet $1 2 8 \times 1 2 8$ and compare them on FID, evaluated at two different points of training, in Table $\nsupseteq$ Aside from rescaling residual connections, all of the other modifications improve performance and have a positive compounding effect. On wall-clock (Figure $5 ,$ Appendix $\bar { \bigstar . 1 \bigstar }$ we find that increased depth hurts training time most, so we opt not to use this change in further experiments. We also study other attention configurations that better match the Transformer architecture $\lVert \ b { 7 2 } \rVert$ . We try two configurations: constant attention heads, or constant channels per head. Table $\bigstar$ shows our results, indicating that more heads or fewer channels per head improves FID. On wall-clock (Figure $\boxed { 5 }$ Appendix $\mathbf { A . l } )$ , we see that 64 channels is best so we opt to use 64 channels per head as our default. We note that this choice also better matches modern transformer architectures, and is on par with our other configurations in terms of final FID.
|
| 47 |
+
|
| 48 |
+
Table 1: Ablation of various architecture changes, evaluated at 700K and 1200K iterations
|
| 49 |
+
|
| 50 |
+
<table><tr><td>Channels</td><td>Depth</td><td>Heads</td><td>Attention resolutions</td><td>BigGAN up/downsample</td><td>Rescale resblock</td><td>FID 700K</td><td>FID 1200K</td></tr><tr><td>160</td><td>2</td><td>1</td><td>16</td><td>X</td><td>X</td><td>15.33</td><td>13.21</td></tr><tr><td>128</td><td>4</td><td></td><td></td><td></td><td></td><td>-0.21</td><td>-0.48</td></tr><tr><td></td><td></td><td>4</td><td></td><td></td><td></td><td>-0.54</td><td>-0.82</td></tr><tr><td></td><td></td><td></td><td>32,16,8</td><td></td><td></td><td>-0.72</td><td>-0.66</td></tr><tr><td></td><td></td><td></td><td></td><td>√</td><td></td><td>-1.20</td><td>-1.21</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>0.16</td><td>0.25</td></tr><tr><td>160</td><td>2</td><td>4</td><td>32,16,8</td><td>√</td><td>×</td><td>-3.14</td><td>-3.00</td></tr></table>
|
| 51 |
+
|
| 52 |
+
Table 2: Ablation of attention heads. More heads or lower channels per heads both improve FID. The base model was a smaller version of the best model from Table 1.
|
| 53 |
+
|
| 54 |
+
<table><tr><td>Number of heads</td><td>Channels per head</td><td>FID</td></tr><tr><td>1</td><td></td><td>14.08</td></tr><tr><td>2</td><td></td><td>-0.50</td></tr><tr><td>4</td><td></td><td>-0.97</td></tr><tr><td>8</td><td></td><td>-1.17</td></tr><tr><td></td><td>32</td><td>-1.36</td></tr><tr><td></td><td>64</td><td>-1.03</td></tr><tr><td></td><td>128</td><td>-1.08</td></tr></table>
|
| 55 |
+
|
| 56 |
+
We also experiment with a layer $\boxed { \boxplus 9 }$ that we refer to as adaptive group normalization (AdaGN), which incorporates the timestep and class embedding into each residual block after a group normalization operation $\mathbb { [ [ \mathsf { Z } \mathsf { S } ] ] }$ , similar to adaptive instance norm $\pmb { \Vert 3 3 \Vert }$ and FiLM [54]. We define this layer as $\mathrm { A d a G N } ( h , y ) = y _ { s }$ $\mathrm { G r o u p N o r m } ( h ) + y _ { b }$ , where $h$ is the intermediate activations of the residual block following the first convolution, and $y = [ y _ { s } , y _ { b } ]$ is obtained from a linear projection of the timestep and class embedding. We had already seen AdaGN improve our earliest diffusion models, and so had included it by default in all our runs. We explicitly ablate this choice (Table $6 ,$ , Appendix $\underline { { \vert \overline { { \mathbf { A . } } } \mathbf { l } \mathbf { \rangle } } }$ , and find that FID becomes worse by 2.02 when we remove the adaptive group normalization layer.
|
| 57 |
+
|
| 58 |
+
In the rest of the paper, we use this final improved model architecture as our default: variable width with 2 residual blocks per resolution, multiple heads with 64 channels per head, attention at 32, 16 and 8 resolutions, BigGAN residual blocks for up and downsampling, and adaptive group normalization for injecting timestep and class embeddings into residual blocks.
|
| 59 |
+
|
| 60 |
+
# 4 Classifier Guidance
|
| 61 |
+
|
| 62 |
+
In addition to employing well designed architectures, GANs for conditional image synthesis [45, 8] make heavy use of class labels. This often takes the form of class-conditional normalization statistics $\mathbb { \ Z O } \mathbb { \perp } \mathbb { \perp } \mathbb { I }$ as well as discriminators with heads explicitly designed to behave like classifiers $p ( y | x )$ [46]. As further evidence that class information is crucial to the success of these models, Lucic et al. [42] find that it is helpful to generate synthetic labels when working in a label-limited regime. Given this observation for GANs, it makes sense to explore different ways to condition diffusion models on class labels. We already incorporate class information into adaptive group normalization layers (Section $3 )$ . Here, we explore a different approach: exploiting a classifier $p ( y | x )$ to improve a diffusion generator. Sohl-Dickstein et al. $\mathbb { \left[ 6 3 \right] }$ and $\widetilde { \mathbb { S } \mathrm { o n g } \ e t \ a l . } \Vert \widehat { \mathbb { b } \mathrm { 7 } } \Vert$ show one way to achieve this, wherein a pre-trained diffusion model can be conditioned using the gradients of a classifier. In particular, we can train a classifier $p _ { \phi } ( y | x _ { t } , t )$ on noisy images $x _ { t }$ , and then use gradients $\nabla _ { x _ { t } } \log \overset { \cdot } { p _ { \phi } } ( y | x _ { t } , t )$ to guide the diffusion sampling process towards an arbitrary class label $y$ .
|
| 63 |
+
|
| 64 |
+
For class conditional diffusion sampling, we reproduce the derivation from Sohl-Dickstein et al. [63] in Appendix $\mathbb { D . 2 }$ For DDIM, we perform a score-based derivation in Appendix $\overline { { \mathbf { D } . 3 } }$ inspired by Song et al. $[ \overbrace { 6 7 } ]$ . The resulting sampling algorithms we use for guidance are Algorithms $\mathbf { \overline { { \Pi } } }$ and $\dot { 2 }$ respectively. Both algorithms incorporate class information by adding the gradients of a classifier to each sampling step with an appropriate step size. In these algorithms, we choose the notation
|
| 65 |
+
|
| 66 |
+
Algorithm 1 Classifier guided diffusion sampling, given a diffusion model $( \mu _ { \theta } ( x _ { t } ) , \Sigma _ { \theta } ( x _ { t } ) )$ , classifier $p _ { \phi } ( y | x _ { t } )$ , and gradient scale $s$ .
|
| 67 |
+
|
| 68 |
+
Input: class label $y$ , gradient scale $s$
|
| 69 |
+
$x _ { T } \gets$ sample from $\mathcal { N } ( 0 , \bf { I } )$
|
| 70 |
+
for all $t$ from $T$ to 1 do $\mu , \Sigma \mu _ { \theta } ( x _ { t } ) , \Sigma _ { \theta } ( x _ { t } )$ $x _ { t - 1 } \gets$ sample from $\overset { \vartriangle } { \mathcal { N } } ( \mu + s \Sigma \nabla _ { x _ { t } } \log p _ { \phi } ( y | x _ { t } ) , \Sigma )$
|
| 71 |
+
end for
|
| 72 |
+
return $x _ { 0 }$
|
| 73 |
+
|
| 74 |
+
Algorithm 2 Classifier guided DDIM sampling, given a diffusion model $\epsilon _ { \theta } ( x _ { t } )$ , classifier $\overline { { p _ { \phi } ( y | x _ { t } ) } }$ and gradient scale $s$ .
|
| 75 |
+
|
| 76 |
+
Input: class label $y$ , gradient scale $s$
|
| 77 |
+
$x _ { T } \gets$ sample from $\bar { \mathcal { N } } ( 0 , \mathbf { I } )$
|
| 78 |
+
for all $t$ from $T$ to 1 do $\begin{array} { r l } & { \hat { \epsilon } \epsilon _ { \theta } ( x _ { t } ) - \sqrt { 1 - \bar { \alpha } _ { t } } \nabla _ { x _ { t } } \log p _ { \phi } ( y \vert x _ { t } ) } \\ & { x _ { t - 1 } \sqrt { \bar { \alpha } _ { t - 1 } } ( \frac { x _ { t } - \sqrt { 1 - \bar { \alpha } _ { t } } \hat { \epsilon } } { \sqrt { \bar { \alpha } _ { t } } } ) + \sqrt { 1 - \bar { \alpha } _ { t - 1 } } \hat { \epsilon } } \end{array}$
|
| 79 |
+
end for
|
| 80 |
+
return $x _ { 0 }$
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 2: Samples from an unconditional diffusion model with classifier guidance to condition on the class "Pembroke Welsh corgi". Using classifier scale 1.0 (left; FID: 33.0) does not produce convincing samples in this class, whereas classifier scale 10.0 (right; FID: 12.0) produces much more class-consistent images.
|
| 84 |
+
|
| 85 |
+
$p _ { \phi } ( y | x _ { t } , t ) = p _ { \phi } ( y | x _ { t } )$ and $\epsilon _ { \theta } ( x _ { t } , t ) = \epsilon _ { \theta } ( x _ { t } )$ for brevity, noting that they refer to separate functions for each timestep $t$ and at training time the models must be conditioned on the input $t$ .
|
| 86 |
+
|
| 87 |
+
To apply classifier guidance to a large scale generative task, we train classification models on ImageNet. Our classifier architecture is simply the downsampling trunk of the UNet model with an attention pool $\begin{array} { r l } { \| \boldsymbol { \bar { 5 } } \boldsymbol { \bar { 5 } } \| } & { { } } \end{array}$ at the $8 \mathrm { x } 8$ layer to produce the final output. We train these classifiers on the same noising distribution as the corresponding diffusion model, and also add random crops to reduce overfitting.
|
| 88 |
+
|
| 89 |
+
In initial experiments with unconditional ImageNet models, we found it necessary to scale the classifier gradients by a constant factor larger than 1. When using a scale of 1, we observed that the classifier assigned reasonable probabilities (around $5 0 \%$ ) to the desired classes for the final samples, but these samples did not match the intended classes upon visual inspection. Scaling up the classifier gradients remedied this problem, and the class probabilities from the classifier increased to nearly $100 \%$ . Figure $2$ shows an example of this effect. To understand the effect of scaling classifier gradients, note that $\begin{array} { r } { s \cdot \nabla _ { x } \log p ( y | x ) \stackrel { \cdot } { = } \nabla _ { x } \log \frac { 1 } { Z } p ( y | x ) ^ { s } } \end{array}$ , where $Z$ is an arbitrary constant. As a result, the conditioning process is still theoretically grounded in a re-normalized classifier distribution proportional to $p ( y | x ) ^ { s }$ . When $s > 1$ , this distribution becomes sharper than $p ( y | x )$ , since larger values are amplified by the exponent. In other words, using a larger gradient scale focuses more on the modes of the classifier, which is potentially desirable for producing higher quality (but less diverse) samples.
|
| 90 |
+
|
| 91 |
+
In the above derivations, we assumed that the underlying diffusion model was unconditional, modeling $p ( x )$ . It is also possible to train conditional diffusion models, $p ( x | y )$ , and use classifier guidance in the exact same way. Table $3$ shows that the sample quality of both unconditional and conditional models can be greatly improved by classifier guidance. We see that, with a high enough scale, the guided unconditional model can get quite close to the FID of an unguided conditional model, although training directly with the class labels still helps. Guiding a conditional model further improves FID.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 3: Change in sample quality as we vary scale of the classifier gradients for a class-conditional ImageNet $1 2 8 \times 1 2 8$ model.
|
| 95 |
+
|
| 96 |
+
Table $3$ also shows that classifier guidance improves precision at the cost of recall, thus introducing a trade-off in sample fidelity versus diversity. We explicitly evaluate how this trade-off varies with the gradient scale in Figure $\textcircled { 3 }$ We see that scaling the gradients beyond 1.0 smoothly trades off recall (a measure of diversity) for higher precision and IS (measures of fidelity). Since FID and sFID depend on both diversity and fidelity, their best values are obtained at an intermediate point. We also compare our guidance with the truncation trick from BigGAN (Figure $6 ,$ Appendix A.2). We find that classifier guidance is strictly better than BigGAN-deep when trading off FID for Inception Score. Less clear cut is the precision/recall trade-off, which shows that classifier guidance is only a better choice up until a certain precision threshold, after which point it cannot achieve better precision.
|
| 97 |
+
|
| 98 |
+
# 5 Results
|
| 99 |
+
|
| 100 |
+
To evaluate our improved model architecture on unconditional image generation, we train separate diffusion models on three LSUN $\mathbb { \ m }$ classes: bedroom, horse, and cat. To evaluate classifier guidance, we train conditional diffusion models on the ImageNet $\mathbb { \left[ 5 9 \right] }$ dataset at $1 2 8 \times 1 2 8$ , $2 5 6 \times 2 5 6$ , and $5 1 2 \times 5 1 2$ resolution.
|
| 101 |
+
|
| 102 |
+
Table 4 summarizes our results. ADM refers to our ablated diffusion model, and ADM-G additionally uses classifier guidance. Our diffusion models can obtain the best FID on each task, and the best sFID on all but one task. With the improved architecture, we already obtain state-of-the-art image generation on LSUN and ImageNet $6 4 \times 6 4$ . For higher resolution ImageNet, we observe that classifier guidance allows our models to substantially outperform the best GANs. These models obtain perceptual quality similar to GANs, while maintaining a higher coverage of the distribution as measured by recall, and can even do so using only 25 sampling steps. We also evaluate the computational requirements for training our models (Table $\underline { { \overline { { 1 0 } } } } ,$ Appendix $\mathbf { B } )$ , and find that we can obtain competitive sample quality while using the same or less compute than the corresponding BigGAN-deep or StyleGAN2 model.
|
| 103 |
+
|
| 104 |
+
Figure 4 compares random samples from the best BigGAN-deep model to our guided diffusion model. While the samples are of similar perceptual quality, the diffusion model contains more modes than the GAN, such as zoomed ostrich heads, single flamingos, different orientations of cheeseburgers, and a tinca fish with no human holding it. We also check our generated samples for nearest neighbors in the Inception-V3 feature space in Appendix E, and we show additional samples in Appendices M-O.
|
| 105 |
+
|
| 106 |
+
Table 4: Sample quality comparison with state-of-the-art generative models for each task. LSUN diffusion models are sampled using 1000 steps (see Appendix $\bigstar \bigstar$ . ImageNet diffusion models are sampled using 250 steps, except when we use the DDIM sampler with 25 steps. \*No BigGAN-deep model was available at this resolution, so we trained our own. †Values are taken from a previous paper, due to lack of public models or samples. ‡Results use two-resolution stacks. §Results use compute-intensive classifier rejection sampling.
|
| 107 |
+
|
| 108 |
+
<table><tr><td>Model</td><td>FID</td><td>sFID</td><td>Prec</td><td>Rec</td></tr><tr><td colspan="5">LSUN Bedrooms 256×256 DCTransformer+ 48</td></tr><tr><td>DDPM [31]</td><td>6.40 4.89</td><td>6.66 9.07</td><td>0.44 0.60</td><td>0.56 0.45</td></tr><tr><td>IDDPM[49]</td><td>4.24</td><td>8.21</td><td>0.62</td><td>0.46</td></tr><tr><td>StyleGAN [33]</td><td>2.35</td><td>6.62</td><td>0.59</td><td>0.48</td></tr><tr><td>ADM (dropout)</td><td>1.90</td><td>5.59</td><td>0.66</td><td>0.51</td></tr><tr><td colspan="5">LSUN Horses 256×256</td></tr><tr><td>StyleGAN2 34 ADM ADM (dropout)</td><td>3.84 2.95</td><td>6.46 5.94</td><td>0.63 0.69</td><td>0.48 0.55</td></tr><tr><td></td><td>2.57</td><td>6.81</td><td>0.71</td><td>0.55</td></tr><tr><td>LSUN Cats 256×256</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="5">DDPM [31]</td></tr><tr><td>StyleGAN2 [34]</td><td>17.1</td><td>12.4</td><td>0.53</td><td>0.48</td></tr><tr><td></td><td>7.25</td><td>6.33</td><td>0.58</td><td>0.43</td></tr><tr><td>ADM (dropout)</td><td>5.57</td><td>6.69</td><td>0.63</td><td>0.52</td></tr><tr><td>ImageNet 64×64</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="5">BigGAN-deep* 回</td></tr><tr><td></td><td>4.06</td><td>3.96</td><td>0.79</td><td>0.48</td></tr><tr><td>IDDPM[ [49]</td><td>2.92</td><td>3.79</td><td>0.74</td><td>0.62</td></tr><tr><td>ADM</td><td>2.61</td><td>3.77</td><td>0.73</td><td>0.63</td></tr><tr><td>ADM (dropout)</td><td>2.07</td><td>4.29</td><td>0.74</td><td>0.63</td></tr></table>
|
| 109 |
+
|
| 110 |
+
<table><tr><td>Model</td><td>FID</td><td>SFID</td><td>Prec</td><td>Rec</td></tr><tr><td>ImageNet 128×128 BigGAN-deep 8</td><td>6.02</td><td>7.18</td><td>0.86</td><td>0.35</td></tr><tr><td>LOGANt 四</td><td>3.36</td><td></td><td></td><td></td></tr><tr><td>ADM</td><td>5.91</td><td>5.09</td><td>0.70</td><td>0.65</td></tr><tr><td>ADM-G (25 steps)</td><td>5.98</td><td>7.04</td><td>0.78</td><td>0.51</td></tr><tr><td>ADM-G</td><td>2.97</td><td>5.09</td><td>0.78</td><td>0.59</td></tr><tr><td>ImageNet 256×256</td><td></td><td></td><td></td><td></td></tr><tr><td>DCTransformer† 8</td><td>36.51</td><td>8.24</td><td></td><td>0.67</td></tr><tr><td>VQ-VAE-2†‡ 回</td><td></td><td></td><td>0.36</td><td></td></tr><tr><td></td><td>31.11</td><td>17.38</td><td>0.36</td><td>0.57</td></tr><tr><td>VQ-VAE-2 (RS)t‡ $ 四</td><td>~10</td><td></td><td></td><td>0.58</td></tr><tr><td>VQ-GAN* 四</td><td>15.97</td><td>19.05</td><td>0.63</td><td>0.48</td></tr><tr><td>VQ-GAN (RS)t$ 四 IDDPM‡ [ 49</td><td>5.06 12.26</td><td>7.34 5.42</td><td>0.79 0.70</td><td>0.62</td></tr><tr><td>SR3tt 四</td><td>11.30</td><td></td><td></td><td></td></tr><tr><td>BigGAN-deep 回</td><td>6.95</td><td>7.36</td><td>0.87</td><td>0.28</td></tr><tr><td>ADM</td><td>10.94</td><td>6.02</td><td>0.69</td><td>0.63</td></tr><tr><td>ADM-G (25 steps)</td><td>5.44</td><td>5.32</td><td>0.81</td><td>0.49</td></tr><tr><td>ADM-G</td><td>4.59</td><td>5.25</td><td>0.82</td><td>0.52</td></tr><tr><td>ImageNet 512×512</td><td></td><td></td><td></td><td></td></tr><tr><td>BigGAN-deep 图</td><td>8.43</td><td>8.13</td><td></td><td>0.29</td></tr><tr><td>ADM</td><td></td><td></td><td>0.88</td><td></td></tr><tr><td></td><td>23.24</td><td>10.19</td><td>0.73</td><td>0.60</td></tr><tr><td>ADM-G (25 steps)</td><td>8.41</td><td>9.67</td><td>0.83</td><td>0.47</td></tr><tr><td>ADM-G</td><td>7.72</td><td>6.57</td><td>0.87</td><td>0.42</td></tr></table>
|
| 111 |
+
|
| 112 |
+
We also compare guidance to using a two-stage upsampling stack. Nichol and Dhariwal [49] and Saharia et al. $\boxed { 6 0 }$ train two-stage diffusion models by combining a low-resolution diffusion model with a corresponding upsampling diffusion model. In this approach, the upsampling model is trained to upsample images from the training set, and conditions on low-resolution images that are concatenated channel-wise to the model input using a simple interpolation (e.g. bilinear). During sampling, the low-resolution model produces a sample, and then the upsampling model is conditioned on this sample. This greatly improves FID on ImageNet $2 5 6 \times 2 5 6$ , but does not reach the same performance as state-of-the-art models like BigGAN-deep [49, 60], as seen in Table 4.
|
| 113 |
+
|
| 114 |
+
In Table $\boxed { 5 }$ we show that guidance and upsampling improve sample quality along different axes. We use the upsampling stack from Nichol and Dhariwal [49] combined with our architecture improvements, which we refer to as ADM-U. While upsampling improves precision while keeping a high recall, guidance provides a knob to trade off diversity for much higher precision. We achieve the best FIDs by using guidance at a lower resolution before upsampling to a higher resolution, indicating that these approaches complement one another.
|
| 115 |
+
|
| 116 |
+
# 6 Related Work
|
| 117 |
+
|
| 118 |
+
Score based generative models were introduced by Song and Ermon [66] as a way of modeling a data distribution using its gradients, and then sampling using Langevin dynamics [73]. Ho et al. [31] found a connection between this method and diffusion models $\pmb { \mathbb { E 3 } } ] $ , and achieved excellent sample quality by leveraging this connection. After this breakthrough work, many works followed up with more promising results: Kong et al. [36] and Chen et al. [11] demonstrated that diffusion models work well for audio; Jolicoeur-Martineau et al. [32] found that a GAN-like setup could improve samples from these models; Song et al. [67] explored ways to leverage techniques from stochastic differential equations to improve the sample quality obtained by score-based models; Song et al. [64] and Nichol and Dhariwal [49] proposed methods to improve sampling speed; Nichol and Dhariwal [49] and Saharia et al. [60] demonstrated promising results on the difficult ImageNet generation task using upsampling diffusion models. Also related to diffusion models, and following the work of Sohl-Dickstein et al. [63], Goyal et al. [27] described a technique for learning a model with learned iterative generation steps, and found that it could achieve good image samples when trained with a likelihood objective.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 4: Samples from BigGAN-deep with truncation 1.0 (FID 6.95, left) vs samples from our diffusion model with guidance (FID 4.59, middle) and samples from the training set (right).
|
| 122 |
+
|
| 123 |
+
Table 5: Comparing our single, upsampling and classifier guided models. The upsamplers are $6 4 2 5 6$ and $1 2 8 \to 5 1 2$ . When combining guidance with upsampling, we only guide the lower resolution model. All models are sampled using 250 sampling steps.
|
| 124 |
+
|
| 125 |
+
<table><tr><td>Model</td><td>FID</td><td>sFID</td><td>IS</td><td>Prec</td><td>Rec</td><td>Model</td><td>FID</td><td>SFID</td><td>IS</td><td>Prec</td><td>Rec</td></tr><tr><td>ImageNet 256×256</td><td></td><td></td><td></td><td></td><td></td><td>ImageNet 512×512</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ADM</td><td>10.94</td><td>6.02</td><td>100.98</td><td>0.69</td><td>0.63</td><td>ADM</td><td>23.24</td><td>10.19</td><td>58.06</td><td>0.73</td><td>0.60</td></tr><tr><td>ADM, ADM-U</td><td>7.49</td><td>5.13</td><td>127.49</td><td>0.72</td><td>0.63</td><td>ADM, ADM-U</td><td>9.96</td><td>5.62</td><td>121.78</td><td>0.75</td><td>0.64</td></tr><tr><td>ADM-G</td><td>4.59</td><td>5.25</td><td>186.70</td><td>0.82</td><td>0.52</td><td>ADM-G</td><td>7.72</td><td>6.57</td><td>172.71</td><td>0.87</td><td>0.42</td></tr><tr><td>ADM-G,ADM-U</td><td>3.94</td><td>6.14</td><td>215.84</td><td>0.83</td><td>0.53</td><td>ADM-G, ADM-U</td><td>3.85</td><td>5.86</td><td>221.72</td><td>0.84</td><td>0.53</td></tr></table>
|
| 126 |
+
|
| 127 |
+
One missing element from previous work on diffusion models is a way to trade off diversity for fidelity. Other generative techniques provide natural levers for this trade-off. Brock et al. [8] introduced the truncation trick for GANs, wherein the latent vector is sampled from a truncated normal distribution. They found that increasing truncation naturally led to a decrease in diversity but an increase in fidelity. More recently, Razavi et al. [57] proposed to use classifier rejection sampling to filter out bad samples from an autoregressive likelihood-based model, and found that this technique improved FID. DeVries et al. [16] found that filtering out low-density regions of the training set improves GAN training performance. Most likelihood-based models also allow for low-temperature sampling [1], which provides a natural way to emphasize modes of the data distribution (see Appendix I).
|
| 128 |
+
|
| 129 |
+
Other likelihood-based models have been shown to produce high-fidelity image samples. VQ-VAE $\pmb { \mathbb { Z } 1 }$ and VQ-VAE-2 $ { \mathbb { B } } { \mathbb { Z } }$ are autoregressive models trained on top of quantized latent codes, greatly reducing the computational resources required to train these models on large images. These models produce diverse and high quality images, but still fall short of GANs without expensive rejection sampling and special metrics to compensate for blurriness. DCTransformer $\lVert \rVert$ is a related method which relies on a more intelligent compression scheme. VAEs are another promising class of likelihood-based models, and recent methods such as NVAE $\textcircled { 1 6 9 } \textcircled { 1 }$ and VDVAE $\lVert \dot { 1 } \dot { 2 } \rVert$ have successfully been applied to difficult image generation domains. Energy-based models are another class of likelihood-based models with a rich history [1, 13, 30]. Sampling from the EBM distribution is challenging, and Xie et al. $\pmb { \mathbb { Z } } \pmb { 6 } \|$ demonstrate that Langevin dynamics can be used to sample coherent images from these models. Du and Mordatch [19] further improve upon this approach, obtaining high quality images. More recently, Gao et al. [24] incorporate diffusion steps into an energy-based model, and find that doing so improves image samples from these models.
|
| 130 |
+
|
| 131 |
+
Other works have controlled generative models with a pre-trained classifier. For example, an emerging body of work [23, 53, 2] aims to optimize GAN latent spaces for text prompts using pre-trained CLIP $\pmb { \| 5 5 \| }$ models. More similar to our work, Song et al. $\textcircled { 6 7 }$ uses a classifier to generate class-conditional CIFAR-10 images with a diffusion model. In some cases, classifiers can act as stand-alone generative models. For example, Santurkar et al. [62] demonstrate that a robust image classifier can be used as a stand-alone generative model, and Grathwohl et al. [28] train a model which is jointly a classifier and an energy-based model.
|
| 132 |
+
|
| 133 |
+
# 7 Limitations and Future Work
|
| 134 |
+
|
| 135 |
+
While we believe diffusion models are an extremely promising direction for generative modeling, they are still slower than GANs at sampling time due to the use of multiple denoising steps (and therefore forward passes). Since our diffusion models are also larger than the competing GAN generators, each forward pass takes anywhere from 5-20 times longer too. A promising direction to reduce this latency gap is Luhman and Luhman [43], who explore a way to distill the DDIM sampling process into a single step model. The samples from the single step model are not yet competitive with GANs, but are much better than previous single-step likelihood-based models. Future work in this direction might be able to completely close the sampling speed gap between diffusion models and GANs without sacrificing image quality.
|
| 136 |
+
|
| 137 |
+
Unlike GANs, Flows, and VAEs, diffusion models do not learn an explicit latent representation. While DDIM provides a way to encode images into an implicit latent space, it is unclear how semantically meaningful this latent representation is compared to those of other model classes. This could make it difficult to use diffusion models for representation learning or image editing applications.
|
| 138 |
+
|
| 139 |
+
The effectiveness of classifier guidance demonstrates that we can obtain powerful generative models from the gradients of a classification function. This could be used to condition an image generator with a text caption using a noisy version of CLIP $ { \mathbb { I } } { \mathbb { I } } ^ { { 5 } { 5 } { \mathbb { I } } }$ , similar to recent methods that guide GANs using text prompts $\pm \sqrt { 2 3 } \sqrt { 5 3 } \sqrt { 2 }$ . Our proposed classifier guidance technique is currently limited to labeled datasets. In the future, our method could be extended to unlabeled data by clustering samples to produce synthetic labels $[ | \overline { { 4 2 } } | |$ or by training discriminative models to use for guidance. This also suggests that large unlabeled datasets could be leveraged in the future to pre-train powerful diffusion models that can later be improved by using a classifier with desirable properties.
|
| 140 |
+
|
| 141 |
+
# 8 Societal Impact
|
| 142 |
+
|
| 143 |
+
Our proposed technique makes generative models more accessible in terms of compute costs, especially because new classifiers can be trained and used on top of existing high-quality diffusion models. While we believe this is generally a benefit of these models, it could also have negative societal implications. For example, cheaper generative models could enable bad actors to generate fake news, propaganda images, or doctored photos. Additionally, the wide-spread deployment of these models could displace jobs in art, graphic design, animation, and photography. One could imagine, however, that democratizing generative models could also have positive impacts in the long run, creating new types of jobs such as generative photo editing. Intentionally deceitful generated images are a more direct concern, and detecting and mitigating propaganda and fake news based on generative models is an ongoing area of research [4, 3, 5].
|
| 144 |
+
|
| 145 |
+
# 9 Conclusion
|
| 146 |
+
|
| 147 |
+
We have shown that diffusion models, a class of likelihood-based models with a stationary training objective, can obtain better sample quality than state-of-the-art GANs. Our improved architecture is sufficient to achieve this on unconditional image generation tasks, and our classifier guidance technique allows us to do so on class-conditional tasks. In the latter case, we find that the scale of the classifier gradients can be adjusted to trade off diversity for fidelity. These guided diffusion models can reduce the sampling time gap between GANs and diffusion models, although diffusion models still require multiple forward passes during sampling. Finally, by combining guidance with upsampling, we can further improve sample quality on high-resolution conditional image synthesis.
|
| 148 |
+
|
| 149 |
+
# References
|
| 150 |
+
|
| 151 |
+
[1] David Ackley, Geoffrey Hinton, and Terrence Sejnowski. A learning algorithm for boltzmann machines. Cognitive science, 9(1):147-169, 1985.
|
| 152 |
+
[2] Adverb. The big sleep. https://twitter.com/advadnoun/status/ 1351038053033406468, 2021.
|
| 153 |
+
[3] Shruti Agarwal, Hany Farid, Yuming Gu, Mingming He, Koki Nagano, and Hao Li. Protecting world leaders against deep fakes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, June 2019.
|
| 154 |
+
[4] Hadeer Ahmed, Issa Traore, and Sherif Saad. Detection of online fake news using n-gram analysis and machine learning techniques. pages 127–138, 10 2017. ISBN 978-3-319-69154-1. doi: 10.1007/978-3-319-69155-8_9.
|
| 155 |
+
[5] Hadeer Ahmed, Issa Traore, and Sherif Saad. Detecting opinion spams and fake news using text classification. Security and Privacy, 1(1):e9, 2018. doi: https://doi.org/10.1002/spy2.9. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/spy2.9.
|
| 156 |
+
[6] Shane Barratt and Rishi Sharma. A note on the inception score. arXiv:1801.01973, 2018.
|
| 157 |
+
[7] Andrew Brock, Theodore Lim, J. M. Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. arXiv:1609.07093, 2016.
|
| 158 |
+
[8] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv:1809.11096, 2018.
|
| 159 |
+
[9] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv:2005.14165, 2020.
|
| 160 |
+
[10] Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In International Conference on Machine Learning, pages 1691–1703. PMLR, 2020.
|
| 161 |
+
[11] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. arXiv:2009.00713, 2020.
|
| 162 |
+
[12] Rewon Child. Very deep vaes generalize autoregressive models and can outperform them on images. arXiv:2011.10650, 2021.
|
| 163 |
+
[13] Peter Dayan, Geoffrey E Hinton, Radford M Neal, and Richard S Zemel. The helmholtz machine. Neural computation, 7(5):889–904, 1995.
|
| 164 |
+
[14] Harm de Vries, Florian Strub, Jérémie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron Courville. Modulating early visual processing by language. arXiv:1707.00683, 2017.
|
| 165 |
+
[15] DeepMind. Biggan-deep $1 2 8 \mathrm { x } 1 2 8$ on tensorflow hub. https://tfhub.dev/deepmind/ biggan-deep-128/1, 2018.
|
| 166 |
+
[16] Terrance DeVries, Michal Drozdzal, and Graham W. Taylor. Instance selection for gans. arXiv:2007.15255, 2020.
|
| 167 |
+
[17] Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, and Ilya Sutskever. Jukebox: A generative model for music. arXiv:2005.00341, 2020.
|
| 168 |
+
[18] Jeff Donahue and Karen Simonyan. Large scale adversarial representation learning. arXiv:1907.02544, 2019.
|
| 169 |
+
[19] Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. arXiv:1903.08689, 2019.
|
| 170 |
+
[20] Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. arXiv:1610.07629, 2017.
|
| 171 |
+
[21] Patrick Esser, Robin Rombach, and Björn Ommer. Taming transformers for high-resolution image synthesis. arXiv:2012.09841, 2020.
|
| 172 |
+
[22] Jeffrey De Fauw, Sander Dieleman, and Karen Simonyan. Hierarchical autoregressive image models with auxiliary decoders. arXiv:1903.04933, 2019.
|
| 173 |
+
[23] Federico A. Galatolo, Mario G. C. A. Cimino, and Gigliola Vaglini. Generating images from caption and vice versa via clip-guided generative latent space search. arXiv:2102.01645, 2021.
|
| 174 |
+
[24] Ruiqi Gao, Yang Song, Ben Poole, Ying Nian Wu, and Diederik P. Kingma. Learning energybased models by diffusion recovery likelihood. arXiv:2012.08125, 2020.
|
| 175 |
+
[25] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. arXiv:1406.2661, 2014.
|
| 176 |
+
[26] Google. Cloud tpus. https://cloud.google.com/tpu/, 2018.
|
| 177 |
+
[27] Anirudh Goyal, Nan Rosemary Ke, Surya Ganguli, and Yoshua Bengio. Variational walkback: Learning a transition operator as a stochastic recurrent net. arXiv:1711.02282, 2017.
|
| 178 |
+
[28] Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, and Kevin Swersky. Your classifier is secretly an energy based model and you should treat it like one. arXiv:1912.03263, 2019.
|
| 179 |
+
[29] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in Neural Information Processing Systems 30 (NIPS 2017), 2017.
|
| 180 |
+
[30] Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002.
|
| 181 |
+
[31] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv:2006.11239, 2020.
|
| 182 |
+
[32] Alexia Jolicoeur-Martineau, Rémi Piché-Taillefer, Rémi Tachet des Combes, and Ioannis Mitliagkas. Adversarial score matching and improved sampling for image generation. arXiv:2009.05475, 2020.
|
| 183 |
+
[33] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. arXiv:arXiv:1812.04948, 2019.
|
| 184 |
+
[34] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. arXiv:1912.04958, 2019.
|
| 185 |
+
[35] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv:1412.6980, 2014.
|
| 186 |
+
[36] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. arXiv:2009.09761, 2020.
|
| 187 |
+
[37] Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. CIFAR-10 (Canadian Institute for Advanced Research), 2009. URL http://www.cs.toronto.edu/\~kriz/cifar.html.
|
| 188 |
+
[38] Tuomas Kynkäänniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved precision and recall metric for assessing generative models. arXiv:1904.06991, 2019.
|
| 189 |
+
[39] Guosheng Lin, Anton Milan, Chunhua Shen, and Ian Reid. Refinenet: Multi-path refinement networks for high-resolution semantic segmentation. arXiv:1611.06612, 2016.
|
| 190 |
+
[40] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
|
| 191 |
+
[41] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv:1711.05101, 2017.
|
| 192 |
+
[42] Mario Lucic, Michael Tschannen, Marvin Ritter, Xiaohua Zhai, Olivier Bachem, and Sylvain Gelly. High-fidelity image generation with fewer labels. arXiv:1903.02271, 2019.
|
| 193 |
+
[43] Eric Luhman and Troy Luhman. Knowledge distillation in iterative generative models for improved sampling speed. arXiv:2101.02388, 2021.
|
| 194 |
+
[44] Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, and Hao Wu. Mixed precision training. arXiv:1710.03740, 2017.
|
| 195 |
+
[45] Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv:1411.1784, 2014.
|
| 196 |
+
[46] Takeru Miyato and Masanori Koyama. cgans with projection discriminator. arXiv:1802.05637, 2018.
|
| 197 |
+
[47] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv:1802.05957, 2018.
|
| 198 |
+
[48] Charlie Nash, Jacob Menick, Sander Dieleman, and Peter W. Battaglia. Generating images with sparse representations. arXiv:2103.03841, 2021.
|
| 199 |
+
[49] Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. arXiv:2102.09672, 2021.
|
| 200 |
+
[50] NVIDIA. Stylegan2. https://github.com/NVlabs/stylegan2, 2019.
|
| 201 |
+
[51] Gaurav Parmar, Richard Zhang, and Jun-Yan Zhu. On buggy resizing libraries and surprising subtleties in fid calculation. arXiv:2104.11222, 2021.
|
| 202 |
+
[52] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. arXiv:1912.01703, 2019.
|
| 203 |
+
[53] Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Text-driven manipulation of stylegan imagery. arXiv:2103.17249, 2021.
|
| 204 |
+
[54] Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer. arXiv:1709.07871, 2017.
|
| 205 |
+
[55] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. arXiv:2103.00020, 2021.
|
| 206 |
+
[56] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv:2102.12092, 2021.
|
| 207 |
+
[57] Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. arXiv:1906.00446, 2019.
|
| 208 |
+
[58] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. arXiv:1505.04597, 2015.
|
| 209 |
+
[59] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. Imagenet large scale visual recognition challenge. arXiv:1409.0575, 2014.
|
| 210 |
+
[60] Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. arXiv:arXiv:2104.07636, 2021.
|
| 211 |
+
[61] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv:1606.03498, 2016.
|
| 212 |
+
[62] Shibani Santurkar, Dimitris Tsipras, Brandon Tran, Andrew Ilyas, Logan Engstrom, and Aleksander Madry. Image synthesis with a single (robust) classifier. arXiv:1906.09453, 2019.
|
| 213 |
+
[63] Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. arXiv:1503.03585, 2015.
|
| 214 |
+
[64] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, 2020.
|
| 215 |
+
[65] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. arXiv:2006.09011, 2020.
|
| 216 |
+
[66] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. arXiv:arXiv:1907.05600, 2020.
|
| 217 |
+
[67] Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv:2011.13456, 2020.
|
| 218 |
+
[68] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. arXiv:1512.00567, 2015.
|
| 219 |
+
[69] Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. arXiv:2007.03898, 2020.
|
| 220 |
+
[70] Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv:1609.03499, 2016.
|
| 221 |
+
[71] Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. arXiv:1711.00937, 2017.
|
| 222 |
+
[72] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv:1706.03762, 2017.
|
| 223 |
+
[73] Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11), pages 681–688. Citeseer, 2011.
|
| 224 |
+
[74] Yan Wu, Jeff Donahue, David Balduzzi, Karen Simonyan, and Timothy Lillicrap. Logan: Latent optimisation for generative adversarial networks. arXiv:1912.00953, 2019.
|
| 225 |
+
[75] Yuxin Wu and Kaiming He. Group normalization. arXiv:1803.08494, 2018.
|
| 226 |
+
[76] Jianwen Xie, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. A theory of generative convnet. arXiv:1602.03264, 2016.
|
| 227 |
+
|
| 228 |
+
[77] Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv:1506.03365, 2015.
|
| 229 |
+
|
| 230 |
+
[78] Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. arXiv:1612.03242, 2016.
|
| 231 |
+
|
| 232 |
+
# Checklist
|
| 233 |
+
|
| 234 |
+
• Did you include the license to the code and datasets? [No] We were unable to find the official license for either ImageNet or LSUN. We do include a license for our released source code.
|
| 235 |
+
|
| 236 |
+
1. For all authors...
|
| 237 |
+
|
| 238 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 239 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 7.
|
| 240 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 8.
|
| 241 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 242 |
+
|
| 243 |
+
2. If you are including theoretical results...
|
| 244 |
+
|
| 245 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Appendix D.
|
| 246 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] We provide detailed derivations in Appendix D.
|
| 247 |
+
|
| 248 |
+
3. If you ran experiments...
|
| 249 |
+
|
| 250 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We include the source code and instructions for running it.
|
| 251 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix K.
|
| 252 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Each experiment requires several hundred GPU days to run, so it is quite costly to compute error bars.
|
| 253 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix B.
|
| 254 |
+
|
| 255 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 256 |
+
|
| 257 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] Our codebase references the codebase it is forked from [49, 31]. We also cite PyTorch [52], which we use throughout our experiments.
|
| 258 |
+
(b) Did you mention the license of the assets? [Yes] A license file is included with the code release.
|
| 259 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] The code is included in the supplemental material.
|
| 260 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 261 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 262 |
+
|
| 263 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 264 |
+
|
| 265 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 266 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 267 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/B1e0X3C9tQ/B1e0X3C9tQ.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DIAGNOSING AND ENHANCING VAE MODELS
|
| 2 |
+
|
| 3 |
+
# Bin Dai
|
| 4 |
+
|
| 5 |
+
David Wipf
|
| 6 |
+
Microsoft Research
|
| 7 |
+
Beijing, China
|
| 8 |
+
davidwipf@gmail.com
|
| 9 |
+
Institute for Advanced Study
|
| 10 |
+
Tsinghua University
|
| 11 |
+
Beijing, China
|
| 12 |
+
daib13@mails.tsinghua.edu.cn
|
| 13 |
+
|
| 14 |
+
# ABSTRACT
|
| 15 |
+
|
| 16 |
+
Although variational autoencoders (VAEs) represent a widely influential deep generative model, many aspects of the underlying energy function remain poorly understood. In particular, it is commonly believed that Gaussian encoder/decoder assumptions reduce the effectiveness of VAEs in generating realistic samples. In this regard, we rigorously analyze the VAE objective, differentiating situations where this belief is and is not actually true. We then leverage the corresponding insights to develop a simple VAE enhancement that requires no additional hyperparameters or sensitive tuning. Quantitatively, this proposal produces crisp samples and stable FID scores that are actually competitive with a variety of GAN models, all while retaining desirable attributes of the original VAE architecture. The code for our model is available at https://github.com/daib13/TwoStageVAE.
|
| 17 |
+
|
| 18 |
+
# 1 INTRODUCTION
|
| 19 |
+
|
| 20 |
+
Our starting point is the desire to learn a probabilistic generative model of observable variables ${ \pmb x } \in$ $x$ , where $x$ is a $r$ -dimensional manifold embedded in $\mathbf { \mathbb { R } } ^ { d }$ . Note that if $r = d$ , then this assumption places no restriction on the distribution of $\pmb { x } \in \mathbb { R } ^ { d }$ whatsoever; however, the added formalism is introduced to handle the frequently encountered case where $_ { \textbf { \em x } }$ possesses low-dimensional structure relative to a high-dimensional ambient space, i.e., $r \ll d$ . In fact, the very utility of generative models of continuous data, and their attendant low-dimensional representations, often hinges on this assumption (Bengio et al., 2013). It therefore behooves us to explicitly account for this situation.
|
| 21 |
+
|
| 22 |
+
Beyond this, we assume that $x$ is a simple Riemannian manifold, which means there exists a diffeomorphism $\varphi$ between $x$ and $\mathbb { R } ^ { r }$ , or more explicitly, the mapping $\varphi : x \mapsto \mathbb { R } ^ { r }$ is invertible and differentiable. Denote a ground-truth probability measure on $x$ as $\mu _ { g t }$ such that the probability mass of an infinitesimal $d \mathbf { x }$ on the manifold is $\mu _ { g t } ( d \pmb { x } )$ and $\textstyle \int _ { \mathcal { X } } \mu _ { g t } ( d \pmb { x } ) \doteq 1$ .
|
| 23 |
+
|
| 24 |
+
The variational autoencoder (VAE) (Kingma & Welling, 2014; Rezende et al., 2014) attempts to approximate this ground-truth measure using a parameterized density $p _ { \theta } ( { \pmb x } )$ defined across all of $\mathbb { R } ^ { d }$ since any underlying generative manifold is unknown in advance. This density is further assumed to admit the latent decomposition $\begin{array} { r } { p _ { \theta } ( \pmb { x } ) = \int p _ { \theta } ( \pmb { x } | \pmb { z } ) p ( \pmb { z } ) d \pmb { z } } \end{array}$ , where $z \in \mathbb { R } ^ { \kappa }$ serves as a lowdimensional representation, with $\kappa \approx r$ and prior $p ( z ) = \mathcal { N } ( z | \mathbf { 0 } , I )$ .
|
| 25 |
+
|
| 26 |
+
Ideally we might like to minimize the negative log-likelihood $- \log p _ { \theta } ( { \pmb x } )$ averaged across the ground-truth measure $\mu _ { g t }$ , i.e., solve $\begin{array} { r } { \operatorname* { m i n } _ { \theta } \int _ { \mathcal { X } } - \log p _ { \theta } ( \pmb { x } ) \mu _ { g t } ( d \pmb { x } ) } \end{array}$ . Unfortunately though, the required marginalization over $_ z$ is generally infeasible. Instead the VAE model relies on tractable encoder $q _ { \phi } \bar { ( } z | \mathbf { x } )$ and decoder $p _ { \boldsymbol { \theta } } ( \boldsymbol { \mathbf { \hat { x } } } | \boldsymbol { \mathbf { \tilde { z } } } )$ distributions, where $\phi$ represents additional trainable parameters. The canonical VAE cost is a bound on the average negative log-likelihood given by
|
| 27 |
+
|
| 28 |
+
$$
|
| 29 |
+
\begin{array} { r } { \mathcal { L } ( \theta , \phi ) \triangleq \int _ { \mathcal { X } } \left\{ - \log p _ { \theta } ( \pmb { x } ) \ + \ \mathbb { K L } \left[ q _ { \phi } ( z | \pmb { x } ) | | p _ { \theta } ( z | \pmb { x } ) \right] \right\} \mu _ { g t } ( d \pmb { x } ) \geq \int _ { \mathcal { X } } - \log p _ { \theta } ( \pmb { x } ) \mu _ { g t } ( d \pmb { x } ) , } \end{array}
|
| 30 |
+
$$
|
| 31 |
+
|
| 32 |
+
where the inequality follows directly from the non-negativity of the KL-divergence. Here $\phi$ can be viewed as tuning the tightness of bound, while $\theta$ dictates the actual estimation of $\mu _ { g t }$ . Using a few standard manipulations, this bound can also be expressed as
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\begin{array} { r } { \mathcal { L } ( \theta , \phi ) = \int _ { \mathcal { X } } \left\{ - \mathbb { E } _ { q _ { \phi } ( z | \mathbf { x } ) } \left[ \log p _ { \theta } \left( { \pmb x } | { \pmb z } \right) \right] + \mathbb { K L } \left[ q _ { \phi } ( z | \mathbf { x } ) | | p ( z ) \right] \right\} \mu _ { g t } ( d \pmb { x } ) , } \end{array}
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
which explicitly involves the encoder/decoder distributions and is conveniently amenable to SGD optimization of $\{ \theta , \phi \}$ via a reparameterization trick (Kingma & Welling, 2014; Rezende et al.,
|
| 39 |
+
|
| 40 |
+
2014). The first term in (2) can be viewed as a reconstruction cost (or a stochastic analog of a traditional autoencoder), while the second penalizes posterior deviations from the prior $p ( z )$ . Additionally, for any realizable implementation via SGD, the integration over $x$ must be approximated via a finite sum across training samples $\{ \pmb { x } ^ { ( i ) } \} _ { i = 1 } ^ { n }$ drawn from $\mu _ { g t }$ . Nonetheless, examining the true objective ${ \mathcal { L } } ( \theta , \phi )$ can lead to important, practically-relevant insights.
|
| 41 |
+
|
| 42 |
+
At least in principle, $q _ { \phi } ( \pmb { z } | \pmb { x } )$ and $p _ { \theta } ( { \pmb x } | { \pmb z } )$ can be arbitrary distributions, in which case we could simply enforce $q _ { \phi } ( z | \mathbf { x } ) = p _ { \theta } ( z | \mathbf { x } ) \propto p _ { \theta } ( \mathbf { x } | z ) p ( z )$ such that the bound from (1) is tight. Unfortunately though, this is essentially always an intractable undertaking. Consequently, largely to facilitate practical implementation, a commonly adopted distributional assumption for continuous data is that both $q _ { \phi } ( \pmb { z } | \pmb { x } )$ and $p _ { \theta } ( { \pmb x } | { \pmb z } )$ are Gaussian. This design choice has previously been cited as a key limitation of VAEs (Burda et al., 2015; Kingma et al., 2016), and existing quantitative tests of generative modeling quality thus far dramatically favor contemporary alternatives such as generative adversarial networks (GAN) (Goodfellow et al., 2014). Regardless, because the VAE possesses certain desirable properties relative to GAN models (e.g., stable training (Tolstikhin et al., 2018), interpretable encoder/inference network (Brock et al., 2016), outlier-robustness (Dai et al., 2018), etc.), it remains a highly influential paradigm worthy of examination and enhancement.
|
| 43 |
+
|
| 44 |
+
In Section 2 we closely investigate the implications of VAE Gaussian assumptions leading to a number of interesting diagnostic conclusions. In particular, we differentiate the situation where $r = d$ , in which case we prove that recovering the ground-truth distribution is actually possible iff the VAE global optimum is reached, and $r < d$ , in which case the VAE global optimum can be reached by solutions that reflect the ground-truth distribution almost everywhere, but not necessarily uniquely so. In other words, there could exist alternative solutions that both reach the global optimum and yet do not assign the same probability measure as $\mu _ { g t }$ .
|
| 45 |
+
|
| 46 |
+
Section 3 then further probes this non-uniqueness issue by inspecting necessary conditions of global optima when $r \ < \ d$ . This analysis reveals that an optimal VAE parameterization will provide an encoder/decoder pair capable of perfectly reconstructing all ${ \pmb x } \in { \pmb x }$ using any $_ z$ drawn from $q _ { \phi } ( z | \pmb { x } )$ . Moreover, we demonstrate that the VAE accomplishes this using a degenerate latent code whereby only $r$ dimensions are effectively active. Collectively, these results indicate that the VAE global optimum can in fact uniquely learn a mapping to the correct ground-truth manifold when $r < d$ , but not necessarily the correct probability measure within this manifold, a critical distinction.
|
| 47 |
+
|
| 48 |
+
Next we leverage these analytical results in Section 4 to motivate an almost trivially-simple, twostage VAE enhancement for addressing typical regimes when $r \ < \ d$ . In brief, the first stage just learns the manifold per the allowances from Section 3, and in doing so, provides a mapping to a lower dimensional intermediate representation with no degenerate dimensions that mirrors the $r = d$ regime. The second (much smaller) stage then only needs to learn the correct probability measure on this intermediate representation, which is possible per the analysis from Section 2. Experiments from Sections 5 and 6 empirically corroborate motivational theory and reveal that the proposed two-stage procedure can generate high-quality samples, reducing the blurriness often attributed to VAE models in the past (Dosovitskiy & Brox, 2016; Larsen et al., 2015). And to the best of our knowledge, this is the first demonstration of a VAE pipeline that can produce stable FID scores, an influential recent metric for evaluating generated sample quality (Heusel et al., 2017), that are comparable to GAN models under neutral testing conditions. Moreover, this is accomplished without additional penalties, cost function modifications, or sensitive tuning parameters. Finally, an extended version of this work can be found in (Dai & Wipf, 2019). There we include additional results, consideration of disentangled representations, as well as a comparative discussion of broader VAE modeling paradigms such as those involving normalizing flows or parameterized families for $p ( z )$ .
|
| 49 |
+
|
| 50 |
+
# 2 HIGH-LEVEL IMPACT OF VAE GAUSSIAN ASSUMPTIONS
|
| 51 |
+
|
| 52 |
+
Conventional wisdom suggests that VAE Gaussian assumptions will introduce a gap between ${ \mathcal { L } } ( \theta , \phi )$ and the ideal negative log-likelihood $\begin{array} { r } { \int _ { \mathcal { X } } - \log p _ { \theta } ( \pmb { x } ) \bar { \mu } _ { g t } ( d \pmb { x } ) } \end{array}$ , compromising efforts to learn the ground-truth measure. However, we will now argue that this pessimism is in some sense premature. In fact, we will demonstrate that, even with the stated Gaussian distributions, there exist parameters $\phi$ and $\theta$ that can simultaneously: $( i )$ Globally optimize the VAE objective and, $( i i )$ Recover the ground-truth probability measure in a certain sense described below. This is possible because, at least for some coordinated values of $\phi$ and $\theta$ , $q _ { \phi } ( \pmb { z } | \pmb { x } )$ and $p _ { \theta } ( \pmb { z } | \pmb { x } )$ can indeed become arbitrarily close. Before presenting the details, we first formalize a $\kappa$ -simple VAE, which is merely a VAE model with explicit Gaussian assumptions and parameterizations:
|
| 53 |
+
|
| 54 |
+
Definition 1 A $\kappa$ -simple VAE is defined as a VAE model with $d i m [ z ] = \kappa$ latent dimensions, the Gaussian encoder $q _ { \phi } \bar { ( } z | \mathbf { x } ) = \mathcal { N } ( z | \mu _ { z } , \Sigma _ { z } )$ , and the Gaussian decoder $p _ { \theta } ( { \pmb x } | z ) = \mathcal { N } ( { \pmb x } | { \pmb \mu } _ { x } , { \pmb \Sigma } _ { x } )$ . Moreover, the encoder moments are defined as $\mu _ { z } = f _ { \mu _ { z } } ( { \pmb x } ; \phi )$ and $\pmb { \Sigma } _ { z } = \pmb { S } _ { z } \pmb { S } _ { z } ^ { \top }$ with $S _ { z } ~ =$ $f _ { S _ { z } } ( { \pmb x } ; \phi )$ . Likewise, the decoder moments are $\begin{array} { r } { \pmb { \mu } _ { x } = f _ { \mu _ { x } } ( z ; \theta ) } \end{array}$ and $\Sigma _ { x } = \gamma I$ . Here $\gamma > 0$ is $a$ tunable scalar, while $f _ { \mu _ { z } }$ , $f _ { S _ { z } }$ and $f _ { \mu _ { x } }$ specify parameterized differentiable functional forms that can be arbitrarily complex, e.g., a deep neural network.
|
| 55 |
+
|
| 56 |
+
Equipped with these definitions, we will now demonstrate that a $\kappa$ -simple VAE, with $\kappa \geq r$ , can achieve the optimality criteria $( i )$ and $( i i )$ from above. In doing so, we first consider the simpler case where $r = d$ , followed by the extended scenario with $r \textless d$ . The distinction between these two cases turns out to be significant, with practical implications to be explored in Section 4.
|
| 57 |
+
|
| 58 |
+
# 2.1 MANIFOLD DIMENSION EQUAL TO AMBIENT SPACE DIMENSION $( r = d$
|
| 59 |
+
|
| 60 |
+
We first analyze the specialized situation where $r \ = \ d$ . Assuming $p _ { g t } ( { \pmb x } ) \triangleq \mu _ { g t } ( d { \pmb x } ) / d { \pmb x }$ exists everywhere in $\mathbb { R } ^ { d }$ , then $p _ { g t } ( \pmb { x } )$ represents the ground-truth probability density with respect to the standard Lebesgue measure in Euclidean space. Given these considerations, the minimal possible value of (1) will necessarily occur if
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\mathbb { K L } \left[ q _ { \phi } ( \boldsymbol { z } | \boldsymbol { x } ) | | p _ { \theta } ( \boldsymbol { z } | \boldsymbol { x } ) \right] = 0 \quad \mathrm { a n d } \quad p _ { \theta } ( \boldsymbol { x } ) = p _ { g t } ( \boldsymbol { x } ) \mathrm { a }
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
This follows because by VAE design it must be that $\begin{array} { r } { \mathcal { L } ( \theta , \phi ) \geq - \int p _ { g t } ( \pmb { x } ) \log p _ { g t } ( \pmb { x } ) d \pmb { x } , } \end{array}$ , and in the present context, this lower bound is achievable iff the conditions from (3) hold. Collectively, this implies that the approximate posterior produced by the encoder $q _ { \phi } ( \pmb { z } | \pmb { x } )$ is in fact perfectly matched to the actual posterior $p _ { \theta } ( z | \mathbf { \bar { x } } )$ , while the corresponding marginalized data distribution $p _ { \theta } ( { \pmb x } )$ is perfectly matched the ground-truth density $p _ { g t } ( \pmb { x } )$ as desired. Perhaps surprisingly, a $\kappa$ -simple VAE can actually achieve such a solution:
|
| 67 |
+
|
| 68 |
+
Theorem 1 Suppose that $r = d$ and there exists a density $p _ { g t } ( \pmb { x } )$ associated with the ground-truth measure $\mu _ { g t }$ that is nonzero everywhere on $\mathbb { R } ^ { d } . ^ { 1 }$ . Then for any $\kappa \geq r$ , there is a sequence of $\dot { } _ { \kappa }$ -simple VAE model parameters $\{ \theta _ { t } ^ { * } , \phi _ { t } ^ { * } \}$ such that
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\operatorname* { l i m } _ { t \to \infty } \mathbb { K } \mathbb { L } \left[ q _ { \phi _ { t } ^ { * } } ( z | x ) | | p _ { \theta _ { t } ^ { * } } ( z | x ) \right] = 0 \quad a n d \quad \operatorname* { l i m } _ { t \to \infty } p _ { \theta _ { t } ^ { * } } ( x ) = p _ { g t } ( x ) \ : a
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
All the proofs can be found in (Dai & Wipf, 2019). So at least when $r = d$ , the VAE Gaussian assumptions need not actually prevent the optimal ground-truth probability measure from being recovered, as long as the latent dimension is sufficiently large (i.e., $\kappa \geq r$ ). And contrary to popular notions, a richer class of distributions is not required to achieve this. Of course Theorem 1 only applies to a restricted case that excludes $d > r$ ; however, later we will demonstrate that a key consequence of this result can nonetheless be leveraged to dramatically enhance VAE performance.
|
| 75 |
+
|
| 76 |
+
# 2.2 MANIFOLD DIMENSION LESS THAN AMBIENT SPACE DIMENSION $( r < d )$
|
| 77 |
+
|
| 78 |
+
When $r < d$ , additional subtleties are introduced that will be unpacked both here and in the sequel. To begin, if both $q _ { \phi } ( \pmb { z } | \pmb { x } )$ and $p _ { \theta } ( { \pmb x } | { \pmb z } )$ are arbitrary/unconstrained (i.e., not necessarily Gaussian), then $\begin{array} { r } { \operatorname* { i n f } _ { \phi , \theta } \mathcal { L } ( \theta , \phi ) = - \infty } \end{array}$ . To achieve this global optimum, we need only choose $\phi$ such that $q _ { \phi } ( z | \pmb { x } ) = p _ { \theta } ( z | \pmb { x } )$ (minimizing the KL term from (1)) while selecting $\theta$ such that all probability mass collapses to the correct manifold $x$ . In this scenario the density $p _ { \theta } ( { \pmb x } )$ will become unbounded on $x$ and zero elsewhere, such that $\begin{array} { r } { \int _ { \mathcal { X } } - \log p _ { \theta } ( \pmb { x } ) \mu _ { g t } ( d \pmb { x } ) } \end{array}$ will approach negative infinity.
|
| 79 |
+
|
| 80 |
+
But of course the stated Gaussian assumptions from the $\kappa$ -simple VAE model could ostensibly prevent this from occurring by causing the KL term to blow up, counteracting the negative loglikelihood factor. We will now analyze this case to demonstrate that this need not happen. Before proceeding to this result, we first define a manifold density $\tilde { p } _ { g t } ( \pmb { x } )$ as the probability density (assuming it exists) of $\mu _ { g t }$ with respect to the volume measure of the manifold $x$ . If $d = r$ then this volume measure reduces to the standard Lebesgue measure in $\mathbb { R } ^ { d }$ and $\tilde { p } _ { g t } ( { \pmb x } ) = p _ { g t } ( { \pmb x } )$ ; however, when $d > r$ a density $p _ { g t } ( \pmb { x } )$ defined in $\mathbb { R } ^ { d }$ will not technically exist, while $\tilde { p } _ { g t } ( \pmb { x } )$ is still perfectly well-defined. We then have the following:
|
| 81 |
+
|
| 82 |
+
Theorem 2 Assume $r \ < \ d$ and that there exists a manifold density $\tilde { p } _ { g t } ( \pmb { x } )$ associated with the ground-truth measure $\mu _ { g t }$ that is nonzero everywhere on $x$ . Then for any $\kappa \geq r$ , there is a sequence of $\kappa$ -simple VAE model parameters $\{ \theta _ { t } ^ { * } , \phi _ { t } ^ { * } \}$ such that
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
( i ) \operatorname* { l i m } _ { t \infty } \mathbb { K L } [ q _ { \phi _ { t } ^ { \star } } ( z | x ) | | p _ { \theta _ { t } ^ { \star } } ( z | x ) ] = 0 \quad a n d \quad \operatorname* { l i m } _ { t \infty } \int _ { \mathcal { X } } - \log p _ { \theta _ { t } ^ { \star } } ( x ) \mu _ { g t } ( d x ) = - \infty ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r } { \underset { t \infty } { \operatorname* { l i m } } \int _ { \pmb { x } \in A } p _ { \theta _ { t } ^ { * } } ( \pmb { x } ) d \pmb { x } = \mu _ { g t } ( A \cap \pmb { x } ) } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Technical details notwithstanding, Theorem 2 admits a very intuitive interpretation. First, (5) directly implies that the VAE Gaussian assumptions do not prevent minimization of ${ \mathcal { L } } ( \theta , \phi )$ from converging to minus infinity, which can be trivially viewed as a globally optimum solution. Furthermore, based on (6), this solution can be achieved with a limiting density estimate that will assign a probability mass to most all measurable subsets of $\mathbb { R } ^ { d }$ that is indistinguishable from the groundtruth measure (which confines all mass to $x$ ). Hence this solution is more-or-less an arbitrarily-good approximation to $\mu _ { g t }$ for all practical purposes.2
|
| 93 |
+
|
| 94 |
+
Regardless, there is an absolutely crucial distinction between Theorem 2 and the simpler case quantified by Theorem 1. Although both describe conditions whereby the $\kappa$ -simple VAE can achieve the minimal possible objective, in the $r = d$ case achieving the lower bound (whether the specific parameterization for doing so is unique or not) necessitates that the ground-truth probability measure has been recovered almost everywhere. But the $r < d$ situation is quite different because we have not ruled out the possibility that a different set of parameters $\{ \theta , \phi \}$ could push ${ \mathcal { L } } ( \theta , \phi )$ to $- \infty$ and yet not achieve (6). In other words, the VAE could reach the lower bound but fail to closely approximate $\mu _ { g t }$ . And we stress that this uniqueness issue is not a consequence of the VAE Gaussian assumptions per se; even if $q _ { \phi } ( \pmb { z } | \pmb { x } )$ were unconstrained the same lack of uniqueness can persist.
|
| 95 |
+
|
| 96 |
+
Rather, the intrinsic difficulty is that, because the VAE model does not have access to the groundtruth low-dimensional manifold, it must implicitly rely on a density $p _ { \theta } ( { \pmb x } )$ defined across all of $\mathbb { R } ^ { d }$ as mentioned previously. Moreover, if this density converges towards infinity on the manifold during training without increasing the KL term at the same rate, the VAE cost can be unbounded from below, even in cases where (6) is not satisfied, meaning incorrect assignment of probability mass.
|
| 97 |
+
|
| 98 |
+
To conclude, the key take-home message from this section is that, at least in principle, VAE Gaussian assumptions need not actually be the root cause of any failure to recover ground-truth distributions. Instead we expose a structural deficiency that lies elsewhere, namely, the non-uniqueness of solutions that can optimize the VAE objective without necessarily learning a close approximation to $\mu _ { g t }$ . But to probe this issue further and motivate possible workarounds, it is critical to further disambiguate these optimal solutions and their relationship with ground-truth manifolds. This will be the task of Section 3, where we will explicitly differentiate the problem of locating the correct groundtruth manifold, from the task of learning the correct probability measure within the manifold.
|
| 99 |
+
|
| 100 |
+
Note that the only comparable prior work we are aware of related to the results in this section comes from Doersch (2016), where the implications of adopting Gaussian encoder/decoder pairs in the specialized case of $r = d = 1$ are briefly considered. Moreover, the analysis there requires additional much stronger assumptions than ours, namely, that $p _ { g t } ( \pmb { x } )$ should be nonzero and infinitely differentiable everywhere in the requisite 1D ambient space. These requirements of course exclude essentially all practical usage regimes where $d = r > 1$ or $d > r$ , or when ground-truth densities are not sufficiently smooth.
|
| 101 |
+
|
| 102 |
+
# 3 OPTIMAL SOLUTIONS AND THE GROUND TRUTH MANIFOLD
|
| 103 |
+
|
| 104 |
+
We will now more closely examine the properties of optimal $\kappa$ -simple VAE solutions, and in particular, the degree to which we might expect them to at least reflect the true $x$ , even if perhaps not the correct probability measure $\mu _ { g t }$ defined within $x$ . To do so, we must first consider some necessary conditions for VAE optima:
|
| 105 |
+
|
| 106 |
+
Theorem 3 Let $\{ \theta _ { \gamma } ^ { * } , \phi _ { \gamma } ^ { * } \}$ denote an optimal $\kappa$ -simple VAE solution (with $\kappa \geq r$ ) where the decoder variance $\gamma$ is fixed (i.e., it is the sole unoptimized parameter). Moreover, we assume that $\mu _ { g t }$ is not a Gaussian distribution when $d = r$ .3 Then for any $\gamma > 0$ , there exists a $\gamma ^ { \prime } < \gamma$ such that $\mathcal { L } ( \theta _ { \gamma ^ { \prime } } ^ { * } , \phi _ { \gamma ^ { \prime } } ^ { * } ) < \mathcal { L } ( \theta _ { \gamma } ^ { * } , \phi _ { \gamma } ^ { * } )$ .
|
| 107 |
+
|
| 108 |
+
This result implies that we can always reduce the VAE cost by choosing a smaller value of $\gamma$ , and hence, if $\gamma$ is not constrained, it must be that $\gamma 0$ if we wish to minimize (2). Despite this necessary optimality condition, in existing practical VAE applications, it is standard to fix $\gamma \approx 1$ during training. This is equivalent to simply adopting a non-adaptive squared-error loss for the decoder and, at least in part, likely contributes to unrealistic/blurry VAE-generated samples (Bousquet et al., 2017). Regardless, there are more significant consequences of this intrinsic favoritism for $\gamma 0$ , in particular as related to reconstructing data drawn from the ground-truth manifold $x$ :
|
| 109 |
+
|
| 110 |
+
Theorem 4 Applying the same conditions and definitions as in Theorem $^ 3$ , then for all $_ { \textbf { \em x } }$ drawn from $\mu _ { g t }$ , we also have that
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\operatorname* { l i m } _ { \gamma \to 0 } f _ { \mu _ { x } } \left[ f _ { \mu _ { z } } ( \mathbf { x } ; \boldsymbol { \phi } _ { \gamma } ^ { * } ) + f _ { S _ { z } } ( \mathbf { x } ; \boldsymbol { \phi } _ { \gamma } ^ { * } ) \boldsymbol { \varepsilon } ; \boldsymbol { \theta } _ { \gamma } ^ { * } \right] = \operatorname* { l i m } _ { \gamma \to 0 } f _ { \mu _ { x } } \left[ f _ { \mu _ { z } } ( \mathbf { x } ; \boldsymbol { \phi } _ { \gamma } ^ { * } ) ; \boldsymbol { \theta } _ { \gamma } ^ { * } \right] = \mathbf { x } , \quad \forall \boldsymbol { \varepsilon } \in \mathbb { R } ^ { \kappa } .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
By design any random draw $z \sim q _ { \phi _ { \gamma } ^ { * } } \left( z | \boldsymbol { x } \right)$ can be expressed as $f _ { \mu _ { z } } ( { \pmb x } ; \phi _ { \gamma } ^ { * } ) + f _ { S _ { z } } ( { \pmb x } ; \phi _ { \gamma } ^ { * } ) \varepsilon$ for some $\varepsilon \sim \mathcal { N } ( \varepsilon | \mathbf { 0 } , I )$ . From this vantage point then, (7) effectively indicates that any ${ \textbf { \em x } } \in { \boldsymbol { x } }$ will be perfectly reconstructed by the VAE encoder/decoder pair at globally optimal solutions, achieving this necessary condition despite any possible stochastic corrupting factor $f _ { S _ { z } } ( \pmb { x } ; \phi _ { \gamma } ^ { * } ) \varepsilon$ .
|
| 117 |
+
|
| 118 |
+
But still further insights can be obtained when we more closely inspect the VAE objective function behavior at arbitrarily small but explicitly nonzero values of $\gamma$ . In particular, when $\kappa ~ = ~ r$ (meaning $_ z$ has no superfluous capacity), Theorem 4 and attendant analyses in (Dai & Wipf, 2019) ultimately imply that the squared eigenvalues of $f _ { S _ { z } } ( \pmb { x } ; \phi _ { \gamma } ^ { * } )$ will become arbitrarily small at a rate proportional to $\gamma$ , meaning $\begin{array} { r } { \frac { 1 } { \sqrt { \gamma } } f _ { S _ { z } } ( \pmb { x } ; \phi _ { \gamma } ^ { * } ) \approx \cal { O } ( 1 ) } \end{array}$ under mild conditions. It then follows that the VAE data term integrand from (2), in the neighborhood around optimal solutions, behaves as $- 2 \mathbb { E } _ { q _ { \phi _ { \gamma } ^ { * } } ( z | x ) } \left[ \log p _ { \theta _ { \gamma } ^ { * } } \left( \mathbf { { \bar { x } } } | z \right) \right] ~ =$
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
\begin{array} { r } { \mathbb { E } _ { q _ { \phi _ { \gamma } ^ { * } } ( z | x ) } \left[ \frac { 1 } { \gamma } \left\| x - f _ { \mu _ { x } } \left[ z ; \theta _ { \gamma } ^ { * } \right] \right\| _ { 2 } ^ { 2 } \right] + d \log 2 \pi \gamma \approx \mathbb { E } _ { q _ { \phi _ { \gamma } ^ { * } } ( z | x ) } \left[ O ( 1 ) \right] + d \log 2 \pi \gamma = d \log \gamma + O ( 1 ) . } \end{array}
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
This expression can be derived by excluding the higher-order terms of a Taylor series approximation of $\dot { f } _ { \mu _ { x } } \left[ f _ { \mu _ { z } } ( { \pmb x } ; \phi _ { \gamma } ^ { * } ) + f _ { S _ { z } } ( \bar { \pmb x } ; \phi _ { \gamma } ^ { * } ) \varepsilon ; \theta _ { \gamma } ^ { * } \right]$ around the point $f _ { \mu _ { z } } ( \pmb { x } ; \phi _ { \gamma } ^ { * } )$ , which will be relatively tight under the stated conditions. But because $\begin{array} { r } { 2 \mathbb { E } _ { q _ { \phi _ { \gamma } ^ { * } } ( z | x ) } \left[ \frac { 1 } { \gamma } \left\| x - f _ { \mu _ { x } } \left[ z ; \theta _ { \gamma } ^ { * } \right] \right\| _ { 2 } ^ { 2 } \right] \geq 0 . } \end{array}$ , a theoretical lower bound on (8) is given by $d \log 2 \pi \gamma \equiv d \log \gamma + O ( 1 )$ . So in this sense (8) cannot be significantly lowered further.
|
| 125 |
+
|
| 126 |
+
This observation is significant when we consider the inclusion of addition latent dimensions by allowing $\kappa > r$ . Clearly based on the analysis above, adding dimensions to $_ z$ cannot improve the value of the VAE data term in any meaningful way. However, it can have a detrimental impact on the the KL regularization factor in the $\gamma 0$ regime, where
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
2 \mathbb { K L } \left[ q _ { \phi } ( z | \boldsymbol { x } ) | | p ( z ) \right] \equiv \operatorname { t r a c e } \left[ \boldsymbol { \Sigma } _ { z } \right] + \| \boldsymbol { \mu } _ { z } \| _ { 2 } ^ { 2 } - \log \left| \boldsymbol { \Sigma } _ { z } \right| \approx - \hat { r } \log \gamma + O ( 1 ) .
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
Here $\hat { r }$ denotes the number of eigenvalues $\{ \lambda _ { j } ( \gamma ) \} _ { j = 1 } ^ { \kappa }$ of $f _ { S _ { z } } ( \pmb { x } ; \boldsymbol { \phi } _ { \gamma } ^ { * } )$ (or equivalently $\Sigma _ { z }$ ) that satisfy $\lambda _ { j } ( \gamma ) \to 0$ if $\gamma 0$ . $\hat { r }$ can be viewed as an estimate of how many low-noise latent dimensions the VAE model is preserving to reconstruct $_ { \textbf { \em x } }$ . Based on (9), there is obvious pressure to make $\hat { r }$ as small as possible, at least without disrupting the data fit. The smallest possible value is $\hat { r } = r$ , since it is not difficult to show that any value below this will contribute consequential reconstruction errors, causing $2 \mathbb { E } _ { q _ { \phi _ { \gamma } ^ { * } } ( z | x ) } \left[ \frac { 1 } { \gamma } \left\| x - f _ { \mu _ { x } } \left[ z ; \theta _ { \gamma } ^ { * } \right] \right\| _ { 2 } ^ { 2 } \right]$ to grow at a rate of $\Omega \left( \begin{array} { l } { \overline { { 1 } } } \\ { \overline { { \gamma } } } \end{array} \right)$ , pushing the entire cost function towards infinity.4
|
| 133 |
+
|
| 134 |
+
Therefore, in the neighborhood of optimal solutions the VAE will naturally seek to produce perfect reconstructions using the fewest number of clean, low-noise latent dimensions, meaning dimensions whereby $q _ { \phi } \left( z | \pmb { x } \right)$ has negligible variance. For superfluous dimensions that are unnecessary for representing $_ { \textbf { \em x } }$ , the associated encoder variance in these directions can be pushed to one. This will optimize ${ \mathbb K } { \mathbb L } \left[ q _ { \phi } ( { \pmb z } | { \pmb x } ) | | p ( { \pmb z } ) \right]$ along these directions, and the decoder can selectively block the residual randomness to avoid influencing the reconstructions per Theorem 4. So in this sense the VAE is capable of learning a minimal representation of the ground-truth manifold $x$ when $r < \kappa$ .
|
| 135 |
+
|
| 136 |
+
But we must emphasize that the VAE can learn $x$ independently of the actual distribution $\mu _ { g t }$ within $x$ . Addressing the latter is a completely separate issue from achieving the perfect reconstruction error defined by Theorem 4. This fact can be understood within the context of a traditional PCAlike model, which is perfectly capable of learning a low-dimensional subspace containing some training data without actually learning the distribution of the data within this subspace. The central issue is that there exists an intrinsic bias associated with the VAE objective such that fitting the distribution within the manifold will be completely neglected whenever there exists the chance for even an infinitesimally better approximation of the manifold itself.
|
| 137 |
+
|
| 138 |
+
Stated differently, if VAE model parameters have learned a near optimal, parsimonious latent mapping onto $x$ using $\gamma \approx 0$ , then the VAE cost will scale as $\left( d - r \right) \log { \gamma }$ regardless of $\mu _ { g t }$ . Hence there remains a huge incentive to reduce the reconstruction error still further, allowing $\gamma$ to push even closer to zero and the cost closer to $- \infty$ . And if we constrain $\gamma$ to be sufficiently large so as to prevent this from happening, then we risk degrading/blurring the reconstructions and widening the gap between $q _ { \phi } ( z | \pmb { x } )$ and $p _ { \theta } ( \pmb { z } | \pmb { x } )$ , which can also compromise estimation of $\mu _ { g t }$ . Fortunately though, as will be discussed next there is a convenient way around this dilemma by exploiting the fact that this dominanting $\left( d - r \right) \log { \gamma }$ factor goes away when $d = r$ .
|
| 139 |
+
|
| 140 |
+
# 4 FROM THEORY TO PRACTICAL VAE ENHANCEMENTS
|
| 141 |
+
|
| 142 |
+
Sections 2 and 3 have exposed a collection of VAE properties with useful diagnostic value in and of themselves. But the practical utility of these results, beyond the underappreciated benefit of learning $\gamma$ , warrant further exploration. In this regard, suppose we wish to develop a generative model of high-dimensional data ${ \textbf { \em x } } \in { \boldsymbol { x } }$ where unknown low-dimensional structure is significant (i.e., the $r < d$ case with $r$ unknown). The results from Section 3 indicate that the VAE can partially handle this situation by learning a parsimonious representation of low-dimensional manifolds, but not necessarily the correct probability measure $\mu _ { g t }$ within such a manifold. In quantitative terms, this means that a decoder $\bar { p } _ { \boldsymbol { \theta } } ( \pmb { x } | \pmb { z } )$ will map all samples from an encoder $q _ { \phi } ( z | \boldsymbol { x } )$ to the correct manifold such that the reconstruction error is negligible for any ${ \pmb x } \in { \pmb x }$ . But if the measure $\mu _ { g t }$ on $x$ has not been accurately estimated, then
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
\begin{array} { r } { q _ { \phi } ( z ) \triangleq \int _ { \mathbb { X } ^ { d _ { \phi } } } ( z | x ) \mu _ { g t } ( d x ) \neq \int _ { \mathbb { R } ^ { d } } p _ { \theta } ( z | x ) p _ { \theta } ( x ) d x = \int _ { \mathbb { R } ^ { d } } p _ { \theta } ( x | z ) p ( z ) d x = \mathcal { N } ( z | 0 , I ) , } \end{array}
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
where $q _ { \phi } ( z )$ is sometimes referred to as the aggregated posterior (Makhzani et al., 2016). In other words, the distribution of the latent samples drawn from the encoder distribution, when averaged across the training data, will have lingering latent structure that is errantly incongruous with the original isotropic Gaussian prior. This then disrupts the pivotal ancestral sampling capability of the VAE, implying that samples drawn from $\mathcal { N } ( z | 0 , I )$ and then passed through the decoder $p _ { \theta } ( { \pmb x } | { \pmb z } )$ will not closely approximate $\mu _ { g t }$ . Fortunately, our analysis suggests the following two-stage remedy:
|
| 149 |
+
|
| 150 |
+
1. Given $n$ observed samples $\{ \pmb { x } ^ { ( i ) } \} _ { i = 1 } ^ { n }$ , train a $\kappa$ -simple VAE, with $\kappa \geq r$ , to estimate the unknown $r$ -dimensional ground-truth manifold $x$ embedded in $\mathbb { R } ^ { d }$ using a minimal number of active latent dimensions. Generate latent samples $\{ z ^ { ( i ) } \} _ { i = 1 } ^ { n }$ via $\pmb { z } ^ { ( i ) } \sim q _ { \phi } ( \pmb { z } | \pmb { x } ^ { ( i ) } )$ . By design, these samples will be distributed as $q _ { \phi } ( z )$ , but likely not $\mathcal { N } ( z | \mathbf { 0 } , I )$ .
|
| 151 |
+
|
| 152 |
+
2. Train a second $\kappa$ -simple VAE, with independent parameters $\{ \theta ^ { \prime } , \phi ^ { \prime } \}$ and latent representation $\textbf { \em u }$ , to learn the unknown distribution $q _ { \phi } ( z )$ , i.e., treat $q _ { \phi } ( z )$ as a new ground-truth distribution and use samples $\{ z ^ { ( i ) } \} _ { i = 1 } ^ { n }$ to learn it.
|
| 153 |
+
|
| 154 |
+
3. Samples approximating the original ground-truth $\mu _ { g t }$ can then be formed via the extended ancestral process $\mathbf { \Omega } \mathbf { \tilde { u } } \sim \mathbf { \tilde { \mathcal { N } } } ( \mathbf { \Omega } \mathbf { u } | \mathbf { 0 } , \mathbf { \tilde { I } } )$ , $z \sim p \theta ^ { \prime } ( z | u )$ , and finally $\pmb { x } \sim p _ { \theta } ( \pmb { x } | z )$ .
|
| 155 |
+
|
| 156 |
+
The efficacy of the second-stage VAE from above is based on the following. If the first stage was successful, then even though they will not generally resemble $\mathcal { N } ( z | \mathbf { 0 } , I )$ , samples from $q _ { \phi } ( z )$ will nonetheless have nonzero measure across the full ambient space $\mathbb { R } ^ { \kappa }$ . I f $\kappa = r$ , this occurs because the entire latent space is needed to represent an $r$ -dimensional manifold, and if $\kappa > r$ , then the extra latent dimensions will be naturally filled in via randomness introduced along dimensions associated with nonzero eigenvalues of the decoder covariance $\Sigma _ { z }$ per the analysis in Section 3.
|
| 157 |
+
|
| 158 |
+
Consequently, as long as we set $\kappa \geq r$ , the operational regime of the second-stage VAE is effectively equivalent to the situation described in Section 2.1 where the manifold dimension is equal to the ambient dimension.5 And as we have already shown there via Theorem 1, the VAE can readily handle this situation, since in the narrow context of the second-stage VAE, $d = r = \kappa$ , the troublesome $\left( d - r \right) \log { \gamma }$ factor becomes zero, and any globally minimizing solution is uniquely matched to the new ground-truth distribution $q _ { \phi } ( z )$ . Consequently, the revised aggregated posterior $q _ { \phi ^ { \prime } } ( { \pmb u } )$ produced by the second-stage VAE should now closely resemble $\mathcal { N } ( u | { \bf 0 } , I )$ . And importantly, because we generally assume that $d \gg \kappa \geq r$ , we have found that the second-stage VAE can be quite small.
|
| 159 |
+
|
| 160 |
+
It should also be emphasized that concatenating the two VAE stages and jointly training does not generally improve the performance. If trained jointly the few extra second-stage parameters can simply be hijacked by the dominant influence of the first stage reconstruction term and forced to work on an incrementally better fit of the manifold rather than addressing the critical mismatch between $q _ { \phi } ( z )$ and $\mathcal { N } ( u | { \bf 0 } , I )$ . This observation can be empirically tested, which we have done in multiple ways. For example, we have tried fusing the respective encoders and decoders from the first and second stages to train what amounts to a slightly more complex single VAE model. We have also tried merging the two stages including the associated penalty terms. In both cases, joint training does not help at all as expected, with average performance no better than the first stage VAE (which contains the vast majority of parameters). Consequently, although perhaps counterintuitive, separate training of these two VAE stages is actually critical to achieving high quality results as will be demonstrated next.
|
| 161 |
+
|
| 162 |
+
# 5 QUANTITATIVE COMPARISONS OF GENERATED SAMPLE QUALITY
|
| 163 |
+
|
| 164 |
+
We first present quantitative evaluation of novel generated samples using the large-scale testing protocol of GAN models from (Lucic et al., 2018). In this regard, GANs are well-known to dramatically outperform existing VAE approaches in terms of the Frechet Inception Distance (FID) score (Heusel ´ et al., 2017) and related quantitative metrics. For fair comparison, (Lucic et al., 2018) adopted a common neutral architecture for all models, with generator and discriminator networks based on InfoGAN (Chen et al., 2016a); the point here is standardized comparisons, not tuning arbitrarily-large networks to achieve the lowest possible absolute FID values. We applied the same architecture to our first-stage VAE decoder and encoder networks respectively for direct comparison. For the lowdimensional second-stage VAE we used small, 3-layer networks contributing negligible additional parameters beyond the first stage (see (Dai & Wipf, 2019) for further design details).
|
| 165 |
+
|
| 166 |
+
We evaluated our proposed VAE pipeline, henceforth denoted as 2-Stage VAE, against three baseline VAE models differing only in the decoder output layer: a Gaussian layer with fixed $\gamma$ , a Gaussian layer with a learned $\gamma$ , and a cross-entropy layer as has been adopted in several previous applications involving images (Chen et al., 2016b). We also tested the Gaussian decoder VAE model (with learned $\gamma$ ) combined with an encoder augmented with normalizing flows (Rezende & Mohamed, 2015), as well as the recently proposed Wasserstein autoencoder (WAE) (Tolstikhin et al., 2018) which maintains a VAE-like structure. All of these models were adapted to use the same neutral architecture from (Lucic et al., 2018). Note also that the WAE includes two variants, referred to as WAE-MMD and WAE-GAN because different Maximum Mean Discrepancy (MMD) and GAN regularization factors are involved. We conduct experiments using the former because it does not involve potentially-unstable adversarial training, consistent with the other VAE baselines.6 Additionally, we present results from (Lucic et al., 2018) involving numerous competing GAN models, including MM GAN (Goodfellow et al., 2014), WGAN (Arjovsky et al., 2017), WGAN-GP (Gulrajani et al., 2017), NS GAN (Fedus et al., 2017), DRAGAN (Kodali et al., 2017), LS GAN (Mao et al., 2017) and BEGAN (Berthelot et al., 2017). Testing is conducted across four significantly different datasets: MNIST (LeCun et al., 1998), Fashion MNIST (Xiao et al., 2017), CIFAR-10 (Krizhevsky & Hinton, 2009) and CelebA (Liu et al., 2015).
|
| 167 |
+
|
| 168 |
+
For each dataset we executed 10 independent trials and report the mean and standard deviation of the FID scores in Table 1.7 No effort was made to tune VAE training hyperparameters (e.g., learning rates, etc.); rather a single generic setting was first agnostically selected and then applied to all VAE-like models (including the WAE-MMD). As an analogous baseline, we also report the value of the best GAN model for each dataset when trained using suggested settings from the authors; no single model was optimal across all datasets, so these values represent the best performance from different, dataset-dependent GANs. Even so, our single 2-Stage VAE is still better on two of four datasets, and in aggregate, better than any individual GAN model. For example, when averaged across datasets, the mean FID score for any individual GAN trained with suggested settings was always approximately 45 or higher (see (Lucic et al., 2018)[Figure 4]), while our analogous 2-Stage VAE maintained a mean below 40. The other VAE baselines were not competitive. Note also that the relatively poor performance of the WAE-MMD on MNIST and Fashion MNIST data can be attributed to the sensitivity of this approach to the value of $\kappa$ , which for consistency with other models was fixed at $\kappa ~ = ~ 6 4$ for all experiments. This value is likely much larger than actually needed for these simpler data types (meaning $r \ll 6 4$ ), and the WAE-MMD model can potentially be more reliant on having some $\kappa \approx r$ . For head-to-head empirical tests of robustness to $\kappa$ , please see (Dai & Wipf, 2019).
|
| 169 |
+
|
| 170 |
+
Table 1 also displays FID scores from GAN models evaluated using hyperparameters obtained from a large-scale search executed independently across each dataset to achieve the best results; 100 settings per model per dataset, plus an optimal, data-dependent stopping criteria as described in (Lucic et al., 2018). Within this broader paradigm, cases of severe mode collapse were omitted when computing final GAN FID averages. Despite these considerable GAN-specific advantages, the FID performance of the default 2-Stage VAE is well within the range of the heavily-optimized GAN models for each dataset unlike the other VAE baselines. Overall then, these results represent the first demonstration of a VAE pipeline capable of competing with GANs in the arena of generated sample quality. Additionally, representative samples produced using our 2-Stage VAE model can be found in (Dai & Wipf, 2019).
|
| 171 |
+
|
| 172 |
+
Beyond the neutral testing platform from (Lucic et al., 2018), we also consider additional comparisons using the architecture and experimental setup from (Tolstikhin et al., 2018) explicitly designed for applying WAE models to CelebA data. In particular, we adopt the exact same encoder-decoder networks as the WAE models, and train using the same number of epochs. We do not tune any hyperparameters whatsoever, and apply the same small second-stage VAE as used in previous experiments. As before, the second-stage size is a small fraction of the first stage, so any benefit is not simply the consequence of a larger network structure. Results are reported in Table 2, where the 2-Stage VAE even outperforms the WAE-GAN model, which has the advantage of adversarial training tuned for this combination of data and network architecture.
|
| 173 |
+
|
| 174 |
+
# 6 EXPERIMENTAL CORROBORATION OF THEORETICAL RESULTS
|
| 175 |
+
|
| 176 |
+
The true test of any theoretical contribution is the degree to which it leads to useful, empiricallytestable predictions about behavior in real-world settings. In the present context, although our theory from Sections 2 and 3 involves some unavoidable simplifying assumptions, it nonetheless makes predictions that can be tested under practically-relevant conditions where these assumptions may
|
| 177 |
+
|
| 178 |
+
<table><tr><td></td><td></td><td>MNIST</td><td>Fashion</td><td>CIFAR-10</td><td>CelebA</td></tr><tr><td rowspan="3">optimized, data-dependent settings</td><td rowspan="3">MM GAN NS GAN LSGAN WGAN WGAN GP</td><td>9.8±0.9</td><td>29.6 ±1.6 26.5 ± 1.6</td><td>72.7 ± 3.6 58.5 ± 1.9</td><td>65.6± 4.2</td></tr><tr><td>6.8 ± 0.5</td><td></td><td></td><td>55.0 ± 3.3</td></tr><tr><td>7.8± 0.6 6.7±0.4</td><td>30.7 ± 2.2 21.5 ± 1.6</td><td>87.1 ± 47.5 55.2 ± 2.3</td><td>53.9 ± 2.8 41.3 ± 2.0</td></tr><tr><td></td><td>DRAGAN BEGAN Best GAN</td><td>20.3 ± 5.0 7.6 ± 0.4 13.1 ± 1.0 ~10</td><td>24.5 ± 2.1 27.7 ±1.2 22.9 ± 0.9</td><td>55.8 ± 0.9 69.8 ± 2.0 71.4 ± 1.6</td><td>30.3 ± 1.0 42.3 ± 3.0 38.9 ± 0.9</td></tr><tr><td>default settings</td><td>VAE (cross-entr.) VAE (fixed γ) VAE (learned ~) VAE + Flow WAE-MMD 2-Stage VAE (ours)</td><td>16.6 ± 0.4 52.0 ± 0.6 54.5 ± 1.0 54.8± 2.8 115.0 ± 1.1 12.6 ± 1.5</td><td>~32 43.6 ± 0.7 84.6 ± 0.9 60.0 ±1.1 62.1 ± 1.6 101.7 ± 0.8 29.3±1.0</td><td>~70 106.0 ± 1.0 160.5 ± 1.1 76.7 ± 0.8 81.2 ± 2.0 80.9 ± 0.4</td><td>~49 53.3 ± 0.6 55.9 ± 0.6 60.5 ± 0.6 65.7 ± 2.8 62.9 ± 0.8</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Table 1: FID score comparisons using neutral architecture. For all GAN-based models listed in the top section of the table, reported values represent the optimal FID obtained across a large-scale hyperparameter search conducted separately for each dataset (Lucic et al., 2018). Outlier cases (e.g., severe mode collapse) were omitted, which would have otherwise increased these GAN FID scores. In the lower section of the table, the label Best GAN indicates the lowest FID produced across all GAN approaches for each dataset when trained using settings suggested by original authors; these approximate values were extracted from (Lucic et al., 2018)[Figure 4]. For the VAE results (including WAE), only a single default setting was adopted across all datasets and models (no tuning whatsoever), and no cases of mode collapse were removed. Note that specialized architectures and/or random seed optimization can potentially improve the FID for all models reported here.
|
| 181 |
+
|
| 182 |
+
Table 2: FID scores on CelebA data obtained using the network structure and training protocol from (Tolstikhin et al., 2018). For the 2-Stage VAE, we apply the exact same architecture and training epochs without any tuning of hyperparameters.
|
| 183 |
+
|
| 184 |
+
<table><tr><td></td><td>VAE</td><td>WAE-MMD</td><td>WAE-GAN</td><td>2-Stage VAE (ours)</td></tr><tr><td>CelebAFID</td><td>63</td><td>55</td><td>42</td><td>34</td></tr></table>
|
| 185 |
+
|
| 186 |
+
not strictly hold. We now present the results of such tests, which provide strong confirmation of our previous analysis. In particular, after providing validation of Theorems 3 and 4, we explicitly demonstrate that the second stage of our 2-Stage VAE model can reduce the gap between $q ( z )$ and $p ( z )$ .
|
| 187 |
+
|
| 188 |
+
Validation of Theorem 3: This theorem implies that $\gamma$ will converge to zero at any global minimum of the stated VAE objective under consideration. Figure 1a presents empirical support for this result, where indeed the decoder variance $\gamma$ does tend towards zero during training (red line). This then allows for tighter image reconstructions (dark blue curve) with lower average squared error, i.e., a better manifold fit as expected.
|
| 189 |
+
|
| 190 |
+
Validation of Theorem 4: Figure 1b bolsters this theorem, and the attendant analysis which follows in Section 3, by showcasing the dissimilar impact of noise factors applied to different directions in the latent space before passage through the decoder mean network $f _ { \mu _ { x } }$ . In a direction where an eigenvalue $\lambda _ { j }$ of $\Sigma _ { z }$ is large (i.e., a superfluous dimension), a random perturbation is completely muted by the decoder as predicted. In contrast, in directions where such eigenvalues are small (i.e., needed for representing the manifold), varying the input causes large changes in the image space reflecting reasonable movement along the correct manifold.
|
| 191 |
+
|
| 192 |
+
Reduced Mismatch between $q _ { \phi } ( z )$ and $p ( z )$ : Although the VAE with a learnable $\gamma$ can achieve high-quality reconstructions, the associated aggregated posterior is still likely not close to a standard Gaussian distribution as implied by (10). This mismatch then disrupts the critical ancestral sampling process. As we have previously argued, the proposed 2-Stage VAE has the ability to overcome this issue and achieve a standard Gaussian aggregated posterior, or at least nearly so. As empirical evidence for this claim, Figure 2 displays the singular value spectrum of latent sample matrices $z =$ $\{ z ^ { ( i ) } \} _ { i = 1 } ^ { n }$ drawn from $q _ { \phi } ( z )$ (first stage), and $\bar { U = } \{ \pmb { u } ^ { ( i ) } \} _ { i = 1 } ^ { n }$ drawn from $q _ { \phi ^ { \prime } } ( { \pmb u } )$ (enhanced second stage). As expected, the latter is much closer to the spectrum from an analogous i.i.d. $\mathcal { N } ( 0 , \pmb { I } )$ matrix. We also used these same sample matrices to estimate the MMD metric (Gretton et al., 2007) between $\mathcal { N } ( 0 , \pmb { I } )$ and the aggregated posterior distributions from the first and second stages in Table 3. Clearly the second stage has dramatically reduced the difference from $\mathcal { N } ( 0 , \pmb { I } )$ as quantified by the MMD. Overall, these results indicate a superior latent representation, providing high-level support for our 2-Stage VAE proposal.
|
| 193 |
+
|
| 194 |
+

|
| 195 |
+
Figure 1: $( a )$ The red line shows the evolution of $\log \gamma$ , converging close to 0 during training as expected. The two blue curves compare the associated pixel-wise reconstruction errors with $\gamma$ fixed at 1 and with a learnable $\gamma$ respectively. $( b )$ The $j$ -th eigenvalue of $\Sigma _ { z }$ , denoted $\lambda _ { j }$ , should be very close to either 0 or 1 as argued in Section 3. When $\lambda _ { j }$ is close to 0, injecting noise along the corresponding direction will cause a large variance in the reconstructed image, meaning this direction is an informative one needed for representing the manifold. In contrast, if $\lambda _ { j }$ is close to 1, the addition of noise does not make any appreciable difference in the reconstructed image, indicating that the corresponding dimension is a superfluous one that has been ignored/blocked by the decoder.
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 2: Singular value spectrums of latent sample matrices drawn from $q _ { \phi } ( z )$ (first stage) and $q _ { \phi ^ { \prime } } ( { \pmb u } )$ (enhanced second stage).
|
| 199 |
+
|
| 200 |
+
Table 3: Maximum mean discrepancy between $\mathcal { N } ( 0 , \pmb { I } )$ and $q _ { \phi } ( z )$ (first stage); likewise for $q _ { \phi ^ { \prime } } ( { \pmb u } )$ (second stage).
|
| 201 |
+
|
| 202 |
+
<table><tr><td></td><td>First Stage</td><td>Second Stage</td></tr><tr><td>MNIST</td><td>2.85</td><td>0.43</td></tr><tr><td>Fashion</td><td>1.37</td><td>0.40</td></tr><tr><td>Cifar10</td><td>1.08</td><td>0.00</td></tr><tr><td>CelabA</td><td>7.42</td><td>0.29</td></tr></table>
|
| 203 |
+
|
| 204 |
+
# 7 DISCUSSION
|
| 205 |
+
|
| 206 |
+
It is often assumed that there exists an unavoidable trade-off between the stable training, valuable attendant encoder network, and resistance to mode collapse of VAEs, versus the impressive visual quality of images produced by GANs. While we certainly are not claiming that our two-stage VAE model is superior to the latest and greatest GAN-based architecture in terms of the realism of generated samples, we do strongly believe that this work at least narrows that gap substantially such that VAEs are worth considering in a broader range of applications. For further results and discussion, including consideration of broader VAE modeling paradigms and the identifiability of disentangled representations, please see (Dai & Wipf, 2019).
|
| 207 |
+
|
| 208 |
+
# REFERENCES
|
| 209 |
+
|
| 210 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In International Conference on Machine Learning, pp. 214–223, 2017.
|
| 211 |
+
|
| 212 |
+
Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1798–1828, 2013.
|
| 213 |
+
|
| 214 |
+
David Berthelot, Thomas Schumm, and Luke Metz. BEGAN: Boundary equilibrium generative adversarial networks. arXiv:1703.10717, 2017.
|
| 215 |
+
|
| 216 |
+
Olivier Bousquet, Sylvain Gelly, Ilya Tolstikhin, Carl Johann Simon-Gabriel, and Bernhard Scholkopf. From optimal transport to generative modeling: the VEGAN cookbook. ¨ arXiv:1611.02731, 2017.
|
| 217 |
+
|
| 218 |
+
Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. arXiv:1609.07093, 2016.
|
| 219 |
+
|
| 220 |
+
Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv:1509.00519, 2015.
|
| 221 |
+
|
| 222 |
+
Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2172–2180, 2016a.
|
| 223 |
+
|
| 224 |
+
Xi Chen, Diederik Kingma, Tim Salimans, Yan Duan, Prafulla Dhariwal, John Schulman, Ilya Sutskever, and Pieter Abbeel. Variational lossy autoencoder. arXiv:1611.02731, 2016b.
|
| 225 |
+
|
| 226 |
+
Bin Dai and David Wipf. Diagnosing and enhancing VAE models. arXiv:1903.05789, 2019.
|
| 227 |
+
|
| 228 |
+
Bin Dai, Yu Wang, John Aston, Gang Hua, and David Wipf. Connections with robust PCA and the role of emergent sparsity in variational autoencoder models. Journal of Machine Learning Research, 19(41):1–42, 2018.
|
| 229 |
+
|
| 230 |
+
Carl Doersch. Tutorial on variational autoencoders. arXiv:1606.05908, 2016.
|
| 231 |
+
|
| 232 |
+
Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. In Advances in Neural Information Processing Systems, pp. 658–666, 2016.
|
| 233 |
+
|
| 234 |
+
William Fedus, Mihaela Rosca, Balaji Lakshminarayanan, Andrew M Dai, Shakir Mohamed, and Ian Goodfellow. Many paths to equilibrium: GANs do not need to decrease a divergence at every step. arXiv:1710.08446, 2017.
|
| 235 |
+
|
| 236 |
+
Ian 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, pp. 2672–2680, 2014.
|
| 237 |
+
|
| 238 |
+
Arthur Gretton, Karsten Borgwardt, Malte Rasch, Bernhard Scholkopf, and Alex Smola. A kernel ¨ method for the two-sample-problem. In Advances in Neural Information Processing Systems, pp. 513–520, 2007.
|
| 239 |
+
|
| 240 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of Wasserstein GANs. In Advances in Neural Information Processing Systems, pp. 5767–5777, 2017.
|
| 241 |
+
|
| 242 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017.
|
| 243 |
+
|
| 244 |
+
Diederik Kingma and Max Welling. Auto-encoding variational Bayes. In International Conference on Learning Representations, 2014.
|
| 245 |
+
|
| 246 |
+
Diederik Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In Advances in Neural Information Processing Systems, pp. 4743–4751, 2016.
|
| 247 |
+
|
| 248 |
+
Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of GANs. arXiv:1705.07215, 2017.
|
| 249 |
+
|
| 250 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
|
| 251 |
+
|
| 252 |
+
Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv:1512.09300, 2015.
|
| 253 |
+
|
| 254 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 255 |
+
|
| 256 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
|
| 257 |
+
|
| 258 |
+
Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are GANs created equal? A large-scale study. Advances in Neural Information Processing Systems, 2018.
|
| 259 |
+
|
| 260 |
+
Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. arXiv:1511.05644, 2016.
|
| 261 |
+
|
| 262 |
+
Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In IEEE International Conference on Computer Vision, pp. 2813–2821, 2017.
|
| 263 |
+
|
| 264 |
+
Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. arXiv:1505.05770, 2015.
|
| 265 |
+
|
| 266 |
+
D.J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, 2014.
|
| 267 |
+
|
| 268 |
+
Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein autoencoders. International Conference on Learning Representations, 2018.
|
| 269 |
+
|
| 270 |
+
Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-MNIST: A novel image dataset for benchmarking machine learning algorithms. arXiv:1708.07747, 2017.
|
md/train/BJ--gPcxl/BJ--gPcxl.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SEMI-SUPERVISED LEARNING WITHCONTEXT-CONDITIONAL GENERATIVEADVERSARIAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Emily Denton Dept. of Computer Science Courant Institute, New York University denton@cs.nyu.edu
|
| 4 |
+
|
| 5 |
+
Sam Gross
|
| 6 |
+
Facebook AI Research New York
|
| 7 |
+
sgross@fb.com Rob Fergus
|
| 8 |
+
Facebook AI Research New York
|
| 9 |
+
robfergus@fb.com
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
We introduce a simple semi-supervised learning approach for images based on in-painting using an adversarial loss. Images with random patches removed are presented to a generator whose task is to fill in the hole, based on the surrounding pixels. The in-painted images are then presented to a discriminator network that judges if they are real (unaltered training images) or not. This task acts as a regularizer for standard supervised training of the discriminator. Using our approach we are able to directly train large VGG-style networks in a semi-supervised fashion. We evaluate on STL-10 and PASCAL datasets, where our approach obtains performance comparable or superior to existing methods.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Deep neural networks have yielded dramatic performance gains in recent years on tasks such as object classification (Krizhevsky et al., 2012), text classification (Zhang et al., 2015) and machine translation (Sutskever et al., 2014; Bahdanau et al., 2015). These successes are heavily dependent on large training sets of manually annotated data. In many settings however, such large collections of labels may not be readily available, motivating the need for methods that can learn from data where labels are rare.
|
| 18 |
+
|
| 19 |
+
We propose a method for harnessing unlabeled image data based on image in-painting. A generative model is trained to generate pixels within a missing hole, based on the context provided by surrounding parts of the image. These in-painted images are then used in an adversarial setting (Goodfellow et al., 2014) to train a large discriminator model whose task is to determine if the image was real (from the unlabeled training set) or fake (an in-painted image). The realistic looking fake examples provided by the generative model cause the discriminator to learn features that generalize to the related task of classifying objects. Thus adversarial training for the in-painting task can be used to regularize large discriminative models during supervised training on a handful of labeled images.
|
| 20 |
+
|
| 21 |
+
# 1.1 RELATED WORK
|
| 22 |
+
|
| 23 |
+
Learning From Context: The closest work to ours is the independently developed context-encoder approach of Pathak et al. (2016). This introduces an encoder-decoder framework, shown in Fig. 1(a), that is used to in-paint images where a patch has been randomly removed. After using this as a pre-training task, a classifier is added to the encoder and the model is fine-tuned using the labeled examples. Although both approaches use the concept of in-painting, they differ in several important ways. First, the architectures are different (see Fig. 1): in Pathak et al. (2016), the features for the classifier are taken from the encoder, whereas ours come from the discriminator network. In practice this makes an important difference as we are able to directly train large models such as VGG (Simonyan & Zisserman, 2015) using adversarial loss alone. By contrast, Pathak et al. (2016) report difficulties in training an AlexNet encoder with this loss. This leads to the second difference, namely that on account of these issues, they instead employ an $\ell _ { 2 }$ loss when training models for classification and detection (however they do use a joint $\ell _ { 2 }$ and adversarial loss to achieve impressive in-painting results). Finally, the unsupervised learning task differs between the two models. The context-encoder learns a feature representation suitable for in-painting whereas our model learns a feature representation suitable for differentiating real/fake in-paintings. Notably, while we also use a neural network to generate the in-paintings, this model is only used as an adversary for the discriminator, rather than as a feature extractor. In section 4, we compare the performance of our model to the context-encoder on the PASCAL dataset.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: (a) Context-encoder of Pathak et al. (2016), configured for object classification task. (b) Semi-supervised learning with GANs (SSL-GAN). (c) Semi-supervised learning with CC-GANs. In (a-c) the blue network indicates the feature representation being learned (encoder network in the context-encoder model and discriminator network in the GAN and CC-GAN models).
|
| 27 |
+
|
| 28 |
+
Other forms of spatial context within images have recently been utilized for representation learning. Doersch et al. (2015) propose training a CNN to predict the spatial location of one image patch relative to another. Noroozi & Favaro (2016) propose a model that learns by unscrambling image patches, essentially solving a jigsaw puzzle to learn visual representations. In the text domain, context has been successfully leveraged as an unsupervised criterion for training useful word and sentence level representations (Collobert et al., 2011; Mikolov et al., 2015; Kiros et al., 2015).
|
| 29 |
+
|
| 30 |
+
Deep unsupervised and semi-supervised learning: A popular method of utilizing unlabeled data is to layer-wise train a deep autoencoder or restricted Botlzmann machine (Hinton et al., 2006) and then fine tune with labels on a discriminative task. More recently, several autoencoding variants have been proposed for unsupervised and semi-supervised learning, such as the ladder network (Rasmus et al., 2015), stacked what-where autoencoders (Zhao et al., 2016) and variational autoencoders (Kingma & Welling, 2014; Kingma et al., 2014).
|
| 31 |
+
|
| 32 |
+
Dosovitskiy et al. (2014) achieved state-of-the-art results by training a CNN with a different class for each training example and introducing a set of transformations to provide multiple examples per class. The pseudo-label approach (Lee, 2013) is a simple semi-supervised method that trains using the maximumly predicted class as a label when labels are unavailable. Springenberg (2015) propose a categorical generative adversarial network (CatGAN) which can be used for unsupervised and semi-supervised learning. The discriminator in a CatGAN outputs a distribution over classes and is trained to minimize the predicted entropy for real data and maximize the predicted entropy for fake data. Similar to our model, CatGANs use the feature space learned by the discriminator for the final supervised learning task. Salimans et al. (2016) recently proposed a semi-supervised GAN model in which the discriminator outputs a softmax over classes rather than a probability of real vs. fake. An additional ‘generated’ class is used as the target for generated samples. This method differs from our work in that it does not utilize context information and has only been applied to datasets of small resolution. However, the discriminator loss is similar to the one we propose and could be combined with our context-conditional approach.
|
| 33 |
+
|
| 34 |
+
More traditional semi-supervised methods include graph-based approaches (Zhou et al., 2004; Zhu, 2006) that show impressive performance when good image representations are available. However, the focus of our work is on learning such representations.
|
| 35 |
+
|
| 36 |
+
Generative models of images: Restricted Boltzmann machines (Salakhutdinov, 2015), de-noising autoencoders (Vincent et al., 2008) and variational autoencoders (Kingma & Welling, 2014) optimize a maximum likelihood criterion and thus learn decoders that map from latent space to image space. More recently, generative adversarial networks (Goodfellow et al., 2014) and generative moment matching networks (Li et al., 2015; Dziugaite et al., 2015) have been proposed. These methods ignore data likelihoods and instead directly train a generative model to produce realistic samples. Several extensions to the generative adversarial network framework have been proposed to scale the approach to larger images (Denton et al., 2015; Radford et al., 2016; Salimans et al., 2016). Our work draws on the insights of Radford et al. (2016) regarding adversarial training practices and architecture for the generator network, as well as the notion that the discriminator can produce useful features for classification tasks.
|
| 37 |
+
|
| 38 |
+
Other models used recurrent approaches to generate images (Gregor et al., 2015; Theis & Bethge, 2015; Mansimov et al., 2016; van den Oord et al., 2016). Dosovitskiy et al. (2015) trained a CNN to generate objects with different shapes, viewpoints and color. Sohl-Dickstein et al. (2015) propose a generative model based on a reverse diffusion process. While our model does involve image generation, it differs from these approaches in that the main focus is on learning a good representation for classification tasks.
|
| 39 |
+
|
| 40 |
+
Predictive generative models of videos aim to extrapolate from current frames to future ones and in doing so learn a feature representation that is useful for other tasks. In this vein, Ranzato et al. (2014) used an $\ell _ { 2 }$ -loss in pixel-space. Mathieu et al. (2015) combined an adversarial loss with $\ell _ { 2 }$ , giving models that generate crisper images. While our model is also predictive, it only considers interpolation within an image, rather than extrapolation in time.
|
| 41 |
+
|
| 42 |
+
# 2 APPROACH
|
| 43 |
+
|
| 44 |
+
We present a semi-supervised learning framework built on generative adversarial networks (GANs) of Goodfellow et al. (2014). We first review the generative adversarial network framework and then introduce context conditional generative adversarial networks (CC-GANs). Finally, we show how combining a classification objective and a CC-GAN objective provides a unified framework for semi-supervised learning.
|
| 45 |
+
|
| 46 |
+
# 2.1 GENERATIVE ADVERSARIAL NETWORKS
|
| 47 |
+
|
| 48 |
+
The generative adversarial network approach (Goodfellow et al., 2014) is a framework for training generative models, which we briefly review. It consists of two networks pitted against one another in a two player game: A generative model, $G$ , is trained to synthesize images resembling the data distribution and a discriminative model, $D$ , is trained to distinguish between samples drawn from $G$ and images drawn from the training data.
|
| 49 |
+
|
| 50 |
+
More formally, let $\mathcal { X } = \{ \mathbf { x } ^ { 1 } , . . . , \mathbf { x } ^ { n } \}$ be a dataset of images of dimensionality $d$ . Let $D$ denote a discriminative function that takes as input an image $\mathbf { x } \in \mathbb { R } ^ { d }$ and outputs a scalar representing the probability of input $\mathbf { x }$ being a real sample. Let $G$ denote the generative function that takes as input a random vector $\mathbf { z } \in \mathbb { R } ^ { z }$ sampled from a prior noise distribution $p _ { \mathrm { N o i s e } }$ and outputs a synthesized image $\widetilde { \mathbf { x } } = G ( \mathbf { z } ) \in \mathbb { R } ^ { d }$ . Ideally, $D ( \mathbf { x } ) = 1$ when $\mathbf { x } \in \mathcal { X }$ and $D ( \mathbf { x } ) = 0$ when $\mathbf { x }$ was generated from $G$ . The GAN objective is given by:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } \ \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } } [ \log D ( \mathbf { x } ) ] + \mathbb { E } _ { \mathbf { z } \sim p _ { \mathrm { N o i s e } } ( \mathbf { z } ) } [ \log ( 1 - D ( G ( \mathbf { z } ) ) ) ]
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
The conditional generative adversarial network (Mirza $\&$ Osindero, 2014) is an extension of the GAN in which both $D$ and $G$ receive an additional vector of information $\mathbf { y }$ as input. The conditional GAN objective is given by:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } \ \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim \mathcal { X } } [ \log D ( \mathbf { x } , \mathbf { y } ) ] + \mathbb { E } _ { \mathbf { z } \sim p _ { \mathrm { N o i s e } } ( \mathbf { z } ) } [ \log ( 1 - D ( G ( \mathbf { z } , \mathbf { y } ) , \mathbf { x } ) ) ]
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
# 2.2 CONTEXT-CONDITIONAL GENERATIVE ADVERSARIAL NETWORKS
|
| 63 |
+
|
| 64 |
+
We propose context-conditional generative adversarial networks (CC-GANs) which are conditional GANs where the generator is trained to fill in a missing image patch and the generator and discriminator are conditioned on the surrounding pixels.
|
| 65 |
+
|
| 66 |
+
In particular, the generator $G$ receives as input an image with a randomly masked out patch. The generator outputs an entire image. We fill in the missing patch from the generated output and then pass the completed image into $D$ . We pass the completed image into $D$ rather than the context and the patch as two separate inputs so as to prevent $D$ from simply learning to identify discontinuities along the edge of the missing patch.
|
| 67 |
+
|
| 68 |
+
More formally, let $\mathbf { m } \in \mathbb { R } ^ { d }$ denote to a binary mask that will be used to drop out a specified portion of an image. The generator receives as input $\mathbf { m } \odot \mathbf { x }$ where $\odot$ denotes element-wise multiplication. The generator outputs $\mathbf { x _ { G } } = G ( \mathbf { m } \odot \mathbf { x } , \mathbf { z } ) \in \mathbb { R } ^ { d }$ and the in-painted image $\mathbf { x _ { I } }$ is given by:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\mathbf { x _ { I } } = \left( 1 - \mathbf { m } \right) \odot \mathbf { x _ { G } } + \mathbf { m } \odot \mathbf { x }
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
The CC-GAN objective is given by:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } } [ \log D ( \mathbf { x } ) ] + \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } , \mathbf { m } \sim \mathcal { M } } [ \log ( 1 - D ( \mathbf { x _ { I } } ) ) ]
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
# 2.3 COMBINED GAN AND CC-GAN
|
| 81 |
+
|
| 82 |
+
While the generator of the CC-GAN outputs a full image, only a portion of it (corresponding to the missing hole) is seen by the discriminator. In the combined model, which we denote by $\mathrm { C C - \bar { G } A N ^ { 2 } }$ , the fake examples for the discriminator include both the in-painted image $\mathbf { x _ { I } }$ and the full image $\mathbf { x _ { G } }$ produced by the generator (i.e. not just the missing patch). By combining the GAN and CC-GAN approaches, we introduce a wider array of negative examples to the discriminator. The CC-GAN2 objective given by:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { r l } { { \operatorname* { m i n } \operatorname* { m a x } _ { D } \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } } [ \log D ( \mathbf { x } ) ] } } \\ & { + \ \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } , \mathbf { m } \sim \mathcal { M } } [ \log ( 1 - D ( \mathbf { x _ { I } } ) ) ] } \\ & { + \ \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } , \mathbf { m } \sim \mathcal { M } } [ \log ( 1 - D ( \mathbf { x _ { G } } ) ) ] } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
# 2.4 SEMI-SUPERVISED LEARNING WITH CC-GANS
|
| 89 |
+
|
| 90 |
+
A common approach to semi-supervised learning is to combine a supervised and unsupervised objective during training. As a result unlabeled data can be leveraged to aid the supervised task.
|
| 91 |
+
|
| 92 |
+
Intuitively, a GAN discriminator must learn something about the structure of natural images in order to effectively distinguish real from generated images. Recently, Radford et al. (2016) showed that a GAN discriminator learns a hierarchical image representation that is useful for object classification. Such results suggest that combining an unsupervised GAN objective with a supervised classification objective would produce a simple and effective semi-supervised learning method. This approach, denoted by SSL-GAN, is illustrated in Fig. 1(b). The discriminator network receives a gradient from the real/fake loss for every real and generated image. The discriminator also receives a gradient from the classification loss on the subset of (real) images for which labels are available.
|
| 93 |
+
|
| 94 |
+
Generative adversarial networks have shown impressive performance on many diverse datasets. However, samples are most coherent when the set of images the network is trained on comes from a limited domain (eg. churches or faces). Additionally, it is difficult to train GANs on very large images. Both these issues suggest semi-supervised learning with vanilla GANs may not scale well to datasets of large diverse images. Rather than determining if a full image is real or fake, context conditional GANs address a different task: determining if a part of an image is real or fake given the surrounding context.
|
| 95 |
+
|
| 96 |
+
Formally, let $\mathcal { X } _ { \mathcal { L } } = \{ ( \mathbf { x } ^ { 1 } , y ^ { 1 } ) , . . . , ( \mathbf { x } ^ { n } , y ^ { n } ) \}$ denote a dataset of labeled images. Let $D _ { c } ( x )$ denote the output of the classifier head on the discriminator (see Fig. 1(c) for details). Then the semisupervised CC-GAN objective is:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\underset { G } { \mathrm { m i n } } \underset { D } { \mathrm { m a x } } \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } } [ \log D ( \mathbf { x } ) ] + \mathbb { E } _ { \mathbf { x } \sim \mathcal { X } , \mathbf { m } \sim \mathcal { M } } [ \log ( 1 - D ( \mathbf { x _ { I } } ) ) ] + \lambda _ { c } \mathbb { E } _ { \mathbf { x } , y \sim \mathcal { X } _ { \mathcal { L } } } [ \log ( D _ { c } ( y | \mathbf { x } ) ) ]
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
The hyperparameter $\lambda _ { c }$ balances the classification and adversarial losses. We only consider the CCGAN in the semi-supervised setting and thus drop the SSL notation when referring to this model.
|
| 103 |
+
|
| 104 |
+
# 2.5 MODEL ARCHITECTURE AND TRAINING DETAILS
|
| 105 |
+
|
| 106 |
+
The architecture of our generative model, $G$ , is inspired by the generator architecture of the DCGAN (Radford et al., 2016). The model consists of a sequence of convolutional layers with subsampling (but no pooling) followed by a sequence of fractionally-strided convolutional layers. For the discriminator, $D$ , we used the VGG-A network (Simonyan & Zisserman, 2015) without the fully connected layers (which we call the VGG-A’ architecture). Details of the generator and discriminator are given in Fig. 2. The input to the generator is an image with a patch zeroed out. In preliminary experiments we also tried passing in a separate mask to the generator to make the missing area more explicit but found this did not effect performance.
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 2: Architecture of our context-conditional generative adversarial network (CC-GAN). conv(64, $4 \times 4$ , $2 \times 2$ ) denotes a conv layer with 64 channels, 4x4 kernels and stride $2 \mathbf { x } 2$ . Each convolution layer is followed by a spatial batch normalization and rectified linear layer. Dashed lines indicate optional pathways.
|
| 110 |
+
|
| 111 |
+
Even with the context conditioning it is difficult to generate large image patches that look realistic, making it problematic to scale our approach to high resolution images. To address this, we propose conditioning the generator on both the high resolution image with a missing patch and a low resolution version of the whole image (with no missing region). In this setting, the generators task becomes one of super-resolution on a portion of an image. However, the discriminator does not receive the low resolution image and thus is still faced with the same problem of determining if a given in-painting is viable or not. Where indicated, we used this approach in our PASCAL VOC 2007 experiments, with the original image being downsampled by a factor of 4. This provided enough information for the generator to fill in larger holes but not so much that it made the task trivial. This optional low resolution image is illustrated in Fig. 2(left) with the dotted line.
|
| 112 |
+
|
| 113 |
+
We followed the training procedures of Radford et al. (2016). We used the Adam optimizer (Kingma & Ba, 2015) in all our experiments with learning rate of 0.0002, momentum term $\beta _ { 1 }$ of 0.5, and the remaining Adam hyperparameters set to their default values. We set $\lambda _ { c } = 1$ for all experiments.
|
| 114 |
+
|
| 115 |
+
Table 1: Comparison of CC-GAN and other published results on STL-10.
|
| 116 |
+
|
| 117 |
+
<table><tr><td>Method</td><td>Accuracy</td></tr><tr><td>Multi-task Bayesian Optimization (Swersky et al.,2013) Exemplar CNN(Dosovitskiy et al.,2014) Stacked What-Where Autoencoder (Zhao et al.,2016)</td><td>70.10± 0.6 75.40 ± 0.3 74.33</td></tr><tr><td>Supervised VGG-A'</td><td>61.19 ± 1.1</td></tr><tr><td>SSL-GAN</td><td>73.81 ± 0.5</td></tr><tr><td>CC-GAN</td><td>75.67 ± 0.5</td></tr><tr><td>CC-GAN²</td><td>77.79 ± 0.8</td></tr></table>
|
| 118 |
+
|
| 119 |
+
# 3 EXPERIMENTS
|
| 120 |
+
|
| 121 |
+
# 3.1 STL-10 CLASSIFICATION
|
| 122 |
+
|
| 123 |
+
STL-10 is a dataset of $9 6 \times 9 6$ color images with a 1:100 ratio of labeled to unlabeled examples, making it an ideal fit for our semi-supervised learning framework. The training set consists of 5000 labeled images, mapped to 10 pre-defined folds of 1000 images each, and 100,000 unlabeled images. The labeled images belong to 10 classes and were extracted from the ImageNet dataset and the unlabeled images come from a broader distribution of classes. We follow the standard testing protocol and train 10 different models on each of the 10 predefined folds of data. We then evaluate classification accuracy of each model on the test set and report the mean and standard deviation.
|
| 124 |
+
|
| 125 |
+
We trained our CC-GAN and $\mathrm { C C - G A N ^ { 2 } }$ models on $6 4 \times 6 4$ crops of the $9 6 \times 9 6$ image. The hole was $3 2 \times 3 2$ pixels and the location of the hole varied randomly (see Fig. 3(top)). We trained for 100 epochs and then fine-tuned the discriminator on the $9 6 \mathbf { x } 9 6$ labeled images, stopping when training accuracy reached $100 \%$ . As shown in Table 1, the CC-GAN model performs comparably to current state of the art (Dosovitskiy et al., 2014) and the $\mathrm { C C - G A N ^ { 2 } }$ model improves upon it.
|
| 126 |
+
|
| 127 |
+
We also trained two baseline models in an attempt to tease apart the contributions of adversarial training and context conditional adversarial training. The first is a purely supervised training of the VGG-A’ model (the same architecture as the discriminator in the CC-GAN framework). This was trained using a dropout of 0.5 on the final layer and weight decay of 0.001. The performance of this model is significantly worse than the CC-GAN model.
|
| 128 |
+
|
| 129 |
+
We also trained a semi-supervised GAN (SSL-GAN, see Fig. 1(b)) on STL-10. This consisted of the same discriminator as the CC-GAN (VGG-A’ architecture) and generator from the DCGAN model (Radford et al., 2016). The training setup in this case is identical to the CC-GAN model. The SSLGAN performs almost as well as the CC-GAN, confirming our hypothesis that the GAN objective is a useful unsupervised criterion.
|
| 130 |
+
|
| 131 |
+
# 3.2 PASCAL VOC CLASSIFICATION
|
| 132 |
+
|
| 133 |
+
In order to compare against other methods that utilize spatial context we ran the CC-GAN model on PASCAL VOC 2007 dataset. This dataset consists of natural images coming from 20 classes. The dataset contains a large amount of variability with objects varying in size, pose, and position. The training and validation sets combined contain 5,011 images, and the test set contains 4,952 images. The standard measure of performance is mean average precision (mAP).
|
| 134 |
+
|
| 135 |
+
We trained each model on the combined training and validation set for ${ \sim } 5 0 0 0$ epochs and evaluated on the test set once1. Following Pathak et al. (2016), we train using random cropping, and then evaluate using the average prediction from 10 random crops.
|
| 136 |
+
|
| 137 |
+
Our best performing model was trained on images of resolution $1 2 8 \times 1 2 8$ with a hole size of $6 4 \times 6 4$ and a low resolution input of size $3 2 \times 3 2$ . Table 2 compares our CC-GAN method to other feature learning approaches on the PASCAL test set. It outperforms them, beating the current state of the art (Wang & Gupta, 2015) by $3 . 8 \%$ . It is important to note that our feature extractor is the VGGA’ model which is larger than the AlexNet architecture (Krizhevsky et al., 2012) used by other approaches in Table 2. However, purely supervised training of the two models reveals that VGG-A’ is less than $2 \%$ better than AlexNet. Furthermore, our model outperforms the supervised VGG-A’ baseline by a $7 \%$ margin ( $6 2 . 2 \%$ vs. $5 5 . 2 \%$ ). This suggests that our gains stem from the CC-GAN method rather than the use of a better architecture.
|
| 138 |
+
|
| 139 |
+
Table 2: Comparison of CC-GAN and other methods (as reported by Pathak et al. (2016)) on PASCAL VOC 2007.
|
| 140 |
+
|
| 141 |
+
<table><tr><td>Method</td><td>mAP</td></tr><tr><td>Supervised AlexNet</td><td>53.3 %</td></tr><tr><td>Visual tracking from video (Wang & Gupta, 2015)</td><td>58.4%</td></tr><tr><td>Context prediction (Doersch et al.,2015)</td><td>55.3%</td></tr><tr><td>Context encoders (Pathak et al., 2016)</td><td>56.5%</td></tr><tr><td>Supervised VGG-A'</td><td>55.2%</td></tr><tr><td>CC-GAN</td><td>62.2%</td></tr><tr><td>CC-GAN²</td><td>62.7%</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 3: Comparison of different CC-GAN variants on PASCAL VOC 2007.
|
| 144 |
+
|
| 145 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Image size</td><td rowspan=1 colspan=1>Hole size</td><td rowspan=1 colspan=1>Low res size</td><td rowspan=1 colspan=1>mAP</td></tr><tr><td rowspan=1 colspan=1>Supervised VGG-A'CC-GAN</td><td rowspan=1 colspan=1>64×6464×64</td><td rowspan=1 colspan=1>32×32</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>52.97%56.79%</td></tr><tr><td rowspan=1 colspan=1>Supervised VGG-A'CC-GANCC-GAN</td><td rowspan=1 colspan=1>96×9696×9696×96</td><td rowspan=1 colspan=1>=48×4848×48</td><td rowspan=1 colspan=1>=24×24</td><td rowspan=1 colspan=1>55.22%60.38%60.98%</td></tr><tr><td rowspan=1 colspan=1>Supervised VGG-A'CC-GANCC-GAN</td><td rowspan=1 colspan=1>128×128128×128128×128</td><td rowspan=1 colspan=1>=64×6464×64</td><td rowspan=1 colspan=1>-=32×32</td><td rowspan=1 colspan=1>55.2%61.3%62.2%</td></tr></table>
|
| 146 |
+
|
| 147 |
+
Table 3 shows the effect of training on different resolutions. The CC-GAN improves over the baseline CNN consistently regardless of image size. We found that conditioning on the low resolution image began to help when the hole size was largest $( 6 4 \times 6 4 )$ . We hypothesize that the low resolution conditioning would be more important for larger images, potentially allowing the method to scale to larger image sizes than we explored in this work.
|
| 148 |
+
|
| 149 |
+
# 3.3 INPAINTING
|
| 150 |
+
|
| 151 |
+
We now show some sample in-paintings produced by our CC-GAN generators. In our semisupervised learning experiments on STL-10 we remove a single fixed size hole from the image. The top row of Fig. 3 shows in-paintings produced by this model. We can also explored different masking schemes as illustrated in the remaining rows of Fig. 3 (however these did not improve classification results). In all cases we see that training the generator with the adversarial loss produces sharp semantically plausible in-painting results.
|
| 152 |
+
|
| 153 |
+
Fig. 4 shows generated images and in-painted images from a model trained with the CC-GAN2 criterion. The output of a CC-GAN generator tends to be corrupted outside the patch used to inpaint the image (since gradients only flow back to the missing patch). However, in the CC-GAN2 model, we see that both the in-painted image and the generated image are coherent and semantically consistent with the masked input image.
|
| 154 |
+
|
| 155 |
+
Fig. 5 shows in-painted images from a generator trained on $1 2 8 \times 1 2 8$ PASCAL images. Fig. 6 shows the effect of adding a low resolution $( 3 2 \times 3 2 )$ image as input to the generator. For comparison we also show the result of in-painting by filling in with a bi-linearly upsampled image. Here we see the generator produces high-frequency structure rather than simply learning to copy the low resolution patch.
|
| 156 |
+
|
| 157 |
+
# 4 DISCUSSION
|
| 158 |
+
|
| 159 |
+
We have presented a simple semi-supervised learning framework based on in-painting with an adversarial loss. The generator in our CC-GAN model is capable of producing semantically meaningful in-paintings and the discriminator performs comparable to or better than existing semi-supervised methods on two classification benchmarks.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 3: STL-10 in-painting with CC-GAN training and varying methods of dropping out the image.
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 4: STL-10 in-painting with combined CC-GAN2 training.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 5: PASCAL in-painting with CC-GAN.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 6: PASCAL in-painting with CC-GAN conditioned on low resolution image. Top two rows show input to generator. Third row shows inpainting my bilinear upsampling. Bottom row shows inpainted image by generator.
|
| 172 |
+
|
| 173 |
+
Since discrimination of real/fake in-paintings is more closely related to the target task of object classification than extracting a feature representation suitable for in-filling, it is not surprising that we are able to exceed the performance of Pathak et al. (2016) on PASCAL classification. Furthermore, since our model operates on images half the resolution as those used by other approaches ( $1 2 8 \times 1 2 8$ vs. $2 2 4 \times 2 4 4$ , there is potential for further gains if improvements in the generator resolution can be made. Our models and code are available at https://github.com/edenton/cc-gan.
|
| 174 |
+
|
| 175 |
+
Acknowledgements: Emily Denton is supported by a Google Fellowship. Rob Fergus is grateful for the support of CIFAR.
|
| 176 |
+
|
| 177 |
+
# REFERENCES
|
| 178 |
+
|
| 179 |
+
D. Bahdanau, K. Cho, and Y. Bengio. Neural machine translation by jointly learning to align and translate. In The International Conference on Learning Representations, 2015.
|
| 180 |
+
R. Collobert, J. Weston, L. Bottou, M. Karlen, K. Kavukcuoglu, and P. Kuksa. Natural language processing (almost) from scratch. Journal of Machine Learning Research, 2011.
|
| 181 |
+
Emily Denton, Soumith Chintala, Arthur Szlam, and Rob Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in Neural Information Processing Systems 28, 2015.
|
| 182 |
+
Carl Doersch, Abhinav Gupta, and Alexei A. Efros. Unsupervised visual representation learning by context prediction. In International Conference on Computer Vision, 2015.
|
| 183 |
+
Alexey Dosovitskiy, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with convolutional neural networks. In Advances in Neural Information Processing Systems 27, 2014.
|
| 184 |
+
Alexey Dosovitskiy, Jost Tobias Springenberg, and Thomas Brox. Learning to generate chairs, tables and cars with convolutional networks. In Computer Vision and Pattern Recognition, 2015.
|
| 185 |
+
Gintare Karolina Dziugaite, Daniel M. Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. In Uncertainty in Artificial Intelligence, 2015.
|
| 186 |
+
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, 2014.
|
| 187 |
+
Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. In International Conference on Machine Learning, 2015.
|
| 188 |
+
G. E. Hinton, S. Osindero, and Y. Teh. A fast learning algorithm for deep belief nets. Neural Computation, 18, 2006.
|
| 189 |
+
D.P. Kingma and J. Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 190 |
+
D.P. Kingma and M. Welling. Auto-encoding variational bayes. In International Conference on Learning Representations, 2014.
|
| 191 |
+
D.P. Kingma, D.J. Rezende, S. Mohamed, and M. Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems 27, 2014.
|
| 192 |
+
Ryan Kiros, Yukun Zhu, Ruslan Salakhutdinov, Richard S. Zemel, Antonio Torralba, Raquel Urtasun, and Sanja Fidler. Skip-thought vectors. In Advances in Neural Information Processing Systems 28, 2015.
|
| 193 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoff Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25, pp. 1106–1114, 2012.
|
| 194 |
+
D. H. Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on Challenges in Representation Learning, ICML, 2013.
|
| 195 |
+
Yujia Li, Kevin Swersky, and Richard Zemel. Generative moment matching networks. In ICML, 2015.
|
| 196 |
+
Elman Mansimov, Emilio Parisotto, Jimmy Ba, and Ruslan Salakhutdinov. Generating images from captions with attention. In The International Conference on Learning Representations, 2016.
|
| 197 |
+
|
| 198 |
+
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square ¨ error. arXiv 1511.05440, 2015.
|
| 199 |
+
T. Mikolov, I. Sutskever, K. Chen, G. S. Corrado, and J. Dean. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems 28, 2015.
|
| 200 |
+
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. CoRR, abs/1411.1784, 2014.
|
| 201 |
+
Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. CoRR, abs/1603.09246, 2016.
|
| 202 |
+
Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A. Efros. Context encoders: Feature learning by inpainting. In Computer Vision and Pattern Recognition, 2016.
|
| 203 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In The International Conference on Learning Representations, 2016.
|
| 204 |
+
Marc’Aurelio Ranzato, Arthur Szlam, Joan Bruna, Michael Mathieu, Ronan Collobert, and Sumit Chopra. ¨ Video (language) modeling: a baseline for generative models of natural videos. arXiv 1412.6604, 2014.
|
| 205 |
+
Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semi-supervised learning with ladder network. In Advances in Neural Information Processing Systems 28, 2015.
|
| 206 |
+
Ruslan Salakhutdinov. Learning deep generative models. Annual Review of Statistics and Its Application, 2: 361–385, 2015.
|
| 207 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems 29, 2016.
|
| 208 |
+
K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In The International Conference on Learning Representations, 2015.
|
| 209 |
+
Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. CoRR, abs/1503.03585, 2015.
|
| 210 |
+
Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv 1511.06390, 2015.
|
| 211 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems 27, 2014.
|
| 212 |
+
Kevin Swersky, Jasper Snoek, and Ryan P. Adams. Multi-task bayesian optimization. In Advances in Neural Information Processing Systems 26, 2013.
|
| 213 |
+
L. Theis and M. Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems 28, 2015.
|
| 214 |
+
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In ICML, 2016.
|
| 215 |
+
P. Vincent, H. Larochelle, Y. Bengio, and P.A. Manzagol. Extracting and composing robust features with denoising autoencoders. In International Conference on Machine Learning, 2008.
|
| 216 |
+
Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In ICCV, 2015.
|
| 217 |
+
Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems 28, 2015.
|
| 218 |
+
Junbo Zhao, Michael Mathieu, Ross Goroshin, and Yann LeCun. Stacked what-where auto-encoders. In International Conference on Learning Representations, 2016.
|
| 219 |
+
D. Zhou, O. Bousquet, T. Lal, J. Weston, and B. Schoelkopf. Learning with local and global consistency. In Advances in Neural Information Processing Systemsi 17, 2004.
|
| 220 |
+
|
| 221 |
+
Xiaojin Zhu. Semi-supervised learning literature survey, 2006.
|
md/train/BJJLHbb0-/BJJLHbb0-.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEEP AUTOENCODING GAUSSIAN MIXTURE MODEL FOR UNSUPERVISED ANOMALY DETECTION
|
| 2 |
+
|
| 3 |
+
Bo Zong†, Qi Song‡, Martin Renqiang $\mathbf { M } \mathbf { i n } ^ { \dagger }$ , Wei Cheng† Cristian Lumezanu†, Daeki Cho†, Haifeng Chen†
|
| 4 |
+
|
| 5 |
+
†NEC Laboratories America
|
| 6 |
+
‡Washington State University, Pullman
|
| 7 |
+
{bzong, renqiang, weicheng, lume, dkcho, haifeng}@nec-labs.com
|
| 8 |
+
qsong@eecs.wsu.edu
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Unsupervised anomaly detection on multi- or high-dimensional data is of great importance in both fundamental machine learning research and industrial applications, for which density estimation lies at the core. Although previous approaches based on dimensionality reduction followed by density estimation have made fruitful progress, they mainly suffer from decoupled model learning with inconsistent optimization goals and incapability of preserving essential information in the low-dimensional space. In this paper, we present a Deep Autoencoding Gaussian Mixture Model (DAGMM) for unsupervised anomaly detection. Our model utilizes a deep autoencoder to generate a low-dimensional representation and reconstruction error for each input data point, which is further fed into a Gaussian Mixture Model (GMM). Instead of using decoupled two-stage training and the standard Expectation-Maximization (EM) algorithm, DAGMM jointly optimizes the parameters of the deep autoencoder and the mixture model simultaneously in an end-to-end fashion, leveraging a separate estimation network to facilitate the parameter learning of the mixture model. The joint optimization, which well balances autoencoding reconstruction, density estimation of latent representation, and regularization, helps the autoencoder escape from less attractive local optima and further reduce reconstruction errors, avoiding the need of pre-training. Experimental results on several public benchmark datasets show that, DAGMM significantly outperforms state-of-the-art anomaly detection techniques, and achieves up to $1 4 \%$ improvement based on the standard $F _ { 1 }$ score.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Unsupervised anomaly detection is a fundamental problem in machine learning, with critical applications in many areas, such as cybersecurity (Tan et al. (2011)), complex system management (Liu et al. (2008)), medical care (Keller et al. (2012)), and so on. At the core of anomaly detection is density estimation: given a lot of input samples, anomalies are those ones residing in low probability density areas.
|
| 17 |
+
|
| 18 |
+
Although fruitful progress has been made in the last several years, conducting robust anomaly detection on multi- or high-dimensional data without human supervision remains a challenging task. Especially, when the dimensionality of input data becomes higher, it is more difficult to perform density estimation in the original feature space, as any input sample could be a rare event with low probability to observe (Chandola et al. (2009)). To address this issue caused by the curse of dimensionality, two-step approaches are widely adopted (Candes et al. (2011)), in which \` dimensionality reduction is first conducted, and then density estimation is performed in the latent low-dimensional space. However, these approaches could easily lead to suboptimal performance, because dimensionality reduction in the first step is unaware of the subsequent density estimation task, and the key information for anomaly detection could be removed in the first place. Therefore, it is desirable to combine the force of dimensionality reduction and density estimation, although a joint optimization accounting for these two components is usually computationally difficult. Several recent works (Zhai et al. (2016); Yang et al. (2017a); Xie et al. (2016)) explored this direction by utilizing the strong modeling capacity of deep networks, but the resulting performance is limited either by a reduced low-dimensional space that is unable to preserve essential information of input samples, an over-simplified density estimation model without enough capacity, or a training strategy that does not fit density estimation tasks.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: Low-dimensional representations for samples from a private cybersecurity dataset: (1) each sample denotes a network flow that originally has 20 dimensions, (2) red/blue points are abnormal/normal samples, (3) the horizontal axis denotes the reduced 1-dimensional space learned by a deep autoencoder, and (4) the vertical axis denotes the reconstruction error induced by the 1-dimensional representation.
|
| 22 |
+
|
| 23 |
+
In this paper, we propose Deep Autoencoding Gaussian Mixture Model (DAGMM), a deep learning framework that addresses the aforementioned challenges in unsupervised anomaly detection from several aspects.
|
| 24 |
+
|
| 25 |
+
First, DAGMM preserves the key information of an input sample in a low-dimensional space that includes features from both the reduced dimensions discovered by dimensionality reduction and the induced reconstruction error. From the example shown in Figure 1, we can see that anomalies differ from normal samples in two aspects: (1) anomalies can be significantly deviated in the reduced dimensions where their features are correlated in a different way; and (2) anomalies are harder to reconstruct, compared with normal samples. Unlike existing methods that only involve one of the aspects (Zimek et al. (2012); Zhai et al. (2016)) with sub-optimal performance, DAGMM utilizes a sub-network called compression network to perform dimensionality reduction by an autoencoder, which prepares a low-dimensional representation for an input sample by concatenating reduced low-dimensional features from encoding and the reconstruction error from decoding.
|
| 26 |
+
|
| 27 |
+
Second, DAGMM leverages a Gaussian Mixture Model (GMM) over the learned low-dimensional space to deal with density estimation tasks for input data with complex structures, which are yet rather difficult for simple models used in existing works (Zhai et al. (2016)). While GMM has strong capability, it also introduces new challenges in model learning. As GMM is usually learned by alternating algorithms such as Expectation-Maximization (EM) (Huber (2011)), it is hard to perform joint optimization of dimensionality reduction and density estimation favoring GMM learning, which is often degenerated into a conventional two-step approach. To address this training challenge, DAGMM utilizes a sub-network called estimation network that takes the low-dimensional input from the compression network and outputs mixture membership prediction for each sample. With the predicted sample membership, we can directly estimate the parameters of GMM, facilitating the evaluation of the energy/likelihood of input samples. By simultaneously minimizing reconstruction error from compression network and sample energy from estimation network, we can jointly train a dimensionality reduction component that directly helps the targeted density estimation task.
|
| 28 |
+
|
| 29 |
+
Finally, DAGMM is friendly to end-to-end training. Usually, it is hard to learn deep autoencoders by end-to-end training, as they can be easily stuck in less attractive local optima, so pre-training is widely adopted (Vincent et al. (2010); Yang et al. (2017a); Xie et al. (2016)). However, pre-training limits the potential to adjust the dimensionality reduction behavior because it is hard to make any significant change to a well-trained autoencoder via fine-tuning. Our empirical study demonstrates that, DAGMM is well-learned by the end-to-end training, as the regularization introduced by the estimation network greatly helps the autoencoder in the compression network escape from less attractive local optima.
|
| 30 |
+
|
| 31 |
+
Experiments on several public benchmark datasets demonstrate that, DAGMM has superior performance over state-of-the-art techniques, with up to $1 4 \%$ improvement of F1 score for anomaly detection. Moreover, we observe that the reconstruction error from the autoencoder in DAGMM by the end-to-end training is as low as the one made by its pre-trained counterpart, while the reconstruction error from an autoencoder without the regularization from the estimation network stays high. In addition, the end-to-end trained DAGMM significantly outperforms all the baseline methods that rely on pre-trained autoencoders.
|
| 32 |
+
|
| 33 |
+
# 2 RELATED WORK
|
| 34 |
+
|
| 35 |
+
Tremendous effort has been devoted to unsupervised anomaly detection (Chandola et al. (2009)), and the existing methods can be grouped into three categories.
|
| 36 |
+
|
| 37 |
+
Reconstruction based methods assume that anomalies are incompressible and thus cannot be effectively reconstructed from low-dimensional projections. Conventional methods in this category include Principal Component Analysis (PCA) (Jolliffe (1986)) with explicit linear projections, kernel PCA with implicit non-linear projections induced by specific kernels (Gunter et al.), and Robust PCA ¨ (RPCA) (Huber (2011); Candes et al. (2011)) that makes PCA less sensitive to noise by enforcing \` sparse structures. In addition, multiple recent works propose to analyze the reconstruction error induced by deep autoencoders, and demonstrate promising results (Zhou & Paffenroth (2017); Zhai et al. (2016)). However, the performance of reconstruction based methods is limited by the fact that they only conduct anomaly analysis from a single aspect, that is, reconstruction error. Although the compression on anomalous samples could be different from the compression on normal samples and some of them do demonstrate unusually high reconstruction errors, a significant amount of anomalous samples could also lurk with a normal level of error, which usually happens when the underlying dimensionality reduction methods have high model complexity or the samples of interest are noisy with complex structures. Even in these cases, we still have the hope to detect such “lurking” anomalies, as they still reside in low-density areas in the reduced low-dimensional space. Unlike the existing reconstruction based methods, DAGMM considers the both aspects, and performs density estimation in a low-dimensional space derived from the reduced representation and the reconstruction error caused by the dimensionality reduction, for a comprehensive view.
|
| 38 |
+
|
| 39 |
+
Clustering analysis is another popular category of methods used for density estimation and anomaly detection, such as multivariate Gaussian Models, Gaussian Mixture Models, $k$ -means, and so on (Barnett & Lewis (1984); Zimek et al. (2012); Kim & Scott (2011); Xiong et al. (2011)). Because of the curse of dimensionality, it is difficult to directly apply such methods to multi- or high- dimensional data. Traditional techniques adopt a two-step approach (Chandola et al. (2009)), where dimensionality reduction is conducted first, then clustering analysis is performed, and the two steps are separately learned. One of the drawbacks in the two-step approach is that dimensionality reduction is trained without the guidance from the subsequent clustering analysis, thus the key information for clustering analysis could be lost during dimensionality reduction. To address this issue, recent works propose deep autoencoder based methods in order to jointly learn dimensionality reduction and clustering components. However, the performance of the state-of-the-art methods is limited by over-simplified clustering models that are unable to handle clustering or density estimation tasks for data of complex structures, or the pre-trained dimensionality reduction component (i.e., autoencoder) has little potential to accommodate further adjustment by the subsequent fine-tuning for anomaly detection. DAGMM explicitly addresses these issues by a sub-network called estimation network that evaluates sample density in the low-dimensional space produced by its compression network. By predicting sample mixture membership, we are able to estimate the parameters of GMM without EM-like alternating procedures. Moreover, DAGMM is friendly to end-to-end training so that we can unleash the full potential of adjusting dimensionality reduction components and jointly improve the quality of clustering analysis/density estimation.
|
| 40 |
+
|
| 41 |
+
In addition, one-class classification approaches are also widely used for anomaly detection. Under this framework, a discriminative boundary surrounding the normal instances is learned by algorithms, such as one-class SVM (Chen et al. (2001); Song et al. (2002); Williams et al. (2002)). When the number of dimensions grows higher, such techniques usually suffer from suboptimal performance due to the curse of dimensionality. Unlike these methods, DAGMM estimates data density in a jointly learned low-dimensional space for more robust anomaly detection.
|
| 42 |
+
|
| 43 |
+
There has been growing interest in joint learning of dimensionality reduction (feature selection) and Gaussian mixture modeling. Yang et al. (2014; 2017b) propose a method that jointly learns linear dimensionality reduction and GMM. Paulik (2013) studies how to perform better feature selection with a pre-trained GMM as a regularizer. Variani et al. (2015) and Zhang & Woodland (2017) propose joint learning frameworks, where the parameters of GMM are directly estimated through supervision information in speech recognition applications. Tuske et al. (2015a;b) investigate ¨ how to use log-linear mixture models to approximate GMM posterior under the conditions that a class/mixture prior distribution is given and a covariance matrix is globally shared. Unlike the existing works, we focus on unsupervised settings: DAGMM extracts useful features for anomaly detection through non-linear dimensionality reduction realized by a deep autoencoder, and jointly learns their density under the GMM framework by mixture membership estimation, for which DAGMM can be viewed as a more powerful deep unsupervised version of adaptive mixture of experts (Jacobs et al. (1991)) in combination with a deep autoencoder. More importantly, DAGMM combines induced reconstruction error and learned latent representation for unsupervised anomaly detection.
|
| 44 |
+
|
| 45 |
+
# 3 DEEP AUTOENCODING GAUSSIAN MIXTURE MODEL
|
| 46 |
+
|
| 47 |
+
# 3.1 OVERVIEW
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
Figure 2: An overview on Deep Autoencoding Gaussian Mixture Model
|
| 51 |
+
|
| 52 |
+
Deep Autoencoding Gaussian Mixture Model (DAGMM) consists of two major components: a compression network and an estimation network. As shown in Figure 2, DAGMM works as follows: (1) the compression network performs dimensionality reduction for input samples by a deep autoencoder, prepares their low-dimensional representations from both the reduced space and the reconstruction error features, and feeds the representations to the subsequent estimation network; (2) the estimation network takes the feed, and predicts their likelihood/energy in the framework of Gaussian Mixture Model (GMM).
|
| 53 |
+
|
| 54 |
+
# 3.2 COMPRESSION NETWORK
|
| 55 |
+
|
| 56 |
+
The low-dimensional representations provided by the compression network contains two sources of features: (1) the reduced low-dimensional representations learned by a deep autoencoder; and (2) the features derived from reconstruction error. Given a sample $\mathbf { x }$ , the compression network computes its low-dimensional representation $\mathbf { z }$ as follows.
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\begin{array} { r } { \mathbf { z } _ { c } = h ( \mathbf { x } ; \boldsymbol { \theta } _ { e } ) , } \end{array}
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { r l } & { \mathbf { z } ^ { \prime } = g ( \mathbf { z } _ { c } ; \boldsymbol { \theta } _ { d } ) , } \\ & { \mathbf { z } _ { r } = f ( \mathbf { x } , \mathbf { x } ^ { \prime } ) , } \\ & { \mathbf { z } = [ \mathbf { z } _ { c } , \mathbf { z } _ { r } ] , } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $\mathbf { z } _ { c }$ is the reduced low-dimensional representation learned by the deep autoencoder, ${ \bf z } _ { r }$ includes the features derived from the reconstruction error, $\theta _ { e }$ and $\theta _ { d }$ are the parameters of the deep autoencoder, $\mathbf { x } ^ { \prime }$ is the reconstructed counterpart of $\mathbf { x }$ , $h ( \cdot )$ denotes the encoding function, $g ( \cdot )$ denotes the decoding function, and $f ( \cdot )$ denotes the function of calculating reconstruction error features. In particular, $\mathbf { z } _ { r }$ can be multi-dimensional, considering multiple distance metrics such as absolute Euclidean distance, relative Euclidean distance, cosine similarity, and so on. In the end, the compression network feeds $\mathbf { z }$ to the subsequent estimation network.
|
| 67 |
+
|
| 68 |
+
# 3.3 ESTIMATION NETWORK
|
| 69 |
+
|
| 70 |
+
Given the low-dimensional representations for input samples, the estimation network performs density estimation under the framework of GMM.
|
| 71 |
+
|
| 72 |
+
In the training phase with unknown mixture-component distribution $\phi$ , mixture means $\mu$ , and mixture covariance $\pmb { \Sigma }$ , the estimation network estimates the parameters of GMM and evaluates the likelihood/energy for samples without alternating procedures such as EM (Zimek et al. (2012)). The estimation network achieves this by utilizing a multi-layer neural network to predict the mixture membership for each sample. Given the low-dimensional representations $\mathbf { z }$ and an integer $K$ as the number of mixture components, the estimation network makes membership prediction as follows.
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\mathbf { p } = M L N ( \mathbf { z } ; \theta _ { m } ) , \hat { \gamma } = \mathrm { s o f t m a x } ( \mathbf { p } ) ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $\hat { \gamma }$ is a $K$ -dimensional vector for the soft mixture-component membership prediction, and $\mathbf { p }$ is the output of a multi-layer network parameterized by $\theta _ { m }$ . Given a batch of $N$ samples and their membership prediction, $\forall 1 \leq k \leq K$ , we can further estimate the parameters in GMM as follows.
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\hat { \phi } _ { k } = \sum _ { i = 1 } ^ { N } \frac { \hat { \gamma } _ { i k } } { N } , \qquad \hat { \mu } _ { k } = \frac { \sum _ { i = 1 } ^ { N } \hat { \gamma } _ { i k } { \bf z } _ { i } } { \sum _ { i = 1 } ^ { N } \hat { \gamma } _ { i k } } , \qquad \hat { \bf \mu } _ { k } = \frac { \sum _ { i = 1 } ^ { N } \hat { \gamma } _ { i k } \bigl ( { \bf z } _ { i } - \hat { \mu } _ { k } \bigr ) \bigl ( { \bf z } _ { i } - \hat { \mu } _ { k } \bigr ) ^ { T } } { \sum _ { i = 1 } ^ { N } \hat { \gamma } _ { i k } } .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $\hat { \gamma } _ { i }$ is the membership prediction for the low-dimensional representation $\mathbf { z } _ { i }$ , and $\hat { \phi } _ { k } , \hat { \mu } _ { k } , \hat { \Sigma } _ { k }$ are mixture probability, mean, covariance for component $k$ in GMM, respectively.
|
| 85 |
+
|
| 86 |
+
With the estimated parameters, sample energy can be further inferred by
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
E ( \mathbf { z } ) = - \log \bigg ( \sum _ { k = 1 } ^ { K } \hat { \phi } _ { k } \frac { \exp \big ( - \frac { 1 } { 2 } ( \mathbf { z } - \hat { \mu } _ { k } ) ^ { T } \hat { \Sigma } _ { k } ^ { - 1 } ( \mathbf { z } - \hat { \mu } _ { k } ) \big ) } { \sqrt { | 2 \pi \hat { \Sigma } _ { k } | } } \bigg ) .
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $| \cdot |$ denotes the determinant of a matrix.
|
| 93 |
+
|
| 94 |
+
In addition, during the testing phase with the learned GMM parameters, it is straightforward to estimate sample energy, and predict samples of high energy as anomalies by a pre-chosen threshold.
|
| 95 |
+
|
| 96 |
+
# 3.4 OBJECTIVE FUNCTION
|
| 97 |
+
|
| 98 |
+
Given a dataset of $N$ samples, the objective function that guides DAGMM training is constructed as follows.
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
J ( \theta _ { e } , \theta _ { d } , \theta _ { m } ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } L ( \mathbf { x } _ { i } , \mathbf { x } _ { i } ^ { \prime } ) + \frac { \lambda _ { 1 } } { N } \sum _ { i = 1 } ^ { N } E ( \mathbf { z } _ { i } ) + \lambda _ { 2 } P ( \hat { \mathbf { \mathbf { \ x } } } ) .
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
This objective function includes three components.
|
| 105 |
+
|
| 106 |
+
• $L ( \mathbf { x } _ { i } , \mathbf { x } _ { i } ^ { \prime } )$ is the loss function that characterizes the reconstruction error caused by the deep autoencoder in the compression network. Intuitively, if the compression network could make the reconstruction error low, the low-dimensional representation could better preserve the key information of input samples. Therefore, a compression network of lower reconstruction error is always desired. In practice, $L _ { 2 }$ -norm usually gives desirable results, as $L ( \mathbf { x } _ { i } , \mathbf { x } _ { i } ^ { \prime } ) = \left. \mathbf { x } _ { i } - \mathbf { x } _ { i } ^ { \prime } \right. _ { 2 } ^ { 2 }$ . $E ( \mathbf { z } _ { i } )$ models the probabilities that we could observe the input samples. By minimizing the sample energy, we look for the best combination of compression and estimation networks that maximize the likelihood to observe input samples.
|
| 107 |
+
|
| 108 |
+
• DAGMM also has the singularity problem as in GMM: trivial solutions are triggered when the diagonal entries in covariance matrices degenerate to 0. To avoid this issue, we penalize $\begin{array} { r } { P ( \hat { \Sigma } ) \bar { = } \sum _ { k = 1 } ^ { K } \sum _ { j = 1 } ^ { d } \frac { 1 } { \hat { \Sigma } _ { k j j } } } \end{array}$ , where $d$ is the number of dimensions in the low-dimensional representations provided by the compression network. • $\lambda _ { 1 }$ and $\lambda _ { 2 }$ are the meta parameters in DAGMM. In practice, $\lambda _ { 1 } = 0 . 1$ and $\lambda _ { 2 } = 0 . 0 0 5$ usually render desirable results.
|
| 109 |
+
|
| 110 |
+
# 3.5 RELATION TO VARIATIONAL INFERENCE
|
| 111 |
+
|
| 112 |
+
In DAGMM, we leverage the estimation network to make membership prediction for each sample. From the view of probabilistic graphical models, the estimation network plays an analogous role of latent variable (i.e., sample membership) inference. Recently, neural variational inference (Mnih & Gregor (2014)) has been proposed to employ deep neural networks to tackle difficult latent variable inference problems, where exact model inference is intractable and conventional approximate methods cannot scale well. Theoretically, we can also adapt the membership prediction task of DAGMM into the framework of neural variational inference. For sample $\mathbf { x } _ { i }$ , the contribution of its compressed representation $\mathbf { z } _ { i }$ to the energy function can be upper-bounded as follows (Jordan et al. (1999)),
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { l } { { \displaystyle E ( { \bf z } _ { i } ) = - \log p ( { \bf z } _ { i } ) = - \log \sum _ { k } p ( { \bf z } _ { i } , k ) } \ ~ } \\ { { \displaystyle = - \log \sum _ { k } Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) \frac { p ( { \bf z } _ { i } , k ) } { Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) } } \ ~ } \\ { { \displaystyle \leq - \sum _ { k } Q _ { \theta _ { m } } ( k \mid { \bf z } _ { k } ) \log \frac { p ( { \bf z } _ { i } , k ) } { Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) } } \ ~ } \\ { { \displaystyle = - E Q _ { \theta _ { m } } \log p ( { \bf z } _ { i } , k ) - \log Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) ] \ ~ } } \\ { { \displaystyle = - E Q _ { \theta _ { m } } \log p ( { \bf z } _ { i } \mid k ) ] + \mathrm { K L } ( Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) \mid | p ( k ) ) } \ ~ } \\ { { \displaystyle = - \log p ( { \bf z } _ { i } ) + \mathrm { K L } ( Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) \mid p ( k \mid { \bf z } _ { i } ) ) } \ ~ } \\ { { \displaystyle = E ( { \bf z } _ { i } ) + \mathrm { K L } ( Q _ { \theta _ { m } } ( k \mid { \bf z } _ { i } ) \mid p ( k \mid { \bf z } _ { i } ) ) } \ ~ } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
where $Q _ { \theta _ { m } } ( k \mid \mathbf { z } _ { i } )$ is the estimation network that predicts the membership of $\mathbf { z } _ { i }$ , $\mathrm { K L } ( \cdot | | \cdot )$ is the Kullback-Leibler divergence between two input distributions, $p ( k ) = \phi _ { k }$ is the mixing coefficient to be estimated, and $p ( k \mid \mathbf { z } _ { i } )$ is the posterior probability distribution of mixture component $k$ given $\mathbf { z } _ { i }$
|
| 119 |
+
|
| 120 |
+
By minimizing the negative evidence lower bound in Equation (8), we can make the estimation network approximate the true posterior and tighten the bound of energy function. In DAGMM, we use Equation (6) as a part of the objective function instead of its upper bound in Equation (10) simply because the energy function of DAGMM is tractable and efficient to evaluate. Unlike neural variational inference that uses the deep estimation network to define a variational posterior distribution as described above, DAGMM explicitly employs the deep estimation network to parametrize a sampledependent prior distribution. In the history of machine learning research, there were research efforts towards utilizing neural networks to calculate sample membership in mixture models, such as adaptive mixture of experts (Jacobs et al. (1991)). From this perspective, DAGMM can be viewed as a powerful deep unsupervised version of adaptive mixture of experts in combination with a deep autoencoder.
|
| 121 |
+
|
| 122 |
+
# 3.6 TRAINING STRATEGY
|
| 123 |
+
|
| 124 |
+
Unlike existing deep autoencoder based methods (Yang et al. (2017a); Xie et al. (2016)) that rely on pre-training, DAGMM employs end-to-end training. First, in our study, we find that pre-trained compression networks suffer from limited anomaly detection performance, as it is difficult to make significant changes in the well-trained deep autoencoder to favor the subsequent density estimation tasks. Second, we also find that the compression network and estimation network could mutually boost each others’ performance. On one hand, with the regularization introduced by the estimation network, the deep autoencoder in the compression network learned by end-to-end training can reduce reconstruction error as low as the error from its pre-trained counterpart, which meanwhile cannot be achieved by simply performing end-to-end training with the deep autoencoder alone. On the other hand, with the well-learned low-dimensional representations from the compression network, the estimation network is able to make meaningful density estimations.
|
| 125 |
+
|
| 126 |
+
In Section 4.5, we employ an example from a public benchmark dataset to discuss the choice between pre-training and end-to-end training in DAGMM.
|
| 127 |
+
|
| 128 |
+
# 4 EXPERIMENTAL RESULTS
|
| 129 |
+
|
| 130 |
+
In this section, we use public benchmark datasets to demonstrate the effectiveness of DAGMM in unsupervised anomaly detection.
|
| 131 |
+
|
| 132 |
+
# 4.1 DATASET
|
| 133 |
+
|
| 134 |
+
Table 1: Statistics of the public benchmark datasets
|
| 135 |
+
|
| 136 |
+
<table><tr><td></td><td># Dimensions</td><td># Instances</td><td>Anomaly ratio (p)</td></tr><tr><td>KDDCUP</td><td>120</td><td>494,021</td><td>0.2</td></tr><tr><td>Thyroid</td><td>6</td><td>3,772</td><td>0.025</td></tr><tr><td>Arrhythmia</td><td>274</td><td>452</td><td>0.15</td></tr><tr><td>KDDCUP-Rev</td><td>120</td><td>121,597</td><td>0.2</td></tr></table>
|
| 137 |
+
|
| 138 |
+
We employ four benchmark datasets: KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev.
|
| 139 |
+
|
| 140 |
+
• KDDCUP. The KDDCUP99 10 percent dataset from the UCI repository (Lichman (2013)) originally contains samples of 41 dimensions, where 34 of them are continuous and 7 are categorical. For categorical features, we further use one-hot representation to encode them, and eventually we obtain a dataset of 120 dimensions. As $2 0 \%$ of data samples are labeled as “normal” and the rest are labeled as “attack”, “normal” samples are in a minority group; therefore, “normal” ones are treated as anomalies in this task.
|
| 141 |
+
|
| 142 |
+
• Thyroid. The Thyroid (Lichman (2013)) dataset is obtained from the ODDS repository 1. There are 3 classes in the original dataset. In this task, the hyperfunction class is treated as anomaly class and the other two classes are treated as normal class, because hyperfunction is a clear minority class.
|
| 143 |
+
|
| 144 |
+
• Arrhythmia. The Arrhythmia (Lichman (2013)) dataset is also obtained from the ODDS repository. The smallest classes, including 3, 4, 5, 7, 8, 9, 14, and 15, are combined to form the anomaly class, and the rest of the classes are combined to form the normal class.
|
| 145 |
+
|
| 146 |
+
• KDDCUP-Rev. This dataset is derived from KDDCUP. We keep all the data samples labeled as “normal” and randomly draw samples labeled as “attack” so that the ratio between “normal” and “attack” is $4 : 1$ . In this way, we obtain a dataset with anomaly ratio 0.2, where “attack” samples are in a minority group and treated as anomalies. Note that “attack” samples are not fixed, and we randomly draw “attack” samples in every single run.
|
| 147 |
+
|
| 148 |
+
Detailed information about the datasets is shown in Table 1.
|
| 149 |
+
|
| 150 |
+
# 4.2 BASELINE METHODS
|
| 151 |
+
|
| 152 |
+
We consider both traditional and state-of-the-art deep learning methods as baselines.
|
| 153 |
+
|
| 154 |
+
• OC-SVM. One-class support vector machine (Chen et al. (2001)) is a popular kernel-based method used in anomaly detection. In the experiment, we employ the widely adopted radial basis function (RBF) kernel in all the tasks. DSEBM-e. Deep structured energy based model (DSEBM) (Zhai et al. (2016)) is a state-ofthe-art deep learning method for unsupervised anomaly detection. In DSEBM-e, sample energy is leveraged as the criterion to detect anomalies.
|
| 155 |
+
• DSEBM-r. DSEBM-e and DSEBM-r (Zhai et al. (2016)) share the same core technique, but reconstruction error is used as the criterion in DSEBM-r for anomaly detection.
|
| 156 |
+
|
| 157 |
+
• DCN. Deep clustering network (DCN) (Yang et al. (2017a)) is a state-of-the-art clustering algorithm that regulates autoencoder performance by $\mathbf { k }$ -means. We adapt this technique to anomaly detection tasks. In particular, the distance between a sample and its cluster center is taken as the criterion for anomaly detection: samples that are farther from their cluster centers are more likely to be anomalies.
|
| 158 |
+
|
| 159 |
+
Moreover, we include the following DAGMM variants as baselines to demonstrate the importance of individual components in DAGMM.
|
| 160 |
+
|
| 161 |
+
• GMM-EN. In this variant, we remove the reconstruction error component from the objective function of DAGMM. In other words, the estimation network in DAGMM performs membership estimation without the constraints from the compression network. With the learned membership estimation, we infer sample energy by Equation (5) and (6) under the GMM framework. Sample energy is used as the criterion for anomaly detection.
|
| 162 |
+
PAE. We obtain this variant by removing the energy function from the objective function of DAGMM, and this DAGMM variant is equivalent to a deep autoenoder. To ensure the compression network is well trained, we adopt the pre-training strategy (Vincent et al. (2010)). Sample reconstruction error is the criterion for anomaly detection.
|
| 163 |
+
E2E-AE. This variant shares the same setting with PAE, but the deep autoencoder is learned by end-to-end training. Sample reconstruction error is the criterion for anomaly detection PAE-GMM-EM. This variant adopts a two-step approach. At step one, we learn the compression network by pre-training deep autoencoder. At step two, we use the output from the compression network to train the GMM by a traditional EM algorithm. The training procedures in the two steps are separated. Sample energy is used as the criterion for anomaly detection.
|
| 164 |
+
PAE-GMM. This variant also adopts a two-step approach. At step one, we learn the compression network by pre-training deep autoencoder. At step two, we use the output from the compression network to train the estimation network. The training procedures in the two steps are separated. Sample energy is used as the criterion for anomaly detection.
|
| 165 |
+
DAGMM-p. This variant is a compromise between DAGMM and PAE-GMM: we first train the compression network by pre-training, and then fine-tune DAGMM by end-to-end training. Sample energy is the criterion for anomaly detection.
|
| 166 |
+
DAGMM-NVI. The only difference between this variant and DAGMM is that this variant adopts the framework of neural variational inference (Mnih & Gregor (2014)) and replaces Equation (6) with the upper bound in Equation (10) as a part of the objective function.
|
| 167 |
+
|
| 168 |
+
# 4.3 DAGMM CONFIGURATION
|
| 169 |
+
|
| 170 |
+
In all the experiment, we consider two reconstruction features from the compression network: relative Euclidean distance and cosine similarity. Given a sample $\mathbf { x }$ and its reconstructed counterpart $\mathbf { x } ^ { \prime }$ , their relative Euclidean distance is defined as $\frac { \left\| \mathbf { x } - \mathbf { x } ^ { \prime } \right\| _ { 2 } } { \| \mathbf { x } \| _ { 2 } }$ , and the cosine similarity is derived by $\frac { \mathbf { x } \cdot \mathbf { x } ^ { \prime } } { \| \mathbf { x } \| _ { 2 } \| \mathbf { x } ^ { \prime } \| _ { 2 } }$ . In Appendix D, for readers of interest, we discuss why reconstruction features are important to DAGMM and how to select reconstruction features in practice.
|
| 171 |
+
|
| 172 |
+
The network structures of DAGMM used on individual datasets are summarized as follows.
|
| 173 |
+
|
| 174 |
+
• KDDCUP. For this dataset, its compression network provides 3 dimensional input to the estimation network, where one is the reduced dimension and the other two are from the reconstruction error. The estimation network considers a GMM with 4 mixture components for the best performance. In particular, the compression network runs with FC(120, 60, tanh)-FC(60, 30, tanh)-FC(30, 10, tanh)-FC(10, 1, none)-FC(1, 10, tanh)-FC(10, 30, tanh)-FC(30, 60, tanh)-FC(60, 120, none), and the estimation network performs with FC(3, 10, tanh)-Drop(0.5)-FC(10, 4, softmax). Thyroid. The compression network for this dataset also provides 3 dimensional input to the estimation network, and the estimation network employs 2 mixture components for the best performance. In particular, the compression network runs with FC(6, 12, tanh)-FC(12, 4, tanh)-FC(4, 1, none)-FC(1, 4, tanh)-FC(4, 12, tanh)-FC(12, 6, none), and the estimation network performs with FC(3, 10, tanh)-Drop(0.5)-FC(10, 2, softmax).
|
| 175 |
+
|
| 176 |
+
• Arrhythmia. The compression network for this dataset provides 4 dimensional input, where two of them are the reduced dimensions, and the estimation network adopts a setting of 2 mixture components for the best performance. In particular, the compression network runs with FC(274, 10, tanh)-FC(10, 2, none)-FC(2, 10, tanh)-FC(10, 274, none), and the estimation network performs with FC(4, 10, tanh)-Drop(0.5)-FC(10, 2, softmax).
|
| 177 |
+
|
| 178 |
+
• KDDCUP-Rev. For this dataset, its compression network provides 3 dimensional input to the estimation network, where one is the reduced dimension and the other two are from the reconstruction error. The estimation network considers a GMM with 2 mixture components for the best performance. In particular, the compression network runs with FC(120, 60, tanh)-FC(60, 30, tanh)-FC(30, 10, tanh)-FC(10, 1, none)-FC(1, 10, tanh)-FC(10, 30, tanh)-FC(30, 60, tanh)-FC(60, 120, none), and the estimation network performs with FC(3, 10, tanh)-Drop(0.5)-FC(10, 2, softmax).
|
| 179 |
+
|
| 180 |
+
where $\mathrm { F C } ( a , b , f )$ means a fully-connected layer with $a$ input neurons and $b$ output neurons activated by function $f$ (none means no activation function is used), and Drop $( p )$ denotes a dropout layer with keep probability $p$ during training.
|
| 181 |
+
|
| 182 |
+
All the DAGMM instances are implemented by tensorflow (Abadi et al. (2016)) and trained by Adam (Kingma & Ba (2015)) algorithm with learning rate 0.0001. For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the number of training epochs are 200, 20000, 10000, and 400, respectively. For the sizes of mini-batches, they are set as 1024, 1024, 128, and 1024, respectively. Moreover, in all the DAGMM instances, we set $\lambda _ { 1 }$ as 0.1 and $\lambda _ { 2 }$ as 0.005. For readers of interest, we discuss how $\lambda _ { 1 }$ and $\lambda _ { 2 }$ impact DAGMM in Appendix F.
|
| 183 |
+
|
| 184 |
+
For the baseline methods, we conduct exhaustive search to find the optimal meta parameters for them in order to achieve the best performance. We detail their exact configuration in Appendix A.
|
| 185 |
+
|
| 186 |
+
# 4.4 ACCURACY
|
| 187 |
+
|
| 188 |
+
Metric. We consider average precision, recall, and $F _ { 1 }$ score as intuitive ways to compare anomaly detection performance. In particular, based on the anomaly ratio suggested in Table 1, we select the threshold to identify anomalous samples. For example, when DAGMM performs on KDDCUP, the top $2 0 \%$ samples of the highest energy will be marked as anomalies. We take anomaly class as positive, and define precision, recall, and $F _ { 1 }$ score accordingly.
|
| 189 |
+
|
| 190 |
+
In the first set of experiment, we follow the setting in (Zhai et al. (2016)) with completely clean training data: in each run, we take $5 0 \%$ of data by random sampling for training with the rest $5 0 \%$ reserved for testing, and only data samples from the normal class are used for training models.
|
| 191 |
+
|
| 192 |
+
Table 2 reports the average precision, recall, and $F _ { 1 }$ score after 20 runs for DAGMM and its baselines. In general, DAGMM demonstrates superior performance over the baseline methods in terms of $F _ { 1 }$ score on all the datasets. Especially on KDDCUP and KDDCUP-Rev, DAGMM achieves $1 4 \%$ and $1 0 \%$ improvement at $F _ { 1 }$ score, compared with the existing methods. For OC-SVM, the curse of dimensionality could be the main reason that limits its performance. For DSEBM, while it works reasonably well on multiple datasets, DAGMM outperforms as both latent representation and reconstruction error are jointly considered in energy modeling. For DCN, PAE-GMM, and DAGMM-p, their performance could be limited by the pre-trained deep autoencoders. When a deep autoencoder is well-trained, it is hard to make any significant change on the reduced dimensions and favor the subsequent density estimation tasks. For GMM-EN, without the reconstruction constraints, it seems difficult to perform reasonable density estimation. In terms of PAE, the single view of reconstruction error may not be sufficient for anomaly detection tasks. For E2E-AE, we observe that it is unable to reduce reconstruction error as low as PAE and DAGMM do on KDDCUP, KDDCUP-Rev, and Thyroid. As the key information of data could be lost during dimensionality reduction, E2E-AE suffers poor performance on KDDCUP and Thyroid. In addition, the performance of DAGMM and DAGMM-NVI is quite similar. As GMM is a fairly simple graphical model, we cannot spot significant improvement brought by neural variational inference in DAGMM. In Appendix B, for readers of interest, we show the cumulative distribution functions of the energy function learned by DAGMM for all the datasets under the setting of clean training data.
|
| 193 |
+
|
| 194 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">KDDCUP</td><td colspan="3">Thyroid</td></tr><tr><td>Precision</td><td>Recall</td><td>F1</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>OC-SVM</td><td>0.7457</td><td>0.8523</td><td>0.7954</td><td>0.3639</td><td>0.4239</td><td>0.3887</td></tr><tr><td>DSEBM-r</td><td>0.1972</td><td>0.2001</td><td>0.1987</td><td>0.0404</td><td>0.0403</td><td>0.0403</td></tr><tr><td>DSEBM-e</td><td>0.7369</td><td>0.7477</td><td>0.7423</td><td>0.1319</td><td>0.1319</td><td>0.1319</td></tr><tr><td>DCN</td><td>0.7696</td><td>0.7829</td><td>0.7762</td><td>0.3319</td><td>0.3196</td><td>0.3251</td></tr><tr><td>GMM-EN</td><td>0.1932</td><td>0.1967</td><td>0.1949</td><td>0.0213</td><td>0.0227</td><td>0.0220</td></tr><tr><td>PAE</td><td>0.7276</td><td>0.7397</td><td>0.7336</td><td>0.1894</td><td>0.2062</td><td>0.1971</td></tr><tr><td>E2E-AE</td><td>0.0024</td><td>0.0025</td><td>0.0024</td><td>0.1064</td><td>0.1316</td><td>0.1176</td></tr><tr><td>PAE-GMM-EM</td><td>0.7183</td><td>0.7311</td><td>0.7246</td><td>0.4745</td><td>0.4538</td><td>0.4635</td></tr><tr><td>PAE-GMM</td><td>0.7251</td><td>0.7384</td><td>0.7317</td><td>0.4532</td><td>0.4881</td><td>0.4688</td></tr><tr><td>DAGMM-p</td><td>0.7579</td><td>0.7710</td><td>0.7644</td><td>0.4723</td><td>0.4725</td><td>0.4713</td></tr><tr><td>DAGMM-NVI</td><td>0.9290</td><td>0.9447</td><td>0.9368</td><td>0.4383</td><td>0.4587</td><td>0.4470</td></tr><tr><td>DAGMM</td><td>0.9297</td><td>0.9442</td><td>0.9369</td><td>0.4766</td><td>0.4834</td><td>0.4782</td></tr><tr><td rowspan="2">Method</td><td colspan="3">Arrhythmia</td><td colspan="3">KDDCUP-Rev</td></tr><tr><td>Precision</td><td>Recall</td><td>F1</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>OC-SVM</td><td>0.5397</td><td>0.4082</td><td>0.4581</td><td>0.7148</td><td>0.9940</td><td>0.8316</td></tr><tr><td>DSEBM-r</td><td>0.1515</td><td>0.1513</td><td>0.1510</td><td>0.2036</td><td>0.2036</td><td>0.2036</td></tr><tr><td>DSEBM-e</td><td>0.4667</td><td>0.4565</td><td>0.4601</td><td>0.2212</td><td>0.2213</td><td>0.2213</td></tr><tr><td>DCN</td><td>0.3758</td><td>0.3907</td><td>0.3815</td><td>0.2875</td><td>0.2895</td><td>0.2885</td></tr><tr><td>GMM-EN</td><td>0.3000</td><td>0.2792</td><td>0.2886</td><td>0.1846</td><td>0.1746</td><td>0.1795</td></tr><tr><td>PAE</td><td>0.4393</td><td>0.4437</td><td>0.4403</td><td>0.7835</td><td>0.7817</td><td>0.7826</td></tr><tr><td>E2E-AE</td><td>0.4667</td><td>0.4538</td><td>0.4591</td><td>0.7434</td><td>0.7463</td><td>0.7448</td></tr><tr><td>PAE-GMM-EM</td><td>0.3970</td><td>0.4168</td><td>0.4056</td><td>0.2822</td><td>0.2847</td><td>0.2835</td></tr><tr><td>PAE-GMM</td><td>0.4575</td><td>0.4823</td><td>0.4684</td><td>0.6307</td><td>0.6278</td><td>0.6292</td></tr><tr><td>DAGMM-p</td><td>0.4909</td><td>0.4679</td><td>0.4787</td><td>0.2750</td><td>0.2810</td><td>0.2780</td></tr><tr><td>DAGMM-NVI</td><td>0.5091</td><td>0.4892</td><td>0.4981</td><td>0.9211</td><td>0.9211</td><td>0.9211</td></tr><tr><td>DAGMM</td><td>0.4909</td><td>0.5078</td><td>0.4983</td><td>0.9370</td><td>0.9390</td><td>0.9380</td></tr></table>
|
| 195 |
+
|
| 196 |
+
Table 2: Average precision, recall, and $F _ { 1 }$ from DAGMM and the baseline methods. For each metric, the best result is shown in bold.
|
| 197 |
+
|
| 198 |
+
In the second set of experiment, we investigate how DAGMM responds to contaminated training data. In each run, we reserve $5 0 \%$ of data by random sampling for testing. For the rest $5 0 \%$ , we take all samples from the normal class mixed with $c \%$ of samples from the anomaly class for model training.
|
| 199 |
+
Table 3: Anomaly detection results on contaminated training data from KDDCUP
|
| 200 |
+
|
| 201 |
+
<table><tr><td rowspan="2">Ratio c</td><td colspan="3">DAGMM</td><td colspan="3">DCN</td></tr><tr><td>Precision</td><td>Recall</td><td>F1</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>1%</td><td>0.9201</td><td>0.9337</td><td>0.9268</td><td>0.7585</td><td>0.7611</td><td>0.7598</td></tr><tr><td>2%</td><td>0.9186</td><td>0.9340</td><td>0.9262</td><td>0.7380</td><td>0.7424</td><td>0.7402</td></tr><tr><td>3%</td><td>0.9132</td><td>0.9272</td><td>0.9201</td><td>0.7163</td><td>0.7293</td><td>0.7228</td></tr><tr><td>4%</td><td>0.8837</td><td>0.8989</td><td>0.8912</td><td>0.6971</td><td>0.7106</td><td>0.7037</td></tr><tr><td>5%</td><td>0.8504</td><td>0.8643</td><td>0.8573</td><td>0.6763</td><td>0.6893</td><td>0.6827</td></tr><tr><td rowspan="2">Ratio c</td><td colspan="3">DSEBM-e</td><td colspan="3">OC-SVM</td></tr><tr><td>Precision</td><td>Recall</td><td>F1</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>1%</td><td>0.6995</td><td>0.7135</td><td>0.7065</td><td>0.7129</td><td>0.6785</td><td>0.6953</td></tr><tr><td>2%</td><td>0.6780</td><td>0.6876</td><td>0.6827</td><td>0.6668</td><td>0.5207</td><td>0.5847</td></tr><tr><td>3%</td><td>0.6213</td><td>0.6367</td><td>0.6289</td><td>0.6393</td><td>0.4470</td><td>0.5261</td></tr><tr><td>4%</td><td>0.5704</td><td>0.5813</td><td>0.5758</td><td>0.5991</td><td>0.3719</td><td>0.4589</td></tr><tr><td>5%</td><td>0.5345</td><td>0.5375</td><td>0.5360</td><td>0.1155</td><td>0.3369</td><td>0.1720</td></tr></table>
|
| 202 |
+
|
| 203 |
+
Table 3 reports the average precision, recall, and $F _ { 1 }$ score after 20 runs of DAGMM, DCN, DSEBMe, and OC-SVM on the KDDCUP dataset, respectively. As expected, contaminated training data negatively affect detection accuracy. When contamination ratio $c$ increases from $1 \%$ to $5 \%$ , average precision, recall, and $F _ { 1 }$ score decrease for all the methods. Meanwhile, we notice that DAGMM is able to maintain good detection accuracy with $5 \%$ contaminated data. For OC-SVM, we adopt the same parameter setting used in the experiment with clean training data, and observe that OC-SVM is more sensitive to contamination ratio. In order to receive better detection accuracy, it is important to train a model with high-quality data (i.e., clean or keeping contamination ratio as low as possible).
|
| 204 |
+
|
| 205 |
+
In sum, the DAGMM learned by end-to-end training achieves the state-of-the-art accuracy on the public benchmark datasets, and provides a promising alternative for unsupervised anomaly detection.
|
| 206 |
+
|
| 207 |
+
# 4.5 VISUALIZATION ON THE LEARNED LOW-DIMENSIONAL REPRESENTATION
|
| 208 |
+
|
| 209 |
+
In this section, we use an example to demonstrate the advantage of DAGMM learned by end-to-end training, compared with the baselines that rely on pre-trained deep autoencoders.
|
| 210 |
+
|
| 211 |
+

|
| 212 |
+
Figure 3: KDDCUP samples in the learned 3-dimensional space by DAGMM, PAE, DAGMM-p, and DCN, where red points are samples from anomaly class and blue ones are samples from normal class
|
| 213 |
+
|
| 214 |
+
Figure 3 shows the low-dimensional representation learned by DAGMM, PAE, DAGMM-p, and DCN, from one of the experiment runs on the KDDCUP dataset. First, we can see from Figure 3a that DAGMM can better separate anomalous samples from normal samples in the learned low-dimensional space, while anomalies overlap more with normal samples in the low-dimensional space learned by PAE, DAGMM-p, or DCN. Second, Even if DAGMM-p and DCN take effort to fine-tune the pre-trained deep autoencoder by its estimation network or $\mathbf { k }$ -means regularization, one could barely see significant change among Figure 3b, Figure 3c, and Figure 3d, where many anomalous samples are still mixed with normal samples. Indeed, when a deep autoencoder is pre-trained, it tends to be stuck in a good local optima for the purpose of reconstruction only, but it could be suboptimal for the subsequent density estimation tasks. In addition, in our study, we find that the reconstruction error in a trained DAGMM is as low as the error received from a pre-trained deep autoencoder (e.g., around 0.26 in terms of per-sample reconstruction error for KDDCUP). Meanwhile, we also observe that it is difficult to reduce the reconstruction error for a deep autoencoder of the identical structure by endto-end training (e.g., around 1.13 in terms of per-sample reconstruction error for KDDCUP). In other words, the compression network and estimation network mutually boost each others’ performance during end-to-end training: the regularization introduced by the estimation network helps the deep autoencoder escape from less attractive local optima for better compression, while the compression network feeds more meaningful low-dimensional representations to estimation network for robust density estimation. In Appendix C, for readers of interest, we show the visualization of the latent representation learned by DSEBM.
|
| 215 |
+
|
| 216 |
+
In summary, our experimental results show that DAGMM suggests a promising direction for density estimation and anomaly detection, where one can combine the forces of dimensionality reduction and density estimation by end-to-end training.
|
| 217 |
+
|
| 218 |
+
In Appendix E, we provide another case study to discuss which kind of samples benefit more from joint training in DAGMM for readers of interest.
|
| 219 |
+
|
| 220 |
+
# 5 CONCLUSION
|
| 221 |
+
|
| 222 |
+
In this paper, we propose the Deep Autoencoding Gaussian Mixture Model (DAGMM) for unsupervised anomaly detection. DAGMM consists of two major components: compression network and estimation network, where the compression network projects samples into a low-dimensional space that preserves the key information for anomaly detection, and the estimation network evaluates sample energy in the low-dimensional space under the framework of Gaussian Mixture Modeling. DAGMM is friendly to end-to-end training: (1) the estimation network predicts sample mixture membership so that the parameters in GMM can be estimated without alternating procedures; and (2) the regularization introduced by the estimation network helps the compression network escape from less attractive local optima and achieve low reconstruction error by end-to-end training. Compared with the pre-training strategy, the end-to-end training could be more beneficial for density estimation tasks, as we can have more freedom to adjust dimensionality reduction processes to favor the subsequent density estimation tasks. In the experimental study, DAGMM demonstrates superior performance over state-of-the-art techniques on public benchmark datasets with up to $1 4 \%$ improvement on the standard $F _ { 1 }$ score, and suggests a promising direction for unsupervised anomaly detection on multior high-dimensional data.
|
| 223 |
+
|
| 224 |
+
REFERENCES
|
| 225 |
+
Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for large-scale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
|
| 226 |
+
V. Barnett and T. Lewis. Outliers in statistical data. Wiley, 1984.
|
| 227 |
+
Emmanuel J. Candes, Xiaodong Li, Yi Ma, and John Wright. Robust principal component analysis? \` J. ACM, 58(3):11:1–11:37, 2011. ISSN 0004-5411.
|
| 228 |
+
Varun Chandola, Arindam Banerjee, and Vipin Kumar. Anomaly detection: A survey. ACM Comput. Surv, 41:15:1–15:58, 2009.
|
| 229 |
+
Yunqiang Chen, Xiang Sean Zhou, and Thomas S Huang. One-class svm for learning in image retrieval. In International Conference on Image Processing, volume 1, pp. 34–37, 2001.
|
| 230 |
+
Simon Gunter, Nicol N. Schraudolph, and S. V. N. Vishwanathan. Fast Iterative Kernel Principal ¨ Component Analysis. jmlr, 8:1893–1918.
|
| 231 |
+
Peter J Huber. Robust statistics. In International Encyclopedia of Statistical Science, pp. 1248–1251. Springer, 2011.
|
| 232 |
+
Robert A Jacobs, Michael I Jordan, Steven J Nowlan, and Geoffrey E Hinton. Adaptive mixtures of local experts. Neural computation, 3(1):79–87, 1991.
|
| 233 |
+
I. T. Jolliffe. Principal component analysis. In Principal Component Analysis. Springer Verlag, New York, 1986.
|
| 234 |
+
Michael I Jordan, Zoubin Ghahramani, Tommi S Jaakkola, and Lawrence K Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
|
| 235 |
+
Fabian Keller, Emmanuel Muller, and Klemens Bohm. Hics: High contrast subspaces for densitybased outlier ranking. In International Conference on Data Engineering, pp. 1037–1048. IEEE, 2012.
|
| 236 |
+
JooSeuk Kim and Clayton D. Scott. Robust kernel density estimation. CoRR, abs/1107.3133, 2011.
|
| 237 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference for Learning Representations, 2015.
|
| 238 |
+
M. Lichman. UCI machine learning repository, 2013. URL http://archive.ics.uci.edu/ ml.
|
| 239 |
+
Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation forest. In International Conference on Data Mining, pp. 413–422. IEEE, 2008.
|
| 240 |
+
Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In ICML, pp. 1791–1799, 2014.
|
| 241 |
+
Matthias Paulik. Lattice-based training of bottleneck feature extraction neural networks. In Interspeech, pp. 89–93, 2013.
|
| 242 |
+
Q. Song, W. J. Hu, and W. F. Xie. Robust support vector machine with bullet hole image classification. IEEE Trans. Systems, Man and Cybernetics, 32:440–448, 2002.
|
| 243 |
+
Swee Chuan Tan, Kai Ming Ting, and Tony Fei Liu. Fast anomaly detection for streaming data. In IJCAI Proceedings-International Joint Conference on Artificial Intelligence, volume 22, pp. 1511, 2011.
|
| 244 |
+
Zoltan T ´ uske, Pavel Golik, Ralf Schl ¨ uter, and Hermann Ney. Speaker adaptive joint training of ¨ gaussian mixture models and bottleneck features. In IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU), pp. 596–603, 2015a.
|
| 245 |
+
Zoltan T ´ uske, Muhammad Ali Tahir, Ralf Schl ¨ uter, and Hermann Ney. Integrating gaussian mixtures ¨ into deep neural networks: softmax layer with hidden variables. In ICASSP, pp. 4285–4289, 2015b.
|
| 246 |
+
|
| 247 |
+
Ehsan Variani, Erik McDermott, and Georg Heigold. A gaussian mixture model layer jointly optimized with discriminative features within a deep neural network architecture. In ICASSP, pp. 4270–4274, 2015.
|
| 248 |
+
|
| 249 |
+
Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research, 11(Dec):3371–3408, 2010.
|
| 250 |
+
|
| 251 |
+
Graham Williams, Rohan Baxter, Hongxing He, and Simon Hawkins. A comparative study of RNN for outlier detection in data mining. In Proceedings of ICDM02, pp. 709–712, 2002.
|
| 252 |
+
|
| 253 |
+
Junyuan Xie, Ross Girshick, and Ali Farhadi. Unsupervised deep embedding for clustering analysis. In International Conference on Machine Learning, pp. 478–487, 2016.
|
| 254 |
+
|
| 255 |
+
Liang Xiong, Barnabas P ´ oczos, and Jeff G. Schneider. Group anomaly detection using flexible genre ´ models. In Advances in Neural Information Processing Systems, pp. 1071–1079, 2011.
|
| 256 |
+
|
| 257 |
+
Bo Yang, Xiao Fu, Nicholas D Sidiropoulos, and Mingyi Hong. Towards k-means-friendly spaces: Simultaneous deep learning and clustering. In International Conference on Machine Learning, 2017a.
|
| 258 |
+
|
| 259 |
+
Xi Yang, Kaizhu Huang, and Rui Zhang. Unsupervised dimensionality reduction for gaussian mixture model. In International conference on neural information processing, pp. 84–92. Springer, 2014.
|
| 260 |
+
|
| 261 |
+
Xi Yang, Kaizhu Huang, John Yannis Goulermas, and Rui Zhang. Joint learning of unsupervised dimensionality reduction and gaussian mixture model. Neural Processing Letters, 45(3):791–806, 2017b.
|
| 262 |
+
|
| 263 |
+
Shuangfei Zhai, Yu Cheng, Weining Lu, and Zhongfei Zhang. Deep structured energy based models for anomaly detection. In International Conference on Machine Learning, pp. 1100–1109, 2016.
|
| 264 |
+
|
| 265 |
+
C. Zhang and P. C. Woodland. Joint optimisation of tandem systems using gaussian mixture density neural network discriminative sequence training. In ICASSP, pp. 5015–5019, 2017.
|
| 266 |
+
|
| 267 |
+
Chong Zhou and Randy C. Paffenroth. Anomaly detection with robust deep autoencoders. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 665–674, 2017.
|
| 268 |
+
|
| 269 |
+
Arthur Zimek, Erich Schubert, and Hans-Peter Kriegel. A survey on unsupervised outlier detection in high-dimensional numerical data. Statistical Analysis and Data Mining, 5:363–387, 2012.
|
| 270 |
+
|
| 271 |
+
A BASELINE CONFIGURATION
|
| 272 |
+
|
| 273 |
+
OC-SVM. Unlike other baselines that only need decision thresholds in the testing phase, OC-SVM needs parameter $\nu$ be set in the training phase. Although $\nu$ intuitively means anomaly ratio in training data, it is non-trivial to set a reasonable $\nu$ in the case where training data are all normal samples and anomaly ratio in the testing phase could be arbitrary. In this study, we simply perform exhaustive search to find the optimal $\nu$ that renders the highest $F _ { 1 }$ score on individual datasets. In particular, $\nu$ is set to be 0.1, 0.02, 0.04, and 0.1 for KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, respectively.
|
| 274 |
+
|
| 275 |
+
DSEBM. We use the network structure for the encoding in DAGMM as guidelines to set up DSEBM instances. For KDDCUP and KDDCUP-Rev, it is configured as FC(120, 60, softplus)-FC(60, 30, softplus)-FC(30, 10, softplus)-FC(10, 1, softplus). For Thyroid, it is FC(6, 12, softplus)-FC(12, 4, softplus)-FC(4, 1, softplus). For Arrhythmia, it is FC(274, 10, softplus)-FC(10, 2, softplus). Moreover, for KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches are 1024, 1024, 128, and 1024, respectively.
|
| 276 |
+
|
| 277 |
+
DCN. We use the network configuration for the autoencoder in DAGMM as guidelines to set up autoencoders in DCN. For KDDCUP and KDDCUP-Rev, the structure is FC(120, 60, tanh)-FC(60, 30, tanh)-FC(30, 10, tanh)-FC(10, 1, none)-FC(1, 10, tanh)-FC(10, 30, tanh)-FC(30, 60, tanh)- FC(60, 120, none). For Thyroid, it is FC(6, 12, tanh)-FC(12, 4, tanh)-FC(4, 1, none)-FC(1, 4, tanh)-FC(4, 12, tanh)-FC(12, 6, none). For Arrhythmia, it is FC(274, 10, tanh)-FC(10, 2, none)-FC(2, 10, tanh)-FC(10, 274, none). Moreover, for KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for per-layer pre-training are 200, 20000, 10000, and 400, respectively, the numbers of epochs for fine tuning are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches in all the training phases are 1024, 1024, 128, and 1024, respectively.
|
| 278 |
+
|
| 279 |
+
GMM-EN. GMM-EN also borrows the wisdom from the network configurations in DAGMM. For KDDCUP, it is FC(120, 60, tanh)-FC(60, 30, tanh)-FC(30, 10, tanh)-FC(10, 1, none)-FC(1, 10, tanh)-Drop(0.5)-FC(10, 4, softmax). For Thyroid, it is FC(6, 12, tanh)-FC(12, 4, tanh)-FC(4, 1, none)-FC(1, 10, tanh)-Drop(0.5)-FC(10, 2, softmax). For Arrhythmia, it is FC(274, 10, tanh)- FC(10, 2, none)-FC(2, 10, tanh)-Drop(0.5)-FC(10, 2, softmax). For KDDCUP-Rev, it is FC(120, 60, tanh)-FC(60, 30, tanh)-FC(30, 10, tanh)-FC(10, 1, none)-FC(1, 10, tanh)-Drop(0.5)-FC(10, 2, softmax). For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for training are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches are 1024, 1024, 128, and 1024, respectively.
|
| 280 |
+
|
| 281 |
+
PAE. PAE shares identical network structures with the autoencoder in DAGMM. For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for per-layer pre-training are 200, 20000, 10000, and 400, respectively, the numbers of epochs for fine tuning are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches in all the training phases are 1024, 1024, 128, and 1024, respectively.
|
| 282 |
+
|
| 283 |
+
E2E-AE. E2E-AE shares identical network structures with the autoencoder in DAGMM. For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for end-to-end training are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches are 1024, 1024, 128, and 1024, respectively.
|
| 284 |
+
|
| 285 |
+
PAE-GMM-EM. PAE-GMM and DAGMM share identical network configurations. For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for per-layer pre-training are 200, 20000, 10000, and 400, respectively, the numbers of epochs for fine tuning are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches in all the training phases are 1024, 1024, 128, and 1024, respectively. For GMM learning, the EM algorithm stops when the maximum difference of the parameters between current iteration and its previous iteration is smaller than $1 0 ^ { - 6 }$ .
|
| 286 |
+
|
| 287 |
+
PAE-GMM. PAE-GMM and DAGMM share identical network configurations. For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for per-layer pre-training are 200, 20000, 10000, and 400, respectively, the numbers of epochs for fine tuning or GMM training are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches in all the training phases are 1024, 1024, 128, and 1024, respectively.
|
| 288 |
+
|
| 289 |
+
DAGMM-p. DAGMM- $\mathrm { \bf p }$ and DAGMM share identical network configurations, but they are only different in training strategies: DAGMM adopts the strategy of end-to-end training, while DAGMM-p relies on pre-training to compression network and then joint fine-tuning. For KDDCUP, Thyroid, Arrhythmia, and KDDCUP-Rev, the numbers of epochs for per-layer pre-training are 200, 20000, 10000, and 400, respectively, the numbers of epochs for fine tuning are 200, 20000, 10000, and 400, respectively, and the sizes of mini-batches in all the training phases are 1024, 1024, 128, and 1024, respectively.
|
| 290 |
+
|
| 291 |
+
DAGMM-NVI. DAGMM and DAGMM-NVI share identical network configurations and training strategies as discussed in Section 4.
|
| 292 |
+
|
| 293 |
+
# B CUMULATIVE DISTRIBUTION FUNCTION OF THE ENERGY FUNCTION LEARNED BY DAGMM
|
| 294 |
+
|
| 295 |
+

|
| 296 |
+
Figure 4: The cumulative distribution functions of the energy function are learned by DAGMM on KDDCUP, Arrhythmia, Thyroid, and KDDCUP-Rev, respectively. The horizontal axis denotes the energy space, and the vertical axis denotes the percentage.
|
| 297 |
+
|
| 298 |
+
Figure 4 shows the cumulative distribution function (cdf) of the energy function learned by DAGMM on KDDCUP, Arrhythmia, Thyroid, and KDDCUP-Rev, respectively. In particular, on KDDCUP and KDDCUP-Rev, we observe rapid energy increase at around $8 0 \%$ , and most samples whose energy is beyond the 80th percentile are true anomalous samples.
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
Figure 5: KDDCUP samples in the reduced 1-dimensional space by DSEBM, where red points are samples from the anomaly class and blue ones are samples from the normal class
|
| 302 |
+
|
| 303 |
+
Figure 5 demonstrates the reduced 1-dimensional representation for KDDCUP samples learned by DSEBM, where Figure 5a includes all the samples and Figure 5b includes the normal samples only. As shown above, normal and anomalous samples are mixed in the range of $[ - 8 , - 7 . 8 ]$ . For samples in this range, it is difficult to use the energy derived from the latent representation to separate them.
|
| 304 |
+
|
| 305 |
+
# D RECONSTRUCTION FEATURES IN DAGMM
|
| 306 |
+
|
| 307 |
+
In this section, we detail the discussion on reconstruction features.
|
| 308 |
+
|
| 309 |
+
Why reconstruction features are important? We realize the importance of reconstruction features from our investigation on a private network security dataset. In this dataset, normal samples are normal network flows, and anomalies are network flows with spoofing attack. As it is difficult to analyze the samples from their original space with 20 dimensions, we utilize deep autoencoders to perform dimension reduction. In this case, we are a little bit ambitious, and reduce dimensions from 20 to 1. In the reduced 1-dimensional space, for some of the anomalies, we are able to easily separate them from normal samples. However, for the rest, their latent representations are quite similar to the representations of the normal samples. Meanwhile, in the original space, they are actually quite different from the normal ones. Inspired by this observation, we investigate their $L _ { 2 }$ reconstruction error, and obtain the plot shown in Figure 1. In Figure 1, the red points in the top-right corner are the anomalies sharing similar representations with the normal samples in the reduced space. With the additional view from reconstruction error, it becomes easier to separate these anomalies from the normal samples. In our study, this concrete example motivates us to include reconstruction features into DAGMM.
|
| 310 |
+
|
| 311 |
+
What are the guidelines for reconstruction feature selection? In practice, one can select reconstruction features by the following rules. First, for an error metric used to derive a reconstruction feature, its analytical form should be continuous and differentiable. Second, the output of an error metric should be in a range of relatively small values for the ease of training the estimation network in DAGMM. In the experiment of this paper, we select cosine similarity and relative Euclidean distance based on these two rules. For cosine similarity, it is continuous and differentiable, and the range of its output is $[ - 1 , 1 ]$ . For relative Euclidean distance, it is also continuous and differentiable. Theoretically, the range of its output is $[ 0 , + \infty )$ . On the datasets considered in the experiment, we observe that its output is usually a small positive value; therefore, we include this metric as one of the reconstruction features.
|
| 312 |
+
|
| 313 |
+
In sum, as long as an error metric meets the above two rules, it could serve as a candidate metric to derive a reconstruction feature for DAGMM.
|
| 314 |
+
|
| 315 |
+
# E CASE STUDY: WHEN JOINT TRAINING OUTPERFORMS DECOUPLED TRAINING?
|
| 316 |
+
|
| 317 |
+
In this section, we perform a case study to investigate what kind of samples benefit more from the joint training applied in DAGMM over decoupled training. In the evaluation, we employ PAE-GMM as a representative for the methods that leverage decoupled training, and the following results are generated from one run on the KDDCUP dataset.
|
| 318 |
+
|
| 319 |
+
<table><tr><td></td><td>PAE-GMM detect</td><td>PAE-GMM miss</td></tr><tr><td>DAGMM detect</td><td>34,285</td><td>12.038</td></tr><tr><td>DAGMM miss</td><td>1,640</td><td>926</td></tr></table>
|
| 320 |
+
|
| 321 |
+
Table 4: The comparison of anomaly detection results between DAGMM and PAE-GMM
|
| 322 |
+
|
| 323 |
+
Table 4 presents the comparison between DAGMM and PAE-GMM in terms of their anomaly detection results. In the testing data of this run, there are 48, 889 anomalies in total, where 34, 285 of them are detected by both techniques, 926 anomalies can be detected by neither of them, 1, 640 can only be detected by PAE-GMM, and 12, 038 of them can only be detected by DAGMM. Next, we drill deeper and investigate the commonalities of these 12, 038 anomalies that can only be detected by DAGMM.
|
| 324 |
+
|
| 325 |
+
Figure 6 illustrates sample distribution in the low-dimensional spaces learned by DAGMM and PAE-GMM, where Figure 6a (6b) includes all the normal samples and anomalies, Figure 6c (6d) includes all the normal samples and the anomalies detected by both techniques, and Figure 6e (6f) includes all the normal samples and the anomalies detected by DAGMM only. From Figure 6c and 6d, we observe that the anomalies of low cosine similarity and high relative Euclidean distance could be the easy ones that are captured by both techniques. For the difficult ones shown in Figure 6e and 6f, we observe that they usually have medium level of relative Euclidean distance (in the range of [1.0, 1.2] for both cases) with larger than 0.6 cosine similarity. For such anomalous samples, the model learned by PAE-GMM has difficult time to separate them from the normal samples. In addition, we also observe that the model learned by DAGMM tends to assign lower cosine similarity to such anomalies than PAE-GMM does, which also makes it easier to differentiate the anomalies from the normal samples.
|
| 326 |
+
|
| 327 |
+
# F HOW THE HYPERPARAMETERS IN THE OBJECTIVE FUNCTION IMPACT DAGMM
|
| 328 |
+
|
| 329 |
+
As shown in Equation (7), the objective function of DAGMM includes three components: the loss function from deep autoencoder, the energy function from estimation network, and the penalty function for covariance matrices. The coefficient ratio among the three components can be characterized as $1 : \lambda _ { 1 } : \lambda _ { 2 }$ . In terms of $\lambda _ { 1 }$ , a large value could make the loss function of deep autoencoder play little role in optimization so that we are unable to obtain a good reduced representation for input samples, while a small value could lead to ineffective estimation network so that GMM is not well trained. For $\lambda _ { 2 }$ of a large value, DAGMM tends to find GMM with large covariance, which is less desirable as many samples will have high energy as rare events. For $\lambda _ { 2 }$ of a small value, the regularization may not be strong enough to counter the singularity effect.
|
| 330 |
+
|
| 331 |
+
In our exploration, we find the ratio $1 : 0 . 1 : 0 . 0 0 5$ consistently delivers expected results across all the datasets in the experiment. To investigate the sensitivity of this ratio, we vary its base and see how different bases affect anomaly detection accuracy. For example, when the base is set to 2, $\lambda _ { 1 }$ and $\lambda _ { 2 }$ are adjusted to 0.2 and 0.01, respectively.
|
| 332 |
+
|
| 333 |
+
Table 5 shows the average precision, recall, and $F _ { 1 }$ score after 20 runs of DAGMM on the KDDCUP dataset. As we vary the base from 1 to 9 with step 2, DAGMM performs in a consistent way, and $\lambda _ { 1 }$ $\lambda _ { 2 }$ are not sensitive to the changes on the base.
|
| 334 |
+
|
| 335 |
+

|
| 336 |
+
Figure 6: KDDCUP samples in the learned 3-dimensional space by DAGMM and PAE-GMM, where red points are samples from anomaly class and blue ones are samples from normal class
|
| 337 |
+
|
| 338 |
+
Table 5: Sensitivity of $\lambda _ { 1 }$ and $\lambda _ { 2 }$ with fixed ratio $1 : 0 . 1 : 0 . 0 0 5$ on KDDCUP
|
| 339 |
+
|
| 340 |
+
<table><tr><td>Base</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>1</td><td>0.9298</td><td>0.9445</td><td>0.9371</td></tr><tr><td>3</td><td>0.9301</td><td>0.9442</td><td>0.9371</td></tr><tr><td>5</td><td>0.9296</td><td>0.9451</td><td>0.9373</td></tr><tr><td>7</td><td>0.9300</td><td>0.9453</td><td>0.9376</td></tr><tr><td>9</td><td>0.9300</td><td>0.9439</td><td>0.9369</td></tr></table>
|
md/train/BJfvAoC9YQ/BJfvAoC9YQ.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FEATURE TRANSFORMERS: A UNIFIED REPRESENTATION LEARNING FRAMEWORK FOR LIFELONG LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Despite the recent advances in representation learning, lifelong learning continues to be one of the most challenging and unconquered problems. Catastrophic forgetting and data privacy constitute two of the important challenges for a successful lifelong learner. Further, existing techniques are designed to handle only specific manifestations of lifelong learning, whereas a practical lifelong learner is expected to switch and adapt seamlessly to different scenarios. In this paper, we present a single, unified mathematical framework for handling the myriad variants of lifelong learning, while alleviating these two challenges. We utilize an external memory to store only the features representing past data and learn richer and newer representations incrementally through transformation neural networks - feature transformers. We define, simulate and demonstrate exemplary performance on a realistic lifelong experimental setting using the MNIST rotations dataset, paving the way for practical lifelong learners. To illustrate the applicability of our method in data sensitive domains like healthcare, we study the pneumothorax classification problem from X-ray images, achieving near gold standard performance. We also benchmark our approach with a number of state-of-the art methods on MNIST rotations and iCIFAR100 datasets demonstrating superior performance.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep learning algorithms have achieved tremendous success on various challenging tasks like object detection, language translation, medical image segmentation, etc. Lifelong learning - the ability to adapt, benefit and sustain performance post deployment with more data and feedback, is an important goal for artificial intelligence (AI) and extremely crucial for sustained utility of these algorithms in domains like healthcare (learning from rare cases), self driving (learning new object detectors), etc. While there is no single standard definition of lifelong learning, most of the research in this field can be classified into one of the following sub-categories:
|
| 12 |
+
|
| 13 |
+
1. Incremental learning - encountering new data, with no change in distribution, for same task
|
| 14 |
+
2. Domain adaptation - data from modified target distributions but for the same task
|
| 15 |
+
3. New-task learning - data from tasks that were not presented before
|
| 16 |
+
|
| 17 |
+
Majority of the successful techniques study these variants in isolation. However, a realistic lifelong learning scenario would involve a mixture of these manifestations over time. Another major impediment to a successful lifelong learner is data privacy. In domains like healthcare, it is near impossible to have data access beyond scope (both time and geography) which leads to catastophic forgetting (McCloskey & Cohen, 1989)- the inability of machine learning models to retain past knowledge while learning from new data. In this paper, we provide a unified framework - feature transformers - for practical lifelong learning to handle data privacy and catastrophic forgetting.
|
| 18 |
+
|
| 19 |
+
In summary, the major contributions of our work are as follows:
|
| 20 |
+
|
| 21 |
+
• Define a realistic and a challenging lifelong learning scenario and formulate a unique and generic mathematical framework - feature transformer, to work in this setting successfully. • Ensure data privacy by storing only features from previous episodes while successfully combating catastrophic forgetting.
|
| 22 |
+
|
| 23 |
+
• Principled way of utilizing additional neural-compute to tackle complex incremental tasks. • Demonstrate state-of-the-art results on common continuous learning benchmarks for new task learning like MNIST rotations, iCIFAR dataset and a challenging healthcare problem. Demonstrate exemplary performance even under severe constraints on memory and compute, thus operating under the assumptions of practical lifelong learning.
|
| 24 |
+
|
| 25 |
+
Following review of related work in section 2, we describe the mathematical formulation of feature transformers and their practical realization in section 3. Section 4 contains experiments and results, followed by discussion in section 5.
|
| 26 |
+
|
| 27 |
+
# 2 RELATED WORK
|
| 28 |
+
|
| 29 |
+
A conventional deep learning classifier can be viewed as an automatic feature extractor followed by a classifier, trained jointly. For lifelong learning, the methods in literature can be broadly classified into: 1) learning with fixed feature representations and 2) incrementally evolving representations.
|
| 30 |
+
|
| 31 |
+
Fixed Represenations: In this class of approaches, a representation for the data is learnt from the initial task and remains frozen for ensuing tasks, while only the classification layers are modified. The simplest baseline approaches include fine-tuning (Oquab et al., 2014) and Mensink et al. (2012) where the idea of using fixed representations was extended further by using the nearest class mean classifier. In spite of their simplicity, these algorithms do not perform well in practice due to the limiting constraint of a fixed representation throughout the incremental learning phase.
|
| 32 |
+
|
| 33 |
+
Incrementally evolving representations: The last few years have witnessed renewed interest in developing methods that allow changing data representation with the addition of new tasks. Naive methods of retraining with only new data suffer from catastrophic forgetting (McCloskey & Cohen, 1989). To overcome this problem, most methods have attempted different manifestations of rehearsal (Robins, 1995) - replaying data from the previous tasks. However, access to all the previous data is usually not feasible due to size, compute and privacy concerns, researchers have attempted to reproduce past through proxy information, known as pseudorehearsal. Pseudorehearsal techniques can be further classified depending on how the previous information is stored /used:
|
| 34 |
+
|
| 35 |
+
• Knowledge distillation based approaches: An example method for lifelong learning using knowledge distillation (Hinton et al., 2015) is learning without forgetting (LwF) (Li & Hoiem, 2017) - where distillation loss was added to match output of the updated network to that of the old network on the old task output variables. LwF and its extensions does not scale to a large number of new tasks, suffers from catastrophic forgetting and importantly do not address incremental learning or domain adapatation settings.
|
| 36 |
+
|
| 37 |
+
• Rehearsal using exemplar sets: Rebuffi et al. (2017) propose iCaRL, an incremental learning approach by storing an exemplar set of data from the previous tasks and augmenting it with the new data. In more recent works, Javed & Paracha (2018) and Castro et al. (2018) have argued that a decoupled nearest mean classifier from Rebuffi et al. (2017) is not essential and have proposed joint learning of feature extraction and classification. Lopez-Paz et al. (2017) propose Gradient Episodic Memory, a technique which stores data from previous classes and constrains the gradient update while learning new tasks.
|
| 38 |
+
|
| 39 |
+
• Rehearsal using generative models: Triki Rannen et al. (2017) propose to reproduce past knowledge by using task-specific under-complete autoencoders. When a new task is presented, optimization is constrained by preventing the reconstructions of these autoencoders from changing, thereby ensuring that the features necessary for the previous tasks are not destroyed. Shin et al. (2017); He et al. (2018); Venkatesan et al. (2017) employ generative adversarial networks for recreating the history from previous tasks.
|
| 40 |
+
|
| 41 |
+
• Network regularization strategies: Methods belonging to this class aim to identify and selectively modify parts of the neural network which are critical to remember past knowledge or by explicitly penalizing loss of performance on old tasks. Kirkpatrick et al. (2017); Liu et al. (2018) use the Fischer information matrix to identify the most crucial weights responsible for prediction of a given task and lower the learning rate for these tasks. Lee et al. (2017) propose a dynamically expanding network to increase the capacity for new tasks if the previous architecture is insufficient to represent the data.
|
| 42 |
+
|
| 43 |
+
Our framework lies at the intersection of pseudorehearsal methods and progressive neural networks, with scope for judiciously utilizing extra capacity, while resisting catastrophic forgetting.
|
| 44 |
+
|
| 45 |
+
# 3 LIFE-LONG LEARNING VIA FEATURE TRANSFORMATIONS
|
| 46 |
+
|
| 47 |
+
Before we present the feature transformer method, we introduce the terminologies and notations. We consider training a deep neural network which classifies an input to one of the classes $c \in [ C ] ^ { \triangleq }$ $\{ 1 , 2 , \cdots , C \}$ . We refer to the operation of classifying an input to a particular class as a task. To this end, the classifier is trained with training dataset $( X , Y )$ , drawn from a joint distribution $( \mathcal { X } , \mathcal { Y } )$ .
|
| 48 |
+
|
| 49 |
+
We view the deep neural network, defined by the parameters $( \theta , \kappa )$ , as the composition of a feature extractor $\Phi _ { \theta } : X \to F$ , and a classifier $\Psi _ { \kappa }$
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\Psi _ { \kappa } \circ \Phi _ { \theta } : X [ C ] ,
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where $\boldsymbol { X }$ is the space of input data, and $\pmb { F }$ is a space of low-dimensional feature vectors.
|
| 56 |
+
|
| 57 |
+
We concisely denote the training of the neural network by $\mathrm { T R A I N } ( \pmb \theta , \pmb \kappa ; ~ D )$ , which minimizes a loss function on training data $D = ( X , Y )$ and produces the network parameters $( \theta , \kappa )$ . Let us also define the set of all computed features on input ${ \mathcal { F } } = \Phi _ { \theta } ( X )$ . 1
|
| 58 |
+
|
| 59 |
+
When the loss function only penalizes misclassification, the network is expected to learn only the class separation boundaries in the feature space. However, as we demonstrate experimentally, good separation of class specific features enables stable learning of representations, which directly has a bearing on the performance of life-long learning. Therefore, in all our training procedures, we also use a feature loss which promotes feature separation
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\operatorname { m o d e l } \operatorname { l o s s } = \operatorname { c l a s s i f i c a t i o n } \operatorname { l o s s } _ { ( \theta , \kappa ) } + \lambda \cdot \operatorname { f e a t u r e - l o s s } _ { ( \theta ) } .
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
In the lifelong learning context, we denote the time varying aspect of the network, training data and the classes, by using the time symbol $t \in \mathbb { N } \triangleq \{ 0 , 1 , 2 , \cdots \}$ in superscript on these objects. Realistically, at any time $t > 0$ , the classifier encounters any of the following canonical situations:
|
| 66 |
+
|
| 67 |
+
1. The number of classes remain the same for the classifier as at $t - 1$ . The model encounters new training data for a subset of classes, without change in their distribution: $\forall t > 0$ , $C ^ { ( t ) } = C ^ { ( t - 1 ) }$ , ${ \mathcal { T } _ { 1 } ^ { ( t ) } \subseteq [ C ^ { ( t ) } ] }$ and $\in \mathcal { T } _ { 1 } ^ { ( t ) } , \ ( X _ { \tau } ^ { ( t ) } , \bar { Y } _ { \tau } ^ { ( t ) } ) \sim ( \mathcal { X } _ { \tau } ^ { ( t ) } , \mathcal { Y } _ { \tau } ^ { ( t ) } ) =$ $( \mathcal { X } _ { \tau } ^ { ( t - 1 ) } , \mathcal { Y } _ { \tau } ^ { ( t - 1 ) } )$ .
|
| 68 |
+
2. The number of classes remain the same for the classifier as at $t - 1$ . The model encounters new training data from modified input distribution(s), for a subset of classes: $\forall t > 0$ , $C ^ { ( t ) } = C ^ { ( t - 1 ) }$ , $\mathcal { T } _ { 2 } ^ { ( t ) } \subseteq [ C ^ { ( t ) } ]$ and $\forall \tau \in T _ { 2 } ^ { ( t ) }$ , $( X _ { \tau } ^ { ( t ) } , Y _ { \tau } ^ { ( t ) } ) \sim ( \mathcal { X } _ { \tau } ^ { ( t ) } , \mathcal { Y } _ { \tau } ^ { ( t ) } ) \neq$ $( \mathcal { X } _ { \tau } ^ { ( t - 1 ) } , \mathcal { Y } _ { \tau } ^ { ( t - 1 ) } )$ .
|
| 69 |
+
3. The model encounters new class(es) and corresponding new data: $\forall t \ > \ 0$ , $C ^ { ( t ) } >$ $C ^ { ( t - 1 ) }$ , $\mathcal { T } _ { 3 } ^ { ( t ) } = [ C ^ { ( t ) } ] \backslash [ C ^ { ( t - 1 ) } ]$ and $\forall \tau \in T _ { 3 } ^ { ( t ) }$ , $( \bar { X } _ { \tau } ^ { ( t ) } , \bar { Y _ { \tau } ^ { ( t ) } } ) \sim ( \mathcal { X } _ { \tau } ^ { ( t ) } , \mathcal { y } _ { \tau } ^ { ( t ) } )$ .
|
| 70 |
+
|
| 71 |
+
In the most generic scenario, a combination of all the three situations can occur at any time index $t$ , with training data available for the classes in the set $\mathcal { T } ^ { ( t ) } \triangleq \mathcal { T } _ { 1 } ^ { ( t ) } \cup \mathcal { T } _ { 2 } ^ { ( t ) } \cup \mathcal { T } _ { 3 } ^ { ( t ) }$ . However, it is important to note that at every index $t$ , the classifier is trained to classify all the $C ^ { ( t ) }$ classes.
|
| 72 |
+
|
| 73 |
+
# 3.1 FEATURE TRANSFORMATION BY AUGMENTING NETWORK CAPACITY
|
| 74 |
+
|
| 75 |
+
At any time $t - 1$ , the classifier is optimized to classify all the classes $[ C ^ { ( t - 1 ) } ]$ and also the set of features $\mathcal { F } ^ { ( t - 1 ) }$ are well separated according to classes. At $t$ , when new training data $D ^ { ( t ) } =$ $\cup _ { \tau \in \mathcal { T } ^ { ( t ) } } ( X _ { \tau } ^ { ( t ) } , Y _ { \tau } ^ { ( t ) } )$ is encountered, the features extracted using the previous feature extractor
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\partial \mathcal { F } ^ { ( t ) } = \cup _ { \tau \in \mathcal { T } ^ { ( t ) } } \left( \Phi _ { \theta ^ { ( t - 1 ) } } \big ( X _ { \tau } ^ { ( t ) } \big ) \right) ,
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
are not guaranteed to be optimized for classifying the new data and new classes. In order to achieve good performance on new data and classes, we propose to change the feature representation at time $t$ , just before the classification stage. We achieve this by defining a feature transformer
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\Phi _ { \Delta \theta ^ { ( t ) } } : { \cal F } ^ { ( t - 1 ) } { \cal F } ^ { ( t ) } ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
parameterized by $\Delta \pmb { \theta } ^ { ( t ) }$ , which maps any feature extracted by $\Phi _ { \pmb { \theta } ( t - 1 ) }$ to a new representation. The new feature extractor is now given by $\Phi _ { \theta ^ { ( t ) } } \triangleq \Phi _ { \Delta \theta ^ { ( t ) } } \circ \Phi _ { \theta ^ { ( t - 1 ) } }$ , where $\pmb { \theta } ^ { ( t ) } \triangleq \pmb { \theta } ^ { ( t - 1 ) } \cup \Delta \pmb { \theta } ^ { ( t ) }$ . Practically, this is realized by augmenting the capacity of the feature extractor at each time $t$ by using one or more fully connected layers2. It is however possible that $\Phi _ { \Delta \theta ^ { ( t ) } }$ could be simply an identity transform and feature transformers learnt in previous episodes could be adapted for new data. This helps in controlling the growth of network capacity over time and this aspect of our work is described in section 4.5.
|
| 88 |
+
|
| 89 |
+
The feature transformer is trained, along with a new classifier layer, using the composite loss function of the form in equation 2, by invoking $\mathrm { T R A I N } \big ( \Delta \pmb { \theta } ^ { ( t ) } , \pmb { \kappa } ^ { ( t ) } ; \mathbf { \Delta } D ^ { ( t ) } \big )$ , with $D ^ { ( t ) } \stackrel { \textstyle = } { \textstyle = } ( \partial \mathcal { F } ^ { ( t ) } , Y ^ { ( t ) } ) ^ { 3 }$ . This ensures that the classifier performs well on the new data. However, strikingly, training a feature transformer at $t$ does not involve changing the feature extractor $\Phi _ { \pmb { \theta } ( t - 1 ) }$ at all, and this helps us in alleviating catastrophic forgetting by efficiently making use of already computed features $\mathcal { F } ^ { ( t - 1 ) }$ through a memory module.
|
| 90 |
+
|
| 91 |
+
# 3.2 REMEMBERING HISTORY VIA MEMORY
|
| 92 |
+
|
| 93 |
+
The set of all extracted features $\mathcal { F } ^ { ( t - 1 ) }$ serves as a good abstraction of the model, for all the tasks and data encountered till $t - 1$ . Therefore, if $\mathcal { F } ^ { ( t - 1 ) }$ is available to the model when it encounters new tasks and data, then the feature transformer at $t$ can take advantage of this knowledge to retain the classification performance on previous tasks and data as well. To this end, we assume the availability of an un-ending memory module $\mathcal { M }$ , equipped with READ(), WRITE() and ERASE() procedures, that can store $\mathcal { F } ^ { ( t - 1 ) }$ and can retrieve the same at $t$ . In situations where memory is scarce, only a relevant subset of $\mathcal { F } ^ { ( t - 1 ) }$ can be stored and retrieved.
|
| 94 |
+
|
| 95 |
+
We train the feature transformer at any $t > 0$ by invoking $\mathrm { T R A I N } \big ( \Delta \pmb { \theta } ^ { ( t ) } , \pmb { \kappa } ^ { ( t ) } ; ~ \pmb { D } ^ { ( t ) } \big )$ , with the combined set of features
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
D ^ { ( t ) } = ( \partial \mathcal { F } ^ { ( t ) } \cup \mathcal { F } ^ { ( t - 1 ) } , \cup _ { t ^ { \prime } \in [ 1 , 2 , \cdots , t ] } Y ^ { ( t ^ { \prime } ) } ) , \forall t > 0 .
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
We then obtain the new set of features
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathcal { F } ^ { ( t ) } = \Phi _ { \Delta \theta ^ { ( t ) } } ( \partial \mathcal { F } ^ { ( t ) } ) \cup \Phi _ { \Delta \theta ^ { ( t ) } } ( \mathcal { F } ^ { ( t - 1 ) } ) ,
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
and replace $\mathcal { F } ^ { ( t - 1 ) }$ in memory by (a subset of) $\mathcal { F } ^ { ( t ) }$
|
| 108 |
+
|
| 109 |
+
With the assumption of infinite memory and capacity augmentation at every episode, our feature transformers framework is presented in algorithm 1.
|
| 110 |
+
|
| 111 |
+
# 3.3 FEATURE TRANSFORMERS IN ACTION
|
| 112 |
+
|
| 113 |
+
Before we present experimental results to demonstrate the ability of feature transformers for lifelong learning of new tasks, we first show how feature transformers operate when simply new episodes of data are presented. As described in section 3, we use a composite loss comprising of classification loss and feature loss to train the classifier. To promote feature clustering/separation, we propose to use center-loss as described in Wen et al. (2016).
|
| 114 |
+
|
| 115 |
+
Dropping the time index $t$ for the brevity, with the convention that the ground truth class for each $x$ is encoded using one-hot vector $\bar { y } = [ \dot { y _ { 1 } } , y _ { 2 } , \cdot \cdot \cdot , y _ { C } ] ^ { T }$ , and $( \Psi _ { \kappa } \circ \Phi _ { \theta } ( x ) ) _ { c }$ is the $c ^ { t h }$ component of the classifier output, we use the following loss function for all the classifier training procedures:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\log \left( \pmb { \theta } , \kappa \right) = - \sum _ { ( x , \bar { y } ) \in D } \sum _ { c \in [ C ] } y _ { c } \cdot \log \left( \left( \Psi _ { \kappa } \circ \Phi _ { \pmb { \theta } } ( x ) \right) _ { c } \right) + \lambda \cdot \sum _ { ( x , \bar { y } ) \in D } \sum _ { c \in [ C ] } \| \Phi _ { \pmb { \theta } } ( x ) - \mu _ { c } \| _ { 2 } ,
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $D = \cup _ { \tau \in \mathcal { T } } ( X _ { \tau } , Y _ { \tau } )$ is the given training data set, and $\pmb { \mu } _ { c }$ is the centroid of all features corresponding to input data labelled as $c$ .
|
| 122 |
+
|
| 123 |
+
Figure 1 provides snapshot of feature transformation algorithm when a new episode of data is encountered. We consider X-Ray lung images (from Wang et al. (2017a)) consisting of two classes: (i) normal and (ii) pneumothorax. At a time index $( t - 1 )$ , the classifier model is trained on 6000
|
| 124 |
+
|
| 125 |
+
Input Task set $\mathcal { T } ^ { ( t ) }$ , and training data $\cup _ { \tau \in \mathcal { T } ^ { ( t ) } } ( X _ { \tau } ^ { ( t ) } , Y _ { \tau } ^ { ( t ) } ) , \forall t \geq 0$ Output $( \pmb \theta ^ { ( t ) } , \pmb \kappa ^ { ( t ) } ) , \forall t$
|
| 126 |
+
|
| 127 |
+
$t \gets 0$ , ERASE $( \mathcal { M } )$ $D ^ { ( 0 ) } \gets \cup _ { \tau \in \mathcal { T } ^ { ( 0 ) } } ( X _ { \tau } ^ { ( 0 ) } , Y _ { \tau } ^ { ( 0 ) } )$ $\mathrm { T R A I N } \big ( { \pmb \theta } ^ { ( 0 ) } , { \pmb \kappa } ^ { ( 0 ) } ; D ^ { ( 0 ) } \big )$ $\mathcal { F } ^ { ( 0 ) } \cup _ { \tau \in \mathcal { T } ^ { ( 0 ) } } ( \Phi _ { \theta ^ { ( 0 ) } } ( X _ { \tau } ^ { ( 0 ) } ) )$ WRITE $( \mathcal { M } , ( \mathcal { F } ^ { ( 0 ) } , Y ^ { ( 0 ) } ) )$ )
|
| 128 |
+
|
| 129 |
+
$/ { } ^ { * }$ Set initial time, erase memory $^ { * } /$ $/ { } ^ { * }$ Obtain initial tasks and training data $^ { * } /$ $/ { } ^ { * }$ Train initial network $^ { * } /$ /\* Compute features $^ { * } /$ /\* Write features to memory $^ { * } /$
|
| 130 |
+
|
| 131 |
+
# while T RUE do
|
| 132 |
+
|
| 133 |
+
$t \gets t + 1$ , obtain $\mathscr { T } ^ { ( t ) } , \cup _ { \tau \in \mathcal { T } ^ { ( t ) } } ( X _ { \tau } ^ { ( t ) } , Y _ { \tau } ^ { ( t ) } )$ $/ { } ^ { * }$ Obtain current tasks and training data $^ { * } /$ Compute $\partial \mathcal { F } ^ { ( t ) }$ using equation 3 $/ *$ Compute old model features on new data $^ { * } /$ $( \mathcal { F } ^ { ( t - 1 ) } , Y ^ { ( t - 1 ) } ) \gets \mathtt { R E A D } ( \mathcal { M } )$ $/ { * }$ Read previously computed features from memory $^ { * } /$ Form $D ^ { ( t ) }$ using equation 5 /\* Form composite training data $^ { * } /$ $\mathrm { T R A I N } \big ( \Delta \pmb { \theta } ^ { ( t ) } , \bar { \pmb { \kappa } } ^ { ( t ) } ; D ^ { ( t ) } \big )$ /\* Train feature transformer $^ { * } /$ $\Phi _ { \theta ^ { ( t ) } } \gets \Phi _ { \Delta \theta ^ { ( t ) } } \circ \Phi _ { \theta ^ { ( t - 1 ) } }$ $/ *$ Obtain new feature extractor $^ { * } /$ Compute $\mathcal { F } ^ { ( t ) }$ using equation 6 $/ *$ Compute new features $^ { * } /$ $\mathrm { E R A S E } ( \mathcal { M } ) , \mathrm { W R I T E } ( \mathcal { M } , ( \mathcal { F } ^ { ( t ) } , \cup _ { t ^ { \prime } \in [ 1 , 2 , \cdots , t ] } Y ^ { ( t ^ { \prime } ) } ) )$ /\* Erase & write new features\*/
|
| 134 |
+
|
| 135 |
+
# end
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Algorithm 1: The life-long learning framework
|
| 139 |
+
Figure 1: Visual depiction of feature transformation process on new episodes.
|
| 140 |
+
|
| 141 |
+
images with the loss in equation 7. As shown by the t-SNE plot (A), the feature extractor $\Phi _ { \pmb { \theta } ( t - 1 ) }$ produces features which are well-separated, and these features get stored in memory $\mathcal { M }$ . However, at time $t$ , when a set of 2000 new images is encountered, $\Phi _ { \pmb { \theta } ^ { ( t - 1 ) } }$ produces features that are scattered (t-SNE plot (B)). To improve the separation on the new data, the feature transformer is trained using the (well-separated) features in $\mathcal { M }$ as well as poorly separated features (from new data), with the loss function promoting good separation in new representation. This ensures that all the 8000 images seen until time $t$ is well separated (t-SNE plots (C) and (D)). This is repeated for all time indices $t$ . Thus, the feature transformer, along with appropriate loss function, continuously changes the representation to ensure good classification performance.
|
| 142 |
+
|
| 143 |
+
# 4 EXPERIMENTAL RESULTS
|
| 144 |
+
|
| 145 |
+
In this section, we benchmark our algorithm’s performance in various scenarios on relevant datasets.
|
| 146 |
+
|
| 147 |
+
• Realistic Lifelong scenario along with traditional multi-task(MT) on MNIST rotations • Incremental learning on Pneumothorax identification (data-sensitive domain) • New-task learning on iCIFAR100
|
| 148 |
+
|
| 149 |
+
# 4.1 PRACTICAL LIFELONG LEARNER - MNIST ROTATIONS DATASET
|
| 150 |
+
|
| 151 |
+
To simulate a realistic lifelong learning scenario as described in Section 2, we use MNIST rotations dataset - each task contains digits rotated by a fixed angle between 0 and 180 degrees. Firstly, we randomly permute the rotation angles (to test domain adaptation). For every rotation angle, we randomly permute the class labels (0-10) and divide them into two subsets of 5 classes each (learning new tasks). We divide the number of training samples into two different subsets (incremental learning). Table 1 details the episodes of a lifelong learning experiment from the described procedure.
|
| 152 |
+
|
| 153 |
+
Table 1: Episodes descriptions in one realistic life-long learning experiment scenario
|
| 154 |
+
|
| 155 |
+
<table><tr><td rowspan=1 colspan=1>Episode No</td><td rowspan=1 colspan=1>Rotation Angle</td><td rowspan=1 colspan=3>Class Labels</td><td rowspan=1 colspan=1>Samplesseenso far/Total Number of samples available</td><td rowspan=1 colspan=1>Description</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2(5)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[0,2,3,9,7]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>12.5k/50k</td><td rowspan=1 colspan=1>Start</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>25)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[6,4,5,1,8]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>25k/50k</td><td rowspan=1 colspan=1>New-task Learning</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[0,2,3,9,7]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>37.5.5k/50k</td><td rowspan=1 colspan=1>IncrementalLearning</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>∠(5)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[6,4,5,1,8]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>50k/50k</td><td rowspan=1 colspan=1>Incremental Learning</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>Z(270)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[2,8,6,4,7]</td><td></td><td rowspan=1 colspan=1>62.5k/100k</td><td rowspan=1 colspan=1>Domain Adaptation</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>Z(270)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[5,0,1,3,9]</td><td></td><td rowspan=1 colspan=1>75k/100k</td><td rowspan=1 colspan=1>Domain Adaptation</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>2(270)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[2,8,6,4,7]</td><td></td><td rowspan=1 colspan=1>87.5k/100k</td><td rowspan=1 colspan=1>Domain Adaptation+ Incremental Learning</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>2(270)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[5,0,1,3,9]</td><td></td><td rowspan=1 colspan=1>100k/100k</td><td rowspan=1 colspan=1>Domain Adaptation+ Incremental Learning</td></tr><tr><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=3>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td></tr><tr><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=3>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td></tr></table>
|
| 156 |
+
|
| 157 |
+
# 4.1.1 EXPERIMENT DETAILS AND RESULTS
|
| 158 |
+
|
| 159 |
+
We used a basic CNN architecture composed of 3 conv-layers of 32 filters and kernel-size - (3x3) followed by 2 dense layers “fc1” and “fc2” of feature length 256 and a softmax. Our feature transformer networks at every episode aims to transform “fc1” features using 2 additional dense layers of feature length 256. Feature transformers from previous episode serve as initialization for current episode and these models were optimized for the cumulative loss (equation 7), with $\lambda = 0 . 2$ . All the feature transformers were trained for only 3 epochs, with batch size of 32.
|
| 160 |
+
|
| 161 |
+
We compare our results to the two obvious life-long learners - naive and cumulative training, which serve as the lower and upper bounds of performance respectively in the absence of other competitive algorithms for this setting. While the naive learner finetunes the entire network on the latest episode data, cumulative learner accumulates data from all the episodes seen so far and retrains the model. Fig. 2a highlights the remarkable performance of the proposed approach. We show the performance evolution over the first 25 episodes in Fig. 2a while, performance comparisons over 80 episodes across multiple experiment runs are averaged and shown in Table. 2b. We demonstrate that just by storing features in memory and learning feature transformers at every episode, we achieve almost similar performance to the gold-standard result. Further, it also underlines the applicability of our approach as single framework to combat different requirements of lifelong learning.
|
| 162 |
+
|
| 163 |
+
Finally, we also compare our results (figure 3) in the conventional MT setting described in LopezPaz et al. (2017), whose open source implementation we used for our experiments. For details on the terminology and compared methods, the readers are encouraged to refer to Lopez-Paz et al. (2017). Fig. 3a demonstrates clear superiority of our approach over multiple methods compared. Additionally, backward transfer (BWT) - quantitative metric that models the deterioration of performance on older tasks while learning new tasks, is also negligible for our method, which shows resistance to catastrophic forgetting. Fig. 3b highlights this further as shown by accuracy on first task after learning subsequent tasks.
|
| 164 |
+
|
| 165 |
+
# .2 PNEUMOTHORAX IDENTIFICATION FROM X-RAY IMAGES
|
| 166 |
+
|
| 167 |
+
We simulate a practical manifestation of lifelong learning where a model trained to detect pneumothorax is deployed in a hospital with data arriving incrementally. We utilize a subset of ChestXRay (Wang et al., 2017b) dataset, which consists of chest $\mathrm { X }$ -rays labeled with corresponding diagnoses. We simulated incremental learning by providing the 8k training images in incremental batches of $2 \mathrm { k }$ and measured the performance on held-out validation set of $2 \mathrm { k }$ images. Fig. 4a establishes the baselines for the experiment. As in previous experiment, naive and cumulative training define the performance bounds. To clearly highlight the value of our feature transfom, we also add another strong baseline - naive Learner with center loss, which learns on the recent batch but with an augmented loss function (equation 7). In spite of a gain of $5 \%$ due to center loss, there is still a loss of $4 \%$ performance in the incremental learning set-up in the fourth batch of 2k.
|
| 168 |
+
|
| 169 |
+
Experimental Details and Results: We used a pre-trained VGG-network (Simonyan & Zisserman, 2014) as the base network and explored the use of features from different layers of the VGG-network namely - post the two pooling layers and fully connected layers. Feature transformer network essentially had one additional dense layer per step and was optimized for (equation 7).
|
| 170 |
+
|
| 171 |
+

|
| 172 |
+
Figure 2: (a) Performance evolution over first 25 episodes and (b) Average performance across multiple runs at the end of lifelong experiments
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 3: Comparison of proposed approach in conventional multi-task setting
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 4: (a) Performance Comparison on validation dataset and (b) Comparison of feature transformers from different base layers
|
| 179 |
+
|
| 180 |
+
Fig. 4a captures the performance of feature transformer with the base features being extracted from first pooling layer - block3 pool. After fourth batch of data, feature transformer result almost matches the performance of cumulative training. This performance is achieved despite not having access to the full images but only the stored features. Table. 4b also presents the performance of feature transformer depending upon the base features used. It can be noted that performance is lowest for the layer that is closer to the classification layer - fc 2. This is intuitively satisfying because, the further layers in a deep neural network will be more finely tuned towards the specific task and deprives the feature transform of any general features.
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 5: Comparison with state-of-the-art methods - iCIFAR100 dataset
|
| 184 |
+
|
| 185 |
+
# 4.3 ICIFAR100 DATASET
|
| 186 |
+
|
| 187 |
+
We present the 100 classes from CIFAR100 dataset in a sequence of 20 tasks comprising of 5 classes each. Similar to Lomonaco & Maltoni (2017), we use the definitions for MT and single-incremental task (SIT). In an MT setting, evaluation is performed only on the new tasks exposed to the learner in the current episode. We start with a VGG type architecture, pretrained on iCIFAR10 dataset as suggested by Lopez-Paz et al. (2017) and Lomonaco & Maltoni (2017). Base features are extracted from flatten layer (before the fully connected layers) and our feature transformers included two dense layers with feature length $= 2 5 6$ . Similar to our earlier experiments, the feature transformer module from the previous episode initializes the current episode transformer and is optimized for the cumulative loss, with NoEpochs $= 3 0$ and batch size $= 3 2$ .
|
| 188 |
+
|
| 189 |
+
# 4.3.1 MULTI-TASK SETTING
|
| 190 |
+
|
| 191 |
+
Fig 5a demonstrates the superiority of our approach by a significant margin of ${ > } 1 0 \%$ . Further, we have negligible Backward Transfer.
|
| 192 |
+
|
| 193 |
+
# 4.3.2 SINGLE INCREMENTAL TASK SETTING
|
| 194 |
+
|
| 195 |
+
Fig 5b captures the performance over 20 batches of data for our method along with cumulative and naive learner. Unsurprisingly, naive learner performs very poorly, while feature transformer displays exemplary performance numbers of $4 0 \%$ validation acccuracy after encountering all 20 episodes, while compared to cumulative learner at $5 0 \%$ . Our method significantly outperforms AR1 (Lomonaco & Maltoni, 2017), while iCaRL (Rebuffi et al., 2017) achieves best-in-class performance close to gold-standard cumulative learner. This is not surprising because iCaRL is an explicit rehearsal technique, where exemplar images from previous episodes are stored and replayed while learning new tasks, while we only store low dimensional features.
|
| 196 |
+
|
| 197 |
+
# 4.4 EFFECT OF LIMITED MEMORY
|
| 198 |
+
|
| 199 |
+
One of the drawbacks of the proposed approach is the assumption of infinite memory and need to store features computed on all samples observed so far. To understand the extent of this limitation, we performed ablation experiments limiting the amount of history replayed as well as computing the storage requirements involved.
|
| 200 |
+
|
| 201 |
+
Storing all features is not necessary We studied the effect of size of memory by limiting the number of samples stored to a smaller percentage. We observed that performance dropped from $9 7 \%$ to $9 4 \%$ when we reduced the memory size to only $2 5 \%$ the original size on MNIST rotations (Table. 2). We performed similar experiments on Pneumothorax classification problem and achieved similar trends as shown Table. 3, clearly demonstrating the resistance of the proposed method.
|
| 202 |
+
|
| 203 |
+
Storing all features is not prohibitive Additionally, calculations of size-on-disk suggests that storing features of the entire history is not prohibitive. A typical natural/medical image is $2 5 6 ^ { * } 2 5 6 ^ { * } 3$ integers or more, whereas our representation is only 4096 floats (16kb). Even the largest available medical image repository of $1 0 0 \mathrm { k }$ X-ray images takes 1.6GB which is not huge. These are con
|
| 204 |
+
|
| 205 |
+
Table 2: MNIST rotations
|
| 206 |
+
|
| 207 |
+
<table><tr><td rowspan=1 colspan=1>%ofSamples storedfrom history</td><td rowspan=1 colspan=1>FeatureTransformerVal Acc</td><td rowspan=1 colspan=1>CumulativeLearnerVal Acc</td></tr><tr><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>94%</td><td rowspan=1 colspan=1>95%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>94.8%</td><td rowspan=1 colspan=1>98%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>96%</td><td rowspan=1 colspan=1>98.5%</td></tr><tr><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>97 %</td><td rowspan=1 colspan=1>99 %</td></tr></table>
|
| 208 |
+
|
| 209 |
+
Table 3: Pneumothorax dataset
|
| 210 |
+
|
| 211 |
+
<table><tr><td rowspan=1 colspan=1>%ofSamples storedfrom history</td><td rowspan=1 colspan=1>FeatureTransformerVal Acc</td></tr><tr><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>80.95%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>82.95%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>85.85 %</td></tr><tr><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>86.94 %</td></tr></table>
|
| 212 |
+
|
| 213 |
+
Table: Performance comparisons with limited memory budget servative estimates. A standard medical image can be of much larger size $1 0 2 4 ^ { * } 1 0 2 4 )$ and in 3-D (minimum 10 slices). Any exemplar-based method (iCARL) will have severe storage limitations than our method. Additionally, storing 50 low-dimensional features occupies same memory as storing one exemplar image. This directly leads to storing more history compactly while addressing catastrophic forgetting and privacy.
|
| 214 |
+
|
| 215 |
+
# 4.5 CONTROLLING THE GROWTH OF NETWORK CAPACITY
|
| 216 |
+
|
| 217 |
+
In the description of the feature transformer framework in section 3.1 and section 3.2, we provided a generic treatment of the method, where, at the end of the each episode, the features are transformed up to date and then stored in memory for the next episode. With this scheme, it becomes imperative to always augment the capacity of the network in order to learn new representations, resulting in ever-growing network capacity. However, this problem can be easily alleviated by partitioning the entire network into a base feature extractor and feature transformer layers. The base feature extractor remains always fixed, and it is only the output of base feature extractor that is always stored in memory. With this scheme, the feature transformer layers need not grow in capacity and only a few already existing layers can be adapted for the new data. When the capacity of the feature transformer layers is not sufficient, then it can be augmented by adding one or more extra layers. In either case, the stored base features are sufficient to train.
|
| 218 |
+
|
| 219 |
+
# Effect of varying additional capacity
|
| 220 |
+
|
| 221 |
+
We varied the size of feature transformers and observed the difference in performance. Table 4 shows that by halving the additional capacity does not change the performance on MNIST rotations dataset at all. In addition, we froze the capacity of feature transformers after 5th episode and adapted them till end of 80 episodes. It is striking that performance is still high. Similarly, for Pneumothorax classification, Table 5 shows the performance comparisons with varying capacity of 2 , 1 and zero fc layers post third episode. These experiments (along with Sec 4.4) clearly demonstrate that power of the proposed approach comes from learning separable representations continually and not necessarily from storing all features or additional capacity.
|
| 222 |
+
|
| 223 |
+
Table 4: MNIST rotations
|
| 224 |
+
|
| 225 |
+
<table><tr><td rowspan=1 colspan=1>Incremental capacityadded per episode</td><td rowspan=1 colspan=1>Feature TransformerVal Acc</td></tr><tr><td rowspan=1 colspan=1>2 dense layers</td><td rowspan=1 colspan=1>96.4%</td></tr><tr><td rowspan=1 colspan=1>1 dense layers</td><td rowspan=1 colspan=1>96.5%</td></tr><tr><td rowspan=1 colspan=1>No additonal capacity(after 5th episode)</td><td rowspan=1 colspan=1>96.2%</td></tr></table>
|
| 226 |
+
|
| 227 |
+
<table><tr><td rowspan=1 colspan=1>Incremental capacityadded per episode</td><td rowspan=1 colspan=1>FeatureTransformerVal Acc</td></tr><tr><td rowspan=1 colspan=1>2 dense layers</td><td rowspan=1 colspan=1>86.94%</td></tr><tr><td rowspan=1 colspan=1>1 dense layers</td><td rowspan=1 colspan=1>86.43%</td></tr><tr><td rowspan=1 colspan=1>No additonal capacity(after 3rd episode)</td><td rowspan=1 colspan=1>86.41%</td></tr></table>
|
| 228 |
+
|
| 229 |
+
Table: Performance comparisons with limited incremental compute
|
| 230 |
+
|
| 231 |
+
# 5 DISCUSSION
|
| 232 |
+
|
| 233 |
+
In the final section, we discuss various points concerning our proposed approach.
|
| 234 |
+
|
| 235 |
+
# Bayesian interpretation of Feature transformers
|
| 236 |
+
|
| 237 |
+
Our feature transformers framework - learning a new representation with every new episode of data, can be interpreted as a maximum-a-posteriori representation learning, with the previous representation acting as prior. The implementation described in this paper using the combination loss (equation 7) is one instantiation of a general incremental representation learning possible in our framework. We have cast the MAP estimate problem to a tractable optimization problem constrained by a center-loss. In future, we plan to explore other manifestations of our approach with different loss functions that can ensure better separability.
|
| 238 |
+
|
| 239 |
+
# Information Loss, Incremental Capacity, Data Privacy
|
| 240 |
+
|
| 241 |
+
As shown in Table. 4b, feature transformer becomes less effective if the base features do not contain enough relevant information. This also means that additional capacity that every feature transformer adds may not help or in-fact be counter-productive. If the base features are extracted from layers close to the input image, there will be problem of traceability which violates the data privacy requirement we want to accomplish. We feel this a potential trade-off between performance and data privacy which we will investigate in future.
|
| 242 |
+
|
| 243 |
+
# Model compaction for cascade of feature transformers
|
| 244 |
+
|
| 245 |
+
Another approach to control the growth of network capacity is model compaction, which will be our future work. At any point in time, the entire set of feature transformer layers can be replaced by a smaller and simpler network (possibly using distillation techniques) and then again allowed to grow subsequently. This cycle of grow-and-purge can be used to effectively manage the overall capacity of the network.
|
| 246 |
+
|
| 247 |
+
# REFERENCES
|
| 248 |
+
|
| 249 |
+
F. M. Castro, M. J. Mar´ın-Jimenez, N. Guil, C. Schmid, and K. Alahari. End-to-End Incremental ´ Learning. ArXiv e-prints, July 2018.
|
| 250 |
+
|
| 251 |
+
Chen He, Ruiping Wang, Shiguang Shan, and Xilin Chen. Exemplar-supported generative reproduction for class incremental learning. In $2 9 ^ { t h }$ British Machine Vision Conference (BMVC 2018), 3–6 Sep 2018.
|
| 252 |
+
|
| 253 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 254 |
+
|
| 255 |
+
Khurram Javed and Muhammad Talha Paracha. Incremental classifier & representation learning. Learning, 3:4, 2018.
|
| 256 |
+
|
| 257 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, pp. 201611835, 2017.
|
| 258 |
+
|
| 259 |
+
Jeongtae Lee, Jaehong Yoon, Eunho Yang, and Sung Ju Hwang. Lifelong learning with dynamically expandable networks. CoRR, abs/1708.01547, 2017.
|
| 260 |
+
|
| 261 |
+
Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
|
| 262 |
+
|
| 263 |
+
Xialei Liu, Marc Masana, Luis Herranz, Joost Van de Weijer, Antonio M Lopez, and Andrew D Bagdanov. Rotate your networks: Better weight consolidation and less catastrophic forgetting. arXiv preprint arXiv:1802.02950, 2018.
|
| 264 |
+
|
| 265 |
+
Vincenzo Lomonaco and Davide Maltoni. Core50: a new dataset and benchmark for continuous object recognition. In Sergey Levine, Vincent Vanhoucke, and Ken Goldberg (eds.), Proceedings of the 1st Annual Conference on Robot Learning, volume 78 of Proceedings of Machine Learning Research, pp. 17–26. PMLR, 13–15 Nov 2017. URL http://proceedings.mlr.press/ v78/lomonaco17a.html.
|
| 266 |
+
|
| 267 |
+
David Lopez-Paz et al. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, pp. 6467–6476, 2017.
|
| 268 |
+
|
| 269 |
+
Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pp. 109–165. Elsevier, 1989.
|
| 270 |
+
|
| 271 |
+
Thomas Mensink, Jakob Verbeek, Florent Perronnin, and Gabriela Csurka. Metric learning for large scale image classification: Generalizing to new classes at near-zero cost. In Computer Vision– ECCV 2012, pp. 488–501. Springer, 2012.
|
| 272 |
+
|
| 273 |
+
Maxime Oquab, Leon Bottou, Ivan Laptev, and Josef Sivic. Learning and transferring mid-level image representations using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1717–1724, 2014.
|
| 274 |
+
|
| 275 |
+
Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, and Christoph H. Lampert. iCaRL: Incremental classifier and representation learning. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5533–5542, 2017.
|
| 276 |
+
|
| 277 |
+
Anthony Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7: 123–146, 1995.
|
| 278 |
+
|
| 279 |
+
Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In Advances in Neural Information Processing Systems, pp. 2990–2999, 2017.
|
| 280 |
+
|
| 281 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 282 |
+
|
| 283 |
+
Amal Triki Rannen, Rahaf Aljundi, Mathew B Blaschko, and Tinne Tuytelaars. Encoder based lifelong learning. IEEE International Conference of Computer Vision, 2017.
|
| 284 |
+
|
| 285 |
+
Ragav Venkatesan, Hemanth Venkateswara, Sethuraman Panchanathan, and Baoxin Li. A strategy for an uncompromising incremental learner. arXiv preprint arXiv:1705.00744, 2017.
|
| 286 |
+
|
| 287 |
+
X. Wang, Y. Peng, L. Lu, Z. Lu, M. Bagheri, and R. M. Summers. Chestx-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3462–3471, July 2017a. doi: 10.1109/CVPR.2017.369.
|
| 288 |
+
|
| 289 |
+
X. Wang, Y. Peng, L. Lu, Z. Lu, M. Bagheri, and R. M. Summers. Chestx-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3462–3471, July 2017b. doi: 10.1109/CVPR.2017.369.
|
| 290 |
+
|
| 291 |
+
Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In ECCV, 2016.
|
md/train/BkXmYfbAZ/BkXmYfbAZ.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BEYOND SHARED HIERARCHIES: DEEP MULTITASK LEARNING THROUGH SOFT LAYER ORDERING
|
| 2 |
+
|
| 3 |
+
Elliot Meyerson & Risto Miikkulainen
|
| 4 |
+
The University of Texas at Austin and Sentient Technologies, Inc. {ekm, risto} $@$ cs.utexas.edu
|
| 5 |
+
|
| 6 |
+
# ABSTRACT
|
| 7 |
+
|
| 8 |
+
Existing deep multitask learning (MTL) approaches align layers shared between tasks in a parallel ordering. Such an organization significantly constricts the types of shared structure that can be learned. The necessity of parallel ordering for deep MTL is first tested by comparing it with permuted ordering of shared layers. The results indicate that a flexible ordering can enable more effective sharing, thus motivating the development of a soft ordering approach, which learns how shared layers are applied in different ways for different tasks. Deep MTL with soft ordering outperforms parallel ordering methods across a series of domains. These results suggest that the power of deep MTL comes from learning highly general building blocks that can be assembled to meet the demands of each task.
|
| 9 |
+
|
| 10 |
+
# 1 INTRODUCTION
|
| 11 |
+
|
| 12 |
+
In multitask learning (MTL) (Caruana, 1998), auxiliary data sets are harnessed to improve overall performance by exploiting regularities present across tasks. As deep learning has yielded state-ofthe-art systems across a range of domains, there has been increased focus on developing deep MTL techniques. Such techniques have been applied across settings such as vision (Bilen and Vedaldi, 2016; 2017; Jou and Chang, 2016; Lu et al., 2017; Misra et al., 2016; Ranjan et al., 2016; Yang and Hospedales, 2017; Zhang et al., 2014), natural language (Collobert and Weston, 2008; Dong et al., 2015; Hashimoto et al., 2016; Liu et al., 2015a; Luong et al., 2016), speech (Huang et al., 2013; 2015; Seltzer and Droppo, 2013; Wu et al., 2015), and reinforcement learning (Devin et al., 2016; Fernando et al., 2017; Jaderberg et al., 2017; Rusu et al., 2016). Although they improve performance over single-task learning in these settings, these approaches have generally been constrained to joint training of relatively few and/or closely-related tasks.
|
| 13 |
+
|
| 14 |
+
On the other hand, from a perspective of Kolmogorov complexity, “transfer should always be useful”; any pair of distributions underlying a pair of tasks must have something in common (Mahmud, 2009; Mahmud and Ray, 2008). In principle, even tasks that are “superficially unrelated” such as those in vision and NLP can benefit from sharing (even without an adaptor task, such as image captioning). In other words, for a sufficiently expressive class of models, the inductive bias of requiring a model to fit multiple tasks simultaneously should encourage learning to converge to more realistic representations. The expressivity and success of deep models suggest they are ideal candidates for improvement via MTL. So, why have existing approaches to deep MTL been so restricted in scope?
|
| 15 |
+
|
| 16 |
+
MTL is based on the assumption that learned transformations can be shared across tasks. This paper identifies an additional implicit assumption underlying existing approaches to deep MTL: this sharing takes place through parallel ordering of layers. That is, sharing between tasks occurs only at aligned levels (layers) in the feature hierarchy implied by the model architecture. This constraint limits the kind of sharing that can occur between tasks. It requires subsequences of task feature hierarchies to match, which may be difficult to establish as tasks become plentiful and diverse.
|
| 17 |
+
|
| 18 |
+
This paper investigates whether parallel ordering of layers is necessary for deep MTL. As an alternative, it introduces methods that make deep MTL more flexible. First, existing approaches are reviewed in the context of their reliance on parallel ordering. Then, as a foil to parallel ordering, permuted ordering is introduced, in which shared layers are applied in different orders for different tasks. The increased ability of permuted ordering to support integration of information across tasks is analyzed, and the results are used to develop a soft ordering approach to deep MTL. In this approach, a joint model learns how to apply shared layers in different ways at different depths for different tasks as it simultaneously learns the parameters of the layers themselves. In a suite of experiments, soft ordering is shown to improve performance over single-task learning as well as over fixed order deep MTL methods.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: Classes of existing deep multitask learning architectures. (a) Classical approaches add a task-specific decoder to the output of the core single-task model for each task; (b) Columnbased approaches include a network column for each task, and define a mechanism for sharing between columns; (c) Supervision at custom depths adds output decoders at depths based on a task hierarchy; (d) Universal representations adapts each layer with a small number of task-specific scaling parameters. Underlying each of these approaches is the assumption of parallel ordering of shared layers (Section 2.2): each one requires aligned sequences of feature extractors across tasks.
|
| 22 |
+
|
| 23 |
+
Importantly, soft ordering is not simply a technical improvement, but a new way of thinking about deep MTL. Learning a different soft ordering of layers for each task amounts to discovering a set of generalizable modules that are assembled in different ways for different tasks. This perspective points to future approaches that train a collection of layers on a set of training tasks, which can then be assembled in novel ways for future unseen tasks. Some of the most striking structural regularities observed in the natural, technological and sociological worlds are those that are repeatedly observed across settings and scales; they are ubiquitous and universal. By forcing shared transformations to occur at matching depths in hierarchical feature extraction, deep MTL falls short of capturing this sort of functional regularity. Soft ordering is thus a step towards enabling deep MTL to realize the diverse array of structural regularities found across complex tasks drawn from the real world.
|
| 24 |
+
|
| 25 |
+
# 2 PARALLEL ORDERING OF LAYERS IN DEEP MTL
|
| 26 |
+
|
| 27 |
+
This section presents a high-level classification of existing deep MTL approaches (Sec. 2.1) that is sufficient to expose the reliance of these approaches on the parallel ordering assumption (Sec. 2.2).
|
| 28 |
+
|
| 29 |
+
# 2.1 A CLASSIFICATION OF EXISTING APPROACHES TO DEEP MULTITASK LEARNING
|
| 30 |
+
|
| 31 |
+
Designing a deep MTL system requires answering the key question: How should learned parameters be shared across tasks? The landscape of existing deep MTL approaches can be organized based on how they answer this question at the joint network architecture level (Figure 1).
|
| 32 |
+
|
| 33 |
+
Classical approaches. Neural network MTL was first introduced in the case of shallow networks (Caruana, 1998), before deep networks were prevalent. The key idea was to add output neurons to predict auxiliary labels for related tasks, which would act as regularizers for the hidden representation. Many deep learning extensions remain close in nature to this approach, learning a shared representation at a high-level layer, followed by task-specific (i.e., unshared) decoders that extract labels for each task (Devin et al., 2016; Dong et al., 2015; Huang et al., 2013; 2015; Jaderberg et al., 2017; Liu et al., 2015a; Ranjan et al., 2016; Wu et al., 2015; Zhang et al., 2014) (Figure 1a). This approach can be extended to task-specific input encoders (Devin et al., 2016; Luong et al., 2016), and the underlying single-task model may be adapted to ease task integration (Ranjan et al., 2016; Wu et al., 2015), but the core network is still shared in its entirety.
|
| 34 |
+
|
| 35 |
+
Column-based approaches. Column-based approaches (Jou and Chang, 2016; Misra et al., 2016; Rusu et al., 2016; Yang and Hospedales, 2017), assign each task its own layer of task-specific parameters at each shared depth (Figure 1b). They then define a mechanism for sharing parameters between tasks at each shared depth, e.g., by having a shared tensor factor across tasks (Yang and Hospedales, 2017), or allowing some form of communication between columns (Jou and Chang,
|
| 36 |
+
|
| 37 |
+
2016; Misra et al., 2016; Rusu et al., 2016). Observations of negative effects of sharing in columnbased methods (Rusu et al., 2016) can be attributed to mismatches between the features required at the same depth between tasks that are too dissimilar.
|
| 38 |
+
|
| 39 |
+
Supervision at custom depths. There may be an intuitive hierarchy describing how a set of tasks are related. Several approaches integrate supervised feedback from each task at levels consistent with such a hierarchy (Hashimoto et al., 2016; Toshniwal et al., 2017; Zhang and Weiss, 2016) (Figure 1c). This method can be sensitive to the design of the hierarchy (Toshniwal et al., 2017), and to which tasks are included therein (Hashimoto et al., 2016). One approach learns a task-relationship hierarchy during training (Lu et al., 2017), though learned parameters are still only shared across matching depths. Supervision at custom depths has also been extended to include explicit recurrence that reintegrates information from earlier predictions (Bilen and Vedaldi, 2016; Zamir et al., 2016). Although these recurrent methods still rely on pre-defined hierarchical relationships between tasks, they provide evidence of the potential of learning transformations that have a different function for different tasks at different depths, i.e., in this case, at different depths unrolled in time.
|
| 40 |
+
|
| 41 |
+
Universal representations. One approach shares all core model parameters except batch normalization scaling factors (Bilen and Vedaldi, 2017) (Figure 1d). When the number of classes is equal across tasks, even output layers can be shared, and the small number of task-specific parameters enables strong performance to be maintained. This method was applied to a diverse array of vision tasks, demonstrating the power of a small number of scaling parameters in adapting layer functionality for different tasks. This observation helps to motivate the method developed in Section 3.
|
| 42 |
+
|
| 43 |
+
# 2.2 THE PARALLEL ORDERING ASSUMPTION
|
| 44 |
+
|
| 45 |
+
A common interpretation of deep learning is that layers extract progressively higher level features at later depths (Lecun et al., 2015). A natural assumption is then that the learned transformations that extract these features are also tied to the depth at which they are learned. The core assumption motivating MTL is that regularities across tasks will result in learned transformations that can be leveraged to improve generalization. However, the methods reviewed in Section 2.1 add the further assumption that subsequences of the feature hierarchy align across tasks and sharing between tasks occurs only at aligned depths (Figure 1); we call this the parallel ordering assumption.
|
| 46 |
+
|
| 47 |
+
Consider $T$ tasks $t _ { 1 } , \dots , t _ { T }$ to be learned jointly, with each $t _ { i }$ associated with a model $y _ { i } = \mathcal { F } _ { i } ( x _ { i } )$ . Suppose sharing across tasks occurs at $D$ consecutive depths. Let $\mathcal { E } _ { i }$ $( \mathcal { D } _ { i } )$ be $t _ { i }$ ’s task-specific encoder (decoder) to (from) the core sharable portion of the network from its inputs (to its outputs). Let $W _ { k } ^ { i }$ be the layer of learned weights (e.g., affine or convolutional) for task $i$ at shared depth $k$ , with $\phi _ { k }$ an optional nonlinearity. The parallel ordering assumption implies
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
y _ { i } = \left( \mathcal { D } _ { i } \circ \phi _ { D } \circ W _ { D } ^ { i } \circ \phi _ { D - 1 } \circ W _ { D - 1 } ^ { i } \circ \hdots \circ \phi _ { 1 } \circ W _ { 1 } ^ { i } \circ \mathcal { E } _ { i } \right) ( x _ { i } ) , \mathrm { w i t h } W _ { k } ^ { i } \approx W _ { k } ^ { j } \forall ( i , j , k ) .
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
The approximate equality $\ " \approx \ "$ means that at each shared depth the applied weight tensors for each task are similar and compatible for sharing. For example, learned parameters may be shared across all $W _ { k } ^ { i }$ for a given $k$ , but not between $W _ { k } ^ { i }$ and $W _ { l } ^ { j }$ for any $k \neq l$ . For closely-related tasks, this assumption may be a reasonable constraint. However, as more tasks are added to a joint model, it may be more difficult for each layer to represent features of its given depth for all tasks. Furthermore, for very distant tasks, it may be unreasonable to expect that task feature hierarchies match up at all, even if the tasks are related intuitively. The conjecture explored in this paper is that parallel ordering limits the potential of deep MTL by the strong constraint it enforces on the use of each layer.
|
| 54 |
+
|
| 55 |
+
# 3 DEEP MULTITASK LEARNING WITH SOFT ORDERING OF LAYERS
|
| 56 |
+
|
| 57 |
+
Now that parallel ordering has been identified as a constricting feature of deep MTL approaches, its necessity can be tested, and the resulting observations can be used to develop more flexible methods.
|
| 58 |
+
|
| 59 |
+
3.1 A FOIL FOR THE PARALLEL ORDERING ASSUMPTION: PERMUTING SHARED LAYERS
|
| 60 |
+
|
| 61 |
+
Consider the most common deep MTL setting: hard-sharing of layers, where each layer in $\{ W _ { k } \} _ { k = 1 } ^ { D }$ is shared in its entirety across all tasks. The baseline deep MTL model for each task $t _ { i }$ is given by
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
y _ { i } = ( { \mathcal { D } } _ { i } \circ \phi _ { D } \circ W _ { D } \circ \phi _ { D - 1 } \circ W _ { D - 1 } \circ \dots \circ \phi _ { 1 } \circ W _ { 1 } \circ { \mathcal { E } } _ { i } ) ( x _ { i } ) .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 2: Fitting two random tasks. (a) The dotted lines show that permuted ordering fits $n$ samples as well as parallel fits $n / 2$ for linear networks; (b) For ReLU networks, permuted ordering enjoys a similar advantage. Thus, permuted ordering of shared layers eases integration of information across disparate tasks.
|
| 69 |
+
|
| 70 |
+
This setup satisfies the parallel ordering assumption. Consider now an alternative scheme, equivalent to the above, except with learned layers applied in different orders for different task. That is,
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
y _ { i } = \big ( \mathscr { D } _ { i } \circ \phi _ { D } \circ W _ { \rho _ { i } ( D ) } \circ \phi _ { D - 1 } \circ W _ { \rho _ { i } ( D - 1 ) } \circ \dots \circ \phi _ { 1 } \circ W _ { \rho _ { i } ( 1 ) } \circ \mathcal { E } _ { i } \big ) \big ( x _ { i } \big ) ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $\rho _ { i }$ is a task-specific permutation of size $D$ , and $\rho _ { i }$ is fixed before training. If there are sets of tasks for which joint training of the model defined by Eq. 3 achieves similar or improved performance over Eq. 2, then parallel ordering is not a necessary requirement for deep MTL. Of course, in this formulation, it is required that the $W _ { k }$ can be applied in any order. See Section 6 for examples of possible generalizations.
|
| 77 |
+
|
| 78 |
+
Note that this multitask permuted ordering differs from an approach of training layers in multiple orders for a single task. The single-task case results in a model with increased commutativity between layers, a behavior that has also been observed in residual networks (Veit et al., 2016), whereas here the result is a set of layers that are assembled in different ways for different tasks.
|
| 79 |
+
|
| 80 |
+
# 3.2 THE INCREASED EXPRESSIVITY OF PERMUTED ORDERING
|
| 81 |
+
|
| 82 |
+
Fitting tasks of random patterns. Permuted ordering is evaluated by comparing it to parallel ordering on a set of tasks. Randomly generated tasks (similar to (Kirkpatrick et al., 2017)) are the most disparate possible tasks, in that they share minimal information, and thus help build intuition for how permuting layers could help integrate information in broad settings. The following experiments investigate how accurately a model can jointly fit two tasks of $n$ samples. The data set for task $t _ { i }$ is $\{ ( x _ { i j } , y _ { i j } ) \} _ { j = 1 } ^ { n }$ , with each $x _ { i j }$ drawn uniformly from $[ 0 , 1 ] ^ { m }$ , and each $y _ { i j }$ drawn uniformly from $\{ 0 , 1 \}$ . There are two shared learned affine layers $W _ { k } : \mathbb { R } ^ { m } \mathbb { R } ^ { m }$ . The models with permuted ordering (Eq. 3) are given by
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
y _ { 1 } = ( O \circ \phi \circ W _ { 2 } \circ \phi \circ W _ { 1 } ) ( x _ { 1 } ) { \mathrm { ~ a n d ~ } } y _ { 2 } = ( O \circ \phi \circ W _ { 1 } \circ \phi \circ W _ { 2 } ) ( x _ { 2 } ) ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $O$ is a final shared classification layer. The reference parallel ordering models are defined identically, but with $W _ { k }$ in the same order for both tasks. Note that fitting the parallel model with $n$ samples is equivalent to a single-task model with $2 n$ . In the first experiment, $m \ : = \ : 1 2 8$ and $\phi = I$ . Although adding depth does not add expressivity in the single-task linear case, it is useful for examining the effects of permuted ordering, and deep linear networks are known to share properties with nonlinear networks (Saxe et al., 2013). In the second experiment, $m = 1 6$ and $\phi = \mathrm { R e L U }$ .
|
| 89 |
+
|
| 90 |
+
The results are shown in Figure 2. Remarkably, in the linear case, permuted ordering of shared layers does not lose accuracy compared to the single-task case. A similar gap in performance is seen in the nonlinear case, indicating that this behavior extends to more powerful models. Thus, the learned permuted layers are able to successfully adapt to their different orderings in different tasks.
|
| 91 |
+
|
| 92 |
+
Looking at conditions that make this result possible can shed further light on this behavior. For instance, consider $T$ tasks $t _ { 1 } , \dots , t _ { T }$ , with input and output size both $m$ , and optimal linear solutions $F _ { 1 } , \ldots , F _ { T }$ , respectively. Let $F _ { 1 } , \dots , F _ { T }$ be $m \times m$ matrices, and suppose there exist matrices
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 3: Soft ordering of shared layers. Sample soft ordering network with three shared layers. Soft ordering (Eq. 7) generalizes Eqs. 2 and 3, by learning a tensor $S$ of task-specific scaling parameters. $S$ is learned jointly with the $F _ { j }$ , to allow flexible sharing across tasks and depths. The $F _ { j }$ in this figure each include a shared weight layer and any nonlinearity. This architecture enables the learning of layers that are used in different ways at different depths for different tasks.
|
| 96 |
+
|
| 97 |
+
$G _ { 1 } , \ldots , G _ { T }$ such that $F _ { i } = G _ { i } G _ { ( i + 1 \bmod T ) } \dots G _ { ( i - 1 \bmod T ) } \forall i$ . Then, because the matrix trace is invariant under cyclic permutations, the constraint arises that
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\operatorname { t r } ( F _ { 1 } ) = \operatorname { t r } ( F _ { 2 } ) = . . . = \operatorname { t r } ( F _ { T } ) .
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
In the case of random matrices induced by the random tasks above, the traces of the $F _ { i }$ are all equal in expectation and concentrate well as their dimensionality increases. So, the restrictive effect of Eq. 5 on the expressivity of permuted ordering here is negligible.
|
| 104 |
+
|
| 105 |
+
Adding a small number of task-specific scaling parameters. Of course, real world tasks are generally much more structured than random ones, so such reliable expressivity of permuted ordering might not always be expected. However, adding a small number of task-specific scaling parameters can help adapt learned layers to particular tasks. This observation has been previously exploited in the parallel ordering setting, for learning task-specific batch normalization scaling parameters (Bilen and Vedaldi, 2017) and controlling communication between columns (Misra et al., 2016). Similarly, in the permuted ordering setting, the constraint induced by Eq. 5 can be reduced by adding task-specific scalars $\{ s _ { i } \} _ { i = 2 } ^ { T }$ such that $F _ { i } = s _ { i } G _ { i } G _ { ( i + 1 \bmod T ) } \dots G _ { ( i - 1 \bmod T ) }$ , and $s _ { 1 } = 1$ . The constraint given by Eq. 5 then reduces to
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\mathrm { t r } \big ( F _ { i } / { } s _ { i } \big ) = \mathrm { t r } \big ( F _ { i + 1 } / { } s _ { i + 1 } \big ) \forall 1 \leq i < T \implies s _ { i + 1 } = s _ { i } \big ( \mathrm { t r } ( F _ { i + 1 } ) \big / \mathrm { t r } ( F _ { i } ) \big ) ,
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
which are defined when $\mathrm { t r } ( F _ { i } ) \ne 0 \forall i < T$ . Importantly, the number of task-specific parameters does not depend on $m$ , which is useful for scalability as well as encouraging maximal sharing between tasks. The idea of using a small number of task-specific scaling parameters is incorporated in the soft ordering approach introduced in the next section.
|
| 112 |
+
|
| 113 |
+
# 3.3 SOFT ORDERING OF SHARED LAYERS
|
| 114 |
+
|
| 115 |
+
Permuted ordering tests the parallel ordering assumption, but still fixes an a priori layer ordering for each task before training. Here, a more flexible soft ordering approach is introduced, which allows jointly trained models to learn how layers are applied while simultaneously learning the layers themselves. Consider again a core network of depth $D$ with layers $W _ { 1 } , \ldots , W _ { D }$ learned and shared across tasks. The soft ordering model for task $t _ { i }$ is defined as follows:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
y _ { i } ^ { k } = \sum _ { j = 1 } ^ { D } s _ { ( i , j , k ) } ( \phi _ { k } [ W _ { j } ( y _ { i } ^ { k - 1 } ) ] ) , \mathrm { ~ w i t h ~ } \sum _ { j = 1 } ^ { D } s _ { ( i , j , k ) } = 1 \forall ( i , k ) ,
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $y _ { i } ^ { 0 } = \mathcal { E } _ { i } ( x _ { i } )$ , $y _ { i } = \mathcal { D } _ { i } ( y _ { i } ^ { D } )$ , and each $s _ { ( i , j , k ) }$ is drawn from $S$ : a tensor of learned scales for each task $t _ { i }$ for each layer $W _ { j }$ at each depth $k$ . Figure 3 shows an example of a resulting depth three model. Motivated by Section 3.2 and previous work (Misra et al., 2016), $S$ adds only $D ^ { 2 }$ scaling parameters per task, which is notably not a function of the size of any $W _ { j }$ . The constraint that all $s _ { ( i , j , k ) }$ sum to 1 for any $( i , k )$ is implemented via softmax, and emphasizes the idea that a soft ordering is what is being learned; in particular, this formulation subsumes any fixed layer ordering $\rho _ { i }$ by $s _ { ( i , \rho _ { i } ( k ) , k ) } = 1 \bar { \forall } ( i , k )$ . $S$ can be learned jointly with the other learnable parameters in the $W _ { k }$ , $\mathcal { E } _ { i }$ , and $\mathcal { D } _ { i }$ via backpropagation. In training, all $s _ { ( i , j , k ) }$ are initialized with equal values, to reduce initial bias of layer function across tasks. It is also helpful to apply dropout after each shared layer. Aside from its usual benefits (Srivastava et al., 2014), dropout has been shown to be useful in increasing the generalization capacity of shared representations (Devin et al., 2016). Since the trained layers in Eq. 7 are used for different tasks and in different locations, dropout makes them more robust to supporting different functionalities. These ideas are tested empirically on the MNIST, UCI, Omniglot, and CelebA data sets in the next section.
|
| 122 |
+
|
| 123 |
+
# 4 EMPIRICAL EVALUATION OF SOFT LAYER ORDERING
|
| 124 |
+
|
| 125 |
+
These experiments evaluate soft ordering against fixed ordering MTL and single-task learning. The first experiment applies them to intuitively related MNIST tasks, the second to “superficially unrelated” UCI tasks, the third to the real-world problem of Omniglot character recognition, and the fourth to large-scale facial attribute recognition. In each experiment, single task, parallel ordering (Eq. 2), permuted ordering (Eq. 3), and soft ordering (Eq. 7) train an equivalent set of core layers. In permuted ordering, the order of layers were randomly generated for each task each trial. See Appendix A for additional details, including additional details specific to each experiment.
|
| 126 |
+
|
| 127 |
+
4.1 DISENTANGLING RELATED TASKS: MNIST DIGIT $^ 1$ -VS.-DIGIT $^ 2$ BINARY CLASSIFICATION
|
| 128 |
+
|
| 129 |
+
This experiment evaluates the ability of multitask methods to exploit tasks that are intuitively related, but have disparate input representations. Binary classification problems derived from the MNIST hand-written digit dataset are a common test bed for evaluating deep learning methods that require multiple tasks (Fernando et al., 2017; Kirkpatrick et al., 2017; Yang and Hospedales, 2017). Here, the goal of each task is to distinguish between two distinct randomly selected digits. To create initial dissimilarity across tasks that multitask models must disentangle, each $\mathcal { E } _ { i }$ is a random frozen fullyconnected ReLU layer with output size 64. There are four core layers, each a fully-connected ReLU layer with 64 units. Each $\mathcal { D } _ { i }$ is an unshared dense layer with a single sigmoid classification output.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 4: MNIST results. (a) Relative performance of permuted and soft ordering compared to parallel ordering improves as the number of tasks increases, showing how flexibility of order can help in scaling to more tasks. Note that cost savings of multitask over single task models in terms of number of trainable parameters scales linearly with the number of tasks. For a representative two-task soft order experiment (b) the layer-wise distance between scalings of the tasks increases by iteration, and (c) the scalings move towards a hard ordering. (d) The final learned relative scale of each shared layer at each depth for each task is indicated by shading, with the strongest path drawn, showing that a distinct soft order is learned for each task (• marks the shared model boundary).
|
| 133 |
+
|
| 134 |
+
Results are shown in Figure 4. The relative performance of permuted ordering and soft ordering compared to parallel ordering increases with the number of tasks trained jointly (Figure 4a), showing how flexibility of order can help in scaling to more tasks. This result is consistent with the hypothesis that parallel ordering has increased negative effects as the number of tasks increases. Figure 4bd show what soft ordering actually learns: The scalings for tasks diverge as layers specialize to different functions for different tasks.
|
| 135 |
+
|
| 136 |
+
Figure 5: UCI data sets and results. (a) The ten UCI tasks used in joint training; the varying types of problems and dataset characteristics show the diversity of this set of tasks. (b) Mean test error over all ten tasks by iteration. Permuted and parallel order show no improvement after the first 1000 iterations, while soft order decisively outperforms the other methods.
|
| 137 |
+
|
| 138 |
+
<table><tr><td>Dataset</td><td>Input Features</td><td>Output classes</td><td>Samples</td></tr><tr><td>Australian credit</td><td>14</td><td>2</td><td>690</td></tr><tr><td>Breast cancer</td><td>30</td><td>2</td><td>569</td></tr><tr><td>Ecoli</td><td>7</td><td>8</td><td>336</td></tr><tr><td>German credit</td><td>24</td><td>2</td><td>1000</td></tr><tr><td>Heart disease</td><td>13</td><td>5</td><td>303</td></tr><tr><td>Hepatitis</td><td>19</td><td>2</td><td>155</td></tr><tr><td>Iris</td><td>4</td><td>3</td><td>150</td></tr><tr><td>Pima diabetes</td><td>8</td><td>2</td><td>768</td></tr><tr><td>Wine</td><td>13</td><td>3</td><td>178</td></tr><tr><td>Yeast</td><td>8</td><td>10</td><td>1484</td></tr></table>
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
|
| 142 |
+
4.2 SUPERIFICALLY UNRELATED TASKS: JOINT TRAINING OF TEN POPULAR UCI DATASETS
|
| 143 |
+
|
| 144 |
+
The next experiment evaluates the ability of soft ordering to integrate information across a diverse set of “superficially unrelated” tasks (Mahmud and Ray, 2008), i.e., tasks with no immediate intuition for how they may be related. Ten tasks are taken from some of most popular UCI classification data sets (Lichman, 2013). Descriptions of these tasks are given in Figure 5a. Inputs and outputs have no a priori shared meaning across tasks. Each $\mathcal { E } _ { i }$ is a learned fully-connected ReLU layer with output size 32. There are four core layers, each a fully-connected ReLU layer with 32 units. Each $\mathcal { D } _ { i }$ is an unshared dense softmax layer for the given number of classes. The results in Figure 5(b) show that, while parallel and permuted show no improvement in error after the first 1000 iterations, soft ordering significantly outperforms the other methods. With this flexible layer ordering, the model is eventually able to exploit significant regularities underlying these seemingly disparate domains.
|
| 145 |
+
|
| 146 |
+
# 4.3 EXTENSION TO CONVOLUTIONS: MULTI-ALPHABET CHARACTER RECOGNITION
|
| 147 |
+
|
| 148 |
+
The Omniglot dataset (Lake et al., 2015) consists of fifty alphabets, each of which induces a different character recognition task. Deep MTL approaches have recently shown promise on this dataset (Yang and Hospedales, 2017). It is a useful benchmark for MTL because the large number of tasks allows analysis of performance as a function of the number of tasks trained jointly, and there is clear intuition for how knowledge of some alphabets will increase the ability to learn others. Omniglot is also a good setting for evaluating the ability of soft ordering to learn how to compose layers in different ways for different tasks: it was developed as a problem with inherent composibility, e.g., similar kinds of strokes are applied in different ways to draw characters from different alphabets (Lake et al., 2015). Consequently, it has been used as a test bed for deep generative models (Rezende et al., 2016). To evaluate performance for a given number of tasks $T$ , a single random ordering of tasks was created, from which the first $T$ tasks are considered. Train/test splits are created in the same way as previous work (Yang and Hospedales, 2017), using $10 \%$ or $20 \%$ of data for testing.
|
| 149 |
+
|
| 150 |
+
This experiment is a scale-up of the previous experiments in that it evaluates soft ordering of convolutional layers. The models are made as close as possible in architecture to previous work (Yang and Hospedales, 2017), while allowing soft ordering to be applied. There are four core layers, each convolutional followed by max pooling. $\mathcal { E } _ { i } ( x _ { i } ) = x _ { i } \forall i$ , and each $\mathcal { D } _ { i }$ is a fully-connected softmax layer with output size equal to the number of classes. The results show that soft ordering is able to consistently outperform other deep MTL approaches (Figure 6). The improvements are robust to the number of tasks (Figure 6a) and the amount of training data (Figure 6c), suggesting that soft ordering, not task complexity or model complexity, is responsible for the improvement.
|
| 151 |
+
|
| 152 |
+
Permuted ordering performs significantly worse than parallel ordering in this domain. This is not surprising, as deep vision systems are known to induce a common feature hierarchy, especially within the first couple of layers (Lee et al., 2008; Lecun et al., 2015). Parallel ordering has this hierarchy built in; for permuted ordering it is more difficult to exploit. However, the existence of this feature hierarchy does not preclude the possibility that the functions (i.e., layers) used to produce the hierarchy may be useful in other contexts. Soft ordering allows the discovery of such uses. Figure 6b shows how each layer is used more or less at different depths. The soft ordering model learns a “soft hierarchy” of layers, in which each layer has a distribution of increased or decreased usage at each depth. In this case, the usage of each layer is correlated (or inversely correlated) with depth. For instance, the usage of Layer 3 decreases as the depth increases, suggesting that its primary purpose is low-level feature extraction, though it is still sees substantial use in deeper contexts. Section 5 describes an experiment that further investigates the behavior of a single layer in different contexts.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 6: Omniglot results. (a) Error by number of tasks trained jointly. Soft ordering significantly outperforms single task and both fixed ordering approaches for each number of tasks; (b) Distribution of learned layer usage by depth across all 50 tasks for a soft order run. The usage of each layer is correlated (or inversely correlated) with depth. This coincides with the understanding that there is some innate hierarchy in convolutional networks, which soft ordering is able to discover. For instance, the usage of Layer 3 decreases as the depth increases, suggesting that its primary purpose is low-level feature extraction, though it is still sees substantial use in deeper contexts; (c) Errors with all 50 tasks for different training set sizes. The first five methods are previous deep MTL results (Yang and Hospedales, 2017), which use multitask tensor factorization methods in a shared parallel ordering. Soft ordering significantly outperforms the other approaches, showing the approach scales to real-world tasks requiring specialized components such as convolutional layers.
|
| 156 |
+
|
| 157 |
+
4.4 LARGE-SCALE APPLICATION: FACIAL ATTRIBUTE RECOGNITION
|
| 158 |
+
|
| 159 |
+
Although facial attributes are all high-level concepts, they do not intuitively exist at the same level of a shared hierarchy (even one that is learned; Lu et al., 2017). Rather, these concepts are related in multiple subtle and overlapping ways in semantic space. This experiment investigates how a soft ordering approach, as a component in a larger system, can exploit these relationships.
|
| 160 |
+
|
| 161 |
+
The CelebA dataset consists of ${ \approx } 2 0 0 \mathrm { K }$ $1 7 8 \times 2 1 8$ color images, each with binary labels for 40 facial attributes (Liu et al., 2015b). In this experiment, each label defines a task, and parallel and soft order models are based on a ResNet-50 vision model (He et al., 2016), which has also been used in recent state-of-the-art approaches to CelebA (Günther et al., 2017; He et al., 2017). Let $\mathcal { E } _ { i }$ be a ResNet-50 model truncated to the final average pooling layer, followed by a linear layer projecting the embedding to size 256. $\mathcal { E } _ { i }$ is shared across all tasks. There are four core layers, each a dense ReLU layer with 256 units. Each $\mathcal { D } _ { i }$ is an unshared dense sigmoid layer. Parallel ordering and soft ordering models were compared. To further test the robustness of learning, models were trained with and without the inclusion of an additional facial landmark detection regression task. Soft order models were also tested with and without the inclusion of a fixed identity layer at each depth. The identity layer can increase consistency of representation across contexts, which can ease learning of each layer, while also allowing soft ordering to tune how much total non-identity transformation to use for each individual task. This is especially relevant for the case of attributes, since different tasks can have different levels of complexity and abstraction.
|
| 162 |
+
|
| 163 |
+
The results are given in Figure 7c. Existing work that used a ResNet-50 vision model showed that using a parallel order multitask model improved test error over single-task learning from 10.37 to 9.58 (He et al., 2017). With our faster training strategy and the added core layers, our parallel ordering model achieves a test error of 10.21. The soft ordering model yielded a substantial improvement beyond this to 8.79, demonstrating that soft ordering can add value to a larger deep learning system. Including landmark detection yielded a marginal improvement to 8.75, while for parallel ordering it degraded performance slightly, indicating that soft ordering is more robust to joint training of diverse kinds of tasks. Including the identity layer improved performance to 8.64, though with both the landmark detection and the identity layer this improvement was slightly diminished. One explanation for this degredation is that the added flexibility provided by the identity layer offsets the regularization provided by landmark detection. Note that previous work has shown that adaptive weighting of task loss (He et al., 2017; Rudd et al., 2016), data augmentation and ensembling (Günther et al., 2017), and a larger underlying vision model (Lu et al., 2017) each can also yield significant improvements. Aside from soft ordering, none of these improvements alter the multitask topology, so their benefits are expected to be complementary to that of soft ordering demonstrated in this experiment. By coupling them with soft ordering, greater improvements should be possible.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 7: CelebA results. Layer usage by depth (a) without and (b) with inclusion of the identity layer. In both cases, layers with lower usage at lower depths have higher usage at higher depths, and vice versa. The identity layer almost always sees increased usage; its application can increase consistency of representation across contexts. (c) Soft order models achieve a significant improvement over parallel ordering, and receive a boost from including the identity layer. The first two rows are previous work with ResNet-50 that show their baseline improvement from single task to multitask.
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Deep MTL method</td><td>Test Error %</td></tr><tr><td>Single Task (He et al.,2017)</td><td>10.37</td></tr><tr><td>MTL Baseline (He et al.,2017)</td><td>9.58</td></tr><tr><td>Parallel Order</td><td>10.21</td></tr><tr><td>Parallel Order + Landmarks</td><td>10.29</td></tr><tr><td>Soft Order</td><td>8.79</td></tr><tr><td>Soft Order + Landmarks</td><td>8.75</td></tr><tr><td>Soft Order + Identity</td><td>8.64</td></tr><tr><td>Soft Order + Landmarks + Identity</td><td>8.68</td></tr></table>
|
| 169 |
+
|
| 170 |
+
Figures 7a-b characterize the usage of each layer learned by soft order models. Like in the case of Omniglot, layers that are used less at lower depths are used more at higher depths, and vice versa, giving further evidence that the models learn a “soft hierarchy” of layer usage. When the identity layer is included, its usage is almost always increased through training, as it allows the model to use smaller specialized proportions of nonlinear structure for each individual task.
|
| 171 |
+
|
| 172 |
+
# 5 VISUALIZING THE BEHAVIOR OF SOFT ORDERING LAYERS
|
| 173 |
+
|
| 174 |
+
The success of soft layer ordering suggests that layers learn functional primitives with similar effects in different contexts. To explore this idea qualitatively, the following experiment uses generative visual tasks. The goal of each task is to learn a function $( x , y ) \to v$ , where $( x , y )$ is a pixel coordinate and $v$ is a brightness value, all normalized to [0, 1]. Each task is defined by a single image of a “4” drawn from the MNIST dataset; all of its pixels are used as training data. Ten tasks are trained using soft ordering with four shared dense ReLU layers of 100 units each. $\mathcal { E } _ { i }$ is a linear encoder that is shared across tasks, and $\mathcal { D } _ { i }$ is a global average pooling decoder. Thus, task models are distinguished completely by their learned soft ordering scaling parameters $s _ { t }$ . To visualize the behavior of layer $l$ at depth $d$ for task $t$ , the predicted image for task $t$ is generated across varying magnitudes of $\mathbf { \sigma } ^ { s } ( t , l , d ) \cdot$ . The results for the first two tasks and the first layer are shown in Table 1. Similar function is observed in each of the six contexts, suggesting that the layers indeed learn functional primitives.
|
| 175 |
+
|
| 176 |
+

|
| 177 |
+
Table 1: Example behavior of a soft order layer. For each task $t$ , and at each depth $d$ , the effect of increasing the activation of of this particular layer is to expand the left side of the $" 4 "$ in a manner appropriate to the functional context (e.g., the magnitude of the effect decreases with depth). Results for other layers are similar, suggesting that the layers implement functional primitives.
|
| 178 |
+
|
| 179 |
+
# 6 DISCUSSION AND FUTURE WORK
|
| 180 |
+
|
| 181 |
+
In the interest of clarity, the soft ordering approach in this paper was developed as a relatively small step away from the parallel ordering assumption. To develop more practical and specialized methods, inspiration can be taken from recurrent architectures, the approach can be extended to layers of more general structure, and applied to training and understanding general functional building blocks.
|
| 182 |
+
|
| 183 |
+
Connections to recurrent architectures. Eq. 7 is defined recursively with respect to the learned layers shared across tasks. Thus, the soft-ordering architecture can be viewed as a new type of recurrent architecture designed specifically for MTL. From this perspective, Figure 3 shows an unrolling of a soft layer module: different scaling parameters are applied at different depths when unrolled for different tasks. Since the type of recurrence induced by soft ordering does not require task input or output to be sequential, methods that use recurrence in such a setting are of particular interest (Liang and Hu, 2015; Liao and Poggio, 2016; Pinheiro and Collobert, 2014; Socher et al., 2011; Zamir et al., 2016). Recurrent methods can also be used to reduce the size of $S$ below $O ( T D ^ { 2 } )$ , e.g., via recurrent hypernetworks (Ha et al., 2016). Finally, Section 4 demonstrated soft ordering where shared learned layers were fully-connected or convolutional; it is also straightforward to extend soft ordering to shared layers with internal recurrence, such as LSTMs (Hochreiter and Schmidhuber, 1997). In this setting, soft ordering can be viewed as inducing a higher-level recurrence.
|
| 184 |
+
|
| 185 |
+
Generalizing the structure of shared layers. For clarity, in this paper all core layers in a given setup had the same shape. Of course, it would be useful to have a generalization of soft ordering that could subsume any modern deep architecture with many layers of varying structure. As given by Eq. 7, soft ordering requires the same shape inputs to the element-wise sum at each depth. Reshapes and/or resampling can be added as adapters between tensors of different shape; alternatively, a function other than a sum could be used. For example, instead of learning a weighting across layers at each depth, a probability of applying each module could be learned in a manner similar to adaptive dropout (Ba and Frey, 2013; Li et al., 2016) or a sparsely-gated mixture of experts (Shazeer et al., 2017). Furthermore, the idea of a soft ordering of layers can be extended to soft ordering over modules with more general structure, which may more succinctly capture recurring modularity.
|
| 186 |
+
|
| 187 |
+
Training generalizable building blocks. Because they are used in different ways at different locations for different tasks, the shared trained layers in permuted and soft ordering have learned more general functionality than layers trained in a fixed location or for a single task. A natural hypothesis is that they are then more likely to generalize to future unseen tasks, perhaps even without further training. This ability would be especially useful in the small data regime, where the number of trainable parameters should be limited. For example, given a collection of these layers trained on a previous set of tasks, a model for a new task could learn how to apply these building blocks, e.g., by learning a soft order, while keeping their internal parameters fixed. Learning an efficient set of such generalizable layers would then be akin to learning a set of functional primitives. Such functional modularity and repetition is evident in the natural, technological and sociological worlds, so such a set of functional primitives may align well with complex real-world models. This perspective is related to recent work in reusing modules in the parallel ordering setting (Fernando et al., 2017). The different ways in which different tasks learn to use the same set of modules can also help shed light on how tasks are related, especially those that seem superficially disparate (e.g., by extending the analysis performed for Figure 4d), thus assisting in the discovery of real-world regularities.
|
| 188 |
+
|
| 189 |
+
# 7 CONCLUSION
|
| 190 |
+
|
| 191 |
+
This paper has identified parallel ordering of shared layers as a common assumption underlying existing deep MTL approaches. This assumption restricts the kinds of shared structure that can be learned between tasks. Experiments demonstrate how direct approaches to removing this assumption can ease the integration of information across plentiful and diverse tasks. Soft ordering is introduced as a method for learning how to apply layers in different ways at different depths for different tasks, while simultaneously learning the layers themselves. Soft ordering is shown to outperform parallel ordering methods as well as single-task learning across a suite of domains. These results show that deep MTL can be improved while generating a compact set of multipurpose functional primitives, thus aligning more closely with our understanding of complex real-world processes.
|
| 192 |
+
|
| 193 |
+
# ACKNOWLEDGMENTS
|
| 194 |
+
|
| 195 |
+
We would like to thank Matt Feiszli for valuable discussions and all anonymous reviewers for their helpful feedback.
|
| 196 |
+
|
| 197 |
+
# REFERENCES
|
| 198 |
+
|
| 199 |
+
M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
|
| 200 |
+
J. Ba and B. Frey. Adaptive dropout for training deep neural networks. In NIPS, pages 3084–3092. 2013.
|
| 201 |
+
H. Bilen and A. Vedaldi. Integrated perception with recurrent multi-task neural networks. In NIPS, pages 235–243. 2016.
|
| 202 |
+
H. Bilen and A. Vedaldi. Universal representations: The missing link between faces, text, planktons, and cat breeds. CoRR, abs/1701.07275, 2017.
|
| 203 |
+
R. Caruana. Multitask learning. In Learning to learn, pages 95–133. Springer US, 1998.
|
| 204 |
+
F. Chollet et al. Keras, 2015.
|
| 205 |
+
R. Collobert and J. Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In ICML, pages 160–167, 2008.
|
| 206 |
+
C. Devin, A. Gupta, T. Darrell, P. Abbeel, and S. Levine. Learning modular neural network policies for multitask and multi-robot transfer. CoRR, abs/1609.07088, 2016.
|
| 207 |
+
D. Dong, H. Wu, W. He, D. Yu, and H. Wang. Multi-task learning for multiple language translation. In ACL, pages 1723–1732, 2015.
|
| 208 |
+
C. Fernando, D. Banarse, C. Blundell, Y. Zwols, D. Ha, A. A. Rusu, A. Pritzel, and D. Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. CoRR, abs/1701.08734, 2017.
|
| 209 |
+
M. Günther, A. Rozsa, and T. E. Boult. AFFACT - alignment free facial attribute classification technique. CoRR, abs/1611.06158v2, 2017.
|
| 210 |
+
D. Ha, A. M. Dai, and Q. V. Le. Hypernetworks. CoRR, abs/1609.09106, 2016.
|
| 211 |
+
K. Hashimoto, C. Xiong, Y. Tsuruoka, and R. Socher. A joint many-task model: Growing a neural network for multiple NLP tasks. CoRR, abs/1611.01587, 2016.
|
| 212 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016.
|
| 213 |
+
K. He, Z. Wang, Y. Fu, R. Feng, Y.-G. Jiang, and X. Xue. Adaptively weighted multi-task deep network for person attribute classification. 2017.
|
| 214 |
+
S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997. ISSN 0899-7667.
|
| 215 |
+
J. T. Huang, J. Li, D. Yu, L. Deng, and Y. Gong. Cross-language knowledge transfer using multilingual deep neural network with shared hidden layers. In ICASSP, pages 7304–7308, 2013.
|
| 216 |
+
Z. Huang, J. Li, S. M. Siniscalchi, I.-F. Chen, J. Wu, and C.-H. Lee. Rapid adaptation for deep neural networks through multi-task learning. In INTERSPEECH, 2015.
|
| 217 |
+
M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. In ICLR, 2017.
|
| 218 |
+
B. Jou and S.-F. Chang. Deep cross residual learning for multitask visual recognition. In MM, pages 998–1007, 2016.
|
| 219 |
+
D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
|
| 220 |
+
J. Kirkpatrick, R. Pascanu, N. Rabinowitz, J. Veness, et al. Overcoming catastrophic forgetting in neural networks. PNAS, 114(13):3521–3526, 2017.
|
| 221 |
+
B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
|
| 222 |
+
Y. Lecun, Y. Bengio, and G. Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
|
| 223 |
+
H. Lee, C. Ekanadham, and A. Y. Ng. Sparse deep belief net model for visual area v2. In NIPS, pages 873–880. 2008.
|
| 224 |
+
Z. Li, B. Gong, and T. Yang. Improved dropout for shallow and deep learning. In NIPS, pages 2523–2531. 2016.
|
| 225 |
+
M. Liang and X. Hu. Recurrent convolutional neural network for object recognition. In CVPR, 2015.
|
| 226 |
+
Q. Liao and T. A. Poggio. Bridging the gaps between residual learning, recurrent neural networks and visual cortex. CoRR, abs/1604.03640, 2016.
|
| 227 |
+
M. Lichman. UCI machine learning repository, 2013.
|
| 228 |
+
X. Liu, J. Gao, X. He, L. Deng, K. Duh, and Y. Y. Wang. Representation learning using multi-task deep neural networks for semantic classification and information retrieval. In NAACL, pages 912–921, 2015a.
|
| 229 |
+
Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015b.
|
| 230 |
+
Y. Lu, A. Kumar, S. Zhai, Y. Cheng, T. Javidi, and R. S. Feris. Fully-adaptive feature sharing in multi-task networks with applications in person attribute classification. CVPR, 2017.
|
| 231 |
+
M. Luong, Q. V. Le, I. Sutskever, O. Vinyals, and L. Kaiser. Multi-task sequence to sequence learning. In ICLR, 2016.
|
| 232 |
+
M. H. Mahmud. On universal transfer learning. Theoretical Computer Science, 410(19):1826 – 1846, 2009. ISSN 0304-3975.
|
| 233 |
+
M. M. Mahmud and S. Ray. Transfer learning using Kolmogorov complexity: Basic theory and empirical evaluations. In NIPS, pages 985–992. 2008.
|
| 234 |
+
I. Misra, A. Shrivastava, A. Gupta, and M. Hebert. Cross-stitch networks for multi-task learning. In CVPR, 2016.
|
| 235 |
+
P. Pinheiro and R. Collobert. Recurrent convolutional neural networks for scene labeling. In ICML, pages 82–90, 2014.
|
| 236 |
+
R. Ranjan, V. M. Patel, and R. Chellappa. Hyperface: A deep multi-task learning framework for face detection, landmark localization, pose estimation, and gender recognition. CoRR, abs/1603.01249, 2016.
|
| 237 |
+
D. Rezende, Shakir, I. Danihelka, K. Gregor, and D. Wierstra. One-shot generalization in deep generative models. In ICML, pages 1521–1529, 2016.
|
| 238 |
+
E. M. Rudd, M. Günther, and T. E. Boult. MOON: A mixed objective optimization network for the recognition of facial attributes. In ECCV, pages 19–35, 2016.
|
| 239 |
+
A. A. Rusu, N. C. Rabinowitz, G. Desjardins, H. Soyer, et al. Progressive neural networks. CoRR, abs/1606.04671, 2016.
|
| 240 |
+
A. M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. CoRR, abs/1312.6120, 2013.
|
| 241 |
+
M. L. Seltzer and J. Droppo. Multi-task learning in deep neural networks for improved phoneme recognition. In ICASSP, pages 6965–6969, 2013.
|
| 242 |
+
N. Shazeer, A. Mirhoseini, K. Maziarz, A. Davis, Q. V. Le, G. E. Hinton, and J. Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In ICLR, 2017.
|
| 243 |
+
R. Socher, C. C.-Y. Lin, A. Y. Ng, and C. D. Manning. Parsing natural scenes and natural language with recursive neural networks. In ICML, pages 129–136, 2011.
|
| 244 |
+
N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. JMLR, 15(1):1929–1958, 2014.
|
| 245 |
+
S. Toshniwal, H. Tang, L. Lu, and K. Livescu. Multitask Learning with Low-Level Auxiliary Tasks for EncoderDecoder Based Speech Recognition. CoRR, abs/1704.01631, 2017.
|
| 246 |
+
A. Veit, M. J. Wilber, and S. Belongie. Residual networks behave like ensembles of relatively shallow networks. In NIPS, pages 550–558. 2016.
|
| 247 |
+
Z. Wu, C. Valentini-Botinhao, O. Watts, and S. King. Deep neural networks employing multi-task learning and stacked bottleneck features for speech synthesis. In ICASSP, pages 4460–4464, 2015.
|
| 248 |
+
Y. Yang and T. Hospedales. Deep multi-task representation learning: A tensor factorisation approach. In ICLR, 2017.
|
| 249 |
+
A. R. Zamir, T. Wu, L. Sun, W. Shen, J. Malik, and S. Saverese. Feedback networks. CoRR, abs/1612.09508, 2016.
|
| 250 |
+
Y. Zhang and D. Weiss. Stack-propagation: Improved representation learning for syntax. CoRR, abs/1603.06598, 2016.
|
| 251 |
+
Z. Zhang, P. Luo, C. C. Loy, and X. Tang. Facial landmark detection by deep multi-task learning. In ECCV, pages 94–108, 2014.
|
| 252 |
+
|
| 253 |
+
# A EXPERIMENTAL DETAILS
|
| 254 |
+
|
| 255 |
+
All experiments were run with the Keras deep learning framework Chollet et al. (2015), using the Tensorflow backend (Abadi et al., 2015). All experiments used the Adam optimizer with default parameters (Kingma and Ba, 2014) unless otherwise specified.
|
| 256 |
+
|
| 257 |
+
In each iteration of multitask training, a random batch for each task is processed, and the results are combined across tasks into a single update. Compared to alternating batches between tasks (Luong et al., 2016), processing all tasks simultaneously simplified the training procedure, and led to faster and lower final convergence. When encoders are shared, the inputs of the samples in each batch are the same across tasks. Cross-entropy loss was used for all classification tasks. The overall validation loss is the sum over all per task validation losses.
|
| 258 |
+
|
| 259 |
+
In each experiment, single task, parallel ordering (Eq. 2), permuted ordering (Eq. 3), and soft ordering (Eq. 7) trained an equivalent set of core layers. In permuted ordering, the order of layers was randomly generated for each task each trial. Several trials were run for each setup to produce confidence bounds.
|
| 260 |
+
|
| 261 |
+
# A.1 MNIST EXPERIMENTS
|
| 262 |
+
|
| 263 |
+
Input pixel values were normalized to be between 0 and 1. The training and test sets for each task were the MNIST train and test sets restricted to the two selected digits. A dropout rate of 0.5 was applied at the output of each core layer. Each setup was trained for 20K iterations, with each batch consisting of 64 samples for each task.
|
| 264 |
+
|
| 265 |
+
When randomly selecting the pairs of digits that define a set of tasks, digits were selected without replacement within a task, and with replacement across tasks, so there were 45 possible tasks, and $4 5 ^ { k }$ possible sets of tasks of size $k$ .
|
| 266 |
+
|
| 267 |
+
# A.2 UCI EXPERIMENTS
|
| 268 |
+
|
| 269 |
+
For all tasks, each input feature was scaled to be between 0 and 1. For each task, training and validation data were created by a random 80-20 split. This split was fixed across trials. A dropout rate of 0.8 was applied at the output of each core layer.
|
| 270 |
+
|
| 271 |
+
# A.3 OMNIGLOT EXPERIMENTS
|
| 272 |
+
|
| 273 |
+
To enable soft ordering, the output of all shared layers must have the same shape. For comparability, the models were made as close as possible in architecture to previous work (Yang and Hospedales, 2017), in which models had four sharable layers, three of which were 2D convolutions followed by $2 \times 2$ max-pooling, of which two had $3 \times 3$ kernels. So, in this experiment, to evaluate soft ordering of convolutional layers, there were four core layers, each a 2D convolutional layer with ReLU activation and kernel size $3 \times 3$ . Each convolutional layer was followed by a $2 \times 2$ maxpooling layer. The number of filters for each convolutional layer was set at 53, which makes the number of total model parameters as close as possible to the reference model. A dropout rate of 0.5 was applied at the output of after each core layer.
|
| 274 |
+
|
| 275 |
+
The Omniglot dataset consists of $1 0 5 \times 1 0 5$ black-and-white images. There are fifty alphabets of characters and twenty images per character. To be compatible with the shapes of shared layers, the input was zero-padded along the third dimension so that its shape was $1 0 5 \times 1 0 5 \times 5 3$ , i.e., with the first $1 0 5 \times 1 0 5$ slice containing the image data and the remainder zeros. To evaluate approaches on $k$ tasks, a random ordering of the fifty tasks was created and fixed across all trials. In each trial, the first $k$ tasks in this ordering were trained jointly for 5000 iterations, with each training batch containing $k$ random samples, one from each task. The fixed ordering of tasks was as follows:
|
| 276 |
+
|
| 277 |
+
[Gujarati, Sylheti, Arcadian, Tibetan, Old Church Slavonic (Cyrillic), Angelic, Malay (Jawi-Arabic), Sanskrit, Cyrillic, Anglo-Saxon Futhorc, Syriac (Estrangelo), Ge’ez, Japanese (katakana), Keble, Manipuri, Alphabet of the Magi, Gurmukhi, Korean, Early Aramaic, Atemayar Qelisayer, Tagalog, Mkhedruli (Georgian), Inuktitut (Canadian Aboriginal Syllabics), Tengwar, Hebrew, N’Ko, Grantha, Latin, Syriac (Serto), Tifinagh, Balinese, Mongolian, ULOG, Futurama, Malayalam, Oriya, Ojibwe (Canadian Aboriginal Syllabics), Avesta, Kannada, Bengali, Japanese (hiragana), Armenian, AurekBesh, Glagolitic, Asomtavruli (Georgian), Greek, Braille, Burmese (Myanmar), Blackfoot (Canadian Aboriginal Syllabics), Atlantean].
|
| 278 |
+
|
| 279 |
+
# A.4 CELEBA EXPERIMENTS
|
| 280 |
+
|
| 281 |
+
The training, validation, and test splits provided by Liu et al. (2015b) were used. There are ${ \approx } 1 6 0 \mathrm { K }$ images for training, ${ \approx } 2 0 \mathrm { K }$ for validation, and ${ \approx } 2 0 \mathrm { K }$ for testing. The dataset contains 20 images of each of approximately ${ \approx } 1 0 \mathrm { K }$ celebrities. The images for a given celebrity occur in only one of the three dataset splits, so models must also generalize to new human identities.
|
| 282 |
+
|
| 283 |
+
The weights for ResNet-50 were initialized with the pre-trained imagenet weights provided in the Keras framework Chollet et al. (2015). Image preprocessing was done with the default Keras image preprocessing function, including resizing all images to $2 2 4 \times 2 2 4$ .
|
| 284 |
+
|
| 285 |
+
The output for the facial landmark detection task is a 10 dimensional vector indicating the $( x , y )$ locations of five landmarks, normalized between 0 and 1. Mean squared error was used as the training loss. When landmark detection is included, the target metric is still attribute classification error. This is because the aligned CelebA images are used, so accurate landmark detection is not a challenge, but including it as an additional task can still provide additional regularization to a multitask model.
|
| 286 |
+
|
| 287 |
+
A dropout rate of 0.5 was applied at the output of after each core layer. The experiments used a batch size of 32. After validation loss converges via Adam, models are trained with RMSProp with learning rate $1 e ^ { - 5 }$ , which is a similar approach to that used by Günther et al. (2017).
|
| 288 |
+
|
| 289 |
+
# A.5 EXPERIMENTS ON VISUALIZING LAYER BEHAVIOR
|
| 290 |
+
|
| 291 |
+
To produce the resulting image for a fixed model, the predictions at each pixel locations were generated, denormalized, and mapped back to the pixel coordinate space. The loss used for this experiment was mean squared error (MSE). Since all pixels for a task image are used for training, there is no sense of generalization to unseen data within a task. As a result, no dropout was used in this experiment.
|
| 292 |
+
|
| 293 |
+
Task models are distinguished completely by their learned soft ordering scaling parameters $s _ { t }$ , so the joint model can be viewed as a generative model which generates different 4’s for varying values of $s _ { t }$ . To visualize the behavior of layer $l$ at depth $d$ for task $t$ , the output of the model for task $t$ was visualized while sweeping $\mathbf { \Xi } ^ { S } ( t , l , d )$ across [0, 1]. To enable this sweeping while keeping the rest of the model behavior fixed, the softmax for each task at each depth was replaced with a sigmoid activation. Note that due to the global avgerage pooling decoder, altering the weight of a single layer has no observable effect at depth four.
|
md/train/Bye9LiR9YX/Bye9LiR9YX.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# REMEMBER AND FORGET FOR EXPERIENCE REPLAY
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Experience replay (ER) is crucial for attaining high data-efficiency in off-policy deep reinforcement learning (RL). ER entails the recall of experiences obtained in past iterations to compute gradient estimates for the current policy. However, the accuracy of such updates may deteriorate when the policy diverges from past behaviors, possibly undermining the effectiveness of ER. Previous off-policy RL algorithms mitigated this issue by tuning their hyper-parameters in order to abate policy changes. We propose ReF-ER, a method for active management of experiences in the Replay Memory (RM). ReF-ER forgets experiences that would be too unlikely with the current policy and constrains policy changes within a trust region of the behaviors in the RM. We couple ReF-ER with Q-learning, deterministic policy gradient and off-policy gradient methods to show that ReF-ER reliably improves the performance of continuous-action off-policy RL. We complement ReF-ER with a novel off-policy actor-critic algorithm (RACER) for continuous-action control. RACER employs a computationally efficient closed-form approximation of the action values and is shown to be highly competitive with state-of-the-art algorithms on benchmark problems, while being robust to large hyper-parameter variations.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep Reinforcement Learning (RL) has an ever increasing number of success stories ranging from realistic simulated environments (Schulman et al., 2015; Mnih et al., 2016), robotics (Levine et al., 2016) and games (Mnih et al., 2015; Silver et al., 2016). Experience Replay (ER) (Lin, 1992) enhances deep RL algorithms by using information collected in past policy $( \mu )$ iterations to compute updates for the current policy $( \pi )$ . ER has become one of the mainstay techniques to improve the sample-efficiency of off-policy deep RL. Sampling from a Replay Memory (RM) stabilizes stochastic gradient descent (SGD) by disrupting temporal correlations and extracts information from useful experiences over multiple updates (Schaul et al., 2015b). However, when $\pi$ is parameterized by a Neural Network (NN), SGD updates may result in significant changes to the policy, thereby shifting the distribution of states observed from the environment. In this case sampling the RM for further updates may lead to incorrect gradient estimates, therefore deep RL methods must account for and limit the dissimilarity between $\pi$ and behaviors in the RM. Previous works employed trust region methods to bound policy updates (Schulman et al., 2015; Wang et al., 2017). Despite several successes, deep RL algorithms are known to suffer from instabilities and exhibit high-variance of outcomes (Islam et al., 2017; Henderson et al., 2017), especially continuous-action methods employing the stochastic (Sutton et al., 2000) or deterministic (Silver et al., 2014) Policy Gradients (PG or DPG).
|
| 12 |
+
|
| 13 |
+
In this work we redesign ER in order to control the distance between the behaviors $\mu$ used to compute the update and the current policy $\pi$ . More specifically, we classify experiences either as “near-policy" or “far-policy", depending on the ratio $\rho$ of probabilities of selecting the associated action with $\pi$ and that with $\mu$ . The weight $\rho$ appears in many estimators that are used with ER such as the off-policy policy gradients (off-PG) (Degris et al., 2012) and the off-policy return-based evaluation algorithm Retrace (Munos et al., 2016). From this classification, we introduce measures to limit the fraction of “far-policy" samples in the RM, as well as computing gradient estimates only from “near-policy" experiences. Furthermore, these hyper-parameters can be gradually annealed during training to obtain increasingly accurate updates from nearly on-policy experiences. Remember and Forget Experience Replay (ReF-ER) is a simple algorithm that can be applied to virtually any off-policy RL algorithm with parameterized policies. We show that ReF-ER allows better stability and performance than conventional ER in all three main classes of continuous-actions off-policy deep RL algorithms:
|
| 14 |
+
|
| 15 |
+
methods based on the DPG (ie. DDPG (Lillicrap et al., 2016)), methods based on Q-learning (ie.
|
| 16 |
+
NAF (Gu et al., 2016)), and with off-PG (Degris et al., 2012; Wang et al., 2017).
|
| 17 |
+
|
| 18 |
+
In recent years, there has been a growing interest in coupling RL with high-fidelity physics simulations (Reddy et al., 2016; Novati et al., 2017; Colabrese et al., 2017; Verma et al., 2018). The computational cost of these simulations calls for data-efficient RL methods that are reliable and do not require problem-specific tweaks to the hyper-parameters. Moreover, while on-policy training of simple policy architectures has been shown to be sufficient in some benchmark environments (Rajeswaran et al., 2017), agents aiming to solve complex problems with highly non-linear dynamics might require deep or recurrent models that can be trained more efficiently with off-policy methods. We address these issues by introducing a simple and computationally efficient off-policy actor-critic architecture (RACER) for continuous-action control problems. We systematically analyze a wide range of hyper-parameters on the OpenAI Gym (Brockman et al., 2016) robotic tasks, and show that RACER combined with ReF-ER reliably obtains results that are competitive with the state-of-the-art.
|
| 19 |
+
|
| 20 |
+
# 2 PRELIMINARIES
|
| 21 |
+
|
| 22 |
+
Consider the sequential decision process of an agent aiming to optimize its interaction with the environment. At each step $t$ , the agent observes its state $s _ { t } \in \bar { \mathbb { R } } ^ { d _ { S } }$ , performs an action by sampling a policy $a _ { t } \sim \mu ( a | s _ { t } ) \in \mathbb { R } ^ { \mathbf { \bar { d } } _ { A } }$ , and transitions to a new state $s _ { t + 1 } \sim \mathcal { D } ( s | a _ { t } , s _ { t } )$ with reward $r _ { t + 1 } \in \mathbb { R }$ . These interactions $\{ s _ { t } , a _ { t } , r _ { t } , \mu _ { t } \}$ are stored in a RM, which constitutes the data used by off-policy RL to train the parametric policy $\pi ^ { \mathfrak { w } } ( a | s )$ . The importance weight $\rho _ { t } = \pi ^ { \mathrm { w } } ( a _ { t } | s _ { t } ) / \mu _ { t }$ is the ratio between the probability of selecting $a _ { t }$ with the current $\pi ^ { \mathfrak { w } }$ and with the behavior $\mu _ { t }$ , which gradually becomes dissimilar from $\pi ^ { \mathfrak { w } }$ as the latter is trained. The on-policy state-action value $Q ^ { \pi } ( s , a )$ measures the expected returns from $( s , a )$ following the policy $\pi ^ { \mathfrak { w } }$ :
|
| 23 |
+
|
| 24 |
+
$$
|
| 25 |
+
Q ^ { \pi } ( s , a ) = \underset { s _ { t } \sim \mathcal { D } , ~ a _ { t } \sim \pi ^ { \mathfrak { r } } } { \mathbb { E } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t + 1 } \bigg | s _ { 0 } = s , a _ { 0 } = a \right]
|
| 26 |
+
$$
|
| 27 |
+
|
| 28 |
+
Here $\gamma$ is a discount factor. The value of state $s$ is the on-policy expectation: $V ^ { \pi } ( s ) \ =$ $\mathbb { E } _ { a \sim \pi } \left[ Q ^ { \pi } ( s , a ) \right]$ and the action advantage is $\begin{array} { r l } { A ^ { \pi } ( s , a ) } & { { } = { \begin{array} { l } { { \bar { } } Q ^ { \pi } { \bar { } } ( s , a { \bar { ) } } - V ^ { \pi } ( s ) } \end{array} } } \end{array}$ , such that $\mathbb { E } _ { a \sim \pi } \left[ A ^ { \pi } ( s , a ) \right] : = 0$ . We consider algorithms that train parametric approximators $Q ^ { \mathsf { w } }$ from off-policy data. The Q-learning target is $\begin{array} { r } { \hat { q } _ { t } = r _ { t + 1 } + \gamma \mathbb { E } _ { a ^ { \prime } \sim \pi } Q ^ { \mathrm { w } } ( s _ { t + 1 } , a ^ { \prime } ) } \end{array}$ . The Retrace algorithm (Munos et al., 2016) includes all the rewards obtained by the behavior $\mu _ { t }$ in the value estimation:
|
| 29 |
+
|
| 30 |
+
$$
|
| 31 |
+
\hat { Q } _ { t } ^ { \mathrm { r e t } } = r _ { t + 1 } + \gamma V ^ { \mathrm { u } } ( s _ { t + 1 } ) + \gamma \operatorname* { m i n } \{ 1 , \rho _ { t + 1 } \} \left[ \hat { Q } _ { t + 1 } ^ { \mathrm { r e t } } - Q ^ { \mathrm { u } } ( s _ { t + 1 } , a _ { t + 1 } ) \right]
|
| 32 |
+
$$
|
| 33 |
+
|
| 34 |
+
The off-PG (Degris et al., 2012) can be used to update $\pi ^ { \mathfrak { w } }$ by ER: $\begin{array} { r } { \hat { g } _ { t } ^ { \mathrm { o f f - P G } } ( \mathbb { w } ) = \rho _ { t } \hat { A } _ { t } ^ { \pi } \nabla _ { \mathbb { w } } \log \pi ^ { \mathrm { w } } ( a _ { t } | s _ { t } ) } \end{array}$ Here, $\hat { A } _ { t } ^ { \pi }$ is an estimator for the on-policy advantage, such as $\hat { A } _ { t } ^ { \mathrm { r e t } } : = \hat { Q } _ { t } ^ { \mathrm { r e t } } - V ^ { \mathsf { u } } ( s _ { t } )$ .
|
| 35 |
+
|
| 36 |
+
# 3 REMEMBER AND FORGET EXPERIENCE REPLAY
|
| 37 |
+
|
| 38 |
+
In off-policy RL it is common to maximize on-policy returns averaged over the distribution of states in a RM (Degris et al., 2012). However, as $\pi ^ { \mathfrak { w } }$ gradually shifts away from previous behaviors $\mu _ { t }$ , the distribution of states in the RM is increasingly dissimilar from the on-policy distribution, and trying to increase an off-policy performance metric may not improve on-policy outcomes. This issue may be compounded with algorithm-specific concerns. For example, in ACER (Wang et al., 2017) the dissimilarity between $\mu _ { t }$ and $\pi ^ { \mathfrak { w } }$ may cause vanishing or diverging importance weights $\rho _ { t }$ , thereby increasing the variance of the off-PG and deteriorating the convergence speed of Retrace by inducing “trace-cutting” (Munos et al., 2016). As a remedy, ACER tunes the learning rate and uses a target network (Mnih et al., 2015), updated as a delayed copy of the policy network, to constrain policy updates. Target networks are also employed in DDPG (Lillicrap et al., 2016) in order to slow down the feedback loop between value-network and policy-network optimizations. This feedback loop causes overestimated action values that can only be corrected by acquiring new on-policy samples. Recent works (Henderson et al., 2017) have shown the opaque variability of outcomes of continuous-action deep RL algorithms depending on hyper-parameters. Target-networks may be one of the sources of this unpredictability. In fact, when using deep approximators, there is no guarantee that the small weight changes imposed by target-networks correspond to small changes in the network’s output.
|
| 39 |
+
|
| 40 |
+
Here we propose a set of three simple rules, collectively referred to as Remember and Forget ER (ReF-ER), to directly control the degree of “off-policyness” of the samples in the RM:
|
| 41 |
+
|
| 42 |
+
1. Updates are computed from mini-batches drawn uniformly from a RM. We compute the importance weight $\rho _ { t }$ of each sample and classify it as “near-policy" if $1 / c _ { \mathrm { m a x } } { < } \rho _ { t } { < } c _ { \mathrm { m a x } }$ with $c _ { \operatorname* { m a x } } > 1$ . The samples with vanishing $( \rho _ { t } { < } 1 / c _ { \mathrm { m a x } } )$ or exploding $( \rho _ { t } > c _ { \operatorname* { m a x } } )$ importance weights are classified as “far-policy". When computing off-policy estimators with finite batch-sizes, such as ${ \hat { Q } } ^ { \mathrm { r e t } }$ or the off-PG, “far-policy" samples may either be irrelevant or increase the variance. ReF-ER allows computing gradient estimates exclusively from “near-policy" samples. In order to efficiently approximate the number of far-policy samples in the RM, we store for each step its most recent $\rho _ { t }$
|
| 43 |
+
|
| 44 |
+
2. When acquiring samples from the environment, older episodes with the highest fraction of far-policy samples are removed until the number $n _ { \mathrm { o b s } }$ of samples in the RM is at most $N$ .
|
| 45 |
+
|
| 46 |
+
3. Policy updates are penalized in order to attract the current policy $\pi ^ { \mathfrak { w } }$ towards $\mu _ { t }$
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\begin{array} { r } { \hat { \mathbf { g } } _ { t } ^ { \mathrm { R e F - E R } } ( \mathsf { w } ) = \left\{ \begin{array} { l l } { \beta \hat { \mathbf { g } } _ { t } ( \mathsf { w } ) - ( 1 - \beta ) \nabla D _ { \mathrm { K L } } \left[ \mu _ { t } \| \pi ^ { \mathsf { w } } ( \cdot | s _ { t } ) \right] } & { \mathrm { i f ~ } 1 / c _ { \mathrm { m a x } } < \rho _ { t } < c _ { \mathrm { m a x } } } \\ { - ( 1 - \beta ) \nabla D _ { \mathrm { K L } } \left[ \mu _ { t } \| \pi ^ { \mathsf { w } } ( \cdot | s _ { t } ) \right] } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \end{array}
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
Here $D _ { \mathrm { K L } }$ is the Kullback–Leibler divergence and the coefficient $\beta \in [ 0 , 1 ]$ is updated after each gradient step such that a fixed fraction $\bar { D } \in ( 0 , 1 )$ of the RM are far-policy samples:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\beta \{ { \begin{array} { l l } { ( 1 - \eta ) \beta } & { { \mathrm { i f ~ } } n _ { \mathrm { f a r } } / n _ { \mathrm { o b s } } > D } \\ { ( 1 - \eta ) \beta + \eta , } & { { \mathrm { o t h e r w i s e } } } \end{array} }
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\eta$ is the learning rate and $n _ { \mathrm { f a r } }$ is the number of far-policy samples. Note that iteratively updating $\beta$ with Eq. 4 has fixed points in 0 for $n _ { \mathrm { f a r } } / n _ { \mathrm { o b s } } { > } D$ and in 1 otherwise.
|
| 59 |
+
|
| 60 |
+
For $c _ { \mathrm { m a x } } { \to } 1$ and $D { \to } 0$ , ReF-ER becomes asymptotically equivalent to computing updates from on-policy samples. ReF-ER aims to reduce the sensitivity on the network architecture and hyperparameters by controlling the rate at which the policy can deviate from the behaviors in the RM.
|
| 61 |
+
|
| 62 |
+
# 4 RACER: REGULARIZED ACTOR-CRITIC WITH EXPERIENCE REPLAY
|
| 63 |
+
|
| 64 |
+
This work analyzes ReF-ER with three types of continuous-actions off-policy deep RL algorithms: methods based on the DPG (i.e. DDPG), based on Q-learning (i.e. NAF), and based on the off-PG (e.g. ACER (Wang et al., 2017) and IMPALA (Espeholt et al., 2018)). Here we introduce RACER, an off-PG based architecture with some improvements over ACER and IMPALA which aid our analysis of ReF-ER. First, RACER does not require expensive network architectures (easing reproducibility and exploration of the hyper-parameters). Second, it samples time steps rather than episodes (like DDPG and NAF and unlike ACER and IMPALA), further reducing its cost. Third, it does not introduce any technique that would interfere with ReF-ER and affect its analysis. Specifically, ACER uses the variance truncation and bias correction trick (TBC), employs a target network to bound policy updates with a trust-region scheme, and modifies Retrace to use $^ { d } \hat { \sqrt { \rho } }$ instead of $\rho$ . Lacking these techniques, we expect RACER to require ReF-ER to deal with unbounded importance weights.
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 1: (a) Diagram of asynchronous ER-based RL algorithms. (b) Neural network architecture employed by RACER. Blue arrows connect each output with the elements of the actor-critic framework for which it is used. Red arrows represent the flow of the error signals.
|
| 68 |
+
|
| 69 |
+
RACER’s network architecture consists of a single Multilayer Perceptron (MLP) with weights $\mathtt { w }$ which receives the state $s$ and outputs as shown in Fig. 1b. From the final layer, the first $2 d _ { A }$ outputs are taken as the mean m and diagonal covariance $\pmb { \Sigma }$ of the Gaussian policy $\pi ^ { \mathfrak { w } } ( a | s )$ . One output estimates the state value $V ^ { \mathrm { { w } } }$ , and the remaining outputs are the parameters of a closed-form approximator for the action advantage $A ^ { \mathfrak { w } }$ . RACER can be extended for problems where the state is received as a visual feed (by inserting convolutional layers), or where the state is only partially observable (by substituting the MLP with a recurrent model). However, these extensions are outside the scope of this paper.
|
| 70 |
+
|
| 71 |
+
The parameters $\mathtt { w }$ are updated from mini-batches of off-policy time steps with ReF-ER. A separate gradient is defined for each component of the actor-critic framework, as sketched in figure 1b. The policy statistics $\mathbf { m } ( s )$ and $\Sigma ( s )$ are updated with the off-PG (Degris et al., 2012):
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\hat { \mathbf { g } } _ { t } ^ { \pi } ( \mathsf { w } ) = \rho _ { t } \hat { A } _ { t } ^ { \mathrm { r e t } } \nabla _ { \{ \mathbf { m } , \Sigma \} } \log \pi ^ { \forall } ( a _ { t } \mid s _ { t } )
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
We estimate the on-policy advantage with Retrace. From TBC and Retrace, we obtain an estimator for the on-policy state value $\hat { V } _ { t } ^ { \mathrm { t b c } } = V ^ { \mathrm { u } } ( s _ { t } ) + \operatorname* { m i n } \{ 1 , \rho _ { t } \} ( \hat { Q } _ { t } ^ { \mathrm { r e t } } - Q ^ { \mathrm { u } } ( s _ { t } , a _ { t } ) )$ , used as a target for $V ^ { \mathtt { w } }$ :
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\hat { \mathbf { g } } _ { t } ^ { V } ( \mathbf { w } ) = \hat { V } ^ { \mathrm { t b c } } ( s ) - V ^ { \mathrm { u } } ( s _ { t } ) = \operatorname* { m i n } \left. 1 , \rho _ { t } \right. \left[ \hat { Q } _ { t } ^ { \mathrm { r e t } } - Q ^ { \mathrm { u } } ( s _ { t } , a _ { t } ) \right]
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Rather than having a separate MLP with inputs $( s , a )$ to parameterize $Q ^ { \mathsf { w } }$ (as in ACER or $\tt D D P G$ ), whose expected value under the policy would be computationally demanding to compute, we employ a closed-form equation for $A ^ { \mathfrak { w } }$ inspired by NAF (Gu et al., 2016). The network outputs the coefficients of a concave function $f ^ { \ w } ( s , a )$ which is chosen such that its maximum coincides with the mean of the policy $\mathbf { m } ( s )$ , and such that it is possible to derive analytical expectations for $a \sim \pi ^ { \mathfrak { w } }$ . In App. B we explore multiple choices of $f ^ { \ w } ( s , a )$ . For all results in the main text of the manuscript we used:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
f ^ { \bowtie } ( s , a ) = K ( s ) \exp \left[ - { \frac { 1 } { 2 } } { \mathbf { a } } _ { + } ^ { \intercal } { \mathbf { L } } _ { + } ^ { - 1 } ( s ) { \mathbf { a } } _ { + } - { \frac { 1 } { 2 } } { \mathbf { a } } _ { - } ^ { \intercal } { \mathbf { L } } _ { - } ^ { - 1 } ( s ) { \mathbf { a } } _ { - } \right]
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
Here $\mathbf { a } _ { - } = \operatorname* { m i n } \left[ a - \mathbf { m } ( s ) , \mathbf { 0 } \right]$ and $\mathbf { a } _ { + } { = } \operatorname* { m a x } \left[ a { - } \mathbf { m } ( s ) , \mathbf { 0 } \right]$ (both element-wise operations). This parameterization requires one MLP output for $K ( s )$ and $d _ { A }$ outputs for each diagonal matrix $\mathbf { L } _ { + }$ and $\mathbf { L } _ { - }$ . In total, given a state $s$ , the MLP computes $\mathbf { m } , \pmb { \Sigma } , V , K , \mathbf { L } _ { + }$ and $\mathbf { L } _ { - }$ . From Eq.7, for any action $a$ the advantage is uniquely defined: $A ^ { \mathfrak { w } } ( s , a ) { : = } f ^ { \mathfrak { w } } ( s , a ) { - } \mathbb { E } _ { a ^ { \prime } \sim \pi } \left[ f ^ { \mathfrak { w } } ( s , a ^ { \prime } ) \right]$ . Like the exact on-policy advantage $A ^ { \pi }$ , $A ^ { \mathfrak { w } }$ has by design expectation zero under the policy. The parameterization coefficients $K$ and $\mathbf { L }$ are updated to minimize the L2 error from $\hat { A } _ { t } ^ { \mathrm { r e t } }$ :
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\hat { \mathbf { g } } _ { t } ^ { A } ( \mathfrak { w } ) = \rho _ { t } \left[ \hat { A } _ { t } ^ { \mathrm { r e t } } - A ^ { \mathfrak { w } } ( s _ { t } , a _ { t } ) \right] \nabla _ { \{ K , \mathbf { L } \} } A ^ { \mathfrak { w } } ( s _ { t } , a _ { t } )
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
Here, $\rho _ { t }$ reduces the weight of estimation errors for unlikely actions, where $A ^ { \mathfrak { w } }$ is expected to be less accurate. To ensure that $\Sigma , K , \mathbf { L } _ { + }$ and $\mathbf { L } _ { - }$ are positive definite, the respective outputs are mapped onto $\mathbb { R } ^ { + }$ by a Softplus rectifier. The analytical derivation of $\mathbb { E } _ { a ^ { \prime } \sim \pi } \left[ f ^ { \mathsf { w } } ( s , { \overline { { a ^ { \prime } } } } ) \right]$ can be found in App. A. Collectively, $\hat { \mathbf { g } } _ { t } ^ { \pi } ( \mathbf { \bar { w } } ) , \hat { \mathbf { g } } _ { t } ^ { V } ( \mathbf { w } )$ , and $\hat { \mathbf { g } } _ { t } ^ { A } ( \mathbf { \bar { w } } )$ form a vector $\hat { \mathbf { g } } _ { t } ^ { \mathrm { A C } } ( \mathbf { w } )$ with the same size as the MLP output. $\hat { \mathbf { g } } _ { t } ^ { \mathrm { A C } } ( \mathbf { w } )$ is weighted with the ReF-ER penalization (Eq. 3) and then back-propagated to the MLP.
|
| 96 |
+
|
| 97 |
+
In order to estimate $\hat { Q } _ { t } ^ { \mathrm { r e t } }$ for a sampled time step $t$ , Retrace (Eq. 2) requires $V ^ { \mathrm { { w } } }$ and $Q ^ { \mathrm { w } }$ for all future steps in sample $t$ ’s episode. These are naturally computed when training from batches of episodes (as in ACER) rather than time steps. However, the information contained in consecutive steps is highly correlated, worsening the quality of the gradient estimate, and episodes can be composed of thousands of time steps, increasing the computational cost. In order to efficiently train from uncorrelated time steps, RACER stores for each sample in the RM the most recently computed estimations of $V ^ { \mathbb { w } } ( s _ { t } )$ , $A ^ { \mathrm { w } } ( s _ { t } , a _ { t } )$ , $\rho _ { t }$ and $\boldsymbol { Q } _ { t } ^ { \mathrm { r e t } }$ . When a batch of time steps is sampled, the stored $\boldsymbol { Q } _ { t } ^ { \mathrm { r e t } }$ are used to compute the gradient update. At the same time, the stored $V ^ { \mathbb { w } } ( s _ { t } )$ , $A ^ { \mathbb { w } } ( s _ { t } , a _ { t } )$ and $\rho _ { t }$ are updated with the current NN outputs and used to correct $\boldsymbol { Q } ^ { \mathrm { r e t } }$ for all prior time-steps in the respective episodes with Eq. 2. A description of all remaining implementation details is provided in App. D.
|
| 98 |
+
|
| 99 |
+
# 5 RELATED WORK
|
| 100 |
+
|
| 101 |
+
The rules that determine which samples are kept in the RM and how they are used for training can be designed to address several objectives. For example, properly designed ER may prove necessary to prevent lifelong learning agents from forgetting previously mastered tasks (Isele & Cosgun, 2018). Prioritized Experience Replay (Schaul et al., 2015b) (PER) improves the performance of DQN (Mnih et al., 2015) by biasing sampling in favor of experiences that cause large temporal-difference (TD) errors. TD errors may signal rare events that would convey useful information to the learner. ER can be used to train transition models in planning-based RL (Pan et al., 2018), or to train off-policy learners on auxiliary tasks (Schaul et al., 2015a; Jaderberg et al., 2017) helping to shape the network features. When rewards are very sparse, RL agents can be trained to repeat previous outcomes (Andrychowicz et al., 2017) or to reproduce successful states or episodes (Oh et al., 2018; Goyal et al., 2018).
|
| 102 |
+
|
| 103 |
+
de Bruin et al. (2015) proposes a modification to ER that increases the diversity of behaviors contained in the RM, which is the opposite of what ReF-ER achieves. The ideas proposed by de Bruin et al. (2015) cannot readily be applied to complex tasks (they consider a low-dimensional problem which can be learned with the RM holding a handful of episodes) and the authors concede that their method is not suitable when the policy is advanced for many iterations. For these reasons, we compare ReF-ER only to PER and conventional ER. We assume that if increasing the diversity of experiences in the RM were beneficial to off-policy RL then either PER or ER would outperform ReF-ER.
|
| 104 |
+
|
| 105 |
+
ReF-ER is inspired by the techniques developed for on-policy RL to bound policy updates of PPO (Schulman et al., 2017). Rule 1 of ReF-ER is similar to the clipped objective function of PPO (gradients are zero if $\rho$ lies outside of some range). However, Rule 1 is not affected by the sign of the advantage estimate and clips both policy and value gradients. Like Rule 3, one variant of PPO penalizes $D _ { K L } ( \mu _ { t } | | \pi ^ { \mathtt { W } } )$ (also Schulman et al. (2015) and Wang et al. (2017) employ trust-region schemes in the on- and off-policy setting respectively). While PPO picks one of the two techniques, in ReF-ER Rules 1 and 3 complement each other and can be applied to most off-policy RL methods with parametric policies. In the ER setting, samples remain in the RM over many iterations. If only Rule 1 is included, any PG could push the sample’s $\rho$ outside of the clipping range without means to recover, leading to zero-valued gradients. Including only Rule 3 would not reduce the number of hyper-parameters (a target $D _ { K L }$ would be needed), and would not prevent unbounded $\rho$ .
|
| 106 |
+
|
| 107 |
+
The first method to combine ER and PG was the Off-Policy Actor Critic (Degris et al., 2012). Further contributions were introduced with ACER (Wang et al., 2017), such as extension to NN, estimation of on-policy returns with Retrace, and the variance truncation and bias correction trick (TBC). In the continuous-action domain, the proposed RACER offers several advantages over ACER: (a) reduced complexity by employing a single NN and closed-form $A ^ { \mathfrak { w } }$ (continuous-ACER uses 9 NN evaluations per gradient). (b) relies on ReF-ER rather than constraining policy updates around a target network. (c) samples time steps rather than episodes (which may consist of thousands of steps). (d) uses the original Retrace estimator, which has better convergence guarantees than the value-estimators used by continuous-ACER. Because of (a) and (c), RACER is two orders of magnitude faster than ACER.
|
| 108 |
+
|
| 109 |
+
# 6 RESULTS
|
| 110 |
+
|
| 111 |
+
In this section we couple ReF-ER, conventional ER and PER with one method from each of the three main classes of deep continuous-action RL algorithms: DDPG, NAF, and RACER. The performance of each combination of algorithms is measured on the MuJoCo (Todorov et al., 2012) tasks of OpenAI Gym (Brockman et al., 2016) by plotting the mean cumulative reward $R = \textstyle \sum _ { t } r _ { t }$ . Each plot tracks the average $R$ among all episodes entering the RM within intervals of $2 { \cdot } 1 0 ^ { 5 }$ time steps and averaged again among five differently seeded training trials. In the appendix we include contours of the $2 \overline { { 0 } } ^ { t h }$ to $8 0 ^ { t h }$ percentiles of $R$ obtained by DDPG and RACER on the OpenAI Gym and on the DeepMind Control Suite (Tassa et al., 2018). The code to reproduce all present results is available on GitHub.1
|
| 112 |
+
|
| 113 |
+
# 6.1 RESULTS FOR DDPG
|
| 114 |
+
|
| 115 |
+
DDPG (Lillicrap et al., 2016) trains two networks by ER. The value network outputs $Q ^ { \mathrm { w } ^ { \prime } } ( s , a )$ and is trained to minimize the L2 distance from the Q-learning target (Sec. 2). The policy network outputs a deterministic policy $\mathbf { m } ^ { \mathbf { w } } ( s )$ and is trained with the DPG (Silver et al., 2014):
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\hat { g } _ { t } ^ { \mathrm { D P G } } ( \boldsymbol { \mathbf { \check { w } } } ) = \nabla _ { \boldsymbol { \mathbf { \check { w } } } } \boldsymbol { \mathbf { m } } ^ { \boldsymbol { \mathsf { w } } } ( s ) \left. \nabla _ { a } Q ^ { \boldsymbol { \mathsf { w } } ^ { \prime } } ( s , a ) \right| _ { a = \boldsymbol { \mathbf { m } } ^ { \boldsymbol { \mathsf { s } } } ( s ) }
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 2: Cumulative rewards on OpenAI MuJoCo tasks for DDPG (green line), DDPG with rankbased PER (gray line), u-DDPG with regular ER (blue), and ReF-ER with $C = 8$ (purple), $C = 4$ (red), $C = 2$ (orange). Implementation details in App. D.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 3: Average Kullback-Leibler divergence between the policy $\pi ^ { \mathrm { { w } } } = m ^ { \mathrm { { w } } } + \mathcal { N } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbf { I } )$ and the behaviors $\mu _ { t }$ in the RM during training for DDPG (green line), u-DDPG with regular ER (blue), and ReF-ER with $C = 8$ (purple), $C = 4$ (red), $C = 2$ (orange).
|
| 126 |
+
|
| 127 |
+
Noise is added to the deterministic policy $\boldsymbol { \pi } ^ { \mathrm { w } } { = } \mathbf { m } ^ { \mathrm { w } } { + } \mathcal { N } ( \mathbf { 0 } , \boldsymbol { \sigma } ^ { 2 } \mathbf { I } )$ for exploration. We consider two variants of DDPG: one with $\mathbf { m } ^ { \mathtt { w } }$ bounded to the unit box $[ - 1 , 1 ] ^ { d _ { A } }$ (as in the original) and one without bounds (referred to as $\mathtt { u - D D P G }$ , implementation details can be found in App. D). Bounding the policy may lead to lower returns in the OpenAI MuJoCo benchmarks, which are defined for unbounded actions. We note that, without measures to constrain policy updates or without careful tuning of the hyper-parameters (we found the critic’s weight decay and temporally-correlated action noise to be necessary), $\mathtt { u - D D P G }$ is unstable. The returns for u-DDPG can fall to large negative values, especially in tasks that include a control-cost penalty in the reward such as Ant. This behavior is explained by the value network not having learned local maxima with respect to the action (Silver et al., 2014).
|
| 128 |
+
|
| 129 |
+
By replacing ER with ReF-ER we can stabilize u-DDPG and greatly improve its performance, especially for tasks with complex dynamics such as Humanoid or Ant. The hyper-parameter $c _ { \mathrm { m a x } }$ determines how much the policy is allowed to change from the behaviors in the RM. By annealing $c _ { \mathrm { m a x } }$ we can allow faster improvements at the beginning of training, when an inaccurate policy gradient might be sufficient to estimate a good direction for the update. Conversely, during the later stages of training, precise updates can be computed from almost on-policy samples. We anneal $c _ { \mathrm { m a x } }$ and the learning rate according to:
|
| 130 |
+
|
| 131 |
+
$$
|
| 132 |
+
c _ { \operatorname* { m a x } } ( k ) = 1 + C / ( 1 + 5 e - 7 \cdot k ) , \quad \eta ( k ) = \eta / ( 1 + 5 e - 7 \cdot k )
|
| 133 |
+
$$
|
| 134 |
+
|
| 135 |
+
Here $k$ is the gradient step index, $\eta$ is the initial learning rate $1 0 ^ { - 4 }$ and $1 0 ^ { - 5 }$ for the value and policy networks respectively, as when using regular ER). We found that annealing $\eta$ worsened the instability of $\mathtt { u - D D P G }$ with regular ER. Lower values of $C$ reduce the speed of policy improvements, but after $\mathrm { i 0 ^ { 7 } }$ time steps $C = 2$ achieves the best performance in most tasks. In Fig. 3 we report for a subset of problems the average $D _ { K L } ( \mu _ { t } | | \pi ^ { \mathtt { w } } )$ . $D _ { K L }$ decreases for lower values of $C$ and further decreases during training due to the annealing process. With regular ER, even after lowering $\eta$ by one order of magnitude from that of the original paper, the distance between $\pi$ and $\mu$ may span the entire action space. In fact, in most tasks shown in Fig. 3 the $D _ { K L } ( \mu _ { t } | | \pi ^ { \mathbf { w } } )$ of DDPG is of similar order of magnitude as its maximum $\textstyle { \frac { d _ { A } } { 2 } } ( 2 / \sigma ) ^ { 2 }$ (for example, since $\sigma = 0 . 2$ , the maximum $D _ { K L }$ is 850 for Humanoid and 300 for Walker2d and it oscillates during training around 100 and 50 respectively).
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 4: Cumulative rewards on the OpenAI MuJoCo tasks for NAF (blue line), NAF with rank-based PER (gray line), NAF with ReF-ER and $C = 8$ (purple), $C = 4$ (red), $C = 2$ (orange).
|
| 139 |
+
|
| 140 |
+
ReF-ER maintains a RM of mostly near-policy samples, providing the value-network with multiple examples of trajectories that are possible with the current policy. This focuses the predictive capabilities of the value-network, enabling it to extrapolate the effect of a marginal change of action on the expected returns, and therefore increasing the accuracy of the DPG. Any misstep of the DPG is weighted with a penalization term that attracts the policy towards past behaviors. This allows time for the learner to gather experiences with the new policy, improve the value-network, and correct the misstep. This reasoning is almost diametrically opposed to that behind PER. In PER observations that are associated with larger TD errors are sampled more frequently. In the continuous-action setting, however, TD errors may be result from actions that are farther from the current policy. Therefore, precisely estimating their value might not help the value network in yielding an accurate estimate of the DPG. We obtained better results with the rank-based variant of PER, which has similar performance to that of DDPG with ER. The main benefits over ReF-ER arise in tasks that require more exploration, such as Swimmer and HumanoidStandup.
|
| 141 |
+
|
| 142 |
+
# 6.2 RESULTS FOR NAF
|
| 143 |
+
|
| 144 |
+
Normalized Advantage Functions (NAF) is the state-of-the-art of Q-learning based algorithms for continuous-action problems. It employs a quadratic-form approximation of the advantage $A ^ { \mathfrak { w } }$ , analogous to the one employed by RACER:
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
A _ { \mathrm { N A F } } ^ { \boldsymbol { \mathsf { w } } } ( s , a ) = - \left[ a - \mathbf { m } ^ { \boldsymbol { \mathsf { w } } } ( s ) \right] ^ { \mathsf { T } } \mathbf { L } _ { \mathrm { Q } } ^ { \boldsymbol { \mathsf { w } } } ( s ) \left[ \mathbf { L } _ { \mathrm { Q } } ^ { \boldsymbol { \mathsf { w } } } ( s ) \right] ^ { \mathsf { T } } \left[ a - \mathbf { m } ^ { \boldsymbol { \mathsf { w } } } ( s ) \right]
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
NAF trains $A ^ { \mathtt { w } }$ with the Q-learning target (Sec. 2) and uses the location $\mathbf { m } ^ { \mathtt { w } }$ of its maximum as the mean of the policy, with added Gaussian noise for exploration. When the actual $A ^ { \pi }$ is not well approximated by a quadratic (e.g. when the return landscape is multi-modal), NAF may fail to choose good actions. In contrast, RACER updates $\pi ^ { \mathfrak { w } }$ with the off-PG, which is independent of the error in approximating $A ^ { \pi } ( s _ { t } , a _ { t } )$ (but depends on the error at $t { + } 1$ ). Figure 4 shows how NAF is affected by the choice of ER algorithm. While Q-learning based methods are thought to be less sensitive than PG-based methods to the dissimilarity between policy and stored behaviors owing to the bootstrapped Q-learning target, NAF benefits from REF-ER. This is because $A ^ { \pi }$ is likely to be approximated well by a quadratic in a small neighborhood near its local maxima. ReF-ER constrains learning from actions within this neighborhood and prevents large TD errors from disrupting the locally-accurate approximation of $A ^ { \mathfrak { w } }$ . This intuition is supported by observing that rank-based PER (the better performing variant of PER also in this case), often worsens the performance of NAF. PER aims at biasing sampling in favor of larger TD errors, which are more likely to be farther from $\mathbf { m } ( s )$ (note that $f _ { \mathrm { N A F } } ^ { \mathrm { w } }$ is unbounded), and their accurate prediction might not help the learner in fine-tuning the policy by improving a local approximation of the advantage.
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 5: Average cumulative rewards on MuJoCo OpenAI Gym tasks obtained with PPO (dashed black lines), ACER (dash-dot purple lines) and with RACER by independently varying the two main hyper-parameters of ReF-ER: the RM size $N$ and $C$ (colored lines).
|
| 154 |
+
|
| 155 |
+
# 6.3 RESULTS FOR RACER
|
| 156 |
+
|
| 157 |
+
Here we compare RACER to ACER and PPO, an algorithm that owing to its simplicity and good performance on MuJoCo tasks is often used as baseline. We omit results from coupling RACER with ER or PER as it yields large negative $R$ values. In fact, without ReF-ER, the unbounded importance weights cause off-PG estimates to diverge, disrupting prior learning progress. Similarly to ReF-ER, ACER’s techniques (Sec. 4) guard against the numerical instability of the off-PG. However, bounding policy updates to a target-network does not ensure similarity between $\pi ^ { \mathfrak { w } }$ and RM behaviors (as shown in Fig. 7). In fact, when using deep approximators, simply enforcing slow parameter updates does not guarantee small changes in the output. As $D _ { K L } ( \mu _ { t } \parallel \pi ^ { \mathsf { w } } )$ grows, off-PG estimates may become inaccurate, causing ACER to be outperformed by RACER and PPO. We note that, due to ACER’s cost, we could only optimize some of its hyper-parameters relative to the original paper (see App. D). We do not exclude that ACER could have performed better after more extensive tuning.
|
| 158 |
+
|
| 159 |
+
The two hyper-parameters that most strongly affect the performance of RACER are the RM size $N$ and $c _ { \mathrm { m a x } }$ , annealed with Eq. 10 (for a discussion of the other parameters see App. B). RACER uses the Retrace estimator $\boldsymbol { Q } ^ { \mathrm { r e t } }$ which is expected to converge to the on-policy $Q ^ { \pi }$ (Munos et al., 2016). Because $\pi ^ { \mathfrak { w } }$ is gradually changing during training, it is crucial to maximize the convergence speed of Retrace to obtain accurate estimates of the off-PG. Large values of $c _ { \mathrm { m a x } }$ increase the variance of the policy gradient and increase the amount of “trace-cutting” as the importance weights are allowed to diverge from 1. The cumulative rewards reported in Fig. 5 show that “stable” tasks, where the agent’s success is less predicated on avoiding mistakes that would cause it to trip, are more tolerant to high values of $c _ { \mathrm { m a x } }$ (e.g. HalfCheetah). In most other tasks, especially those that require precise controls (e.g. Walker), the best results are obtained for values of $c _ { \mathrm { m a x } }$ that strike a balance between strict penalty terms, which slow down policy improvements, and high-variance gradient estimates. The RM size $N$ has a parallel effect. A small RM may not contain enough diversity of samples for the learner to accurately estimate the gradients. Conversely, a large RM is composed of episodes obtained with increasingly older versions of $\pi ^ { \mathfrak { w } }$ . In this case, the penalty terms required to preserve a sufficient fraction of near-policy samples may prevent the policy from improving. A discussion of all the secondary hyper-parameters and the choice of function parameterizing $A ^ { \mathfrak { w } }$ can be found in App. B. For most combinations of hyper-parameters and tasks presented in this section, RACER outperforms the best result from DDPG (Sec. 6.1), PPO, and is competitive with the best results found in the published literature, which to our knowledge were achieved by the on-policy algorithms TRPO (Schulman et al., 2015) and Policy Search with Natural Gradient (Rajeswaran et al., 2017).
|
| 160 |
+
|
| 161 |
+
# 7 CONCLUSION
|
| 162 |
+
|
| 163 |
+
Many RL algorithms update a policy $\pi ^ { \mathfrak { w } }$ from past experiences collected with off-policy behaviors $\mu$ . We present evidence that off-policy continuous-action deep RL methods benefit from actively maintaining similarity between policy and replay behaviors. We propose a novel ER algorithm (ReF-ER) that extends these benefits to off-policy PG, deterministic PG and Q-learning methods. ReF-ER characterizes past behaviors either as “near-policy" or “far-policy" by the deviation from one of the importance weight $\rho { = } { \pi } ^ { \mathsf { w } } ( a | s ) / \mu ( a | s )$ . ReF-ER consists of: 1) Computing gradients only from near-policy experiences. 2) Forgetting far-policy samples when new observations are obtained from the environment. 3) Regulating the pace at which $\pi ^ { \mathfrak { w } }$ is allowed to deviate from $\mu$ through penalty terms that reduce $D _ { K L } ( \mu | | \pi ^ { \mathtt { w } } )$ . This allows time for the learner to gather experiences with the new policy, improve the value estimators, and increase the accuracy of the next steps. The extension of ReF-ER to discrete-action methods is subject of ongoing work.
|
| 164 |
+
|
| 165 |
+
ReF-ER is combined with a novel method based on the off-policy PG (RACER). RACER uses a closed-form parameterization of the advantage and it estimates on-policy returns with a bootstrapped formulation of Retrace. These innovations greatly increase the computational efficiency of RACER compared to similar methods. The application of ReF-ER and RACER to OpenAI Gym benchmarks produces state-of-the-art results while being robust to large variations in their hyper-parameters.
|
| 166 |
+
|
| 167 |
+
# REFERENCES
|
| 168 |
+
|
| 169 |
+
M. Andrychowicz, F. Wolski, A. Ray, J. Schneider, R. Fong, P. Welinder, B. McGrew, J. Tobin, P. Abbeel, and W. Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, pp. 5048–5058, 2017.
|
| 170 |
+
G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schulman, J. Tang, and W. Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
|
| 171 |
+
S. Colabrese, K. Gustavsson, A. Celani, and L. Biferale. Flow navigation by smart microswimmers via reinforcement learning. Physical Review Letters, 118(15):158004, 2017.
|
| 172 |
+
T. de Bruin, J. Kober, K. Tuyls, and R. Babuška. The importance of experience replay database composition in deep reinforcement learning. In Deep Reinforcement Learning Workshop, NIPS, 2015.
|
| 173 |
+
T. Degris, M. White, and R. S. Sutton. Off-policy actor-critic. arXiv preprint arXiv:1205.4839, 2012.
|
| 174 |
+
Y. Duan, X. Chen, R. Houthooft, J. Schulman, and P. Abbeel. Benchmarking deep reinforcement learning for continuous control. In International Conference on Machine Learning, pp. 1329–1338, 2016.
|
| 175 |
+
L. Espeholt, H. Soyer, R. Munos, K. Simonyan, V. Mnih, T. Ward, Y. Doron, V. Firoiu, T. Harley, I. Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
|
| 176 |
+
A. Goyal, P. Brakel, W. Fedus, T. Lillicrap, S. Levine, H. Larochelle, and Y. Bengio. Recall traces: Backtracking models for efficient reinforcement learning. arXiv preprint arXiv:1804.00379, 2018.
|
| 177 |
+
S. Gu, T. Lillicrap, I. Sutskever, and S. Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, pp. 2829–2838, 2016.
|
| 178 |
+
P. Henderson, R. Islam, P. Bachman, J. Pineau, D. Precup, and D. Meger. Deep reinforcement learning that matters. arXiv preprint arXiv:1709.06560, 2017.
|
| 179 |
+
D. Isele and A. Cosgun. Selective experience replay for lifelong learning. arXiv preprint arXiv:1802.10269, 2018.
|
| 180 |
+
R. Islam, P. Henderson, M. Gomrokchi, and D. Precup. Reproducibility of benchmarked deep reinforcement learning tasks for continuous control. arXiv preprint arXiv:1708.04133, 2017.
|
| 181 |
+
M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. In International Conference on Learning Representations (ICLR), 2017.
|
| 182 |
+
S. Levine, C. Finn, T. Darrell, and P. Abbeel. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research, 17(1):1334–1373, 2016.
|
| 183 |
+
T. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. In International Conference on Learning Representations (ICLR), 2016.
|
| 184 |
+
L. H. Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3/4):69–97, 1992.
|
| 185 |
+
V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, j. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540): 529, 2015.
|
| 186 |
+
V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
|
| 187 |
+
R. Munos, T. Stepleton, A. Harutyunyan, and M. Bellemare. Safe and efficient off-policy reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1054–1062, 2016.
|
| 188 |
+
G. Novati, S. Verma, D. Alexeev, D. Rossinelli, W. M. van Rees, and P. Koumoutsakos. Synchronisation through learning for two self-propelled swimmers. Bioinspiration & Biomimetics, 12(3):036001, 2017.
|
| 189 |
+
J. Oh, Y. Guo, S. Singh, and H. Lee. Self-imitation learning. arXiv preprint arXiv:1806.05635, 2018.
|
| 190 |
+
Y. Pan, M. Zaheer, A. White, A. Patterson, and M. White. Organizing experience: A deeper look at replay mechanisms for sample-based planning in continuous state domains. arXiv preprint arXiv:1806.04624, 2018.
|
| 191 |
+
A. Rajeswaran, K. Lowrey, E. V. Todorov, and S. M. Kakade. Towards generalization and simplicity in continuous control. In Advances in Neural Information Processing Systems, pp. 6553–6564, 2017.
|
| 192 |
+
G. Reddy, A. Celani, T. J. Sejnowski, and M. Vergassola. Learning to soar in turbulent environments. Proceedings of the National Academy of Sciences, pp. 201606075, 2016.
|
| 193 |
+
T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal value function approximators. In International Conference on Machine Learning, pp. 1312–1320, 2015a.
|
| 194 |
+
T. Schaul, J. Quan, I. Antonoglou, and D. Silver. Prioritized experience replay. In International Conference on Learning Representations (ICLR), 2015b.
|
| 195 |
+
J. Schulman, S. Levine, P. Abbeel, M. Jordan, and P. Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015.
|
| 196 |
+
J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 197 |
+
D. Silver, G. Lever, N. Heess, T. Degris, D. Wierstra, and M. Riedmiller. Deterministic policy gradient algorithms. In ICML, 2014.
|
| 198 |
+
D. Silver, A. Huang, C. J Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
|
| 199 |
+
R. S. Sutton, D. A. McAllester, S. P. Singh, and Y. Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000.
|
| 200 |
+
Y. Tassa, Y. Doron, A. Muldal, T. Erez, Y. Li, D. Casas, D. Budden, A. Abdolmaleki, J. Merel, A. Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
|
| 201 |
+
E. Todorov, T. Erez, and Y. Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026–5033. IEEE, 2012.
|
| 202 |
+
S. Verma, G. Novati, and P. Koumoutsakos. Efficient collective swimming by harnessing vortices through deep reinforcement learning. Proceedings of the National Academy of Sciences, 2018.
|
| 203 |
+
Z. Wang, V. Bapst, N. Heess, V. Mnih, R. Munos, K. K., and N. de Freitas. Sample efficient actor-critic with experience replay. In International Conference on Learning Representations (ICLR), 2017.
|
| 204 |
+
|
| 205 |
+
We considered three parameterizations for the action advantage:
|
| 206 |
+
|
| 207 |
+
$$
|
| 208 |
+
\begin{array} { r l } { f _ { \mathbf { Q } } ^ { \aleph } ( s , a ) = } & { \quad - \frac { 1 } { 2 } \left[ a - \mathbf { m } ( s ) \right] ^ { \top } \mathbf { L } _ { \mathbf { Q } } ( s ) \mathbf { L } _ { \mathbf { Q } } ^ { \top } ( s ) \left[ a - \mathbf { m } ( s ) \right] } \\ { f _ { \mathrm { S G } } ^ { \aleph } ( s , a ) = } & { \ K ( s ) \ \exp \left\{ - \frac { 1 } { 2 } \left[ a - \mathbf { m } ( s ) \right] ^ { \top } \mathbf { L } _ { \mathrm { S G } } ^ { - 1 } ( s ) \left[ a - \mathbf { m } ( s ) \right] \right\} } \\ { f _ { \mathrm { D G } } ^ { \aleph } ( s , a ) = } & { \ K ( s ) \ \exp \left\{ - \frac { 1 } { 2 } \mathbf { a } _ { + } ^ { \top } \mathbf { L } _ { + } ^ { - 1 } ( s ) \mathbf { a } _ { + } - \frac { 1 } { 2 } \mathbf { a } _ { - } ^ { \top } \mathbf { L } _ { - } ^ { - 1 } ( s ) \mathbf { a } _ { - } \right\} } \end{array}
|
| 209 |
+
$$
|
| 210 |
+
|
| 211 |
+
We recall $\mathbf { a } _ { - } = \operatorname* { m i n } \left[ a - \mathbf { m } ( s ) , \mathbf { 0 } \right]$ and $\mathbf { a } _ { + } { = } \operatorname* { m a x } \left[ a { - } \mathbf { m } ( s ) , \mathbf { 0 } \right]$ . The first parameterization $f _ { \mathrm { Q } } ^ { \mathrm { w } }$ is identical to the one employed by NAF (Gu et al., 2016), and requires training $( d _ { A } ^ { 2 } + d _ { A } ) / 2$ coefficients of the lower triangular matrix $\mathbf { L } _ { \mathrm { Q } }$ . Its quadratic complexity makes the choice of $f _ { \mathrm { Q } } ^ { \ w }$ unfavorable for high-dimensional action spaces (e.g. it requires 153 parameters for the 17-dimensional Humanoid tasks of OpenAI Gym, against the 35 of $f _ { \mathrm { D G } } ^ { \mathrm { w } } )$ . In order to preserve bijection between $\mathbf { L } _ { \mathrm { Q } }$ and $\mathbf { L } _ { \mathrm { Q } } \mathbf { L } _ { \mathrm { Q } } ^ { \intercal }$ , the diagonal terms are mapped to $\mathcal { R } ^ { + }$ with a Softplus function. The expectation under a Gaussian policy can be computed as (Petersen et al., 2008):
|
| 212 |
+
|
| 213 |
+
$$
|
| 214 |
+
\begin{array} { r } { \mathbb { E } _ { a ^ { \prime } \sim \pi } \left[ f _ { \mathrm { Q } } ^ { \mathrm { w } } ( s , a ^ { \prime } ) \right] = \operatorname { T r } \left[ \mathbf { L } _ { \mathrm { Q } } ( s ) \mathbf { L } _ { \mathrm { Q } } ^ { \mathsf { T } } ( s ) \Sigma ( s ) \right] } \end{array}
|
| 215 |
+
$$
|
| 216 |
+
|
| 217 |
+
Here Tr denotes the trace of a matrix.
|
| 218 |
+
|
| 219 |
+
The second parameterization requires training the $1 + d _ { A }$ coefficients for $K ( s )$ and the diagonal matrix $\mathbf { L } ( s )$ . The expectation can be easily derived from the properties of products of Gaussian densities:
|
| 220 |
+
|
| 221 |
+
$$
|
| 222 |
+
\mathbb { E } _ { a ^ { \prime } \sim \pi } \left[ f _ { \mathrm { S G } } ^ { \mathtt { w } } ( s , a ^ { \prime } ) \right] = K ( s ) \sqrt { \frac { | \mathbf { L } ( s ) | } { | \mathbf { L } ( s ) + \boldsymbol { \Sigma } ( s ) | } }
|
| 223 |
+
$$
|
| 224 |
+
|
| 225 |
+
Here $| \cdot |$ denotes a determinant.
|
| 226 |
+
|
| 227 |
+
To derive the expectation of the third parameterization, which was used for most results in the paper, we recall that the expectation of a product of independent variables is the product of the expectations. For one component $i$ of the action vector:
|
| 228 |
+
|
| 229 |
+
$$
|
| 230 |
+
\mathbb { E } _ { a ^ { \prime } \sim \pi } \left[ e ^ { - \frac { 1 } { 2 } u _ { + , i } ^ { \tau } \ L _ { + , i } ^ { - 1 } ( s ) \ u _ { + , i } - \frac { 1 } { 2 } u _ { - , i } ^ { \tau } \ L _ { - , i } ^ { - 1 } ( s ) \ u _ { - , i } } \right] = \frac { \sqrt { \frac { L _ { + , i } ( s ) } { L _ { + , i } ( s ) + \Sigma _ { i } ( s ) } } + \sqrt { \frac { L _ { - , i } ( s ) } { L _ { - , i } ( s ) + \Sigma _ { i } ( s ) } } } { 2 }
|
| 231 |
+
$$
|
| 232 |
+
|
| 233 |
+
Here we exploited the symmetry of the Gaussian policy around the mean. Since $\Sigma , \mathbf { L } _ { + }$ , and $\mathbf { L } _ { - }$ are all diagonal, we can compute the expectation:
|
| 234 |
+
|
| 235 |
+
$$
|
| 236 |
+
\mathbb { E } _ { a ^ { \prime } \sim \pi } \left[ f _ { \mathrm { D G } } ^ { \mathrm { w } } ( s , a ^ { \prime } ) \right] = K ( s ) \prod _ { i = 1 } ^ { d _ { A } } \frac { \sqrt { \frac { L _ { + , i } ( s ) } { L _ { + , i } ( s ) + \Sigma _ { i } ( s ) } } + \sqrt { \frac { L _ { - , i } ( s ) } { L _ { - , i } ( s ) + \Sigma _ { i } ( s ) } } } { 2 }
|
| 237 |
+
$$
|
| 238 |
+
|
| 239 |
+
Finally, we note that all these parameterizations are differentiable.
|
| 240 |
+
|
| 241 |
+
# B SENSITIVITY TO HYPER-PARAMETERS
|
| 242 |
+
|
| 243 |
+
Figure 6 shows the robustness of RACER to various hyper-parameters and to the choice of the advantage parameterizations introduced in App. A. Moreover, we can bypass the advantage approximator (i.e. $A ^ { \mathfrak { w } } { : = } 0 )$ and rely exclusively on the state value approximator. We recall the on-policy value estimator obtained with “variance truncation and bias correction” (TBC) (Wang et al., 2017) (Sec. 4):
|
| 244 |
+
|
| 245 |
+
$$
|
| 246 |
+
\hat { V } _ { t } ^ { \mathrm { t b c } } = V ^ { \mathrm { u } } ( s _ { t } ) + \operatorname* { m i n } \{ 1 , \rho _ { t } \} ( \hat { Q } _ { t } ^ { \mathrm { r e t } } - Q ^ { \mathrm { u } } ( s _ { t } , a _ { t } ) )
|
| 247 |
+
$$
|
| 248 |
+
|
| 249 |
+
From Eq. 2 and 19 we obtain $\hat { Q } ^ { \mathrm { r e t } } \big ( s _ { t } , a _ { t } \big ) = r _ { t + 1 } + \gamma \hat { V } ^ { \mathrm { t b c } } \big ( s _ { t + 1 } \big )$ . By neglecting $A ^ { \mathfrak { w } }$ , from this relation and Eq. 19, we obtain a recursive Retrace-based estimator for the on-policy state value that depends on $V ^ { \mathrm { { w } } }$ alone:
|
| 250 |
+
|
| 251 |
+
$$
|
| 252 |
+
\hat { V } _ { t } ^ { \mathrm { t b c } } = V ^ { \mathrm { v } } ( s _ { t } ) + \operatorname* { m i n } \left\{ 1 , \rho ( s _ { t } , a _ { t } ) \right\} \Big [ r _ { t + 1 } + \gamma \hat { V } ^ { \mathrm { t b c } } ( s _ { t + 1 } ) - V ^ { \mathrm { u } } ( s _ { t } ) \Big ]
|
| 253 |
+
$$
|
| 254 |
+
|
| 255 |
+
This target is equivalent to the recently proposed $\mathrm { v } .$ -trace estimator (Espeholt et al., 2018) when all importance weights are clipped at 1, which was empirically found by the authors to be the best-performing solution. As expected, lacking a model for $A ^ { \mathfrak { w } } ( s , a )$ , this architecture (denoted as V-RACER in the first column of results of Fig. 6) yielded worse performance than the original RACER. However the difference is often minor and the increased simplicity of this architecture might justify its adoption for some problems.
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
Figure 6: Mean cumulative rewards with RACER on OpenAI Gym tasks exploring the effect of the choice of advantage parameterization, ReF-ER tolerance factor $D$ , mini-batch size $B$ , number of time steps per gradient step $F$ , and learning rate $\eta$ . Dashed-black lines refer to the baseline parameters. The $y$ -axes are magnified around the final returns to clarify often minor differences in performance.
|
| 259 |
+
|
| 260 |
+
The tolerance $D$ for far-policy samples in the RM has a similar effect as $c _ { \mathrm { m a x } }$ : low values tend to delay learning while high values reduce the fraction of the RM that is used to compute updates and may decrease the accuracy of gradient estimates. Increasing the number $F$ of time steps per gradient step could either cause a rightward shift of the expected returns because the learner computes fewer updates for the same budget of observations, or it could aid the learner by providing more on-policy samples. The actual outcomes depend on the problem: tasks with simpler dynamics (e.g. HalfCheetah) can be learned more quickly by performing more gradient steps, while problems with more complex dynamics (e.g. Ant, Humanoid) benefit from more on-policy samples. The batch-size $B$ and learning rate $\eta$ have a minor effect on performance.
|
| 261 |
+
|
| 262 |
+
# C STATE, ACTION AND REWARD PREPROCESSING
|
| 263 |
+
|
| 264 |
+
Several authors have employed state (Henderson et al., 2017) and reward (Duan et al., 2016) (Gu et al., 2017) rescaling to improve the learning results. This technique has not systematically been studied but reflects a deeper challenge of RL. The success of any RL algorithm is intrinsically linked to the design of the control problem. For example, the stability of DDPG is affected by the L2 weight decay of the value-network. Depending on the numerical values of the distribution of rewards provided by the environment and the choice of weight decay coefficient, the L2 penalization can be either negligible or dominate the Bellman error. Similarly, the distribution of values describing the state variables can increase the challenge of learning by gradient descent.
|
| 265 |
+
|
| 266 |
+
We propose partially addressing these issues by rescaling both rewards and state vectors depending on the the experiences contained in the RM. At the beginning of training we prepare the RM by collecting $N _ { \mathrm { s t a r t } }$ observations and then we compute:
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\begin{array} { r l } { \mu _ { s } = } & { \frac { 1 } { n _ { \mathrm { o b s } } } \sum _ { t = 0 } ^ { n _ { \mathrm { o b s } } } s _ { t } } \\ { \sigma _ { s } = } & { \sqrt { \frac { 1 } { n _ { \mathrm { o b s } } } \sum _ { t = 0 } ^ { n _ { \mathrm { o b s } } } \left( s _ { t } - \mu _ { s } \right) ^ { 2 } } } \end{array}
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
Throughout training, $\mu _ { s }$ and $\sigma _ { s }$ are used to standardize all state vectors $\hat { s } _ { t } = ( s _ { t } - \mu _ { s } ) / ( \sigma _ { s } + \epsilon )$ before feeding them to the network approximators. Moreover, every 1000 steps, chosen as the smallest power of ten that did not affect the run time, we loop over the $n _ { \mathrm { o b s } }$ observations stored in the RM to compute:
|
| 273 |
+
|
| 274 |
+
$$
|
| 275 |
+
\sigma _ { r } \gets \sqrt { \frac { 1 } { n _ { \mathrm { o b s } } } \sum _ { t = 0 } ^ { n _ { \mathrm { o b s } } } { \left( r _ { t + 1 } \right) ^ { 2 } } }
|
| 276 |
+
$$
|
| 277 |
+
|
| 278 |
+
This value is used to scale the rewards $\hat { r } _ { t } = r _ { t } / ( \sigma _ { r } + \epsilon )$ used by the Q-learning target of DDPG and the Retrace algorithm for RACER. We use $\epsilon = 1 0 ^ { - 7 }$ to ensure numerical stability.
|
| 279 |
+
|
| 280 |
+
The actions sampled by the learner may need to be rescaled or bounded to some interval depending on the environment. For the OpenAI Gym tasks this amounts to a linear scaling $\textit { a } ^ { \prime } = \textit { a }$ $\mathsf { \backslash u p p e r \_ v a l u e - l o w e r \_ v a l u e ) / 2 }$ , where the values specified by the Gym library are $\pm 0 . 4$ for the Humanoid tasks, $\pm 8$ for the Pendulum tasks, and $\pm 1$ for all others. The tasks of DeepMind Control Suite are defined with all actions bounded do the interval $[ - 1 , 1 ] ^ { d _ { A } }$ . In this case we can learn Gaussian policies, as if the action space were unbounded, and then map the actions sent to the environment with an hyperbolic tangent: $a _ { t } ^ { \prime } = \operatorname { t a n h } a _ { t }$ . This approach, however, might prevent efficiently learning policies that behave like bang-bang controllers. Close to the bounds of the control space, actions that should be similar may be mapped to distant positions in the unbounded action space. Therefore, learning bang-bang controls is more likely to be hindered by the $D _ { K L }$ penalties of ReF-ER. This issue may explain some poor results on the DeepMind Control Suite shown in Fig. 10 and 11. These results show that successfully tackling control problems with bounded action spaces may require policies parameterized as Beta distribution (Chou et al., 2017).
|
| 281 |
+
|
| 282 |
+
# D IMPLEMENTATION AND NETWORK ARCHITECTURE DETAILS
|
| 283 |
+
|
| 284 |
+
We implemented all presented learning algorithms within smarties,2 our open source $\mathrm { C } + +$ RL framework, and optimized for high CPU-level efficiency through fine-grained multi-threading, strict control of cache-locality, and computation-communication overlap. On every step, we asynchronously obtain on-policy data by sampling the environment with $\pi$ , which advances the index $t$ of observed time steps, and we compute updates by sampling from the Replay Memory (RM), which advances the index $k$ of gradient steps (Fig. 1a). During training, the ratio of time and update steps is usually equal to a constant: $t / k = \bar { F }$ . This parameter affects the data efficiency of the algorithm; by lowering $F$ each sample is used more times to improve the policy before being replaced by newer samples. Upon completion of all tasks, we apply the gradient update and proceed to the next step. The pseudo-codes in App. E neglect parallelization details as they do not affect execution.
|
| 285 |
+
|
| 286 |
+
In order to evaluate all algorithms on equal footing, we use the same baseline network architecture for RACER, DDPG and NAF, consisting of an MLP with two hidden layers of 128 units each. For the sake of computational efficiency, we employed Softsign activation functions. The weights of the hidden√ √ layers are initialized according to $\mathcal { U }$ $\lceil - 6 / \sqrt { f _ { i } + \bar { f _ { o } } }$ , $6 / \sqrt { f _ { i } + f _ { o } } ]$ , where $f _ { i }$ and $f _ { o }$ are respectively the layer’s fan-in and fan-out (Glorot & Bengio, 2010). The weights of the linear output layer are√ √ initialized from the distribution $\mathcal { A } \left[ - 0 . 1 / \sqrt { f _ { i } } , 0 . 1 / \sqrt { f _ { i } } \right]$ , such that the MLP has near-zero outputs at the beginning of training. When sampling the components of the action vectors, the policies are treated as truncated normal distributions with symmetric bounds at three standard deviations from the mean. Finally, we optimize the network weights with the Adam algorithm (Kingma & Ba, 2015).
|
| 287 |
+
|
| 288 |
+
RACER We note that the values of the diagonal covariance matrix are shared among all states and initialized to $\pmb { \Sigma } = 0 . 2 \mathbf { I }$ . The remaining hyper-parameters of RACER are listed in table 1.
|
| 289 |
+
|
| 290 |
+
DDPG In its original formulation, DDPG transforms the policy-network’s output onto the bounded interval $[ - 1 , 1 ] ^ { \breve { d } _ { A } }$ with an hyperbolic tangent function. We found that bounding the action space may limit the performance of DDPG with the OpenAI MuJoCo tasks. In order to stabilize the unboundedaction version of DDPG $\mathrm { \backslash u - D D P G } ,$ we set the learning rate for the policy-network to $1 \cdot 1 0 ^ { - 5 }$ and that of the value-network to $1 \cdot 1 0 ^ { - 4 }$ with L2 weight decay coefficient of $1 \cdot 1 0 ^ { - 4 } $ . These changes lead to better performance also with the bounded-action DDPG and therefore were used for all numerical experiments. The RM is set to contain $N { = } 2 ^ { 1 9 }$ observations and we follow Henderson et al. (2017) for the remaining hyper-parameters: mini-batches of $B = 1 2 8$ samples, $\gamma { = } 0 . 9 9 5$ , soft target network update coefficient 0.01. We note that while DDPG is the only algorithm employing two networks, choosing half the batch-size as RACER and NAF makes the compute cost roughly equal among the three methods. Finally, when using ReF-ER we add exploratory Gaussian noise to the deterministic policy: $\boldsymbol { \pi } ^ { \mathrm { w } ^ { \prime } } { = } \mathbf { m } ^ { \mathrm { w } ^ { \prime } } { + } \dot { \mathcal { N } } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbf { I } )$ with $\sigma { = } 0 . 2$ . When performing regular ER or PER we sample the exploratory noise from an Ornstein–Uhlenbeck process with $\sigma { = } 0 . 2$ and $\theta { = } 0 . 1 5$ .
|
| 291 |
+
|
| 292 |
+
Table 1: RACER architecture’s baseline hyper-parameters.
|
| 293 |
+
|
| 294 |
+
<table><tr><td>Short-hand</td><td>Description</td><td>Baseline value</td></tr><tr><td>C</td><td>Annealing parameter of Cmax*</td><td>4</td></tr><tr><td>N</td><td>Size of the Replay Memory.</td><td>219</td></tr><tr><td>Nstart</td><td>Number of samples gathered before training starts.</td><td>218</td></tr><tr><td>D</td><td>Fraction of far-policy samples allowed in the RM.</td><td>0.1</td></tr><tr><td>B</td><td>Mini-batch size.</td><td>256</td></tr><tr><td>F</td><td>Ratio between observed time steps and gradient steps.</td><td>1</td></tr><tr><td>n</td><td>Learning rate.</td><td>10-4</td></tr><tr><td>Y</td><td>Discount factor.</td><td>0.995</td></tr></table>
|
| 295 |
+
|
| 296 |
+
NAF We use the same baseline MLP architecture and learning rate $\eta = 1 0 ^ { - 4 }$ , batch-size $B = 2 5 6$ discount $\gamma = 0 . 9 9 5$ , RM size $N = 2 ^ { 1 9 }$ , and soft target network update coefficient 0.01. Gaussian noise is added to the deterministic policy $\scriptstyle \pi ^ { \mathsf { w } ^ { \prime } } = \mathbf { m } ^ { \mathsf { w } ^ { \prime } } + { \bar { \mathcal { N } } } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbf { I } )$ with $\sigma { = } 0 . 2$ .
|
| 297 |
+
|
| 298 |
+
PPO We tuned the hyper-parameters as Henderson et al. (2017): $\gamma { = } 0 . 9 9 5$ , GAE $\lambda { = } 0 . 9 7$ , policy clipping at $\Delta \rho _ { t } { = } 0 . 2$ , and we alternate performing 2048 environment steps and 10 optimizer epochs with batch-size 64 on the obtained data. Both the policy- and the value-network are 2-layer MLPs with 64 units per layer. We further improved results by having separate learning rates ( $1 0 ^ { - 4 }$ for the policy and $3 \cdot 1 0 ^ { - 4 }$ for the critic) with the same annealing as used in the other experiments.
|
| 299 |
+
|
| 300 |
+
ACER We kept most hyper-parameters as described in the original paper (Wang et al., 2017): the TBC clipping parameter is $c = 5$ , the trust-region update parameter is $\delta = 1$ , and five samples of the advantage network are used to compute $A ^ { \mathfrak { w } }$ estimates under $\pi$ . We use a RM of $1 e 5$ samples, each gradient is computed from 24 uniformly sampled episodes, and we perform one gradient step per environment step. Because here learning is not from pixels, each network (value, advantage, and policy) is an MLP with 2 layers and 64 units per layer (we tried training runs with 96 and 128 units per layer and did not observe improvements). Accordingly, we reduced the soft target-network update coefficient $\begin{array} { r } { \alpha = 0 . 0 0 1 , } \end{array}$ ) and the learning rates for the value- $( \eta = 3 \cdot 1 0 ^ { - 4 } )$ and for the policy-network $( \eta = 1 \cdot 1 0 ^ { - 4 } )$ ). Despite these reduced learning rates, Fig. 7 shows that ACER’s techniques do not prevent the policy from becoming disconnected from prior behaviors. We note that hyper-parameters are known to affect performance (Henderson et al., 2017) and we do not exclude that ACER could have performed better with more extensive tuning.
|
| 301 |
+
|
| 302 |
+
# E PSEUDO-CODES
|
| 303 |
+
|
| 304 |
+
Remarks on algorithm 1: 1) It describes the general structure of the ER-based off-policy RL algorithms implemented for this work (i.e. RACER, DDPG, and NAF). 2) This algorithm can be adapted to conventional ER, PER (by modifying the sampling algorithm to compute the gradient estimates), or ReF-ER (by following Sec. 3)). 3) The algorithm requires 3 hyper-parameters: the ratio of time step to gradient steps $F$ (usually set to 1 as in DDPG), the maximal size of the RM $N$ , and the minimal size of the RM before we begin gradient updates $N _ { \mathrm { s t a r t } }$ .
|
| 305 |
+
|
| 306 |
+
Remarks on algorithm 2: 1) The reward for an episode’s initial state, before having performed any action, is zero by definition. 2) The value $V ^ { \mathbb { w } } ( s _ { t } )$ for the last state of an episode is computed if the episode has been truncated due the task’s time limits or is set to zero if $s _ { t }$ is a terminal state. 3) Each time step we use the learner’s updated policy network and we store $\mu _ { t } = \{ \mathbf { m } ( s _ { t } ) , \pmb { \Sigma } ( s _ { t } ) \}$ .
|
| 307 |
+
|
| 308 |
+
Remarks on algorithm 3: 1) In order to compute the gradients $\hat { g } _ { t _ { i } } ^ { A C } ( \mathbf { w } )$ , we rely on advantage estimates $\boldsymbol { Q } _ { t _ { i } } ^ { \mathrm { r e t } }$ that were computed when subsequent time steps in $t _ { i }$ ’s episode were previously drawn by ER. Not having to compute the quantities , and $\rho$ for all following steps comes with clear computational
|
| 309 |
+
|
| 310 |
+
Algorithm 1 Serial description of the master algorithm.
|
| 311 |
+
|
| 312 |
+
$t = 0 , k = 0$ ,
|
| 313 |
+
Initialize an empty RM, network weights $\mathtt { w }$ , and Adam’s (Kingma & Ba, 2015) moments.
|
| 314 |
+
while $n _ { \mathrm { o b s } } < N _ { \mathrm { s t a r t } }$ do Advance the environment according algorithm 2.
|
| 315 |
+
end while
|
| 316 |
+
Compute the initial statistics used to standardize the state vectors (App. C).
|
| 317 |
+
Compute the initial statistics used to rescale the rewards (App. C).
|
| 318 |
+
while $t < T _ { \operatorname* { m a x } }$ do while $t < F \cdot k$ do Advance the environment according to algorithm 2. while $n _ { \mathrm { o b s } } > N _ { \mathrm { s t a r t } }$ do Remove an episode from the RM (either first in first out or as in Sec. 3). end while $t \gets t + 1$ end while Sample $B$ time steps from the RM to compute a gradient estimate (e.g. for RACER with algorithm 3). Perform the gradient step with the Adam algorithm. If applicable, update the ReF-ER penalization coefficient $\beta$ . if modulo $( k , 1 0 0 0 )$ is 0 then Update the statistics used to rescale the rewards (App. C). end if k ← k + 1
|
| 319 |
+
end while
|
| 320 |
+
|
| 321 |
+
# Algorithm 2 Environment sampling
|
| 322 |
+
|
| 323 |
+
Observe $s _ { t }$ and $r _ { t }$ .
|
| 324 |
+
if $s _ { t }$ concludes an episode then Store data for $t$ into the RM: $\left\{ { { s _ { t } } , { r _ { t } } , V ^ { \mathrm { w } } ( { s _ { t } } ) } \right\}$ Compute and store $\boldsymbol { Q } ^ { \mathrm { r e t } }$ for all steps of the episode
|
| 325 |
+
else Sample the current policy $a _ { t } \sim \pi ^ { \mathsf { w } } ( a | s _ { t } ) = \mu _ { t }$ Store data for $t$ into the RM: $\left\{ s _ { t } , r _ { t } , a _ { t } , \mu _ { t } , V ^ { \mathsf { w } } \big ( s _ { t } \big ) , A ^ { \mathsf { w } } \big ( s _ { t } , a _ { t } \big ) \right\}$ Advance the environment by performing $a _ { t }$
|
| 326 |
+
end if
|
| 327 |
+
|
| 328 |
+
efficiency benefits, at the risk of employing an incorrect estimate for $Q _ { t _ { i } } ^ { \mathrm { r e t } }$ . In practice, we find that the Retrace values incur only minor changes between updates (even when large RM sizes decrease the
|
| 329 |
+
|
| 330 |
+
# Algorithm 3 RACER’s gradient update
|
| 331 |
+
|
| 332 |
+
<table><tr><td>for mini-batch sample i = O to B do Fetch allrelevantinformation: St,atQtt,andμt={mt∑t}. Call the approximator to compute π",V(sti), A"(St, @ti) Update Qret for all prior steps in ti's episode with Vw(sti),A"(Sti , ati) Update the importance weight ρti = π"(ati|Sti)/μti(at: |Sti)</td></tr><tr><td>if1/Cmax<pt<Cmax then Compute gAC gAC(w) according to Sec. 4 else</td></tr><tr><td>9ti AC (w)=0 end if</td></tr><tr><td>gReF-ER(w)= βgAC(w)-(1-β)VDkL[μti(-|st:)lπ"(*|st)] ReF-ER penalization: gti end for Accumulate the gradient estimate over the mini-batch ∑=0 9R ReF-ER(w) JB</td></tr></table>
|
| 333 |
+
|
| 334 |
+
<table><tr><td>Algorithm 4 DDPG's gradient update with ReF-ER</td></tr><tr><td>for mini-batch sample i= O to B do Fetch all relevant information: Sti,ati,and μti = {mti,∑ti}. The policy-network computes m"(sts) and the value-network computes Qw'(St , äti ). Define a stochastic policy with Gaussian exploration noise: π"(a | sti)= m(st)+N</td></tr><tr><td>Update the importance weight βt: = π"(ati|Sti)/μti(ati|Sti) if 1/Cmax < pti <Cmax then</td></tr><tr><td>Compute the policy at ti+1 with the target-network: m"(Sti+1) Compute the Q-learning target: qti = rti+1 + γQ (Sti+1,m"(Sti+1))</td></tr><tr><td>The gradient gt&(w') of the value-network minimizes the squared distance from qti ·</td></tr><tr><td>The gradient gDP gPG(w) of the policy-network is the deterministic PG (Eq. 9).</td></tr><tr><td></td></tr><tr><td>else g (w')=0,gDPG(w)=0</td></tr><tr><td>end if ReF-ER penalization: RF-ER()=βgDG()-(1-β)Dμt(-|st)l/(st)</td></tr></table>
|
| 335 |
+
|
| 336 |
+
frequency of updates to the Retrace estimator) and that relying on previous estimates has no evident effect on performance. This could be attributed to the gradual policy changes enforced by ReF-ER. 2) With a little abuse of the notation, with $\pi$ (or $\mu _ { . }$ ) we denote the statistics (mean, covariance) of the multivariate normal policy, with $\pi ( a | s )$ we denote the probability of performing action $a$ given state $s$ , and with $\pi ( \cdot | s )$ we denote the probability density function over actions given state $s$ .
|
| 337 |
+
|
| 338 |
+
Remarks on algorithm 4: 1) It assumes that weights and Adam are initialized for both policy-network and value-network. 2) The “target” weights are initialized as identical to the “trained” weights. 3) For the sake of brevity, we omit the algorithm for NAF, whose structure would be very similar to this one. The key difference is that NAF employs only one network and all the gradients are computed from the Q-learning target.
|
| 339 |
+
|
| 340 |
+
# SUPPLEMENTARY REFERENCES
|
| 341 |
+
|
| 342 |
+
[S1] P. Chou, D. Maturana, and S. Scherer. Improving stochastic policy gradients in continuous control with deep reinforcement learning using the beta distribution. In International Conference on Machine Learning, pp. 834–843, 2017.
|
| 343 |
+
|
| 344 |
+
[S2] X. Glorot and Y. Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the 13th international conference on artificial intelligence and statistics, pp. 249–256, 2010.
|
| 345 |
+
|
| 346 |
+
[S3] S. Gu, T. Lillicrap, Z. Ghahramani, R. E Turner, and S. Levine. Q-prop: Sample-efficient policy gradient with an off-policy critic. In International Conference on Learning Representations (ICLR), 2017.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 7: Average $D _ { K L } ( \mu _ { t } \| \pi ^ { \mathtt { w } } )$ for ACER (purple line), RACER baseline (green line, $C { = } 4$ , $N { = } 1 0 ^ { 1 9 }$ ), RACER with conservative ReF-ER constraints and large RM size (blue line, $C { = } 2$ , $N { = } 1 0 ^ { 2 0 }$ ), and RACER with relaxed ReF-ER constraints and smaller RM size (red line, $C { = } 8$ , $N { = } 1 0 ^ { 1 8 }$ ).
|
| 350 |
+
|
| 351 |
+
[S4] D. Kingma and J. Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
|
| 352 |
+
|
| 353 |
+
[S5] K. B. Petersen, M. S. Pedersen, et al. The matrix cookbook. Technical University of Denmark, 7(15):510, 2008.
|
| 354 |
+
|
| 355 |
+

|
| 356 |
+
Figure 8: $2 0 ^ { \mathrm { t h } }$ and $8 0 ^ { \mathrm { t h } }$ percentiles of cumulative rewards for episodes of OpenAI Gym tasks ended within intervals of $2 \cdot 1 \bar { 0 } ^ { 5 }$ time steps across 5 independent training runs. The figures includes results for PPO (black contours), RACER baseline (green contours, $C = 4$ , $N = \overline { { 1 0 ^ { 1 9 } } }$ ), RACER with conservative ReF-ER constraints and large RM size (blue contours, $C = 2$ , $N = 1 0 ^ { 2 0 }$ ), and RACER with relaxed ReF-ER constraints and smaller RM size (red contours, $C = 8$ , $N = 1 0 ^ { 1 8 }$ ).
|
| 357 |
+
|
| 358 |
+

|
| 359 |
+
Figure 9: $2 0 ^ { \mathrm { t h } }$ and $8 0 ^ { \mathrm { t h } }$ percentiles of cumulative rewards for episodes of OpenAI Gym tasks ended within intervals of $2 \cdot 1 0 ^ { 5 }$ time steps across 5 independent training runs. The figures includes results for DDPG (green contours), DDPG with PER (red contours), and $\mathtt { u - D D P G }$ with ReF-ER (blue contours, $C = 4$ , and all other hyper-parameters set according to App. D).
|
| 360 |
+
|
| 361 |
+

|
| 362 |
+
Figure $1 0 \colon 2 0 ^ { \mathrm { t h } }$ and $8 0 ^ { \mathrm { t h } }$ percentiles of cumulative rewards for trajectories of DeepMind Control Suite tasks ended within intervals of $2 \cdot 1 0 ^ { 5 }$ time steps across 5 independent training runs using the baseline RACER hyper-parameters (Table 1).
|
| 363 |
+
|
| 364 |
+

|
| 365 |
+
Figure 11: $2 0 ^ { \mathrm { t h } }$ and $8 0 ^ { \mathrm { t h } }$ percentiles of cumulative rewards for trajectories of DeepMind Control Suite tasks ended within intervals of $2 \cdot 1 0 ^ { 5 }$ time steps across 5 independent training runs for $\mathtt { u - D D P G }$ with ReF-ER, $C = 4$ , and all other hyper-parameters set according to App. D.
|
md/train/BylEqnVFDB/BylEqnVFDB.md
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CURVATURE GRAPH NETWORK
|
| 2 |
+
|
| 3 |
+
Ze Ye
|
| 4 |
+
Department of Biomedical Informatics
|
| 5 |
+
Stony Brook University
|
| 6 |
+
ze.ye@stonybrook.edu
|
| 7 |
+
|
| 8 |
+
Kin Sum Liu Department of Computer Science Stony Brook University kiliu@cs.stonybrook.edu
|
| 9 |
+
|
| 10 |
+
Tengfei Ma IBM Research AI Tengfei.Ma1@ibm.com
|
| 11 |
+
|
| 12 |
+
Jie Gao
|
| 13 |
+
Department of Computer Science
|
| 14 |
+
Rutgers University
|
| 15 |
+
jg1555@rutgers.edu Chao Chen
|
| 16 |
+
Department of Biomedical Informatics Stony Brook University
|
| 17 |
+
chao.chen.1@stonybrook.edu
|
| 18 |
+
|
| 19 |
+
# ABSTRACT
|
| 20 |
+
|
| 21 |
+
Graph-structured data is prevalent in many domains. Despite the widely celebrated success of deep neural networks, their power in graph-structured data is yet to be fully explored. We propose a novel network architecture that incorporates advanced graph structural information, specifically, discrete graph curvature, which measures how the neighborhoods of a pair of nodes are structurally related. The curvature of an edge $( x , y )$ is defined by comparing the distance taken to travel from neighbors of $x$ to neighbors of $y$ , with the length of edge $( x , y )$ . It is a much more descriptive structural measure compared to previously ones that only focus on node specific attributes or limited graph topological information such as degree. Our curvature graph convolution network outperforms state-of-the-art methods on various synthetic and real-world graphs, especially the large and dense ones.
|
| 22 |
+
|
| 23 |
+
# 1 INTRODUCTION
|
| 24 |
+
|
| 25 |
+
Despite the huge success of deep neural networks, it remains challenging to fully exploit their power on graph-structured data, i.e., data whose underlying structure is captured by graphs, e.g., social networks, telecommunication networks, biological networks and brain connectomes. Inspired by the power of convolutional neural networks on image data, convolutional networks have been proposed for graph-structured data. Existing works can be roughly divided into two categories, depending on whether convolution is applied to the spectral or spatial domain.
|
| 26 |
+
|
| 27 |
+
Spectral approaches (Bruna et al., 2013; Defferrard et al., 2016; Henaff et al., 2015; Velickovi ˇ c et al., ´ 2017) apply convolution to eigen-decomposed graph Laplacians and are generally efficient in both computation and memory. However, the learned convolution filters are graph-specific and cannot generalize to different graphs.
|
| 28 |
+
|
| 29 |
+
Spatial approaches execute “convolution” directly on the graph and operate on the neighborhood as defined by the graph topology. A spatial method iteratively updates the representation of each graph node by aggregating representations from its neighbors, i.e., adjacent nodes (Xu et al., 2018). Nonlinear transformations are applied to the representation passed from one node to another, called a message. These transformations have the same input/output dimension, i.e., the dimension of the node representation. They can be shared and learned across different nodes and even different graphs.
|
| 30 |
+
|
| 31 |
+
For spatial approaches, it is important to incorporate local structural information of the graph. Node degree has been used to re-parametrize the non-linear transformation of messages (Monti et al., 2017) or as an additional node feature (Hamilton et al., 2017). However, node degree is fairly limited; there can be different graph topologies with the same degree distribution. The limitation is illustrated in
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Illustration of structural information. In all three graphs, the degrees of $x$ and $y$ are the same. However, the Ricci curvature of the edge $( x , y )$ is negative, zero, and positive, respectively. All edges have weight 1. $\alpha = 0 . 5$ so each node keeps $5 0 \%$ of the probability mass to itself.
|
| 35 |
+
|
| 36 |
+
Figure 1. Nodes $x$ and $y$ have the same degree in three significantly different graphs: a tree, a grid and a clique. To effectively make use of graph structural knowledge, one would need a feature with more discriminative power; one that can distinguish these three scenarios in Figure 1.
|
| 37 |
+
|
| 38 |
+
In this paper, we propose a novel graph neural network that exploits advanced structural information. Notice that node degree only describes the number of neighbors of each node, but does not say how these neighbors are connected among themselves. We seek to use structural information characterizing how neighborhoods of a pair of nodes relate to each other. In Figure 1, the neighborhoods of $x$ and $y$ are well separated in different branches of a tree. In a grid graph, the two neighborhoods are within a parallel shift of each other. In a clique, they completely overlap. To quantify such pairwise structural information, we draw inspiration from recent study of graph curvature (Ollivier, 2009; Lin et al., 2011; Weber et al., 2016).
|
| 39 |
+
|
| 40 |
+
Similar to curvature in the continuous domain, e.g., the Ricci curvature of a Riemannian manifold, the discrete graph curvature measures how the geometry of a pair of neighborhoods deviates from a “flat” case, namely, the case of a grid graph. There are several definitions of discrete curvature for graphs. The most notable one is Ollivier’s Ricci curvature (Ollivier, 2009). The edges of an infinite grid graph have zero curvature. The curvature of an edge in a tree is negative and is positive in a complete graph. Intuitively, the graph curvature measures how well two neighborhoods are connected and/or overlap with each other. Such information is related to how information propagates in the neighborhood, and should be leveraged by a graph convolutional network.
|
| 41 |
+
|
| 42 |
+
We propose Curvature Graph Network (CurvGN), the first graph convolutional network built on advanced graph curvature information. The use of curvature information allows CurvGN to adapt to different local structural scenarios and filter messages passed between nodes differently. Notice that curvature captures how easily information flows between two nodes. Within a well-connected community, neighborhoods of adjacent nodes have large overlap and many shortcuts. The corresponding curvature is positive and passing information between the nodes is easy. For an edge serving as a bridge of two clusters, its curvature is negative and it is hard for information to pass. The key to our success is that we choose to be agnostic on whether curvature should be used to block or accelerate the messages in graph convolution. We exploit the curvature information in a data-driven manner and learn how to use it to reweigh different channels of the messages.
|
| 43 |
+
|
| 44 |
+
To further investigate how curvature information affects graph convolution, we carried out extensive experiments with various synthetic graphs and real-world graphs. Our synthetic graphs are generated according to various well-established graph models, e.g., stochastic block model (Decelle et al., 2011), Watts–Strogatz network (Watts & Strogatz, 1998), Newman–Watts network (Newman & Watts, 1999) and Kleinberg’s navigable small world graph (Kleinberg, 2000). On these data, CurvGN outperforms vanilla graph network and networks using node degree information and self attention, demonstrating the benefit of curvature information in graph convolution. Such benefit is more apparent as the graph size increases. We hypothesize that graph convolution alone can adapt to any graph topology, at the cost of more convolutional layers and more training data. This is corroborated by our experiments on real-world graphs. CurvGN outperforms state-of-the-art graph neural networks, especially on large and dense graphs, which tend to have a large variation of local structures. The success of CurvGN demonstrates how topological intuitions inspire better practical solutions. It encourages us to continue the endeavor in applying theoretical insights in successful deployments of deep learning.
|
| 45 |
+
|
| 46 |
+
# 2 RELATED WORK
|
| 47 |
+
|
| 48 |
+
We briefly summarize previous works on graph convolution. In early works (Frasconi et al., 1998; Sperduti & Starita, 1997), recursive neural networks were applied on data whose underlying structures are directed acyclic graphs. In Graph Neural Networks (GNNs) (Gori et al., 2005; Scarselli et al., 2009), the recursive network framework was extended to general graphs. Li et al. (2015) introduced gated recurrent units into the framework in order to improve the performance. Since Convolutional Neural Networks (CNNs) have demonstrated strong performance in grid-like-structured data, various methods have been proposed to implement “convolution” on graph-structured data. The efforts can be roughly divided into spectral approaches and spatial approaches. Below we will review both categories in details.
|
| 49 |
+
|
| 50 |
+
Spectral approach. Bruna et al. (2013) transformed the graph convolution into spectral domain multiplication by graph Fourier transform. This method is expensive due to the need to perform matrix eigen-decomposition. Furthermore, it cannot create spatially localized filters as in CNNs. Henaff et al. (2015) applied smooth coefficients on spectral filters to make them spatially localized. Defferrard et al. (2016) used Chebyshev expansion of the graph Laplacian to approximate the filters as a $k$ -polynomial function. Kipf & Welling (2016) simplified those methods by reducing to degree one polynomials. Their method is to essentially filter the graph with a kernel whose receptive field is the one-hop neighborhood of each node. The common limitation of spectral approaches is that the convolution filters depend on the Laplacian of each specific graph.
|
| 51 |
+
|
| 52 |
+
Spatial approach. The main challenge of spatial approaches is to design an operator which applies to neighborhoods with different topology and still maintains shared filters. Monti et al. (2017) introduced a mixture model CNN (MoNet) that maps graph neighborhood into spatial neighborhood (with pseudo-coordinates) for spatial convolution. Hamilton et al. (2017) proposed GraphSAGE that samples fixed size neighbors and aggregates their representations. Velickovi ˇ c et al. (2017) ´ proposed Graph Attention Network (GAT), which uses self-attention mechanism to reweigh graph convolution. Recently, there have been other methods which studied graph neural networks from different perspectives, such as pooling (Gao & Ji, 2019; Ying et al., 2018).
|
| 53 |
+
|
| 54 |
+
Discrete graph curvature. Different proposals for discrete graph curvature have been introduced in recent years, including Ollivier-Ricci curvature (Ollivier, 2009; Lin et al., 2011) and Forman curvature (Forman, 2003). We focus on Ollivier-Ricci curvature as it is more geometric in nature, while Forman curvature (Forman, 2003) is combinatorial and is faster to compute. Both curvatures have been applied to real-world graphs. Ni et al. (2015) showed that Ollivier-Ricci curvature can be used to identify backbone edges of an Internet AS graph and is closely related to network vulnerability. Similar applications are shown in the characterization of complex biological networks (Sandhu et al., 2015). There are also applications of Ollivier-Ricci curvature in network alignment (Ni et al., 2018) and community detection (Ni et al., 2019; Sia et al., 2019). Forman curvature is shown to have similar effect (Weber et al., 2017; 2016). To the best of our knowledge, graph curvature has not been used in graph neural networks.
|
| 55 |
+
|
| 56 |
+
# 3 CURVATURE GRAPH NETWORK
|
| 57 |
+
|
| 58 |
+
We first formulate the node label prediction problem and explain the mechanism of a Graph Neural Network (GNN). Suppose we have an undirected graph $G = ( V , E )$ with features on the vertices $H = ( h _ { 1 } , h _ { 2 } , \cdot \cdot \cdot , h _ { n } ^ { - } ) , h _ { i } \in \mathbb { R } ^ { F }$ . Here $n = | V |$ is the number of nodes in the graph and $F$ is the feature dimension of each node. Given labels of some nodes in $V$ , we would like to predict the labels of the remaining nodes. A GNN iteratively updates the graph $G$ ’s node representation and eventually predicts node labels. A GNN consists of multiple hidden layers that update node representation from a lower level node representation $H ^ { t } \in \mathbb { R } ^ { n \times F ^ { t } }$ where $F ^ { t }$ is feature dimension at the $t$ -th layer to a higher level representation Ht+1 ∈ Rn×F t+1 . In particular, $H ^ { 0 }$ is the input feature $H$ and $F ^ { t } = F$ . The last node representation, $H ^ { T }$ , are fed to a fully connected layer or a linear classifier to predict node labels. The layers and node representations are illustrated in the top of Figure 2.
|
| 59 |
+
|
| 60 |
+
Now we explain how to construct hidden layers that update node representations from $H ^ { t }$ to $H ^ { t + 1 }$ We focus on spatial approaches and treat convolution as a message passing scheme. The $( t + 1 )$ -th representation of node $x$ is computed by aggregating messages passed from $x$ ’s neighbors. We also include the message from $x$ to itself. There are several aggregation methods, such as mean, max and sum. We choose summation as it is a commonly used aggregation method (Kipf & Welling, 2016;
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 2: An overview of our Curvature Graph Network. The top row represents the iterative feature update function $H ^ { t }$ implemented by consecutive non-linear layers. The bottom row represents the computation of reweighting parameter $\tau _ { x y } ^ { t }$ from the edge curvature information.
|
| 64 |
+
|
| 65 |
+
Velickovi ˇ c et al., 2017; Xu et al., 2018). Denote by ´ $\overline { { \mathcal { N } } } ( x ) = \mathcal { N } ( x ) \cup \{ x \}$ the neighborhood of $x$ including itself. We have $\begin{array} { r } { h _ { x } ^ { t + 1 } = \sigma _ { t } ( \sum _ { y \in \overline { { \mathcal { N } } } ( x ) } M _ { y x } ^ { t } ) } \end{array}$ , in which $\sigma _ { t }$ is a non-linear transformation. A message passed from to is a linear transformation of ’s representation. We also introduce a weight $\tau _ { x y } ^ { \bar { t } }$ whose purpose will be clear later. Formally, we have $M _ { y x } ^ { t } = \tau _ { x y } ^ { t } W ^ { t } h _ { y } ^ { t }$ , in which $W ^ { t }$ is the linear transformation matrix learned through training. Formally, we have the updating equation
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
h _ { x } ^ { t + 1 } = \sigma _ { t } \left( \sum _ { y \in \overline { { \mathcal { N } } } ( x ) } \tau _ { x y } ^ { t } W ^ { t } h _ { y } ^ { t } \right)
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
It is crucial to obtain suitable reweighting parameter $\tau _ { x y } ^ { t }$ since it is directly affecting how information from neighbors of node $x$ is passed to $x$ . Some papers use node degree information as $\underset { - } { \tau } _ { x y } ^ { t }$ (Kipf $\&$ Welling, 2016; Monti et al., 2017) and other work uses joint node features to compute self attention as τ txy (Velickovi ˇ c et al., 2017). We propose to use more advanced structural information, i.e., the Ricci ´ curvature, to compute $\tau _ { x y } ^ { t }$ . It is also known that the reweighting parameter $\tau _ { x y } ^ { t }$ is not necessarily a scalar. It can be anything between a scalar and a $F ^ { t + 1 } \times F ^ { t + 1 }$ matrix. Empirically, we choose $\tau _ { x y } ^ { t }$ as a vector in the experiments because a vector has more expressive power than a scalar and is easier to train than a matrix.
|
| 72 |
+
|
| 73 |
+
To develop the curvature convolution layer in Equation (3.1), we define dthe context of a general graph in Section 3.1. We explain how to compute $\tau _ { x y } ^ { t }$ ete Ricci curvature infrom the curvature in Section 3.2.
|
| 74 |
+
|
| 75 |
+
# 3.1 RICCI CURVATURE
|
| 76 |
+
|
| 77 |
+
In Riemannian geometry, curvature measures how a smooth object deviates from being flat, or being straight in the case of a line. Similar concepts can be extended to a non-smooth setting for discrete objects. In particular, curvature has been studied for metric-measure space (Bonciocat, 2014; Bonciocat & Sturm, 2009; Lott & Villani, 2009; Sturm et al., 2006), Markov chain (Ollivier, 2009) and general graphs (Ollivier, 2009; Lin et al., 2011). There are a number of possibilities to define discrete curvature for an edge in a graph. For example, the Gaussian curvature for a triangulated surface could be defined s.t. the curvature of a vertex is $2 \pi$ (or $\pi$ ) minus the sum of corner angles (the angles of the triangles) at it, if it is an interior (or boundary) vertex. The definitions of curvatures easier to generalize in a discrete and general graph setting are sectional curvature and Ricci curvature.
|
| 78 |
+
|
| 79 |
+
Curvature computation. For a point $x$ on the surface, considers two tangent vectors $v$ and $w _ { x }$ . Let $y$ be the end point of the tangent vector $v$ at $x$ . Imagine transporting in parallel $w _ { x }$ along $v$ to a tangent vector $w _ { y }$ at $y$ . If the surface is flat, any pair of points $x ^ { \prime }$ and $y ^ { \prime }$ which is $\epsilon$ away from $x$ and $y$ along $w _ { x }$ and $w _ { y }$ will have the same distance as $x$ and $y$ . Its deviation from $| v |$ defines the sectional curvature. Then averaging it over all directions of $w _ { x }$ gives the Ricci curvature which only depends on the tangent vector $v$ . Intuitively, instead of $w _ { x }$ , we can think of $S _ { x }$ be the set of end points of all tangent vectors at $x$ with length $\epsilon$ . Again, if we map $S _ { x }$ to $S _ { y }$ using parallel transport along $v$ the distance between a point at $S _ { x }$ and its corresponding image at $S _ { y }$ can be different from $| v |$ if the surface is not flat.
|
| 80 |
+
|
| 81 |
+
To generalize Ricci curvature to discrete spaces, Ollivier (2009) takes a coarse approach and represents $S _ { x }$ as a probability measure $m _ { x }$ of total mass 1 around $x$ . Thus the distance can be measured by Wasserstein distance (or Earth Mover distance) which finds the optimal mass-preserving transportation plan between two probability measures. Then the coarse Ricci curvature $\kappa _ { x y }$ on edge $\bar { ( } x , y )$ is defined by comparing the Wasserstein distance $W ( m _ { x } , m _ { y } )$ to the distance $d ( x , y )$ , formally, $\kappa _ { x y } = 1 - \mathrm { \Delta } W ( m _ { x } , m _ { y } ) / d ( x , y )$ .
|
| 82 |
+
|
| 83 |
+
The natural analogy of a small ball $S _ { x }$ at point $x$ in the metric space is the 1-hop neighborhood $N ( x )$ of node $x$ in a graph. This motivates the Ollivier-Ricci curvature on graph edges. For an undirected graph $G = ( V , E )$ , denote the set of neighboring nodes of a node $x \in V$ as $\mathcal { N } ( x ) = \{ x _ { 1 } , x _ { 2 } , . . . , x _ { k } \}$ . Then we can define a probability measure $m _ { x } ^ { \alpha }$ at $x$ :
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
m _ { x } ^ { \alpha } ( x _ { i } ) = { \left\{ \begin{array} { l l } { \alpha } & { { \mathrm { i f ~ } } x _ { i } = x } \\ { ( 1 - \alpha ) / k } & { { \mathrm { i f ~ } } x _ { i } \in { \mathcal { N } } ( x ) } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\alpha$ is a parameter within $[ 0 , 1 ]$ . It is to keep probability mass of $\alpha$ at node $x$ itself and distribute the rest uniformly over the neighborhood. We set $\alpha = 0 . 5$ , similar to (Ni et al., 2018). To compute the Wasserstein distance $W ( m _ { x } ^ { \alpha } , m _ { y } ^ { \alpha } )$ between the probability measures around two end points $x , y$ of the edge $( x , y )$ , the optimal transportation plan can be solved by the following linear programming:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\operatorname* { m i n } _ { M } \sum _ { i , j } d ( x _ { i } , y _ { j } ) M ( x _ { i } , y _ { j } ) \mathrm { ~ s . t . ~ } \sum _ { j } M ( x _ { i } , y _ { j } ) = m _ { x } ^ { \alpha } ( x _ { i } ) , \forall i ; \sum _ { i } M ( x _ { i } , y _ { j } ) = m _ { y } ^ { \alpha } ( y _ { j } ) , \forall j \in \mathcal { G } .
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $M ( x _ { i } , y _ { j } )$ is the amount of probability mass transported from node $x _ { i }$ to $y _ { i }$ along the shortest path with length $d ( x _ { i } , y _ { j } )$ . In the language of graph theory, if the Ollivier-Ricci curvature is negative $( W ( m _ { x } ^ { \alpha } , m _ { y } ^ { \alpha } ) > d ( x , y ) )$ , the edge $( x , y )$ serves as the bridge connecting the neighborhood around $x$ and $y$ . This aligns with the intuition in the smooth setting where the small balls $S _ { x }$ and $S _ { y }$ are closer to each other than their centers.
|
| 96 |
+
|
| 97 |
+
# 3.2 CURVATURE-DRIVEN GRAPH CONVOLUTION
|
| 98 |
+
|
| 99 |
+
Next we present how Ricci curvature is used in our graph convolutional network. Intuitively, curvature measures how easily a message flows through an edge, and could be used to guide message passing in convolution. But its usage should really depend on the problem and data. We choose to be agnostic on how the knowledge of edge curvature should be used. We resort to a data-driven strategy and learn a mapping function that maps Ricci curvature $\kappa _ { x y }$ to the weight of messages, i.e., $\tau _ { x y } ^ { t }$ in Equation (3.1). We first explain how the mapping is learned end-to-end (CurvGN-1). Next we expand the mapping to a multi-valued version, to incorporate more flexibility in the model (CurvGN-n).
|
| 100 |
+
|
| 101 |
+
CurvGN-1. As mentioned before, $\tau _ { x y } ^ { t }$ can be anything between a scalar and a $F ^ { t + 1 } \times F ^ { t + 1 }$ matrix. We first assume $\tau _ { x y } ^ { t }$ is a scalar. Then the mapping function can be defined as:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
f ^ { t } : \kappa _ { x y } \tau _ { x y } ^ { t }
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
We create a multi-layer perceptron (MLP) to approximate the mapping function $f ^ { t }$ since MLP is proved to be a universal approximation machine and can be easily incorporated into our GNN model for end-to-end training. Denote the MLP at the $t$ -th layer as $\mathrm { M L P } ^ { t }$ . As summation is used as the aggregation function in Equation (3.1), the messages may accumulate to an arbitrarily large value. To prevent a numerical explosion, we apply a softmax function, $S ^ { t }$ , to $\mathrm { M L P } ^ { t } ( \kappa _ { x y } )$ of all neighbors of $x$ including itself, $y \in { \overline { { \mathcal { N } } } } ( x )$ nodes.
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\tau _ { x y } ^ { t } = S ^ { t } ( \mathrm { M L P } ^ { t } ( \kappa _ { x y } ) )
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Figure 2 shows how MLP transforms curvature to reweigh messages.
|
| 114 |
+
|
| 115 |
+
CurvGN-n. Messages $M _ { y x } ^ { t }$ are usually multi-channeled. In particular, they are $F ^ { t + 1 }$ -dimensional. The scalar weight generated using curvature is not necessarily the same for different channels. To improve the expressing power of $\tau _ { x y } ^ { t }$ , we create a similar mapping function as t+1 $f ^ { t }$ in Equation (3.3) but it generates a reweighting vector $\bar { \mathcal { T } } _ { x y } ^ { t } \in \mathbb { R } ^ { F ^ { t + 1 } }$ instead. In other words, we learn to reweigh different message channels differently. In principle, we can even learn a matrix of dimension RFt+1 $\mathbb { R } ^ { F ^ { t + 1 } } \times \mathbb { R } ^ { F ^ { t + 1 } }$ to reweigh the message. However, a vector has significantly fewer parameters to train and is found to be sufficient in practice.
|
| 116 |
+
|
| 117 |
+
Using the same strategy as CurvGN-1, the vector $\mathcal { T } _ { x y } ^ { t }$ is calculated by applying a ${ \bf M L P } ^ { t }$ with $F ^ { t + 1 }$ outputs. Then, we apply a channel-wise softmax function, $\mathbf { S } ^ { t }$ , that normalizes the MLP outputs separately on each message channel: $\mathcal { T } _ { x y } ^ { t } = \mathbf { S } ^ { t } ( \mathbf { M L P } ^ { t } ( \kappa _ { x y } ) )$
|
| 118 |
+
|
| 119 |
+
Substituting $\mathcal { T } _ { x y }$ into Equation (3.1), we have the convolution of CurvGN-n:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
h _ { x } ^ { t + 1 } = \sigma _ { t } \left( \sum _ { y \in \overline { { \mathcal { N } } } ( x ) } \mathrm { d i a g } ( \mathcal { T } _ { x y } ^ { t } ) W ^ { t } h _ { y } ^ { t } \right)
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\mathrm { d i a g } ( T _ { x y } ^ { t } )$ is a matrix whose diagonal entries are entries of $\mathcal { T } _ { x y } ^ { t }$ . For the details of $\mathrm { { M L P ^ { t } } }$ , please refer to Appendix A.1.
|
| 126 |
+
|
| 127 |
+
# 3.3 DESIGN DETAILS OF THE NETWORK
|
| 128 |
+
|
| 129 |
+
In practice, we use a two-convolutional-layer CurvGN model. The first layer is a linear transform layer that produces an output feature vector paired with a three layer MLP that computes reweighting vector. The output feature is pushed into an exponential linear unit layer to add non-linearity. The second layer is for classification, with the same structure as the first layer except that the output feature is now at length of class number. The hyperparameters are similar to GAT implemented in Velickovi ˇ c´ et al. (2017). For synthetic experiments, the hidden layer output is reduced to 8 dimensions.
|
| 130 |
+
|
| 131 |
+
# 4 EXPERIMENTS
|
| 132 |
+
|
| 133 |
+
We have evaluated our method for both synthetic and real-world graphs. Our method outperforms the state-of-the-art methods, especially on large and dense graphs, which tend to have heterogeneous topological structures. To demonstrate the prediction power, we use different graph theoretical models in synthetic experiments and different parameter settings to gain insights of how curvature information helps graph convolution. We focus on node classification tasks, while our method easily generalizes to graph classification tasks.
|
| 134 |
+
|
| 135 |
+
# 4.1 GRAPH THEORETICAL MODELS
|
| 136 |
+
|
| 137 |
+
We generate synthetic data using different graph theoretical models. We start with the Stochastic Block Model (SBM) (Holland et al., 1983), which assumes a partition of the graph into communities. We create random graphs, each with 1000 nodes and equally partition the node set into five disjoint communities. Nodes in the same community have the same class label. Edges are randomly sampled with an intra-community probability, $p$ , for nodes within the same community and with an intercommunity probability, $q$ , for nodes in different communities. We randomly create 100 graphs with $p$ ranging in $\{ 0 . 0 5 , 0 . 0 7 , \cdots , 0 . 2 3 \}$ and $q$ ranging in $\{ 0 . 0 , 0 . 0 0 5 , \cdot \cdot \cdot , 0 . 0 \dot { 4 } 5 \}$ . For each generated graph, we randomly select 400 nodes as the training set, another 400 nodes as the validation set and the remaining 200 nodes as the test set. We assign each node with a randomly generated feature of dimension 10 and use them as uninformative input of our CurvGN.
|
| 138 |
+
|
| 139 |
+
Baselines. We compared our proposed methods, CurvGN-1 and CurvGN-n, with two popular state-of-the-art methods: GCN (Kipf & Welling, 2016) and GAT (Velickoviˇ c et al., 2017). For these´ methods, we use the same setting as for Cora dataset mentioned in (Velickovi ˇ c et al., 2017; Kipf & ´ Welling, 2016), except that the dimension of the hidden layer is 8. We also included a baseline method which aggregates messages without reweighting, namely, Vanilla GN. Compared with Vanilla GN, GCN reweighs messages using node degrees. GAT reweighs messages using self attention map computed using node representations. CurvGN-1 and CurvGN-n reweigh messages using the scalar and vector forms computed from Ollivier-Ricci curvature.
|
| 140 |
+
|
| 141 |
+
We ran all methods on 100 random graphs. For each graph, we ran the training and inference task 10 times and took average accuracy. For each training, we run 200 epochs and use validation set for early stopping. Figure 3 shows the heat maps for all methods. The title of each heatmap includes the max and average performance over all parameter settings. In Figure 3(c), we run the same experiments on graphs with different sizes and report the average accuracy.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 3: Heat maps on synthetic data by SBM. The top-right figure is the performance of Vanilla GN, CurvGN-1 and CurvGN-n over different graph sizes.
|
| 145 |
+
|
| 146 |
+
Discussion. From the heatmaps, we observe that Vanilla GN, GCN and GAT are not better than random guessing. This implies node degree information is not enough. Meanwhile, we observe improved performance by CurvGN-1, confirming the power of reweighting with curvature in graph convolution. In addition, CurvGN-n outperforms CurvGN-1, suggesting that the multi-channel reweighting based on curvature is beneficial. Furthermore, in Figure 3(c), we observe that the benefit of curvature increases as the graph size increases. We hypothesize that the graph convolution is sufficient in small graph setting to fully explore the graph structure and advanced structural information becomes important on graphs large in size and rich in structural diversity.
|
| 147 |
+
|
| 148 |
+
We also visualize the prediction results on one particular graph generated at $( p , q ) = ( 0 . 2 1 , 0 . 0 2 5 )$ in Figure 4. We observe that CurvGN-1 and CurvGN-n make high quality predictions except for a small portion of data in a few communities. Meanwhile, other baselines can completely mix different communities and results are unsatisfactory.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 4: One SBM result with $( p , q ) = ( 0 . 2 1 , 0 . 0 2 5 )$ . Small nodes are training set. Large nodes are testing set. Colors correspond to the predicted node labels.
|
| 152 |
+
|
| 153 |
+
Further studies on different graph theoretic models. To further examine the expressive power of Ricci curvature, we run synthetic experiments using several well-accepted graph theoretical models: Watts–Strogatz model (Watts & Strogatz, 1998), Newman–Watts model (Newman & Watts, 1999) and Kleinberg’s navigable small world graphs (Kleinberg, 2000). A Watts-Strogatz network randomly rewires edges of a ring graph. A Newman-Watts network randomly adds new edges to the ring. The Kleinberg’s model also adds random edges, but the probability of a new edge is inversely proportional to the shortest path distance on the ring. In all these settings, we partition the ring into different communities and design experiments similar to the Stochastic Block Model. More details can be found in the Appendix A.2.
|
| 154 |
+
|
| 155 |
+
We compared all five methods on these different graph models and report the average accuracy over different parameter settings in Table 1. The standard deviations on these results are generally large as we are averaging over different parameter settings. We observe consistently better performance of CurvGN-n than other methods. This confirms that curvature information is beneficial in a broad spectrum of graphs. We also note that GCN and GAT are indeed doing well for Watts-Strogatz and Newman-Watts models. This is because, in these networks, edge rewiring and addition enlarge differences in node degrees. Bridges crossing different communities tend to have higher node degree. Therefore, node degrees carry useful structural information and can help with graph convolution. We do not observe the same benefit of node degree information in SBM and Kleinberg’s model as in these models, node degree is not correlated with the locations of bridges. More heatmap results can be found in the Appendix A.2.
|
| 156 |
+
|
| 157 |
+
Table 1: Average prediction accuracy on four different graph models.
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Method</td><td>SBM</td><td>Watts-Strogatz</td><td>Newman-Watts</td><td>Kleinberg</td></tr><tr><td>GCN</td><td>24%</td><td>32%</td><td>32%</td><td>23%</td></tr><tr><td>GAT</td><td>23%</td><td>30%</td><td>30%</td><td>22%</td></tr><tr><td>Vanilla GN</td><td>28%</td><td>26%</td><td>27%</td><td>28%</td></tr><tr><td>CurvGN-1</td><td>31%</td><td>29%</td><td>29%</td><td>27%</td></tr><tr><td>CurvGN-n</td><td>36%</td><td>32%</td><td>33%</td><td>31%</td></tr></table>
|
| 160 |
+
|
| 161 |
+
# 4.2 REAL-WORLD BENCHMARKS
|
| 162 |
+
|
| 163 |
+
Our real-world benchmarks include two families of datasets: small sparse graphs and large dense graphs. We compare our networks CurvGN-1 and CurvGN-n with several strong baselines. Besides GCN and GAT that have been used in the experiments on synthetic data, we also compared CurvGN-1 and CurvGN-n with multilayer perceptron (MLP), MoNet (Monti et al., 2017), WSCN (Morris et al., 2019) and GraphSAGE with mean aggregation (GS-mean) (Hamilton et al., 2017). Our method is on par with state-of-the-art methods on relatively small graphs and greatly outperforms state-of-the-art methods on large and dense graphs, which tend to have heterogeneous graph topology.
|
| 164 |
+
|
| 165 |
+
Datasets. We use three popular citation network benchmark datasets: Cora, citetseer and PubMed (Sen et al., 2008). We categorize Cora and citetseer into the first family since both Cora and citetseer graphs are relatively small and sparse. They have thousands of nodes and edges with an average node degree below 2. We also use four extra datasets: Coauthor CS and Coauthor Physics which are co-authorship graphs based on the Microsoft Academic Graph from the KDD Cup 2016 challenge; Amazon Computers and Amazon Photos which are segments of the Amazon co-purchase graph in McAuley et al. (2015). These graphs, together with PubMed, are large and dense graphs. Those graphs have more than 10 thousands node and 200 thousands edges with an average node degree as high as 20. We use the exact data splitting as in semi-supervised learning setting used in Kipf & Welling (2016); Velickovi ˇ c et al. (2017): using ´ 20 nodes per class for training, 500 nodes for validation and 1000 nodes for testing. The descriptions and statistics for all datasets in our experiments can be found in the Appendix A.3.
|
| 166 |
+
|
| 167 |
+
During the training stage, we set $L _ { 2 }$ regularization with $\lambda = 0 . 0 0 0 5$ for all datasets. Also, all the models are initialized by Glorot initialization and trained by minimizing cross-entropy loss using Adam SGD optimizer with learning rate 0.005. We apply an early stopping strategy based on the validation set’s accuracy with a patience of 100 epochs. We compute curvature exactly following Eq. (3.2) for all datasets but one. For the Amazon Computer dataset, we use an approximation scheme for computational efficiency (Ni et al., 2018). The linear programming problem is solved using an interior point solver (ECOS).
|
| 168 |
+
|
| 169 |
+
We report the mean and standard deviation of classification accuracy on test nodes on 100 runs and re-use the metrics reported by Monti et al. (2017); Shchur et al. (2018); Velickovi ˇ c et al. (2017) ´ for other state-of-the-art methods. The results are reported in Table 2. Our method is on par with state-of-the-art methods for relatively small graphs and achieves superior performance on large and dense graphs. This is consistent with our conclusion from synthetic experiments: when the graph is large and has heterogeneous topology, advanced structural information becomes critical in graph convolution.
|
| 170 |
+
|
| 171 |
+
Table 2: Performance on real-world benchmarks.
|
| 172 |
+
|
| 173 |
+
<table><tr><td>Method</td><td>Cora</td><td>CiteSeer</td><td>PubMed</td><td>Coauthor CS</td><td>Coauthor Physics</td><td>Amazon Computer</td><td>Amazon Photo</td></tr><tr><td>MLP</td><td>58.2</td><td>59.1</td><td>70.0±2.1</td><td>88.3±0.7</td><td>88.9±1.1</td><td>44.9±5.8</td><td>69.6±3.8</td></tr><tr><td>MoNet</td><td>81.7</td><td>71.2</td><td>78.6±2.3</td><td>90.8±0.6</td><td>92.5±0.9</td><td>83.5±2.2</td><td>91.2±1.3</td></tr><tr><td>GS-mean</td><td>79.2</td><td>71.2</td><td>77.4±2.2</td><td>91.3±2.8</td><td>93.0±0.8</td><td>82.4±1.8</td><td>91.4±1.3</td></tr><tr><td>WSCN</td><td>78.9±0.9</td><td>67.4±0.8</td><td>78.1±0.6</td><td>89.1±0.7</td><td>90.7±0.9</td><td>67.6±3.7</td><td>82.1±1.2</td></tr><tr><td>GCN</td><td>81.5±0.5</td><td>70.9±0.5</td><td>79.0±0.3</td><td>91.1±0.5</td><td>92.8±1.0</td><td>82.6±2.4</td><td>91.2±1.2</td></tr><tr><td>GAT</td><td>83.0±0.7</td><td>72.5±0.7</td><td>79.0±0.3</td><td>90.5±0.6</td><td>92.5±0.9</td><td>78.0±19.0</td><td>85.1±20.3</td></tr><tr><td>CurvGN-1</td><td>82.6±0.6</td><td>71.5±0.8</td><td>78.8±0.6</td><td>92.9±0.4</td><td>94.1±0.3</td><td>86.3±0.7</td><td>92.5±0.5</td></tr><tr><td>CurvGN-n</td><td>82.7±0.7</td><td>72.1±0.6</td><td>79.2±0.5</td><td>92.8±0.3</td><td>94.3±0.2</td><td>86.5±0.7</td><td>92.5±0.5</td></tr></table>
|
| 174 |
+
|
| 175 |
+
# 5 CONCLUSION
|
| 176 |
+
|
| 177 |
+
We introduce a novel graph convolution network to leverage advanced graph structural information, namely, the graph curvature. The curvature information effectively helps to achieve superior performance on synthetic and real-world datasets, especially on large and dense graphs. This shows how principled mathematics and theory help the deployment of deep learning and encourages us to continue the endeavor in bridging the gap between graph theoretical foundation and neural networks.
|
| 178 |
+
|
| 179 |
+
Acknowledgement. Liu and Gao would like to acknowledge supports from NSF CNS-1618391, DMS-1737812, OAC-1939459. Ye and Chen’s research was partially supported by NSF IIS-1909038, IIS-1855759, CCF-1855760.
|
| 180 |
+
|
| 181 |
+
REFERENCES
|
| 182 |
+
|
| 183 |
+
Jason Altschuler, Jonathan Weed, and Philippe Rigollet. Near-linear time approximation algorithms for optimal transport via sinkhorn iteration. In Advances in Neural Information Processing Systems, pp. 1964–1974, 2017.
|
| 184 |
+
|
| 185 |
+
Anca-Iuliana Bonciocat. A rough curvature-dimension condition for metric measure spaces. Open Mathematics, 12(2):362–380, 2014.
|
| 186 |
+
|
| 187 |
+
Anca-Iuliana Bonciocat and Karl-Theodor Sturm. Mass transportation and rough curvature bounds for discrete spaces. Journal of Functional Analysis, 256(9):2944–2966, 2009.
|
| 188 |
+
|
| 189 |
+
Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
|
| 190 |
+
|
| 191 |
+
Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in neural information processing systems, pp. 2292–2300, 2013.
|
| 192 |
+
|
| 193 |
+
Aurelien Decelle, Florent Krzakala, Cristopher Moore, and Lenka Zdeborová. Asymptotic analysis of the stochastic block model for modular networks and its algorithmic applications. Physical Review E, 84(6):066106, 2011.
|
| 194 |
+
|
| 195 |
+
Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in neural information processing systems, pp. 3844–3852, 2016.
|
| 196 |
+
|
| 197 |
+
Robin Forman. Bochner’s method for cell complexes and combinatorial ricci curvature. Discrete and Computational Geometry, 29(3):323–374, 2003.
|
| 198 |
+
|
| 199 |
+
Paolo Frasconi, Marco Gori, and Alessandro Sperduti. A general framework for adaptive processing of data structures. IEEE transactions on Neural Networks, 9(5):768–786, 1998.
|
| 200 |
+
|
| 201 |
+
Hongyang Gao and Shuiwang Ji. Graph u-nets. In International Conference on Machine Learning, pp. 2083–2092, 2019.
|
| 202 |
+
|
| 203 |
+
Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005.
|
| 204 |
+
|
| 205 |
+
Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pp. 1024–1034, 2017.
|
| 206 |
+
|
| 207 |
+
Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163, 2015.
|
| 208 |
+
|
| 209 |
+
Paul W Holland, Kathryn Blackmond Laskey, and Samuel Leinhardt. Stochastic blockmodels: First steps. Social networks, 5(2):109–137, 1983.
|
| 210 |
+
|
| 211 |
+
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
|
| 212 |
+
|
| 213 |
+
Jon M Kleinberg. Navigation in a small world. Nature, 406(6798):845, 2000.
|
| 214 |
+
|
| 215 |
+
Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
|
| 216 |
+
|
| 217 |
+
Yong Lin, Linyuan Lu, and Shing-Tung Yau. Ricci curvature of graphs. Tohoku Mathematical Journal, Second Series, 63(4):605–627, 2011.
|
| 218 |
+
|
| 219 |
+
John Lott and Cédric Villani. Ricci curvature for metric-measure spaces via optimal transport. Annals of Mathematics, pp. 903–991, 2009.
|
| 220 |
+
|
| 221 |
+
Julian McAuley, Christopher Targett, Qinfeng Shi, and Anton Van Den Hengel. Image-based recommendations on styles and substitutes. In Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 43–52. ACM, 2015.
|
| 222 |
+
|
| 223 |
+
Federico Monti, Davide Boscaini, Jonathan Masci, Emanuele Rodola, Jan Svoboda, and Michael M Bronstein. Geometric deep learning on graphs and manifolds using mixture model cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5115–5124, 2017.
|
| 224 |
+
|
| 225 |
+
Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4602–4609, 2019.
|
| 226 |
+
|
| 227 |
+
Mark EJ Newman and Duncan J Watts. Renormalization group analysis of the small-world network model. Physics Letters A, 263(4-6):341–346, 1999.
|
| 228 |
+
|
| 229 |
+
Chien-Chun Ni, Yu-Yao Lin, Jie Gao, Xianfeng David Gu, and Emil Saucan. Ricci curvature of the internet topology. In 2015 IEEE Conference on Computer Communications (INFOCOM), pp. 2758–2766. IEEE, 2015.
|
| 230 |
+
|
| 231 |
+
Chien-Chun Ni, Yu-Yao Lin, Jie Gao, and Xianfeng Gu. Network alignment by discrete ollivier-ricci flow. In International Symposium on Graph Drawing and Network Visualization, pp. 447–462. Springer, 2018.
|
| 232 |
+
|
| 233 |
+
Chien-Chun Ni, Yu-Yao Lin, Feng Luo, and Jie Gao. Community detection on networks with ricci flow. Scientific Reports, 9(9984), July 2019.
|
| 234 |
+
|
| 235 |
+
Yann Ollivier. Ricci curvature of markov chains on metric spaces. Journal of Functional Analysis, 256(3):810–864, 2009.
|
| 236 |
+
|
| 237 |
+
Romeil Sandhu, Tryphon Georgiou, Ed Reznik, Liangjia Zhu, Ivan Kolesov, Yasin Senbabaoglu, and Allen Tannenbaum. Graph curvature for differentiating cancer networks. Scientific reports, 5(1): 1–13, 2015.
|
| 238 |
+
|
| 239 |
+
Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
|
| 240 |
+
|
| 241 |
+
Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
|
| 242 |
+
|
| 243 |
+
Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Günnemann. Pitfalls of graph neural network evaluation. arXiv preprint arXiv:1811.05868, 2018.
|
| 244 |
+
|
| 245 |
+
Jayson Sia, Edmond Jonckheere, and Paul Bogdan. Ollivier-ricci curvature-based method to community detection in complex networks. Scientific reports, 9(1):1–12, 2019.
|
| 246 |
+
|
| 247 |
+
Alessandro Sperduti and Antonina Starita. Supervised neural networks for the classification of structures. IEEE Transactions on Neural Networks, 8(3):714–735, 1997.
|
| 248 |
+
|
| 249 |
+
Karl-Theodor Sturm et al. On the geometry of metric measure spaces. Acta mathematica, 196(1): 65–131, 2006.
|
| 250 |
+
|
| 251 |
+
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
|
| 252 |
+
|
| 253 |
+
Duncan J Watts and Steven H Strogatz. Collective dynamics of ‘small-world’networks. nature, 393 (6684):440, 1998.
|
| 254 |
+
|
| 255 |
+
Melanie Weber, Jürgen Jost, and Emil Saucan. Forman-ricci flow for change detection in large dynamic data sets. Axioms, 5(4):26, 2016.
|
| 256 |
+
|
| 257 |
+
Melanie Weber, Emil Saucan, and Jürgen Jost. Characterizing complex networks with forman-ricci curvature and associated geometric flows. Journal of Complex Networks, 5(4):527–550, 2017.
|
| 258 |
+
|
| 259 |
+
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
|
| 260 |
+
|
| 261 |
+
Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, Will Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In Advances in Neural Information Processing Systems, pp. 4800–4810, 2018.
|
| 262 |
+
|
| 263 |
+
# A APPENDIX
|
| 264 |
+
|
| 265 |
+
# A.1 THE DETAILS OF CURVATURE TRANSFORMATION
|
| 266 |
+
|
| 267 |
+
We describe the details of ${ \mathrm { M L P } } ^ { t }$ for the $t { \cdot }$ -th convolutional layer, which maps the curvature $\kappa _ { x y }$ of the edge to the weight vector $\mathcal { T } _ { x y } ^ { t } \in \mathbb { R } ^ { F ^ { t + 1 } }$ . ${ \mathrm { M L P } } ^ { t }$ has three layers: an input layer, followed by a non-linear transformation layer and an output layer. The input layer $\mathbf { I n }$ linearly transforms the Ricci curvature $\kappa _ { x y }$ into an output vector with the same size as the message $M _ { y x } ^ { t } \in \mathbb { R } ^ { F ^ { t + 1 } }$ . We use LeakyReLU function in our non-linear layer. For output layer Out, we use a transformation matrix with size $F ^ { t + 1 } \times F ^ { t + 1 }$ to compute reweighing vector $\mathcal { T } _ { x y } ^ { t }$ . Formally,
|
| 268 |
+
|
| 269 |
+
$$
|
| 270 |
+
\mathbf { M L P } ^ { t } = \mathbf { O u t } ( \mathbf { L e a k y R e L U } ( \mathbf { I n } ) )
|
| 271 |
+
$$
|
| 272 |
+
|
| 273 |
+
Recall a node also passes a message to itself. To generate the weight vector $\mathcal { T } _ { x y } ^ { t }$ , we set $\kappa _ { x x } = 0$ , as if the edge $( x , x )$ is a grid edge. For the case when we reweigh the message using a single scalar $\tau _ { x y }$ (e.g., CurvGN-1 network), we change the size of transformation matrix of output layer into $F ^ { t + 1 } \times 1$
|
| 274 |
+
|
| 275 |
+
# A.2 DIFFERENT NETWORK MODELS FOR SYNTHETIC EXPERIMENTS
|
| 276 |
+
|
| 277 |
+
All three models, Watts-Strogatz, Newman-Watts and Kleinberg’s model, are created by randomly modifying/adding edges to a ring graph.1 A ring graph has $n$ nodes embedded on a circle, with each node connected to its $k$ nearest neighbors. Figure 5a is an example ring graph with $n = 2 0$ and $k = 4$ . To create communities, we partition the nodes into 5 equal-size sets according to their locations on the circle. In addition, we remove the edges cross different communities. Next we explain how edges of the ring graph are randomly changed for Watts-Strogatz, Newman-Watts and Kleinberg’s model, respectively.
|
| 278 |
+
|
| 279 |
+
Watts-Strogatz Network. Watts-Strogatz Network (Watts & Strogatz, 1998) is created by randomly rewiring edges of the ring graph with a predefined probability, $p$ . See Figure 5b for an example of Watts-Strogatz network.
|
| 280 |
+
|
| 281 |
+
In our experiments, we generate 100 random Watts-Strogatz graphs of size $n = 1 0 0 0$ using different parameter combinations of $k$ and $p$ : $k \in \{ 5 , 1 0 , \cdots , 5 0 \}$ and $p \in \{ 0 . 0 2 , 0 . 0 4 , \cdot \cdot \cdot , 0 . 2 \}$ . For each graph, the 5 communities correspond to nodes with 5 different labels. We randomly generate a 10-dimensional feature for each node, as in Stochastic Block Model experiments. The training set is created by randomly sampling 400 nodes in one graph. The validation set and testing set are create in the same way with size 400 and 200, respectively. For each graph, we run the experiment 10 times with 200 epochs each time and report the average.
|
| 282 |
+
|
| 283 |
+
Figure 6a shows the results of all five methods (GCN, GAT, Vanilla GN, CurvGN-1 and CurvGN-n). We observe that CurvGN-n has the best performance compared with others. It suggests that edge curvature information is crucial in prediction: a rewired edge has a high probability to be a bridge with negative curvature. Curvature information can effectively distinguish bridges and intra-community edges, and therefore help graph convolution. It is also worth mentioning that GCN also has good performance. We hypothesize that this is because rewired edges (likely bridges) tend to have higher degrees on adjacent nodes, and thus can be distinguished using degree information alone.
|
| 284 |
+
|
| 285 |
+
Newman-Watts Network. The Newman-Watts network (Newman & Watts, 1999) is similar to the Watts-Strogatz model except that it adds random edges on the ring graph with probability $p$ , instead of rewiring existing edges. We run the experiments in the same setting as Watts-Strogatz model. The results are shown in Figure 6b. We observe similar effects as Watts-Strogatz model.
|
| 286 |
+
|
| 287 |
+
Kleinberg’s Navigable Small World Graph. Instead of randomly generating edges with a fixed probability $p$ , Kleinberg’s model (Kleinberg, 2000) adds a fixed number of additional long-range edges to the ring graph. For each node $u$ , add $e _ { l }$ random edges $( u , v )$ with $v$ picked with a probability proportional to $\bar { 1 } / d ( \bar { u } , v )$ , in which $d ( u , v )$ is the distance between $u$ and $v$ in the circle.2 We slightly modify the original definition by making all edges undirected and removing self-loops. Figure 5c shows an example graph of Kleinberg’s model with 100 nodes. We observe much fewer long range (cross-community) connections and more intra-community connections than the other models.
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
|
| 291 |
+
(a) An example ring graph with $n = 2 0$ , $k = 4$ (b) An example Watts-Strogatz graph with 100 nodes.
|
| 292 |
+
|
| 293 |
+

|
| 294 |
+
|
| 295 |
+

|
| 296 |
+
Figure 5: Visualization of theoretical graph models
|
| 297 |
+
|
| 298 |
+
(c) An example Kleinberg’s graph with 100 nodes.
|
| 299 |
+
|
| 300 |
+
We generate 100 different graphs using different combinations of parameters $e _ { s }$ and $e _ { l }$ . Here $e _ { s } \in \{ \mathtt { f l o o r } ( 2 . 5 ) , \mathtt { f l o o r } ( 5 ) , \cdot \cdot \cdot \mathtt { f l o o r } ( 2 5 ) \}$ controls the distance upperbound for short-range neighbors; any nodes within distance $e _ { s }$ of $x$ is connected with $x$ . $e _ { s }$ is very similar to $k$ in Wattz-Strogatz graph. Similar to previous models, we run experiments on each graph 10 times and use the validation set for early stopping.
|
| 301 |
+
|
| 302 |
+
Since the edge is added with a probability proportional to $1 / d ( u , v )$ , there can be long distance intercommunity edges. And the node degree can no longer capture the structural information introduced by the added edges. The GCN behaves similar to random guessing in this case. However, the Ricci Curvature is still negative on those inter community edges and it can still detect communities. Figure 6c shows the heatmaps of five different algorithms. CurvGN-n outperforms other methods by a large margin.
|
| 303 |
+
|
| 304 |
+

|
| 305 |
+
Figure 6: Results on different theoretical graph models.
|
| 306 |
+
|
| 307 |
+
Table 3: Statistics of graph datasets including graph characteristics, training details and time for curvature computation. "\*" indicates the usage of approximation method.
|
| 308 |
+
|
| 309 |
+
<table><tr><td></td><td>Cora</td><td>CiteSeer</td><td>PubMed</td><td>Coauthor CS</td><td>Coauthor Physics</td><td>Amazon Computer</td><td>Amazon Photo</td></tr><tr><td>#Node</td><td>2708</td><td>3327</td><td>19717</td><td>18333</td><td>34493</td><td>13381</td><td>7487</td></tr><tr><td>#Edge</td><td>5429</td><td>4732</td><td>44338</td><td>100227</td><td>282455</td><td>259159</td><td>126530</td></tr><tr><td>#Edge/#Node</td><td>2.0</td><td>1.42</td><td>2.25</td><td>5.47</td><td>8.19</td><td>19.37</td><td>16.90</td></tr><tr><td>#Class</td><td>7</td><td>6</td><td>3</td><td>15</td><td>5</td><td>10</td><td>8</td></tr><tr><td>#Feature</td><td>1433</td><td>3703</td><td>500</td><td>6805</td><td>8415</td><td>767</td><td>745</td></tr><tr><td>#Training</td><td>140</td><td>120</td><td>60</td><td>300</td><td>100</td><td>200</td><td>160</td></tr><tr><td>Curvature Comp. Time(s)</td><td>2.38</td><td>2.04</td><td>28.8</td><td>49.5</td><td>215.2</td><td>1873.5*</td><td>1237.6</td></tr></table>
|
| 310 |
+
|
| 311 |
+
# A.3 STATISTICAL DETAIL OF BENCHMARKS
|
| 312 |
+
|
| 313 |
+
We describe the statistical details of all datasets in Table 3. Cora and Citeseer are considered as small and sparse graphs while PubMed, Coauthors and Amazons are considered as large and dense graphs.
|
| 314 |
+
|
| 315 |
+
# A.4 COMPLEXITY OF CURVATURE COMPUTATION
|
| 316 |
+
|
| 317 |
+
Exactly calculating the curvatures is somewhat time-consuming. We need to solve a linear programming (LP) problem for each edge. For an edge $( x , y )$ , the LP problem has $d _ { x } \times d _ { y }$ variables and $d _ { x } + d _ { y }$ linear constraints, in which $d _ { x }$ and $d _ { y }$ are the degrees of the nodes $x$ and $y$ . Take the interior point solver (ECOS) as an example, the complexity is $\hat { O ( ( d _ { x } \times d _ { y } ) ^ { w } ) }$ , in which $w$ is the exponent of the complexity of matrix multiplication (the best known is 2.373).
|
| 318 |
+
|
| 319 |
+
However, in practice, there are many approximation methods to accelerate the computation of optimal transport distance, among which the best known is the Sinkhorn’s algorithm (Cuturi, 2013). It is known to have near-linear time complexity (Altschuler et al., 2017). So for small datasets we can keep using the ECOS to get exact solution while for large datasets (e.g. Computers) we may use advanced approximation methods. In Table 3, we show the computation time for the curvatures with two 18-core CPUs. Note that this computation is only needed once for data pre-processing, and the values can be reused in various downstream tasks.
|
| 320 |
+
|
| 321 |
+
# A.5 NECESSITY OF CURVATURE TRANSFORMATION
|
| 322 |
+
|
| 323 |
+
The usage of multi-channel ${ \mathrm { M L P } } ^ { t }$ is essential in the success of using the curvature information. To illustrate this, in Table 4, we report the performance of our model if we directly use the curvature to weigh messages, i.e., $\tau _ { x y } = \kappa _ { x y }$ for all layers. We call this baseline CurvGN- $\kappa$ .
|
| 324 |
+
|
| 325 |
+
Table 4: Performance on real-world benchmarks using curvature $\kappa _ { x y }$ directly to weigh messages.
|
| 326 |
+
|
| 327 |
+
<table><tr><td>Method</td><td>Cora</td><td>CiteSeer</td><td>PubMed</td><td>Coauthor CS</td><td>Coauthor Physics</td><td>Amazon Computer</td><td>Amazon Photo</td></tr><tr><td>CurvGN-κ</td><td>29.8</td><td>52.7</td><td>71.2</td><td>69.6</td><td>87.3</td><td>45.8</td><td>70.2</td></tr></table>
|
| 328 |
+
|
| 329 |
+
We observe that curvature alone cannot provide the best reweighing scheme for graph convolution. Only learning from the data helps us determine how weights on different channels should be dependent on $\kappa$ . We observe weights of different channels are changing very differently w.r.t. $\kappa _ { x y }$ ; some are increasing w.r.t. $\kappa _ { x y }$ , others are decreasing. $\mathrm { M L P } ^ { t }$ is necessary in learning such dependence from data. Using ${ \mathrm { M L P } } ^ { t }$ enhances the model flexibility and model capacity. But also note that curvature $\kappa _ { x y }$ is the essential input that the ${ \mathrm { M L P } } ^ { t }$ relies on.
|
md/train/D9I3drBz4UC/D9I3drBz4UC.md
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LONG-TAILED RECOGNITION BYROUTING DIVERSE DISTRIBUTION-AWARE EXPERTS
|
| 2 |
+
|
| 3 |
+
Xudong Wang1, Long Lian1, Zhongqi Miao1, Ziwei Liu2, Stella X. $\mathbf { Y u } ^ { 1 }$
|
| 4 |
+
|
| 5 |
+
1UC Berkeley / ICSI, 2Nanyang Technological University {xdwang,longlian,zhongqi.miao,stellayu}@berkeley.edu ziwei.liu@ntu.edu.sg
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Natural data are often long-tail distributed over semantic classes. Existing recognition methods tackle this imbalanced classification by placing more emphasis on the tail data, through class re-balancing/re-weighting or ensembling over different data groups, resulting in increased tail accuracies but reduced head accuracies.
|
| 10 |
+
|
| 11 |
+
We take a dynamic view of the training data and provide a principled model bias and variance analysis as the training data fluctuates: Existing long-tail classifiers invariably increase the model variance and the head-tail model bias gap remains large, due to more and larger confusion with hard negatives for the tail.
|
| 12 |
+
|
| 13 |
+
We propose a new long-tailed classifier called RoutIng Diverse Experts (RIDE). It reduces the model variance with multiple experts, reduces the model bias with a distribution-aware diversity loss, reduces the computational cost with a dynamic expert routing module. RIDE outperforms the state-of-the-art by $5 \%$ to $7 \%$ on CIFAR100-LT, ImageNet-LT and iNaturalist 2018 benchmarks. It is also a universal framework that is applicable to various backbone networks, long-tailed algorithms, and training mechanisms for consistent performance gains. Our code is available at: https://github.com/frank-xwang/RIDE-LongTailRecognition.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Real-world data are often long-tail distributed over semantic classes: A few classes contain many instances, whereas most classes contain only a few instances. Long-tailed recognition is challenging, as it needs to handle not only a multitude of small-data learning problems on the tail classes, but also extreme imbalanced classification over all the classes.
|
| 18 |
+
|
| 19 |
+
There are two ways to prevent the many head instances from overwhelming the few tail instances in the classifier training objective: 1) class re-balancing/re-weighting which gives more importance to tail instances (Cao et al., 2019; Kang et al., 2020; Liu et al., 2019), 2) ensembling over different data distributions which re-organizes long-tailed data into groups, trains a model per group, and then combines individual models in a multi-expert framework (Zhou et al., 2020; Xiang et al., 2020).
|
| 20 |
+
|
| 21 |
+
We compare three state-of-the-art (SOTA) long-tail classifiers against the standard cross-entropy (CE) classifier: cRT and $\tau$ -norm (Kang et al., 2020) which adopt a two-stage optimization, first representation learning and then classification learning, and LDAM (Cao et al., 2019), which is trained end-to-end with a marginal loss. In terms of the classification accuracy, a common metric for model selection on a fixed training set, Fig. 1a shows that, all these existing long-tail methods increase the overall, medium- and few-shot accuracies over CE, but decrease the many-shot accuracy.
|
| 22 |
+
|
| 23 |
+
These intuitive solutions and their experimental results seem to suggest that there is a head-tail performance trade-off in long-tailed recognition. We need a principled performance analysis approach that could shed light on such a limitation if it exists and provide guidance on how to overcome it.
|
| 24 |
+
|
| 25 |
+
Our insight comes from a dynamic view of the training set: It is merely a sample set of some underlying data distribution. Instead of evaluating how a long-tailed classifier performs on the fixed training set, we evaluate how it performs as the training set fluctuates according to the data distribution.
|
| 26 |
+
|
| 27 |
+
<table><tr><td rowspan="2"></td><td colspan="3">All</td><td colspan="3">Many-shot</td><td colspan="3">Med-shot</td><td colspan="3">Few-shot</td></tr><tr><td>acc</td><td>bias</td><td>var</td><td>acc</td><td>bias</td><td>var</td><td>acc</td><td>bias</td><td>var</td><td>acc</td><td>bias</td><td>var</td></tr><tr><td>CE</td><td>31.6</td><td>0.60</td><td>0.47</td><td>57.3</td><td>0.28</td><td>0.35</td><td>28.2</td><td>0.61</td><td>0.51</td><td>6.3</td><td>0.94</td><td>0.57</td></tr><tr><td>T-norm</td><td>35.8</td><td>0.52</td><td>0.49</td><td>55.9</td><td>0.28</td><td>0.37</td><td>33.2</td><td>0.53</td><td>0.52</td><td>16.1</td><td>0.78</td><td>0.60</td></tr><tr><td>cRT</td><td>36.4</td><td>0.50</td><td>0.50</td><td>51.3</td><td>0.32</td><td>0.41</td><td>38.6</td><td>0.44</td><td>0.50</td><td>17.0</td><td>0.76</td><td>0.61</td></tr><tr><td>LDAM</td><td>34.4</td><td>0.53</td><td>0.51</td><td>55.1</td><td>0.28</td><td>0.38</td><td>31.9</td><td>0.53</td><td>0.54</td><td>13.9</td><td>0.81</td><td>0.63</td></tr><tr><td>RIDE + LDAM</td><td>40.5</td><td>0.50</td><td>0.42</td><td>60.5</td><td>0.28</td><td>0.30</td><td>38.7</td><td>0.50</td><td>0.44</td><td>20.1</td><td>0.74</td><td>0.52</td></tr></table>
|
| 28 |
+
|
| 29 |
+
(a) Comparisons of the mean accuracy, per-class bias and variance of baselines and our RIDE method. Better (worse) metrics than the distribution-unaware cross entropy (CE) reference are marked in green (red).
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
(b) Histograms of the largest softmax score of the other classes (the hardest negative) per instance.
|
| 33 |
+
Figure 1: Our method RIDE outperforms SOTA by reducing both model bias and variance. a) These metrics are evaluated over 20 independently trained models, each on a random sampled set of CIFAR100 with an imbalance ratio of 100 and 300 samples for class 0. Compared to the standard head performance loss from increased classifier variance. The low tail perfor-CE classifier, existing SOTA methods almost always increase the variance and some reduce the tail mance manifests itself in large between-class confusion and high classifier vari-bias at the cost of increasing the head bias. b) The metrics are evaluated over CIFAR100-LT Liu ance. We aim to reduce both the bias and the variance of a long-tailed classifieret al. (2019). LDAM is more likely to confuse the tail (rather than head) classes with the hardest by RoutIng Diverse Experts (RIDE). It has three components: 1) a shared archi-negative class, with an average score of 0.59. RIDE with LDAM can greatly reduce the confusion tecture for multiple classifiers (experts); 2) a distribution-aware diversity loss thatwith the nearest negative class, especially for samples from the few-shot categories.
|
| 34 |
+
|
| 35 |
+
to additional expertConsider the training data $D$ With on-par computational complexity, RIDE significantlyas a random variable. The prediction error of model $h$ on instance $x$ outwith output $Y$ forms the state-of-the-art methodvaries with the realization of $D$ y 5% to 7% on all the benchmarks in-. The expected variance with respect to variable $D$ cluding CIFAR100-LT, ImageNet-LT andhas a well-known bias-variance decomposition:
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
\operatorname { E r r o r } ( x ; h ) = E [ ( h ( x ; D ) - Y ) ^ { 2 } ] = \operatorname { B i a s } ( x ; h ) + \operatorname { V a r i a n c e } ( x ; h ) + { \mathrm { i r r e d u c i b l e ~ e r r o r } } ( x ) .
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
For the above L2 loss on regression $h ( x ) Y$ , the model bias measures the accuracy of the prediction with respect to the true value, the variance measures the stability of the prediction, and the irreducible error measures the precision of the prediction and is irrelevant to the model $h$ .
|
| 42 |
+
|
| 43 |
+
Empirically, for $n$ random sample sets of data, $D ^ { ( 1 ) } , \ldots , D ^ { ( n ) }$ , the $k$ -th model trained on $D ^ { ( k ) }$ The natupredicts $y ^ { ( k ) }$ ata we encou on instance $x$ er in practice often has a long tail distribution: A, and collectively they have a mean prediction $y _ { m }$ classes contain. For the L2 regression many instances, while most classes contain only a feloss, the model bias is simply the L2 loss between $y _ { m }$ stances. Learningand ground-truth $t = E [ Y ]$ ation among, whereas the model them is challenging, as the fvariance is the variance of $y ^ { ( k ) }$ il instances can be easily overwith respect to their mean $y _ { m }$ l:
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\begin{array} { r l } { \displaystyle \mathcal { L } ( y ; z ) = ( y - z ) ^ { 2 } } \\ { \displaystyle y _ { m } = \frac { 1 } { n } \sum _ { k = 1 } ^ { n } y ^ { ( k ) } } & { ~ = \mathrm { a r g } \operatorname* { m i n } _ { z } E _ { D } [ \mathcal { L } \left( h ( x ) ; z ) \right] } \\ { \displaystyle \mathrm { B i a s } ( x ; h ) = ( y _ { m } - t ) ^ { 2 } } & { ~ = \mathcal { L } \left( y _ { m } ; t \right) } \\ { \displaystyle \mathrm { V a r i a n c e } ( x ; h ) = \frac { 1 } { n } \sum _ { k = 1 } ^ { n } \left( y ^ { ( k ) } - y _ { m } \right) ^ { 2 } } & { ~ = E _ { D } [ \mathcal { L } \left( h ( x ) ; y _ { m } \right) ] . } \end{array}
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
We analyze the performance of a long-tail classifier in terms of bias and variance with respectAs shown on the above right, these concepts can be expressed entirely in terms of L2 loss $\mathcal { L }$ . We can fluctuations in the training set: We randomly sample CIFAR100 (Krizhevthus extended them to classification (Domingos, 2000) by replacing $\mathcal { L }$ y, 200 with $\mathcal { L } _ { 0 - 1 }$ cording to afor classification:
|
| 50 |
+
|
| 51 |
+
The mean prediction $y _ { m }$ minimizes $\begin{array} { r } { \sum _ { k = 1 } ^ { n } \mathcal { L } _ { 0 - 1 } \left( y ^ { ( k ) } ; y _ { m } \right) } \end{array}$ and becomes the most often or main prediction. The bias and variance terms become $\mathcal { L } _ { 0 - 1 } ( y _ { m } ; t )$ and $\begin{array} { r } { \frac { 1 } { n } \sum _ { k = 1 } ^ { n } \mathcal { L } _ { 0 - 1 } ( y ^ { ( k ) } ; y _ { m } ) } \end{array}$ respectively.
|
| 52 |
+
|
| 53 |
+
We apply such bias and variance analysis to the CE and long-tail classifiers. We sample CIFAR100 (Krizhevsky, 2009) according to a long-tail distribution multiple times. For each method, we train a model per long-tail sampled dataset and then estimate the per-class bias and variance over these multiple models on the balanced test set of CIFAR100-LT Liu et al. (2019). Fig. 1a shows that:
|
| 54 |
+
|
| 55 |
+
1. On the model bias: The head bias is significantly smaller than the tail bias, at 0.3 vs. 0.9 for CE. All the existing long-tail methods reduce the overall bias by primarily reducing the tail bias. However, the head-tail bias gap remains large at 0.3 vs. 0.8.
|
| 56 |
+
2. On the model variance: All the existing long-tail methods increase the model variance across all class splits, with a slight reduction in the medium-shot variance for cRT.
|
| 57 |
+
|
| 58 |
+
That is, existing long-tail methods reduce the model bias for the tail at the cost of increased model variance for all the classes, and the head-tail model bias gap remains large.
|
| 59 |
+
|
| 60 |
+
We conduct further statistical analysis to understand the head-tail model bias gap. We examine the largest softmax score in the other classes of $\{ c : c \neq t \}$ , where $t$ is the ground-truth class of an instance. The smaller this hardest negative score is, the less the confusion, and the lower the model bias. Fig. 1b shows that there is increasingly more and larger confusion from the head to the tail.
|
| 61 |
+
|
| 62 |
+
Guided by our model bias/variance and confusion pattern analysis, we propose a new long-tail classifier with four distinctive features: 1) It reduces the model variance for all the classes with multiple experts. 2) It reduces the model bias for the tail with an additional distribution-aware diversity loss. 3) It reduces the computational complexity that comes with multiple experts with a dynamic expert routing module which deploys another trained distinctive expert for a second (or third, ...) opinion only when it is called for. 4) The routing module and a shared architecture for experts of reduced complexity effectively cut down the computational cost of our multi-expert model, to a level that could be even lower than the commonly adopted baseline with the same backbone.
|
| 63 |
+
|
| 64 |
+
Our so-called RoutIng Diverse Experts (RIDE) not only reduces the model variance for all the classes, but also significantly reduces the model bias for the tail classes and increases the mean accuracies for all class splits, all of which existing long-tail methods fail to accomplish.
|
| 65 |
+
|
| 66 |
+
RIDE delivers $5 \% \sim 7 \%$ higher accuracies than the current SOTA methods on CIFAR100-LT, ImageNet-LT (Liu et al., 2019) and iNaturalist (Van Horn et al., 2018). RIDE is also a universal framework that can be applied to different backbone networks for improving existing long-tail algorithms such as focal loss (Lin et al., 2017), LDAM (Cao et al., 2019), $\tau$ -norm (Kang et al., 2020).
|
| 67 |
+
|
| 68 |
+
# 2 RELATED WORKS
|
| 69 |
+
|
| 70 |
+
Few-shot learning. To generalize from small training data, meta-learning (Bertinetto et al., 2016; Ravi & Larochelle, 2017; Santoro et al., 2016; Finn et al., 2017; Yang et al., 2018) and data augmentation/generation are two most studied approaches (Chen et al., 2019; Schwartz et al., 2018; Zhang et al., 2019; Liu et al., 2018). Matching Network (Vinyals et al., 2016) and Prototypical Network (Snell et al., 2017) learn discriminative features that can be transferred to new classes through meta-learners without big training data. Hariharan & Girshick (2017), Wang et al. (2018) and Liu et al. (2018) utilize samples from a generative model to augment the training data. However, fewshot learning relies on balanced training data, whereas long-tail recognition has to deal with highly imbalanced training data, e.g., from hundreds in the head to a few instances in the tail.
|
| 71 |
+
|
| 72 |
+
Re-balancing/re-weighting. A direct approach to achieve sample balance is to under- or oversample training instances according to their class sizes (He & Garcia, 2009). Another option is data augmentation, where additional samples are generated to supplement tail classes, sometimes directly in the feature space (Liu et al., 2020; Chu et al., 2020; Kim et al., 2020). Re-weighting modifies the loss function and puts larger weights on tail classes (Lin et al., 2017; Cui et al., 2019; Cao et al., 2019; Wu et al., 2020) or randomly ignoring gradients from head classes (Tan et al., 2020). However, both sample-wise and loss-wise balancing focus on tail classes, resulting in more sensitivity to fluctuations in the small tail classes and thus much increased model variances (Fig. 1a).
|
| 73 |
+
|
| 74 |
+
Knowledge transfer. OLTR (Liu et al., 2019) and inflated memory (Zhu & Yang, 2020) use memory banks to store and transfer mid- and high-level features from head to tail classes, enhancing feature generalization for the tail. However, this line of work (Liu et al., 2019; Zhu & Yang, 2020; Kang et al., 2020; Jamal et al., 2020; Wang et al., 2017) usually does not have effective control over the knowledge transfer process, often resulting in head performance loss.
|
| 75 |
+
|
| 76 |
+
Ensembling and grouping. One way to counter imbalance is to separate training instances into different groups based their class sizes. Models trained on individual groups are ensembled together in a multi-expert framework. BBN (Zhou et al., 2020) adaptively fuses two-branches that each focus on the head and the tail respectively. LFME (Xiang et al., 2020) distills multiple teacher models into a unified model, each teacher focusing on a relatively balanced group such as many-shot classes, medium-shot classes, and few-shot classes. BBN and LFME still lose head performance and overall generalizability, as no expert has a balanced access to the entire dataset.
|
| 77 |
+
|
| 78 |
+
Our RIDE is a non-traditional ensemble method. 1) Its experts have shared earlier layers and reduced later channels, less prone to small tail overfitting. 2) Its experts are jointly optimized. 3) It deploys experts on an as-needed basis for individual instances with a dynamic expert assignment module. 4) It reaches higher accuracies with a smaller model complexity and computational cost.
|
| 79 |
+
|
| 80 |
+
# 3 RIDE: ROUTING DIVERSE DISTRIBUTION-AWARE EXPERTS
|
| 81 |
+
|
| 82 |
+
We propose a novel multi-expert model (Fig. 2) with shared earlier layers $f _ { \theta }$ and $n$ independent channel-reduced later layers $\Psi = \{ \psi _ { \theta _ { 1 } } , . . . , \psi _ { \theta _ { n } } \}$ . They are jointly optimized at Stage 1 and dynamically deployed with a learned expert assignment module at Stage 2. At the inference time, all the $m$ active experts are averaged together in their logits for final ensemble softmax classification:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\mathbf { p } = \mathrm { s o f t m a x } \left( \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \psi _ { \theta _ { i } } \left( f _ { \theta } ( x ) \right) \right) .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Softmax of the average logits is equivalent to the product of individual classification probabilities, which approximates their joint probability if individual experts makes independent decisions.
|
| 89 |
+
|
| 90 |
+
Experts with a shared early backbone and reduced later channels. Consider $n$ independent experts of the same convolutional neural network (CNN) architecture. Since early layers of a CNN tend to encode generic low-level features, we adopt the common practice in transfer learning and have all the $n$ experts share the same backbone $f _ { \theta }$ . Each expert retains independent later layers $\psi _ { \boldsymbol { \theta } _ { i } }$ , $i = 1 , \ldots , n$ . To reduce overfitting to small training data in the tail classes, we reduce the number of filter channels in $\psi _ { \theta _ { i } }$ , e.g., by $1 / 4$ . All these $n$ experts are trained together on long-tailed data distribution-aware diversity loss $\mathcal { L } _ { \mathrm { D } }$ -Diversify and classification loss $\mathcal { L } _ { \mathrm { C l a s s i f y } }$ , such as CE and LDAM.
|
| 91 |
+
|
| 92 |
+
Individual expert classification loss. One way to combine multiple experts is to apply the classification loss to the aggregated logits of individual experts. While this idea works for several recently proposed multi-expert models (Zhou et al., 2020; Xiang et al., 2020), it does not work for our shared experts: Its performance is on-par with an equal-sized single-expert model. Let $\mathcal { L }$ denote the classification loss (e.g. CE) over instance $x$ and its label $y$ . We call such an aggregation loss collaborative:
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 2: RIDE learns experts and their router in two stages. a) We first jointly optimize multiple experts with individual classification losses and mutual distribution-aware diversity losses. b) We then train a router that dynamically assigns ambiguous samples to additional experts on an as-needed basis. The distribution of instances seen by each expert shows that head instances need fewer experts and the imbalance between classes gets reduced for later experts. At the test time, we collect the logits of assigned experts to make a final decision. c) RIDE outperforms SOTA methods (i.e. LFME (Xiang et al., 2020) for CIFAR100-LT, LWS (Kang et al., 2020) for ImageNet-LT and BBN (Zhou et al., 2020) for iNaturalist) on all the benchmarks.
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\mathcal { L } ^ { \mathrm { c o l l a b o r a t i v e } } ( x , y ) = \mathcal { L } \left( \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \psi _ { \theta _ { i } } \left( f _ { \theta } ( x ) \right) , y \right)
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
as it leads to correlated instead of complementary experts. To discourage correlation, we require each expert to do the job well by itself. Such an aggregation loss is essentially an individual loss, and it contributes a large portion of our performance gain in most of our experiments:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathcal { L } ^ { \mathrm { i n d i v i d u a l } } ( x , y ) = \sum _ { i = 1 } ^ { n } \mathcal { L } \left( \psi _ { \theta _ { i } } \left( f _ { \theta } ( x ) \right) , y \right) .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
Distribution-aware diversity loss. The individual classification loss and random initialization lead to diversified experts with a shared backbone. For long-tailed data, we add a regularization term to encourage complementary decisions from multiple experts. That is, we maximize the KL-divergence between different experts’ classification probabilities on instance $x$ in class $y$ over a total of $c$ classes:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\begin{array} { r l r l } & { \mathrm { d i v e r s i t y ~ l o s s : } \quad } & { \mathcal { L } _ { \mathrm { D - D i v e r s i f y } } ( x , y ; \theta _ { i } ) = \displaystyle \frac { - 1 } { n - 1 } \sum _ { j = 1 , j \neq i } ^ { n } D _ { \mathrm { K L } } \left( \mathbf { p } ^ { ( i ) } ( x , y ) \| \mathbf { p } ^ { ( j ) } ( x , y ) \right) } \\ & { \mathrm { K L ~ d i v e r g e n c e : } \quad } & { D _ { \mathrm { K L } } ( \mathbf { p } \| \mathbf { q } ) = \displaystyle \sum _ { k = 1 } ^ { c } \mathbf { p } _ { k } \log \left( \frac { \mathbf { p } _ { k } } { \mathbf { q } _ { k } } \right) } \\ & { \mathrm { c l a s s i f i c a t i o n ~ b y } \theta _ { i } : \quad } & { \mathbf { p } ^ { ( i ) } ( x , y ) = \mathrm { s o f t m a x } \left( \left[ \frac { \psi _ { \theta _ { i } } ( f _ { \theta } ( x ) ) _ { 1 } } { T _ { 1 } } \quad . . . \quad \frac { \psi _ { \theta _ { i } } ( f _ { \theta } ( x ) ) _ { c } } { T _ { c } } \right] \right) . } \end{array}
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
We vary the temperature $T$ (or concentration) (Hadsell et al., 2006; Wu et al., 2018) applied to class $k$ ’s logit $\psi _ { \boldsymbol { \theta } _ { i } } ( f _ { \boldsymbol { \theta } } ( \boldsymbol { x } ) ) _ { k }$ : For class $k$ with $n _ { k }$ instances, the smaller the $n _ { k }$ , the lower the temperature $T _ { k }$ , the more sensitive the classification probability $\mathbf { p }$ is to a change in the feature $\psi$ . Specifically,
|
| 114 |
+
|
| 115 |
+
class-wise temperature:
|
| 116 |
+
|
| 117 |
+
normalized class size:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\begin{array} { r l } & { T _ { k } = \alpha \left( \beta _ { k } + 1 - \underset { j } { \operatorname* { m a x } } \beta _ { j } \right) } \\ & { \beta _ { k } = \gamma \cdot \frac { n _ { k } } { \frac { 1 } { c } \sum _ { s = 1 } ^ { c } n _ { s } } + ( 1 - \gamma ) . } \end{array}
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
$T$ scales linearly with the class size, ensuring $\beta _ { k } = 1 , T _ { k } = \alpha$ for a balanced set. This simple adaptation allows us to find classifiers of enough complexity for the head and enough robustness for the tail: On one hand, we need strong classifiers to handle large sample variations within head classes; on the other hand, such classifiers are prone to overfit small training data within tail classes. We adapt the temperature only after the CNN network is trained for several epochs and the feature is stabilized, similar to the training scheme for deferred reweighting (Cao et al., 2019).
|
| 124 |
+
|
| 125 |
+
Joint expert optimization. For our $n$ experts $\theta _ { 1 }$ , . . . , $\theta _ { n }$ with a shared backbone $\theta$ , we optimize their individual classification losses ${ \mathcal { L } } _ { \mathrm { C l a s s i f y } } = { \mathcal { L } }$ , any classification loss such as CE, LDAM, and focal loss) and their mutual distribution-aware divergency losses, weighted by hyperparameter $\lambda$ :
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\mathcal { L } _ { \mathrm { T o t a l } } ( x , y ) = \sum _ { i = 1 } ^ { n } \left( \mathcal { L } _ { \mathrm { C l a s s i f y } } ( x , y ; \theta _ { i } ) + \lambda \cdot \mathcal { L } _ { \mathrm { D - D i v e r s i f y } } ( x , y ; \theta _ { i } ) \right) .
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
Since these loss terms are completely symmetrical with respect to each other, the $n$ experts learned at Stage 1 are equally good and distinctive from each other.
|
| 132 |
+
|
| 133 |
+
Routing diversified experts. To cut down the test-time computational cost that comes with multiple experts, we train a router at Stage 2 to deploy these (arbitrarily ordered) experts sequentially on an as-needed basis. Assume that the first $k$ experts have been deployed for instance $x$ . The router takes in the image feature and the mean logits from the first to the $k$ -th expert, and makes a binary decision $y _ { \mathrm { o n } }$ on whether to deploy the $k + 1$ -th expert. If the $k$ -th expert wrongly classifies $x$ , but one of the rest $n - k$ experts correctly classifies $x$ , ideally the router should switch on, i.e., output $y _ { \mathrm { o n } } = 1$ , and otherwise $y _ { \mathrm { o n } } = 0$ . We construct a simple binary classifier with two fully connected layers to learn each router. Each of the $n - 1$ routers for $n$ experts has a shared component to reduce the feature dimensions and an individual component to make decisions.
|
| 134 |
+
|
| 135 |
+
Specifically, we normalize the image feature $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ (for training stability), reduce the feature dimension (to e.g. 16 in our experiments) by a fully connected layer $\mathbf { W } _ { 1 }$ which is shared with all routers, followed by ReLU and flattening, concatenate with the top- $s$ ranked mean logits from the first to $k$ - th expert $\textstyle { \frac { 1 } { k } } \sum _ { i = 1 } ^ { k } \psi _ { \theta _ { i } } ( f _ { \theta } ( x ) )$ , project it to a scalar by $\mathbf { W } _ { 2 } ^ { ( k ) }$ which is independent between routers, and finally apply Sigmoid function $\begin{array} { r } { S ( x ) = \frac { 1 } { 1 + e ^ { - x } } } \end{array}$ to get a continuous activation value in [0,1]:
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
\mathrm { r o u t e r \ a c t i v a t i o n ; } \ r ( x ) = S \left( \mathbf { W } _ { 2 } ^ { ( k ) } \left[ \begin{array} { c } { \mathrm { f a t t e n } \cdot \mathrm { R e L U } \left( \mathbf { W } _ { 1 } \frac { f _ { \theta } ( x ) } { \vert \vert f _ { \theta } ( x ) \vert \vert } \right) } \\ { \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \psi _ { \theta _ { k } } ( f _ { \theta } ( x ) ) \vert _ { \mathrm { t o p } \cdot s \cdot \mathrm { c o m p o n e n t s } } } \end{array} \right] \right) .
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
The router has a negligible size and compute, where $s$ ranges from 30 for CIFAR100 to 50 for iNaturalist (8,142 classes). It is optimized with a weighted variant of binary CE loss:
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\mathcal { L } _ { \mathrm { R o u t i n g } } ( r ( x ) , y _ { \mathrm { o n } } ) = - \omega _ { \mathrm { o n } } y _ { \mathrm { o n } } \log \left( r ( x ) \right) - ( 1 - y _ { \mathrm { o n } } ) \log \left( 1 - r ( x ) \right)
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
where $\omega _ { \mathrm { o n } }$ controls the easiness to switch on the router. We find $\omega _ { \mathrm { o n } } = 1 0 0$ to be a good trade-off between classification accuracy and computational cost for all our experiments. At the test time, we simply threshold the activation with 0.5: If $r ( x ) < 0 . 5$ , the classifier makes the final decision with the current collective logits, otherwise it proceeds to the next expert.
|
| 148 |
+
|
| 149 |
+
Optional self-distillation. While existing long-tail classifiers such as BBN Zhou et al. (2020) and LFME Xiang et al. (2020) have a fixed number of experts, our method could have an arbitrary number of experts to balance classification accuracy and computation cost. We can optionally apply self-distillation from a model with more (6 in our setting) experts to the same model with fewer experts for further performance gain $0 . 4 \% \sim 0 . 8 \%$ for most experiments). We choose knowledge distillation (Hinton et al., 2015) by default. Implementation details and comparisons with various distillation algorithms such as CRD (Tian et al., 2019) are investigated in Appendix Section A.2.
|
| 150 |
+
|
| 151 |
+
# 4 EXPERIMENTS
|
| 152 |
+
|
| 153 |
+
We experiment on major long-tailed recognition benchmarks and various backbone networks.
|
| 154 |
+
|
| 155 |
+
1. CIFAR100-LT (Cao et al., 2019): CIFAR100 is sampled by class per an exponential decay across classes. We choose imbalance factor 100 and ResNet-32 (He et al., 2016) backbone.
|
| 156 |
+
|
| 157 |
+
2. ImageNet-LT (Liu et al., 2019): Multiple backbone networks are experimented on ImageNetLT, including ResNet-10, ResNet-50 and ResNeXt-50 (Xie et al., 2017). All backbone networks are trained with a batch size of 256 on 8 RTX 2080Ti GPUs for 100 epochs using SGD with an initial learning rate of 0.1 decayed by 0.1 at 60 epochs and 80 epochs. See more details and results on other backbones in Appendix.
|
| 158 |
+
|
| 159 |
+
3. iNaturalist 2018 (Van Horn et al., 2018): It is a naturally imbalanced fine-grained dataset with 8,142 categories. We use ResNet-50 as the backbone and apply the same training recipe as for ImageNet-LT except batch size 512, as in (Kang et al., 2020).
|
| 160 |
+
|
| 161 |
+
CIFAR100-LT Results. Table 1 shows that RIDE outperforms SOTA by a large margin on CIFAR100-LT. The average computational cost is even about $10 \%$ less than baseline models with two experts as in BBN. RIDE surpasses multi-expert methods, LFME (Xiang et al., 2020) and BBN (Zhou et al., 2020), by more than $5 . 3 \%$ and $6 . 5 \%$ respectively.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 3: RIDE is a universal framework that can be extended to various long-tail recognition methods and obtain a consistent top-1 accuracy increase. RIDE is experimented on CIFAR100- LT and applied to various training mechanisms. By using RIDE, cross-entropy loss (without any re-balancing strategies) can even outperforms previous SOTA method on CIFAR100-LT. Although higher accuracy can be obtained using distillation, we did not apply it here.
|
| 165 |
+
|
| 166 |
+
Table 1: RIDE achieves the state-of-the-art results on CIFAR100-LT without sacrificing the performance of many-shot classes like all previous methods. Compared with BBN (Zhou et al., 2020) and LFME (Xiang et al., 2020), which also contain multiple experts (or branches), RIDE (2 experts) outperforms them by a large margin with fewer GFlops. The relative computation cost (averaged on testing set) with respect to the baseline model and absolute improvements against SOTA (colored in green) are reported. $\dagger$ denotes our reproduced results with released code. $\ddagger$ denotes results copied from (Cao et al., 2019) and the imbalance ratio is 100.
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan=1 colspan=2>Methods</td><td rowspan=1 colspan=1>MFlops</td><td rowspan=1 colspan=1>All</td><td rowspan=1 colspan=4>Many</td><td rowspan=1 colspan=1>Med</td><td rowspan=1 colspan=1>Few</td></tr><tr><td rowspan=1 colspan=2>Cross Entropy (CE) tCross Entropy (CE) t</td><td rowspan=1 colspan=1>69.5 (1.0x)69.5 (1.0x)</td><td rowspan=1 colspan=1>38.339.1</td><td rowspan=1 colspan=4>166.1</td><td rowspan=1 colspan=1>-37.3</td><td rowspan=1 colspan=1>110.6</td></tr><tr><td rowspan=6 colspan=2>Focal Loss t (Lin et al., 2017)OLTR † (Liu et al., 2019)LDAM + DRW (Cao et al.,2019)LDAM + DRW + (Cao et al., 2019)BBN (Zhou et al., 2020)T-norm t (Kang et al., 2020)cRT + (Kang et al., 2020)M2m (Kim et al., 2020)LFME (Xiang et al., 2020)</td><td rowspan=6 colspan=1>69.5 (1.0x)69.5 (1.0x)69.5 (1.0x)74.3 (1.1x)69.5 (1.0x)69.5 (1.0x)11</td><td rowspan=5 colspan=1>38.441.242.042.042.643.243.343.5</td><td rowspan=2 colspan=4>161.8161.5</td><td rowspan=2 colspan=1>141.4-41.7</td><td rowspan=1 colspan=1>117.61</td></tr><tr><td rowspan=1 colspan=1>20.2</td></tr><tr><td rowspan=4 colspan=4>165.764.011</td><td rowspan=1 colspan=1>-43.6</td><td rowspan=4 colspan=1>■17.318.111</td></tr><tr><td rowspan=1 colspan=1>44.8</td></tr><tr><td rowspan=2 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>43.8</td><td rowspan=1 colspan=2>1</td></tr><tr><td rowspan=1 colspan=1>RIDE (2 experts)RIDE (3 experts)RIDE (4 experts)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64.8 (0.9x)77.8 (1.1x)91.9 (1.3x)</td><td rowspan=1 colspan=1>47.0 (+3.2)48.0 (+4.2)49.1 (+5.3)</td><td rowspan=1 colspan=3>67.9</td><td rowspan=1 colspan=2>67.968.169.3</td><td rowspan=1 colspan=1>48.449.249.3</td></tr></table>
|
| 169 |
+
|
| 170 |
+
Table 2: RIDE achieves state-of-the-art results on ImageNet-LT (Liu et al., 2019) and obtains consistent performance improvements on various backbones. The top-1 accuracy and computational cost are compared with the state-of-the-art methods on ImageNet-LT, with ResNet-50 and ResNeXt50 as the backbone networks. Results marked with $\dagger$ are copied from (Kang et al., 2020). Detailed results on each split are listed in appendix materials.
|
| 171 |
+
|
| 172 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">ResNet-50</td><td colspan="2">ResNeXt-50</td></tr><tr><td>GFlops</td><td>Acc. (%)</td><td>GFlops</td><td>Acc. (%)</td></tr><tr><td>Cross Entropy (CE) t</td><td>4.11 (1.0x)</td><td>41.6</td><td>4.26 (1.0x)</td><td>44.4</td></tr><tr><td>OLTR † (Liu et al., 2019)</td><td></td><td>、</td><td></td><td>46.3</td></tr><tr><td>NCM (Kang et al., 2020)</td><td>4.11 (1.0x)</td><td>44.3</td><td>4.26 (1.0x)</td><td>47.3</td></tr><tr><td>T-norm (Kang et al.,2020)</td><td>4.11 (1.0x)</td><td>46.7</td><td>4.26 (1.0x)</td><td>49.4</td></tr><tr><td>cRT (Kang et al., 2020)</td><td>4.11 (1.0x)</td><td>47.3</td><td>4.26 (1.0x)</td><td>49.6</td></tr><tr><td>LWS (Kang et al., 2020)</td><td>4.11 (1.0x)</td><td>47.7</td><td>4.26 (1.0x)</td><td>49.9</td></tr><tr><td>RIDE (2 experts)</td><td>3.71 (0.9x)</td><td>54.4 (+6.7)</td><td>3.92 (0.9x)</td><td>55.9 (+6.0)</td></tr><tr><td>RIDE (3 experts)</td><td>4.36 (1.1x)</td><td>54.9 (+7.2)</td><td>4.69 (1.1x)</td><td>56.4 (+6.5)</td></tr><tr><td>RIDE (4 experts)</td><td>5.15 (1.3x)</td><td>55.4 (+7.7)</td><td>5.19 (1.2x)</td><td>56.8 (+6.9)</td></tr></table>
|
| 173 |
+
|
| 174 |
+
RIDE as a universal framework. Fig. 3 shows that RIDE consistently benefits from better loss functions and training processes. Whether the model is trained end-to-end (focal loss, CE, LDAM) or in two stages (cRT, $\tau$ -norm, cosine), RIDE delivers consistent accuracy gains. In particular, RIDE with a simple cosine classifier, which we constructed by normalizing the classifier weights and retraining them with a long-tail re-sampling strategy (similar to cRT), achieves on-par performance with the current SOTA methods. Fig. 3 also shows that two-stage methods are generally better than single-stage ones. Nevertheless, since they require an additional training stage, for simplicity, we use the single-stage LDAM as the default $\mathcal { L } _ { \mathrm { C l a s s i f y } }$ in RIDE throughout our remaining experiments.
|
| 175 |
+
|
| 176 |
+
ImageNet-LT Results. Table 2 shows that RIDE outperforms SOTA, LWS and cRT, by more than $7 . 7 \%$ with ResNet-50. ResNeXt-50 is based on group convolution (Xie et al., 2017), which divides all filters into several groups and aggregates information from multiple groups. ResNeXt-50 generally performs better than ResNet-50 on multiple tasks. It provides $6 . 9 \%$ gain on ImageNet-LT.
|
| 177 |
+
|
| 178 |
+
iNaturalist 2018 Results. Table 3 shows that RIDE outperforms current SOTA by $6 . 3 \%$ . Surprisingly, RIDE obtains very similar results on many-shots, medium-shots and few-shots, ideal for long tailed recognition. Current SOTA method BBN also uses multiple experts; however, it significantly decreases the performance on many-shots by about $23 \%$ . RIDE is remarkable at increasing the few-shot accuracy without reducing the many-shot accuracy.
|
| 179 |
+
|
| 180 |
+
Table 3: RIDE outperforms previous state-of-the-art methods on challenging iNaturalist 2018 (Van Horn et al., 2018) dataset, which contains 8,142 classes, by a large margin. Relative improvements to SOTA result of each split (colored with gray) are also listed, with the largest boost from few-shot classes. Compared with previous SOTA method BBN, which also contains multiple “experts”, RIDE achieves more than $20 \%$ higher top-1 accuracy on many-shot classes. Results marked with $\dagger$ are from BBN (Zhou et al., 2020) and Decouple (Kang et al., 2020). BBN’s results are from the released checkpoint.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>Methods</td><td>GFlops</td><td>All</td><td>Many</td><td>Medium</td><td>Few</td></tr><tr><td>CE+</td><td>4.14 (1.0x)</td><td>61.7</td><td>72.2</td><td>63.0</td><td>57.2</td></tr><tr><td>CB-Focal t</td><td>4.14 (1.0x)</td><td>61.1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>OLTR</td><td>4.14 (1.0x)</td><td>63.9</td><td>59.0</td><td>64.1</td><td>64.9</td></tr><tr><td>LDAM + DRW †</td><td>4.14 (1.0x)</td><td>64.6</td><td>1</td><td>1</td><td>1</td></tr><tr><td>cRT</td><td>4.14 (1.0x)</td><td>65.2</td><td>69.0</td><td>66.0</td><td>63.2</td></tr><tr><td>T-norm</td><td>4.14 (1.0x)</td><td>65.6</td><td>65.6</td><td>65.3</td><td>65.9</td></tr><tr><td>LWS</td><td>4.14 (1.0x)</td><td>65.9</td><td>65.0</td><td>66.3</td><td>65.5</td></tr><tr><td>BBN</td><td>4.36 (1.1x)</td><td>66.3</td><td>49.4</td><td>70.8</td><td>65.3</td></tr><tr><td>RIDE (2 experts)</td><td>3.67 (0.9x)</td><td>71.4 4 (+5.1)</td><td>70.2 (+1.2)</td><td>71.3 (+0.5)</td><td>71.7 (+5.8)</td></tr><tr><td>RIDE (3 experts)</td><td>4.17 (1.0x)</td><td>72.2 (+5.9)</td><td>70.2 (+1.2)</td><td>72.2 (+1.4)</td><td>72.7 (+6.8)</td></tr><tr><td>RIDE (4 experts)</td><td>4.51 (1.1x)</td><td>72.6 (+6.3)</td><td>70.9 (+1.9)</td><td>72.4 (+1.6)</td><td>73.1 (+7.2)</td></tr></table>
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 4: Compared to SOTAs, RIDE improves top-1 accuracy on all three splits (many-/med-/fewshot). The absolute accuracy differences of RIDE (blue) over iNaturalist’s current state-of-theart method BBN (Zhou et al., 2020) (left) and ImageNet-LT’s current state-of-the-art method cRT (Kang et al., 2020) (right) are shown. RIDE improves the performance of few- and medium-shots categories without sacrificing the accuracy on many-shots, and outperforms BBN on many-shots by a large margin.
|
| 186 |
+
|
| 187 |
+
Comparing with SOTAs on iNaturalist and ImageNet-LT. As illustrated in Fig. 4, our approach provides a comprehensive treatment to all the many-shot, medium-shot and few-shot classes, achieving substantial improvements to current state-of-the-art on all aspects. Compared with cRT which reduces the performance on the many-shot classes, RIDE can achieves significantly better performance on the few-shot classes without impairing the many-shot classes. Similar observations can be obtained in the comparison with the state-of-the-art method BBN (Zhou et al., 2020) on iNaturalist.
|
| 188 |
+
|
| 189 |
+
Contribution of each component of RIDE. RIDE is jointly trained with $\mathcal { L } _ { \mathrm { D - D i v e r s i f y } }$ and $\mathcal { L } _ { \mathrm { C l a s s i f y } }$ , we use LDAM for $\mathcal { L } _ { \mathrm { C l a s s i f y } }$ by default. Table 4 shows that the architectural change from the original ResNet-32 to the RIDE variant with $2 \sim 4$ experts contributes $2 . 7 \% \sim 4 . 3 \%$ gain. Applying the individual classification loss instead of the collaborative loss brings $1 . 5 \%$ gain. Adding the diversity loss further improves about $0 . 9 \%$ . The computational cost is greatly reduced by adding the dynamic expert router. Knowledge distillation from RIDE with 6 experts obtains another $0 . 6 \%$ gain. All these components deliver $7 . 1 \%$ gain over baseline LDAM.
|
| 190 |
+
|
| 191 |
+
Impact of the number of experts. Fig. 5 shows that whether in terms of relative or absolute gains, few-shots benefit more with more experts. For example, the relative gain is $16 \%$ vs. $3 . 8 \%$ for few-shots and many-shots respectively. No distillation is applied in this comparison.
|
| 192 |
+
|
| 193 |
+
Table 4: Ablation studies on the effectiveness of each component on CIFAR100-LT. LDAM is used as our classification loss. The first 3 RIDE models only have architectural change without changes in training method. The performance without $\mathcal { L } _ { \mathrm { { I n d i v i d u a l } } }$ checked indicates directly applying classification loss onto the final model output, which is the mean expert logits. This is referred to as collaborative loss above. In contrast, if $\mathcal { L } _ { \mathrm { { I n d i v i d u a l } } }$ if checked, we apply individual loss to each individual expert. The difference between collaborative loss and individual loss is described above. By adding the router module, the computational cost of RIDE can be significantly reduced, while the accuracy degradation is negligible. Knowledge distillation step is optional if further improvements are desired. Various knowledge distillation techniques are compared in the appendix.
|
| 194 |
+
|
| 195 |
+
<table><tr><td>Methods</td><td>#expert</td><td>LIndividual</td><td>LD-Diversify</td><td>Router</td><td>distill</td><td>GFlops</td><td>Acc.(%)</td></tr><tr><td>LDAM+DRW</td><td>1</td><td></td><td></td><td></td><td></td><td></td><td>42.0</td></tr><tr><td rowspan="7">RIDE</td><td>2</td><td></td><td></td><td></td><td></td><td>1.1x</td><td>44.7 (+2.7)</td></tr><tr><td>3</td><td></td><td></td><td></td><td></td><td>1.5x</td><td>46.1 (+4.1)</td></tr><tr><td>4</td><td></td><td></td><td></td><td></td><td>1.8x</td><td>46.3 (+4.3)</td></tr><tr><td>4</td><td></td><td></td><td></td><td></td><td>1.8x</td><td>47.8 (+5.8)</td></tr><tr><td>4</td><td><</td><td>√</td><td></td><td></td><td>1.8x</td><td>48.7 (+6.7)</td></tr><tr><td>4</td><td>√</td><td>√</td><td></td><td>1</td><td>1.8x</td><td>49.3 (+7.3)</td></tr><tr><td>4</td><td>√</td><td><</td><td>√</td><td></td><td>1.3x</td><td>49.1 (+7.1)</td></tr></table>
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 5: # experts vs. top-1 accuracy for each split (All, Many/Medium/Few) of CIFAR100- LT. Compared with the many-shot split, which is $3 . 8 \%$ relatively improved by adding more experts, the few-shot split can get more benefits, that is, a relative improvement of $1 6 . 1 \%$ .
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 6: The proportion of the number of experts allocated to each split of CIFAR100-LT. For RIDE with 3 or 4 experts, more than half of many-shot instances only require one expert. On the contrary, more than $76 \%$ samples of few-shot classes require opinions from additional experts.
|
| 202 |
+
|
| 203 |
+
The number of experts allocated to each split. Fig. 6 shows that instances in few-shots need more experts whereas most instances in many-shots just need the first expert. That is, low confidence in tail instances often requires the model to seek a second (or a third, ...) opinion.
|
| 204 |
+
|
| 205 |
+
# 5 SUMMARY
|
| 206 |
+
|
| 207 |
+
We take a dynamic view of training data and study long-tailed recognition with model bias and variance analysis. Existing long-tail classifiers do not reduce head-tail model bias gap enough while increasing model variance across all the classes. We propose a novel multi-expert model called RIDE to reduce model biases and variances throughout. It trains partially shared diverse distributionaware experts and routes an instance to additional experts when necessary, with computational costs comparable to a single expert. RIDE outperforms SOTA by a large margin. It is also a universal framework that works with various backbones and training schemes for consistent gains.
|
| 208 |
+
|
| 209 |
+
Acknowledgments. This work was supported, in part, by Berkeley Deep Drive, US Government fund through Etegent Technologies on Low-Shot Detection and Semi-supervised Detection, and NTU NAP and A\*STAR via Industry Alignment Fund: Industry Collaboration Projects Grant.
|
| 210 |
+
|
| 211 |
+
# REFERENCES
|
| 212 |
+
|
| 213 |
+
Luca Bertinetto, Joao F Henriques, Jack Valmadre, Philip Torr, and Andrea Vedaldi. Learning feed- ˜ forward one-shot learners. In NeurIPS, 2016.
|
| 214 |
+
|
| 215 |
+
Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems, pp. 1567–1578, 2019.
|
| 216 |
+
|
| 217 |
+
Zitian Chen, Yanwei Fu, Yu-Xiong Wang, Lin Ma, Wei Liu, and Martial Hebert. Image deformation meta-networks for one-shot learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8680–8689, 2019.
|
| 218 |
+
|
| 219 |
+
Peng Chu, Xiao Bian, Shaopeng Liu, and Haibin Ling. Feature space augmentation for long-tailed data. arXiv preprint arXiv:2008.03673, 2020.
|
| 220 |
+
|
| 221 |
+
Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. Class-balanced loss based on effective number of samples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9268–9277, 2019.
|
| 222 |
+
|
| 223 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 248–255, 2009.
|
| 224 |
+
|
| 225 |
+
Pedro Domingos. A unified bias-variance decomposition. In Proceedings of 17th International Conference on Machine Learning, pp. 231–238, 2000.
|
| 226 |
+
|
| 227 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
|
| 228 |
+
|
| 229 |
+
Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1735–1742, 2006.
|
| 230 |
+
|
| 231 |
+
Bharath Hariharan and Ross Girshick. Low-shot visual recognition by shrinking and hallucinating features. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3018– 3027, 2017.
|
| 232 |
+
|
| 233 |
+
Haibo He and Edwardo A Garcia. Learning from imbalanced data. IEEE Transactions on knowledge and data engineering, 21(9):1263–1284, 2009.
|
| 234 |
+
|
| 235 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 770–778, 2016.
|
| 236 |
+
|
| 237 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 238 |
+
|
| 239 |
+
Muhammad Abdullah Jamal, Matthew Brown, Ming-Hsuan Yang, Liqiang Wang, and Boqing Gong. Rethinking class-balanced methods for long-tailed visual recognition from a domain adaptation perspective. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7610–7619, 2020.
|
| 240 |
+
|
| 241 |
+
Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Learning imbalanced datasets with label-distribution-aware margin loss. In International Conference on Learning Representations, pp. 1567–1578, 2020.
|
| 242 |
+
|
| 243 |
+
Jaehyung Kim, Jongheon Jeong, and Jinwoo Shin. M2m: Imbalanced classification via major-tominor translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13896–13905, 2020.
|
| 244 |
+
|
| 245 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
|
| 246 |
+
|
| 247 |
+
Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense ´ object detection. In Proceedings of the IEEE international conference on computer vision, pp. 2980–2988, 2017.
|
| 248 |
+
|
| 249 |
+
Bo Liu, Xudong Wang, Mandar Dixit, Roland Kwitt, and Nuno Vasconcelos. Feature space transfer for data augmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 9090–9098, 2018.
|
| 250 |
+
|
| 251 |
+
Jialun Liu, Yifan Sun, Chuchu Han, Zhaopeng Dou, and Wenhui Li. Deep representation learning on long-tailed data: A learnable embedding augmentation perspective. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2970–2979, 2020.
|
| 252 |
+
|
| 253 |
+
Ziwei Liu, Zhongqi Miao, Xiaohang Zhan, Jiayun Wang, Boqing Gong, and Stella X Yu. Largescale long-tailed recognition in an open world. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2537–2546, 2019.
|
| 254 |
+
|
| 255 |
+
Hyun Oh Song, Yu Xiang, Stefanie Jegelka, and Silvio Savarese. Deep metric learning via lifted structured feature embedding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4004–4012, 2016.
|
| 256 |
+
|
| 257 |
+
Nikolaos Passalis and Anastasios Tefas. Learning deep representations with probabilistic knowledge transfer. In Proceedings of the European Conference on Computer Vision, pp. 268–284, 2018.
|
| 258 |
+
|
| 259 |
+
Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In ICLR, 2017.
|
| 260 |
+
|
| 261 |
+
Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In ICML, 2016.
|
| 262 |
+
|
| 263 |
+
Eli Schwartz, Leonid Karlinsky, Joseph Shtok, Sivan Harary, Mattias Marder, Rogerio Feris, Abhishek Kumar, Raja Giryes, and Alex M Bronstein. Delta-encoder: an effective sample synthesis method for few-shot object recognition. arXiv preprint arXiv:1806.04734, 2018.
|
| 264 |
+
|
| 265 |
+
Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In NeurIPS, 2017.
|
| 266 |
+
|
| 267 |
+
Jingru Tan, Changbao Wang, Buyu Li, Quanquan Li, Wanli Ouyang, Changqing Yin, and Junjie Yan. Equalization loss for long-tailed object recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11662–11671, 2020.
|
| 268 |
+
|
| 269 |
+
Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive representation distillation. In International Conference on Learning Representations, 2019.
|
| 270 |
+
|
| 271 |
+
Frederick Tung and Greg Mori. Similarity-preserving knowledge distillation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1365–1374, 2019.
|
| 272 |
+
|
| 273 |
+
Grant Van Horn, Oisin Mac Aodha, Yang Song, Yin Cui, Chen Sun, Alex Shepard, Hartwig Adam, Pietro Perona, and Serge Belongie. The iNaturalist species classification and detection dataset. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8769–8778, 2018.
|
| 274 |
+
|
| 275 |
+
Oriol Vinyals, Charles Blundell, Tim Lillicrap, and Daan Wierstra. Matching networks for one shot learning. In NeurIPS, 2016.
|
| 276 |
+
|
| 277 |
+
Yu-Xiong Wang, Deva Ramanan, and Martial Hebert. Learning to model the tail. In Advances in Neural Information Processing Systems, pp. 7029–7039, 2017.
|
| 278 |
+
|
| 279 |
+
Yu-Xiong Wang, Ross Girshick, Martial Hebert, and Bharath Hariharan. Low-shot learning from imaginary data. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7278–7286, 2018.
|
| 280 |
+
|
| 281 |
+
Tong Wu, Qingqiu Huang, Ziwei Liu, Yu Wang, and Dahua Lin. Distribution-balanced loss for multi-label classification in long-tailed datasets. In Proceedings of the European Conference on Computer Vision, pp. 162–178. Springer, 2020.
|
| 282 |
+
|
| 283 |
+
Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3733–3742, 2018.
|
| 284 |
+
|
| 285 |
+
Liuyu Xiang, Guiguang Ding, and Jungong Han. Learning from multiple experts: Self-paced knowledge distillation for long-tailed classification. In Proceedings of the European Conference on Computer Vision, pp. 247–263. Springer, 2020.
|
| 286 |
+
|
| 287 |
+
Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans-´ formations for deep neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1492–1500, 2017.
|
| 288 |
+
|
| 289 |
+
Flood Sung Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In CVPR, 2018.
|
| 290 |
+
|
| 291 |
+
Hongguang Zhang, Jing Zhang, and Piotr Koniusz. Few-shot learning via saliency-guided hallucination of samples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2770–2779, 2019.
|
| 292 |
+
|
| 293 |
+
Xiao Zhang, Zhiyuan Fang, Yandong Wen, Zhifeng Li, and Yu Qiao. Range loss for deep face recognition with long-tailed training data. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5409–5418, 2017.
|
| 294 |
+
|
| 295 |
+
Boyan Zhou, Quan Cui, Xiu-Shen Wei, and Zhao-Min Chen. BBN: Bilateral-branch network with cumulative learning for long-tailed visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9719–9728, 2020.
|
| 296 |
+
|
| 297 |
+
Linchao Zhu and Yi Yang. Inflated episodic memory with region self-attention for long-tailed visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4344–4353, 2020.
|
| 298 |
+
|
| 299 |
+
# A APPENDIX
|
| 300 |
+
|
| 301 |
+
# A.1 DATASETS AND IMPLEMENTATIONS
|
| 302 |
+
|
| 303 |
+
We conduct experiments on three major long-tailed recognition benchmarks and different backbone networks to prove the effectiveness and universality of RIDE:
|
| 304 |
+
|
| 305 |
+
1.CIFAR100-LT (Krizhevsky, 2009; Cao et al., 2019): The original version of CIFAR-100 contains 50,000 images on training set and 10,000 images on validation set with 100 categories. The long-tailed version of CIFAR-100 follows an exponential decay in sample sizes across different categories. We conduct experiment on CIFAR100-LT with an imbalance factor of 100, i.e. the ratio between the most frequent class and the least frequent class.
|
| 306 |
+
|
| 307 |
+
To make fair comparison with previous works, we follow the training recipe of (Cao et al., 2019) on CIFAR100-LT. We train the ResNet-32 (He et al., 2016) backbone network by SGD optimizer with a momentum of 0.9. CIFAR100-LT is trained for 200 epochs with standard data augmentations (He et al., 2016) and a batch size of 128 on one RTX 2080Ti GPU. The learning rate is initialized as 0.1 and decayed by 0.01 at epoch 120 and 160 respectively.
|
| 308 |
+
|
| 309 |
+
2.ImageNet-LT (Deng et al., 2009; Liu et al., 2019): ImageNet-LT is constructed by sampling a subset of ImageNet-2012 following the Pareto distribution with the power value $\alpha = 6$ (Liu et al., 2019). ImageNet-LT consists of $1 1 5 . 8 \mathrm { k }$ images from 1,000 categories, with the largest and smallest categories containing 1,280 and 5 images, respectively.
|
| 310 |
+
|
| 311 |
+
Multiple backbone networks are experimented on ImageNet-LT, including ResNet-10, ResNet-50 and ResNeXt-50 (Xie et al., 2017). All backbone networks are trained with a batch size of 256 on 8 RTX 2080Ti GPUs for 100 epochs using SGD with an initial learning rate of 0.1 decayed by 0.1 at 60 epochs and 80 epochs. We utilize standard data augmentations as in (He et al., 2016).
|
| 312 |
+
|
| 313 |
+
3.iNaturalist (Van Horn et al., 2018): The iNaturalist-2018 dataset is an imbalanced datasets with 437,513 training images from 8,142 classes with a balanced test set of 24,426 images. We use ResNet-50 as the backbone network and apply the same training recipe as ImageNet-LT, except that we use a batch size of 512.
|
| 314 |
+
|
| 315 |
+
# A.2 ADDITIONAL EXPERIMENTS
|
| 316 |
+
|
| 317 |
+
Ablation study on distillation methods. Self-distillation step is optional but recommended if further improvements $( 0 . 4 \% \sim 0 . 8 \%$ for most experiments) are desired. We apply distillation from a more powerful model with more experts into a model with fewer experts. A simple way to transfer knowledge is knowledge distillation (KD) (Hinton et al., 2015), which applies KD loss $( \mathcal { L } _ { \mathrm { K D } } = T ^ { 2 } D _ { \mathrm { K L } } ( \tilde { \vec { l } _ { \mathrm { t e a c h e r } } } / T , \vec { l } _ { \mathrm { e x p e r t } _ { i } } / T ) )$ to match the distribution of logits of a teacher and a student. We found that for teacher model with more experts using smaller distillation loss factor gives better performance. We hypothesize that since we distill from the same teachers, giving large distillation factor prevents the branches from becoming as diversified as it is able to. We also explored other distillation methods, such as CRD (Tian et al., 2019), PKT (Passalis & Tefas, 2018), and SP (Tung & Mori, 2019), and compared the differences in Table 5. Although adding other methods along with KD may boost performance, the difference is small. Therefore, we opt for simplicity and use KD only unless otherwise noticed.
|
| 318 |
+
|
| 319 |
+
Detailed results for ImageNet-LT experiments. We list details of our ResNet-50 experiments in ImageNet-LT on Table 7. With 2 experts, we are able to achieve about $7 \%$ gain in accuracy with computational cost about $10 \%$ less than baseline. In contrast to previous methods that sacrifice many-shot accuracy to get few-shot accuracy, we improve on all three splits on ImageNet-LT. From 3 experts to 4 experts, we keep the same many-shot accuracy while increasing the few-shot accuracy, indicating that we are using the additional computational power to improve on the hardest part of the data rather than uniformly applying to all samples.
|
| 320 |
+
|
| 321 |
+
We also list our ResNet-10 and ResNeXt-50 experiments on Table 6 and 8, respectively, to compare against other works evaluated on these backbones. Our method also achieves lower computational cost and higher performance when compared to other methods.
|
| 322 |
+
|
| 323 |
+
Comparison with ensemble method. Since our method requires the joint decision from several experts, which raw ensembles also do, we also compare against ensembles of LDAM in Fig.7 on
|
| 324 |
+
|
| 325 |
+
Table 5: Comparison of different distillation methods. We transfer from a model based on ResNet-32 with 6 experts to a model of the same type, except with fewer experts. We use CIFAR100- LT for the following comparison. No expert assignment module is used in the following experiments. Following the procedure for CRD (Tian et al., 2019), we also apply KD when we transfer from a teacher to students with other distillation methods.
|
| 326 |
+
|
| 327 |
+
RIDE and Ensembles of LDAM
|
| 328 |
+
|
| 329 |
+
<table><tr><td>Model Type</td><td>#expert</td><td>DistillationMethod</td><td>Accuracy (%)</td></tr><tr><td>Teacher</td><td>6</td><td></td><td>49.7</td></tr><tr><td rowspan="10">Student</td><td>2</td><td>No Distillation</td><td>46.6</td></tr><tr><td>2</td><td>KD (Hinton et al., 2015)</td><td>47.3</td></tr><tr><td>2</td><td>CRD (Tian et al., 2019)</td><td>47.5</td></tr><tr><td>2</td><td>PKT (Passalis & Tefas,2018)</td><td>47.2</td></tr><tr><td>2</td><td>SP(Tung&Mori,2019)</td><td>47.2</td></tr><tr><td>3 3</td><td>No Distillation</td><td>47.9</td></tr><tr><td></td><td>KD (Hinton et al., 2015)</td><td>48.4</td></tr><tr><td>3</td><td>CRD (Tian et al., 2019)</td><td>48.5</td></tr><tr><td>3</td><td>PKT (Passalis & Tefas,2018)</td><td>48.3</td></tr><tr><td>3 4</td><td>SP(Tung& Mori,2019)</td><td>48.7</td></tr><tr><td></td><td>No Distillation</td><td></td><td>48.7</td></tr><tr><td></td><td>4</td><td>KD (Hinton et al., 2015)</td><td>49.3</td></tr><tr><td></td><td>4</td><td>CRD (Tian et al., 2019)</td><td>49.0</td></tr><tr><td></td><td>4</td><td>PKT (Passalis & Tefas,2018)</td><td>48.9</td></tr><tr><td>4</td><td></td><td>SP (Tung& Mori,2019)</td><td>49.0</td></tr></table>
|
| 330 |
+
|
| 331 |
+

|
| 332 |
+
Figure 7: Comparison between our method and multiple LDAM models ensembled together. In the figure, ensembles of LDAM start from 1 ensemble (original LDAM) to 7 ensembles, and RIDE starts from 2 experts to 4 experts. Our method achieves higher accuracy with substantially less computational cost compared to ensemble method.
|
| 333 |
+
|
| 334 |
+
CIFAR100-LT. In the figure, even our method with 4 experts has less computational cost than the minimum computational cost for the ensemble of 2 LDAM models. This indicates that our model is much more efficient and powerful in terms of computational cost and accuracy than ensemble on long-tailed datasets.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 8: t-SNE visualization of LDAM’s and our model’s embedding space of CIFAR100-LT. The feature embedding of RIDE is more compact for both head and tail classes and better separated. This behavior greatly reduces the difficulty for the classifier to distinguish the tail category.
|
| 338 |
+
|
| 339 |
+
t-SNE visualization. We also provide the t-SNE visualization of embedding space on CIFAR100- LT as in Fig. 8. Compared with the baseline method LDAM, the feature embedding of RIDE is more compact for both the head and tail classes and better separated from the neighboring classes. This greatly reduces the difficulty for the classifier to distinguish the tail category.
|
| 340 |
+
|
| 341 |
+
What if we apply RIDE to balanced datasets? We also conducted experiments on CIFAR100 to check if our method can achieve similar performance gains on balanced datasets. However, we only obtained an improvement of about $1 \%$ , which is much smaller than the improvements observed on the CIFAR100-LT. Compared with balanced datasets, long-tailed datasets can get more benefits from RIDE.
|
| 342 |
+
|
| 343 |
+
Table 6: Top-1 accuracy comparison with state-of-the-art methods on ImageNet-LT (Liu et al., 2019) with ResNet-10. Performance on Many-shot $( > 1 0 0 )$ , Medum-shot $\leq 1 0 0$ & ${ > } 2 0$ ) and Fewshot $( \leq 2 0 )$ are also provided. Results marked with $\dagger$ are copied from (Liu et al., 2019). Results with $\ddagger$ are from (Xiang et al., 2020).
|
| 344 |
+
|
| 345 |
+
<table><tr><td>Methods</td><td>GFlops</td><td>Many</td><td>Medium</td><td>Few</td><td>Overall</td></tr><tr><td>Cross Entropy(CE) t</td><td>0.89 (1.0x)</td><td>40.9</td><td>10.7</td><td>0.4</td><td>20.9</td></tr><tr><td>Focal Loss † (Lin et al.,2017)</td><td>0.89 (1.0x) 0.89 (1.0x)</td><td>36.4</td><td>29.9</td><td>16.0</td><td>30.5</td></tr><tr><td>Range Loss † (Zhang et al., 2017) Lifted Loss † (Oh Song et al., 2016)</td><td>0.89 (1.0x)</td><td>35.8</td><td>30.3</td><td>17.6</td><td>30.7</td></tr><tr><td></td><td></td><td>35.8</td><td>30.4</td><td>17.9</td><td>30.8</td></tr><tr><td>OLTR (Liu et al., 2019) LFME (Xiang et al., 2020)</td><td>0.89 (1.0x)</td><td>43.2</td><td>35.1</td><td>18.5</td><td>35.6</td></tr><tr><td>Many-shot only t</td><td>- 1</td><td>47.0 59.3</td><td>37.9</td><td>19.2</td><td>38.8</td></tr><tr><td>Medium-shot only t</td><td>1</td><td></td><td>35.9</td><td></td><td></td></tr><tr><td>Few-shot only ‡</td><td>1</td><td></td><td></td><td>14.3</td><td></td></tr><tr><td>RIDE (2 experts)</td><td>0.85 (1.0x)</td><td>57.5</td><td>40.8</td><td>26.9</td><td>45.3 (+6.5)</td></tr><tr><td>RIDE (3 experts)</td><td>0.97 (1.1x)</td><td>57.6</td><td>41.7</td><td>28.0</td><td>45.9 (+7.1)</td></tr><tr><td>RIDE (4 experts)</td><td>1.07 (1.2x)</td><td>58.5</td><td>42.4</td><td>27.7</td><td>46.6 ( (+7.8)</td></tr></table>
|
| 346 |
+
|
| 347 |
+
Table 7: Top-1 accuracy comparison with state-of-the-art methods on ImageNet-LT (Liu et al., 2019) with ResNet-50. Performance on Many-shot $( > 1 0 0 )$ , Medum-shot $( \leq 1 0 0$ & ${ > } 2 0$ ) and Fewshot $( \leq 2 0 )$ are also provided. Results marked with $\dagger$ are copied from (Kang et al., 2020).
|
| 348 |
+
|
| 349 |
+
<table><tr><td>Methods</td><td>GFlops</td><td>Many</td><td>Medium</td><td>Few</td><td>Overall</td></tr><tr><td>Cross Entropy (CE) t</td><td>4.11 (1.0x)</td><td>64.0</td><td>33.8</td><td>5.8</td><td>41.6</td></tr><tr><td>NCM (Kang et al., 2020)</td><td>=</td><td>53.1</td><td>42.3</td><td>26.5</td><td>44.3</td></tr><tr><td>cRT (Kang et al., 2020)</td><td>4.11 (1.0x)</td><td>58.8</td><td>44.0</td><td>26.1</td><td>47.3</td></tr><tr><td>T-norm (Kang et al., 2020)</td><td>4.11 (1.0x)</td><td>56.6</td><td>44.2</td><td>27.4</td><td>46.7</td></tr><tr><td>LWS (Kang et al., 2020)</td><td>4.11 (1.0x)</td><td>57.1</td><td>45.2</td><td>29.3</td><td>47.7</td></tr><tr><td>RIDE (2 experts)</td><td>3.71 (0.9x)</td><td>65.8</td><td>51.0</td><td>34.6</td><td>54.4 (+6.7)</td></tr><tr><td>RIDE (3 experts)</td><td>4.36 (1.1x)</td><td>66.2</td><td>51.7</td><td>34.9</td><td>54.9 (+7.2)</td></tr><tr><td>RIDE (4 experts)</td><td>5.15 (1.3x)</td><td>66.2</td><td>52.3</td><td>36.5</td><td> 55.4 (+7.7)</td></tr></table>
|
| 350 |
+
|
| 351 |
+
Table 8: Top-1 accuracy comparison with state-of-the-art methods on ImageNet-LT (Liu et al., 2019) with ResNeXt-50. Performance on Many-shot $( > 1 0 0 )$ , Medum-shot $( \leq 1 0 0$ & ${ > } 2 0 _ { , }$ ) and Few-shot $( \leq 2 0 )$ are also provided. Results marked with $\dagger$ are copied from (Kang et al., 2020).
|
| 352 |
+
|
| 353 |
+
<table><tr><td>Methods</td><td>GFlops</td><td>Many</td><td>Medium</td><td>Few</td><td>Overall</td></tr><tr><td>Cross Entropy(CE) + NCM (Kang et al., 2020)</td><td>4.26 (1.0x)</td><td>65.9</td><td>37.5</td><td>7.7</td><td>44.4</td></tr><tr><td>cRT (Kang et al., 2020)</td><td>4.26 (1.0x)</td><td>56.6 61.8</td><td>45.3 46.2</td><td>28.1 27.4</td><td>47.3 49.6</td></tr><tr><td>T-norm (Kang et al., 2020)</td><td>4.26 (1.0x)</td><td>59.1</td><td>46.9</td><td>30.7</td><td>49.4</td></tr><tr><td>LWS (Kang et al., 2020)</td><td>4.26 (1.0x)</td><td>60.2</td><td>47.2</td><td>30.3</td><td></td></tr><tr><td></td><td>3.92 (0.9x)</td><td>67.6</td><td>52.5</td><td>35.0</td><td>49.9</td></tr><tr><td>RIDE (2 experts)</td><td>4.69 (1.1x)</td><td>67.6</td><td>53.5</td><td>35.9</td><td>55.9 (+6.0)</td></tr><tr><td>RIDE (3 experts)</td><td>5.19 (1.2x)</td><td></td><td></td><td></td><td>56.4 (+6.5)</td></tr><tr><td>RIDE (4 experts)</td><td></td><td>68.2</td><td>53.8</td><td>36.0</td><td>56.8 (+6.9)</td></tr></table>
|
md/train/H1Y8hhg0b/H1Y8hhg0b.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING SPARSE NEURAL NETWORKSTHROUGH $L _ { 0 }$ REGULARIZATION
|
| 2 |
+
|
| 3 |
+
Christos Louizos∗ University of Amsterdam TNO, Intelligent Imaging c.louizos@uva.nl
|
| 4 |
+
|
| 5 |
+
Max Welling
|
| 6 |
+
University of Amsterdam CIFAR
|
| 7 |
+
m.welling@uva.nl
|
| 8 |
+
|
| 9 |
+
Diederik P. Kingma OpenAI dpkingma@openai.com
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
We propose a practical method for $L _ { 0 }$ norm regularization for neural networks: pruning the network during training by encouraging weights to become exactly zero. Such regularization is interesting since (1) it can greatly speed up training and inference, and (2) it can improve generalization. AIC and BIC, well-known model selection criteria, are special cases of $L _ { 0 }$ regularization. However, since the $L _ { 0 }$ norm of weights is non-differentiable, we cannot incorporate it directly as a regularization term in the objective function. We propose a solution through the inclusion of a collection of non-negative stochastic gates, which collectively determine which weights to set to zero. We show that, somewhat surprisingly, for certain distributions over the gates, the expected $L _ { 0 }$ regularized objective is differentiable with respect to the distribution parameters. We further propose the hard concrete distribution for the gates, which is obtained by “stretching” a binary concrete distribution and then transforming its samples with a hard-sigmoid. The parameters of the distribution over the gates can then be jointly optimized with the original network parameters. As a result our method allows for straightforward and efficient learning of model structures with stochastic gradient descent and allows for conditional computation in a principled way. We perform various experiments to demonstrate the effectiveness of the resulting approach and regularizer.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Deep neural networks are flexible function approximators that have been very successful in a broad range of tasks. They can easily scale to millions of parameters while allowing for tractable optimization with mini-batch stochastic gradient descent (SGD), graphical processing units (GPUs) and parallel computation. Nevertheless they do have drawbacks. Firstly, it has been shown in recent works (Han et al., 2015; Ullrich et al., 2017; Molchanov et al., 2017) that they are greatly overparametrized as they can be pruned significantly without any loss in accuracy; this exhibits unnecessary computation and resources. Secondly, they can easily overfit and even memorize random patterns in the data (Zhang et al., 2016), if not properly regularized. This overfitting can lead to poor generalization in practice.
|
| 18 |
+
|
| 19 |
+
A way to address both of these issues is by employing model compression and sparsification techniques. By sparsifying the model, we can avoid unnecessary computation and resources, since irrelevant degrees of freedom are pruned away and do not need to be computed. Furthermore, we reduce its complexity, thus penalizing memorization and alleviating overfitting.
|
| 20 |
+
|
| 21 |
+
A conceptually attractive approach is the $L _ { 0 }$ norm regularization of (blocks of) parameters; this explicitly penalizes parameters for being different than zero with no further restrictions. However, the combinatorial nature of this problem makes for an intractable optimization for large models.
|
| 22 |
+
|
| 23 |
+
In this paper we propose a general framework for surrogate $L _ { 0 }$ regularized objectives. It is realized by smoothing the expected $L _ { 0 }$ regularized objective with continuous distributions in a way that can maintain the exact zeros in the parameters while still allowing for efficient gradient based optimization. This is achieved by transforming continuous random variables (r.v.s) with a hard nonlinearity, the hard-sigmoid. We further propose and employ a novel distribution obtained by this procedure; the hard concrete. It is obtained by “stretching” a binary concrete random variable (Maddison et al., 2016; Jang et al., 2016) and then passing its samples through a hard-sigmoid. We demonstrate the effectiveness of this simple procedure in various experiments.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: $L _ { p }$ norm penalties for a parameter $\theta$ according to different values of $p$ . It is easily observed that both weight decay and Lasso, $p = 2$ and $p = 1$ respectively, impose shrinkage for large values of $\theta$ . By gradually allowing $p < 1$ we observe that the shrinkage is reduced and at the limit of $p = 0$ we observe that the penalty is a constant for $\theta \neq 0$ .
|
| 27 |
+
|
| 28 |
+
# 2 MINIMIZING THE $L _ { 0 }$ NORM OF PARAMETRIC MODELS
|
| 29 |
+
|
| 30 |
+
One way to sparsify parametric models, such as deep neural networks, with the least assumptions about the parameters is the following; let $\mathcal { D }$ be a dataset consisting of $N$ i.i.d. input output pairs $\left\{ ( \mathbf { x } _ { 1 } , \mathbf { y } _ { 1 } ) , \dotsc , ( \mathbf { x } _ { N } , \mathbf { y } _ { N } ) \right\}$ and consider a regularized empirical risk minimization procedure with an $L _ { 0 }$ regularization on the parameters $\pmb \theta$ of a hypothesis (e.g. a neural network) $h ( \cdot ; \bar { \pmb \theta } ) ^ { 1 }$ :
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\mathcal { R } ( \pmb { \theta } ) = \frac { 1 } { N } \bigg ( \sum _ { i = 1 } ^ { N } \mathcal { L } \big ( h ( \mathbf { x } _ { i } ; \pmb { \theta } ) , \mathbf { y } _ { i } \big ) \bigg ) + \lambda \| \pmb { \theta } \| _ { 0 } , \qquad \| \pmb { \theta } \| _ { 0 } = \sum _ { j = 1 } ^ { | \theta | } \mathbb { I } [ \theta _ { j } \neq 0 ] ,
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
where $| \theta |$ is the dimensionality of the parameters, $\lambda$ is a weighting factor for the regularization and $\mathcal { L } ( \cdot )$ corresponds to a loss function, e.g. cross-entropy loss for classification or mean-squared error for regression. The $L _ { 0 }$ norm penalizes the number of non-zero entries of the parameter vector and thus encourages sparsity in the final estimates $\pmb { \theta } ^ { * }$ . The Akaike Information Criterion (AIC) (Akaike, 1998) and the Bayesian Information Criterion (BIC) (Schwarz et al., 1978), well-known model selection criteria, correspond to specific choices of $\lambda$ . Notice that the $L _ { 0 }$ norm induces no shrinkage on the actual values of the parameters $\pmb { \theta }$ ; this is in contrast to e.g. $L _ { 1 }$ regularization and the Lasso (Tibshirani, 1996), where the sparsity is due to shrinking the actual values of $\pmb { \theta }$ . We provide a visualization of this effect in Figure 1.
|
| 37 |
+
|
| 38 |
+
Unfortunately, optimization under this penalty is computationally intractable due to the nondifferentiability and combinatorial nature of $2 ^ { | \theta | }$ possible states of the parameter vector $\pmb \theta$ . How can we relax the discrete nature of the $L _ { 0 }$ penalty such that we allow for efficient continuous optimization of Eq. 1, while allowing for exact zeros in the parameters? This section will present the necessary details of our approach.
|
| 39 |
+
|
| 40 |
+
# 2.1 A GENERAL RECIPE FOR EFFICIENTLY MINIMIZING $L _ { 0 }$ NORMS
|
| 41 |
+
|
| 42 |
+
Consider the $L _ { 0 }$ norm under a simple re-parametrization of $\pmb \theta$ :
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\theta _ { j } = \tilde { \theta } _ { j } z _ { j } , \qquad z _ { j } \in \{ 0 , 1 \} , \qquad \tilde { \theta } _ { j } \neq 0 , \qquad \lVert \theta \rVert _ { 0 } = \sum _ { j = 1 } ^ { \lvert \theta \rvert } z _ { j } ,
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where the $z _ { j }$ correspond to binary “gates” that denote whether a parameter is present and the $L _ { 0 }$ norm corresponds to the amount of gates being “on”. By letting $q ( z _ { j } | \pi _ { j } ) = \mathbf { B } \mathrm { e r n } ( \pi _ { j } )$ be a Bernoulli distribution over each gate $z _ { j }$ we can reformulate the minimization of Eq. 1 as penalizing the number of parameters being used, on average, as follows:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\begin{array} { r l r } { { \mathcal { R } ( \tilde { \pmb { \theta } } , \boldsymbol { \pi } ) = \mathbb { E } _ { q ( \mathbf { z } | \boldsymbol { \pi } ) } [ \frac { 1 } { N } \bigg ( \displaystyle \sum _ { i = 1 } ^ { N } \mathcal { L } \big ( h ( \mathbf { x } _ { i } ; \tilde { \pmb { \theta } } \odot \mathbf { z } ) , \mathbf { y } _ { i } \big ) \bigg ) ] + \lambda \displaystyle \sum _ { j = 1 } ^ { | \theta | } \pi _ { j } , } } \\ & { } & { \tilde { \pmb { \theta } } ^ { * } , \boldsymbol { \pi } ^ { * } = \underset { \tilde { \pmb { \theta } } , \boldsymbol { \pi } } { \operatorname { a r g m i n } } \{ \mathcal { R } ( \tilde { \pmb { \theta } } , \boldsymbol { \pi } ) \} , } \end{array}
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $\odot$ corresponds to the elementwise product. The objective described in Eq. 3 is in fact a special case of a variational bound over the parameters involving spike and slab (Mitchell & Beauchamp, 1988) priors and approximate posteriors; we refer interested readers to appendix A.
|
| 55 |
+
|
| 56 |
+
Now the second term of the r.h.s. of Eq. 3 is straightforward to minimize however the first term is problematic for $\pi$ due to the discrete nature of $\mathbf { z }$ , which does not allow for efficient gradient based optimization. While in principle a gradient estimator such as the REINFORCE (Williams, 1992) could be employed, it suffers from high variance and control variates (Mnih & Gregor, 2014; Mnih & Rezende, 2016; Tucker et al., 2017), that require auxiliary models or multiple evaluations of the network, have to be employed. Two simpler alternatives would be to use either the straightthrough (Bengio et al., 2013) estimator as done at Srinivas et al. (2017) or the concrete distribution as e.g. at Gal et al. (2017). Unfortunately both of these approach have drawbacks; the first one provides biased gradients due to ignoring the Heaviside function in the likelihood during the gradient evaluation whereas the second one does not allow for the gates (and hence parameters) to be exactly zero during optimization, thus precluding the benefits of conditional computation (Bengio et al., 2013).
|
| 57 |
+
|
| 58 |
+
Fortunately, there is a simple alternative way to smooth the objective such that we allow for efficient gradient based optimization of the expected $L _ { 0 }$ norm along with zeros in the parameters $\pmb \theta$ . Let s be a continuous random variable with a distribution $q ( \mathbf { s } )$ that has parameters $\phi$ . We can now let the gates $\mathbf { z }$ be given by a hard-sigmoid rectification of $\mathbf { s } ^ { 2 }$ , as follows:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\begin{array} { l } { \mathbf { s } \sim q ( \mathbf { s } | \phi ) } \\ { \mathbf { z } = \operatorname* { m i n } ( \mathbf { 1 } , \operatorname* { m a x } ( \mathbf { 0 } , \mathbf { s } ) ) . } \end{array}
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
This would then allow the gate to be exactly zero and, due to the underlying continuous random variable s, we can still compute the probability of the gate being non-zero (active). This is easily obtained by the cumulative distribution function (CDF) ${ \bf { \bar { Q } } } ( \cdot )$ of $\mathbf { s }$ :
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
q ( \mathbf { z } \neq 0 | \phi ) = 1 - Q ( \mathbf { s } \leq 0 | \phi ) ,
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
i.e. it is the probability of the s variable being positive. We can thus smooth the binary Bernoulli gates $\mathbf { z }$ appearing in Eq. 3 by employing continuous distributions in the aforementioned way:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\mathcal { R } ( \tilde { \pmb { \theta } } , \phi ) = \mathbb { E } _ { q ( \{ \pmb { \theta } \} ) } \left[ \frac { 1 } { N } \bigg ( \sum _ { i = 1 } ^ { N } \mathcal { L } \big ( h ( \mathbf { x } _ { i } ; \tilde { \pmb { \theta } } \odot g ( \mathbf { s } ) ) , \mathbf { y } _ { i } \big ) \bigg ) \right] + \lambda \sum _ { j = 1 } ^ { | \theta | } \big ( 1 - Q ( s _ { j } \le 0 | \phi _ { j } ) \big ) ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
Notice that this is a close surrogate to the original objective function in Eq. 3, as we similarly have a cost that explicitly penalizes the probability of a gate being different from zero. Now for continuous
|
| 77 |
+
|
| 78 |
+
distributions $q ( \mathbf { s } )$ that allow for the reparameterization trick (Kingma & Welling, 2014; Rezende et al., 2014) we can express the objective in Eq. 7 as an expectation over a parameter free noise distribution $p ( \epsilon )$ and a deterministic and differentiable transformation $f ( \cdot )$ of the parameters $\phi$ and $\epsilon$
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathcal { R } ( \tilde { \pmb { \theta } } , \phi ) = \mathbb { E } _ { p ( \epsilon ) } \left[ \frac { 1 } { N } \bigg ( \sum _ { i = 1 } ^ { N } \mathcal { L } \big ( h ( \mathbf { x } _ { i } ; \tilde { \pmb { \theta } } \odot g ( f ( \phi , \epsilon ) ) ) , \mathbf { y } _ { i } \big ) \bigg ) \right] + \lambda \sum _ { j = 1 } ^ { | \theta | } \big ( 1 - Q ( s _ { j } \le 0 | \phi _ { j } ) \big ) ,
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
which allows us to make the following Monte Carlo approximation to the (generally) intractable expectation over the noise distribution $p ( \epsilon )$ :
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array} { r l } & { \hat { \mathcal { R } } ( \tilde { \pmb { \theta } } , \phi ) = \displaystyle \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \left( \frac { 1 } { N } \bigg ( \sum _ { i = 1 } ^ { N } \mathcal { L } \big ( h ( \mathbf { x } _ { i } ; \tilde { \pmb { \theta } } \odot \mathbf { z } ^ { ( l ) } ) , \mathbf { y } _ { i } \big ) \bigg ) \right) + \lambda \sum _ { j = 1 } ^ { | \boldsymbol { \theta } | } \big ( 1 - Q ( s _ { j } \le 0 | \phi _ { j } ) \big ) } \\ & { \qquad = \mathcal { L } _ { E } ( \tilde { \pmb { \theta } } , \phi ) + \lambda \mathcal { L } _ { C } ( \phi ) , \quad \mathrm { w h e r e ~ } \ \mathbf { z } ^ { ( l ) } = g \big ( f ( \phi , \epsilon ^ { ( l ) } ) \big ) \ \mathrm { a n d } \ \epsilon ^ { ( l ) } \sim p ( \epsilon ) . } \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
$\mathcal { L } _ { E }$ corresponds to the error loss that measures how well the model is fitting the current dataset whereas $\mathcal { L } _ { C }$ refers to the complexity loss that measures the flexibility of the model. Crucially, the total cost in Eq. 9 is now differentiable w.r.t. $\phi$ , thus enabling for efficient stochastic gradient based optimization, while still allowing for exact zeros at the parameters. One price we pay is that now the gradient of the log-likelihood w.r.t. the parameters $\phi$ of $q ( \mathbf { s } )$ is sparse due to the rectifications; nevertheless this should not pose an issue considering the prevalence of rectified linear units in neural networks. Furthermore, due to the stochasticity at s the hard-sigmoid gate $\mathbf { z }$ is smoothed to a soft version on average, thus allowing for gradient based optimization to succeed, even when the mean of s is negative or larger than one. An example visualization can be seen in Figure 2b. It should be noted that a similar argument was also shown at Bengio et al. (2013), where with logistic noise a rectifier nonlinearity was smoothed to a softplus3 on average.
|
| 91 |
+
|
| 92 |
+
# 2.2 THE HARD CONCRETE DISTRIBUTION
|
| 93 |
+
|
| 94 |
+
The framework described in Section 2.1 gives us the freedom to choose an appropriate smoothing distribution $q ( \mathbf { s } )$ . A choice that seems to work well in practice is the following; assume that we have a binary concrete (Maddison et al., 2016; Jang et al., 2016) random variable $s$ distributed in the $( 0 , 1 )$ interval with probability density $q _ { s } ( s | \phi )$ and cumulative density $Q _ { s } ( s | \phi )$ . The parameters of the distribution are $\phi = ( \log \alpha , \beta )$ , where $\log \alpha$ is the location and $\beta$ is the temperature. We can “stretch” this distribution to the $( \gamma , \zeta )$ interval, with $\gamma < 0$ and $\zeta > 1$ , and then apply a hard-sigmoid on its random samples:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\begin{array} { r l } & { u \sim \mathcal { U } ( 0 , 1 ) , \quad s = \mathrm { S i g m o i d } \big ( ( \log u - \log ( 1 - u ) + \log \alpha ) / \beta \big ) , \quad \bar { s } = s ( \zeta - \gamma ) + \gamma , } \\ & { \qquad z = \operatorname* { m i n } ( 1 , \operatorname* { m a x } ( 0 , \bar { s } ) ) . } \end{array}
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
This would then induce a distribution where the probability mass of $q _ { \bar { s } } ( { \bar { s } } | \phi )$ on the negative values, $Q _ { \bar { s } } ( 0 | \phi )$ , is “folded” to a delta peak at zero, the probability mass on values larger than one, $1 -$ $Q _ { \bar { s } } ( 1 | \phi )$ , is “folded” to a delta peak at one and the original distribution $q _ { \bar { s } } ( { \bar { s } } | \phi )$ is truncated to the (0, 1) range. We provide more information and the density of the resulting distribution at the appendix.
|
| 101 |
+
|
| 102 |
+
Notice that a similar behavior would have been obtained even if we passed samples from any other distribution over the real line through a hard-sigmoid. The only requirement of the approach is that we can evaluate the CDF of $\bar { s }$ at 0 and 1. The main reason for picking the binary concrete is its close ties with Bernoulli r.v.s. It was originally proposed at Maddison et al. (2016); Jang et al. (2016) as a smooth approximation to Bernoulli r.vs, a fact that allows for gradient based optimization of its parameters through the reparametrization trick. The temperature $\beta$ controls the degree of approximation, as with $\beta = 0$ we can recover the original Bernoulli r.v. (but lose the differentiable properties) whereas with $0 < \beta < 1$ we obtain a probability density that concentrates its mass near the endpoints (e.g. as shown in Figure 2a). As a result, the hard concrete also inherits the same theoretical properties w.r.t. the Bernoulli distribution. Furthermore, it can serve as a better approximation of the discrete nature, since it includes $\{ 0 , 1 \}$ in its support, while still allowing for (sub)gradient optimization of its parameters due to the continuous probability mass that connects those two values. We can also view this distribution as a “rounded" version of the original binary concrete, where values larger than $\frac { 1 - \gamma } { \zeta - \gamma }$ are rounded to one whereas values smaller than $\frac { - \gamma } { \zeta - \gamma }$ are rounded to zero. We provide an example visualization of the hard concrete distribution in Figure 2a.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 2: (a) The binary concrete distribution with location $\log \alpha = 0$ and temperature $\beta = 0 . 5$ and the hard concrete equivalent distribution obtained by stretching the concrete distribution to $( \gamma = - 0 . 1 , \zeta = 1 . 1 )$ and then applying a hard-sigmoid. Under this specification the hard concrete distribution assigns, roughly, half of its mass to $\{ 0 , 1 \}$ and the rest to $( 0 , 1 )$ . (b) The expected value of the afforementioned concrete and hard concrete gate as a function of the location $\log \alpha$ , obtained by averaging 10000 samples. We also added the value of the gates obtained by removing the noise entirely. We can see that the noise smooths the hard-sigmoid to a sigmoid on average.
|
| 106 |
+
|
| 107 |
+
The $L _ { 0 }$ complexity loss of the objective in Eq. 9 under the hard concrete r.v. is conveniently expressed as follows:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathcal { L } _ { C } = \sum _ { j = 1 } ^ { | \theta | } \big ( 1 - Q _ { \bar { s } _ { j } } ( 0 | \phi ) \big ) = \sum _ { j = 1 } ^ { | \theta | } \mathrm { S i g m o i d } \big ( \log \alpha _ { j } - \beta \log \frac { - \gamma } { \zeta } \big ) .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
At test time we use the following estimator for the final parameters $\pmb { \theta } ^ { * }$ under a hard concrete gate:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\hat { \bf z } = \mathrm { m i n } ( { \bf 1 } , \mathrm { m a x } ( { \bf 0 } , \mathrm { S i g m o i d } ( \mathrm { l o g } { \pmb \alpha } ) ( \zeta - \gamma ) + \gamma ) ) , \qquad { \pmb \theta } ^ { \ast } = \tilde { \pmb \theta } ^ { \ast } \odot \hat { \bf z } .
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
# 2.3 COMBINING THE $L _ { 0 }$ NORM WITH OTHER NORMS
|
| 120 |
+
|
| 121 |
+
While the $L _ { 0 }$ norm leads to sparse estimates without imposing any shrinkage on $\pmb \theta$ it might still be desirable to impose some form of prior assumptions on the values of $\pmb { \theta }$ with alternative norms, e.g. impose smoothness with the $L _ { 2 }$ norm (i.e. weight decay). In the following we will show how this combination is feasible for the $L _ { 2 }$ norm. The expected $L _ { 2 }$ norm under the Bernoulli gating mechanism can be conveniently expressed as:
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\mathbb { E } _ { q ( \mathbf { z } | \pi ) } \left[ \lVert \pmb { \theta } \rVert _ { 2 } ^ { 2 } \right] = \sum _ { j = 1 } ^ { | \theta | } \mathbb { E } _ { q ( z _ { j } | \pi _ { j } ) } \left[ z _ { j } ^ { 2 } \tilde { \theta } _ { j } ^ { 2 } \right] = \sum _ { j = 1 } ^ { | \theta | } \pi _ { j } \tilde { \theta } _ { j } ^ { 2 } ,
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
where $\pi _ { j }$ corresponds to the success probability of the Bernoulli gate $z _ { j }$ . To maintain a similar expression with our smoothing mechanism, and avoid extra shrinkage for the gates $z _ { j }$ , we can take into account that the standard $L _ { 2 }$ norm penalty is proportional to the negative log density of a zero mean Gaussian prior with a standard deviation of $\sigma = 1$ . We will then assume that the $\sigma$ for each $\theta$ is governed by $z$ in a way that when $z = 0$ we have that $\sigma = 1$ and when $z > 0$ we have that $\sigma = z$ . As a result, we can obtain the following expression for the $L _ { 2 }$ penalty (where $\begin{array} { r } { \hat { \theta } = \frac { \theta } { \sigma } , } \end{array}$ ):
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\begin{array} { l } { \displaystyle \mathbb { E } _ { q ( \mathbf { z } | \phi ) } \left[ \| \hat { \theta } \| _ { 2 } ^ { 2 } \right] = \sum _ { j = 1 } ^ { | \theta | } \left( Q _ { \bar { s } _ { j } } ( 0 | \phi _ { j } ) \frac { 0 } { 1 } + \left( 1 - Q _ { \bar { s } _ { j } } ( 0 | \phi _ { j } ) \right) \mathbb { E } _ { q ( z _ { j } | \phi _ { j } , \bar { s } _ { j } > 0 ) } \left[ \frac { \widetilde { \theta } _ { j } ^ { 2 } \chi _ { j } ^ { 2 } } { \widetilde { \chi } _ { j } ^ { 2 } } \right] \right) } \\ { \displaystyle \qquad = \sum _ { j = 1 } ^ { | \theta | } \left( 1 - Q _ { \bar { s } _ { j } } ( 0 | \phi _ { j } ) \right) \widetilde { \theta } _ { j } ^ { 2 } . } \end{array}
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
# 2.4 GROUP SPARSITY UNDER AN $L _ { 0 }$ NORM
|
| 134 |
+
|
| 135 |
+
For reasons of computational efficiency it is usually desirable to perform group sparsity instead of parameter sparsity, as this can allow for practical computation savings. For example, in neural networks speedups can be obtained by employing a dropout (Srivastava et al., 2014) like procedure with neuron sparsity in fully connected layers or feature map sparsity for convolutional layers (Wen et al., 2016; Louizos et al., 2017; Neklyudov et al., 2017). This is straightforward to do with hard concrete gates; simply share the gate between all of the members of the group. The expected $L _ { 0 }$ and, according to section 2.3, $L _ { 2 }$ penalties in this scenario can be rewritten as:
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
\begin{array} { r l } & { \displaystyle \mathbb { E } _ { q ( \mathbf { z } | \boldsymbol { \phi } ) } \left[ \| \pmb { \theta } \| _ { 0 } \right] = \sum _ { g = 1 } ^ { | G | } | g | \left( 1 - Q ( s _ { g } \leq 0 | \phi _ { g } ) \right) } \\ & { \displaystyle \mathbb { E } _ { q ( \mathbf { z } | \boldsymbol { \phi } ) } \left[ \| \hat { \pmb { \theta } } \| _ { 2 } ^ { 2 } \right] = \sum _ { g = 1 } ^ { | G | } \left( \big ( 1 - Q ( s _ { g } \leq 0 | \phi _ { g } ) \big ) \sum _ { j = 1 } ^ { | g | } \tilde { \theta } _ { j } ^ { 2 } \right) . } \end{array}
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
where $| G |$ corresponds to the number of groups and $| g |$ corresponds to the number of parameters of group $g$ . For all of our subsequent experiments we employed neuron sparsity, where we introduced a gate per input neuron for fully connected layers and a gate per output feature map for convolutional layers. Notice that in the interpretation we adopt the gate is shared across all locations of the feature map for convolutional layers, akin to spatial dropout (Tompson et al., 2015). This can lead to practical computation savings while training, a benefit which is not possible with the commonly used independent dropout masks per spatial location (e.g. as at Zagoruyko & Komodakis (2016)).
|
| 142 |
+
|
| 143 |
+
# 3 RELATED WORK
|
| 144 |
+
|
| 145 |
+
Compression and sparsification of neural networks has recently gained much traction in the deep learning community. The most common and straightforward technique is parameter / neuron pruning (LeCun et al., 1990) according to some criterion. Whereas weight pruning (Han et al., 2015; Ullrich et al., 2017; Molchanov et al., 2017) is in general inefficient for saving computation time, neuron pruning (Wen et al., 2016; Louizos et al., 2017; Neklyudov et al., 2017) can lead to computation savings. Unfortunately, all of the aforementioned methods require training the original dense network thus precluding the benefits we can obtain by having exact sparsity on the computation during training. This is in contrast to our approach where sparsification happens during training, thus theoretically allowing conditional computation to speed-up training (Bengio et al., 2013; 2015).
|
| 146 |
+
|
| 147 |
+
Emulating binary r.v.s with rectifications of continuous r.v.s is not a new concept and has been previously done with Gaussian distributions in the context of generative modelling (Hinton & Ghahramani, 1997; Harva & Kabán, 2007; Salimans, 2016) and with logistic distributions at (Bengio et al., 2013) in the context of conditional computation. These distributions can similarly represent the value of exact zero, while still maintaining the tractability of continuous optimization. Nevertheless, they are sub-optimal when we require approximations to binary r.v.s (as is the case for the $L _ { 0 }$ penalty); we cannot represent the bimodal behavior of a Bernoulli r.v. due to the fact that the underlying distribution is unimodal. Another technique that allows for gradient based optimization of discrete r.v.s are the smoothing transformations proposed by Rolfe (2016). There the core idea is that if a model has binary latent variables, then we can smooth them with continuous noise in a way that allows for reparametrization gradients. There are two main differences with the hard concrete distribution we employ here; firstly, the double rectification of the hard concrete r.v.s allows us to represent the values of exact zero and one (instead of just zero) and, secondly, due to the underlying concrete distribution the random samples from the hard concrete will better emulate binary r.v.s.
|
| 148 |
+
|
| 149 |
+
# 4 EXPERIMENTS
|
| 150 |
+
|
| 151 |
+
We validate the effectiveness of our method on two tasks. The first corresponds to the toy classification task of MNIST using a simple multilayer perceptron (MLP) with two hidden layers of size 300 and 100 (LeCun et al., 1998), and a simple convolutional network, the LeNet-5-Caffe4. The second corresponds to the more modern task of CIFAR 10 and CIFAR 100 classification using Wide Residual Networks (Zagoruyko & Komodakis, 2016). For all of our experiments we set $\gamma = - 0 . 1$ , $\zeta = 1 . 1$ and, following the recommendations from Maddison et al. (2016), set $\beta = 2 / 3$ for the concrete distributions. We initialized the locations $\log \alpha$ by sampling from a normal distribution with a standard deviation of 0.01 and a mean that yields $\frac { \alpha } { \alpha + 1 }$ to be approximately equal to the original dropout rate employed at each of the networks. We used a single sample of the gate $\mathbf { z }$ for each minibatch of datapoints during the optimization, even though this can lead to larger variance in the gradients (Kingma et al., 2015). In this way we show that we can obtain the speedups in training with practical implementations, without actually hurting the overall performance of the network.
|
| 152 |
+
|
| 153 |
+
# 4.1 MNIST CLASSIFICATION AND SPARSIFICATION
|
| 154 |
+
|
| 155 |
+
For these experiments we did no further regularization besides the $L _ { 0 }$ norm and optimization was done with Adam (Kingma & Ba, 2014) using the default hyper-parameters and temporal averaging. We can see at Table 1 that our approach is competitive with other methods that tackle neural network compression. However, it is worth noting that all of these approaches prune the network post-training using thresholds while requiring training the full network. We can further see that our approach minimizes the amount of parameters more at layers where the gates affect a larger part of the cost; for the MLP this corresponds to the input layer whereas for the LeNet5 this corresponds to the first fully connected layer. In contrast, the methods with sparsity inducing priors (Louizos et al., 2017; Neklyudov et al., 2017) sparsify parameters irrespective of that extra cost (since they are only encouraged by the prior to move parameters to zero) and as a result they achieve similar sparsity on all of the layers. Nonetheless, it should be mentioned that we can in principle increase the sparsification on specific layers simply by specifying a separate $\lambda$ for each layer, e.g. by increasing the $\lambda$ for gates that affect less parameters. We provide such results at the $^ { 6 6 } \lambda$ sep.” rows.
|
| 156 |
+
|
| 157 |
+
Table 1: Comparison of the learned architectures and performance of the baselines from Louizos et al. (2017) and the proposed $L _ { 0 }$ minimization under $L _ { 0 _ { h c } }$ . We show the amount of neurons left after pruning with the estimator in Eq. 13 along with the error in the test set after 200 epochs. $N$ denotes the number of training datapoints.
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Network& size</td><td>Method</td><td>Pruned architecture</td><td>Error (%)</td></tr><tr><td rowspan="4">MLP 784-300-100</td><td>Sparse VD (Molchanov et al., 2017)</td><td>512-114-72</td><td>1.8</td></tr><tr><td>BC-GNJ (Louizos et al., 2017)</td><td>278-98-13</td><td>1.8</td></tr><tr><td>BC-GHS S (Louizos et al., 2017)</td><td>311-86-14</td><td>1.8</td></tr><tr><td>Lohe,入=0.1/N</td><td>219-214-100</td><td>1.4</td></tr><tr><td rowspan="7">LeNet-5-Caffe 20-50-800-500</td><td>LOne, X sep.</td><td>266-88-33</td><td>1.8</td></tr><tr><td>Sparse VD (Molchanov et al., 2017) GL (Wen et al., 2016)</td><td>14-19-242-131 3-12-192-500</td><td>1.0</td></tr><tr><td>GD (Srinivas & Babu,2016)</td><td>7-13-208-16</td><td>1.0 1.1</td></tr><tr><td>SBP (Neklyudov et al., 2017)</td><td>3-18-284-283</td><td>0.9</td></tr><tr><td>BC-GNJ (Louizos et al., 2017)</td><td>8-13-88-13</td><td>1.0</td></tr><tr><td>BC-GHS (Louizos et al., 2017)</td><td>5-10-76-16</td><td>1.0</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>L0he,λ=0.1/N LOhe, 入 sep.</td><td>20-25-45-462 9-18-65-25</td><td>0.9 1.0</td></tr></table>
|
| 160 |
+
|
| 161 |
+
To get a better idea about the potential speedup we can obtain in training we plot in Figure 3 the expected, under the probability of the gate being active, floating point operations (FLOPs) as a function of the training iterations. We also included the theoretical speedup we can obtain by using dropout (Srivastava et al., 2014) networks. As we can observe, our $L _ { 0 }$ minimization procedure that is targeted towards neuron sparsity can potentially yield significant computational benefits compared to the original or dropout architectures, with minimal or no loss in performance. We further observe that there is a significant difference in the flop count for the LeNet model between the $\lambda = 0 . 1 / N$ and $\lambda$ sep. settings. This is because we employed larger values for $\lambda$ $( 1 0 / N$ and $0 . 5 / N )$ for the convolutional layers (which contribute the most to the computation) in the $\lambda$ sep. setting. As a result, this setting is more preferable when we are concerned with speedup, rather than network compression (which is affected only by the number of parameters).
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 3: Expected number of floating point operations (FLOPs) during training for the original, dropout and $L _ { 0 }$ regularized networks. These were computed by assuming one flop for multiplication and one flop for addition.
|
| 165 |
+
|
| 166 |
+
# 4.2 CIFAR CLASSIFICATION
|
| 167 |
+
|
| 168 |
+
For WideResNets we apply $L _ { 0 }$ regularization on the weights of the hidden layer of the residual blocks, i.e. where dropout is usually employed. We also employed an $L _ { 2 }$ regularization term as described in Section 2.3 with the weight decay coefficient used in Zagoruyko & Komodakis (2016). For the layers with the hard concrete gates we divided the weight decay coefficient by 0.7 to ensure that a-priori we assume the same length-scale as the 0.3 dropout equivalent network. For optimization we employed the procedure described in Zagoruyko & Komodakis (2016) with a minibatch of 128 datapoints, which was split between two GPUs, and used a single sample for the gates for each GPU.
|
| 169 |
+
|
| 170 |
+
Table 2: Results on the benchmark classification tasks of CIFAR 10 and CIFAR 100. All of the baseline results are taken from Zagoruyko & Komodakis (2016). For the $L _ { 0 }$ regularized WRN we report the median of the error on the test set after 200 epochs over 5 runs.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Network</td><td>CIFAR-10</td><td>CIFAR-100</td></tr><tr><td>original-ResNet-110 (He et al., 2016a)</td><td>6.43</td><td>25.16</td></tr><tr><td>pre-act-ResNet-110 (He et al., 2016b)</td><td>6.37</td><td>1</td></tr><tr><td>WRN-28-10 (Zagoruyko & Komodakis, 2016)</td><td>4.00</td><td>21.18</td></tr><tr><td>WRN-28-10-dropout (Zagoruyko & Komodakis,2016)</td><td>3.89</td><td>18.85</td></tr><tr><td>WRN-28-10-L0hc,入= 0.001/N</td><td>3.83</td><td>18.75</td></tr><tr><td>WRN-28-10-L0hc,λ = 0.002/N</td><td>3.93</td><td>19.04</td></tr></table>
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 4: (a, b) Expected number of FLOPs during training for the dropout and $L _ { 0 }$ regularized WRNs for CIFAR 10 (a) and CIFAR 100 (b). The original WRN is not shown as it has the same practical FLOPs as the dropout equivalent network. (c) Train (dashed) and test (solid) error as a function of the training epochs for dropout and $L _ { 0 }$ WRNs at CIFAR 10.
|
| 176 |
+
|
| 177 |
+
As we can observe at Table 2, with a $\lambda$ of $0 . 0 0 1 / N$ the $L _ { 0 }$ regularized wide residual network improves upon the accuracy of the dropout equivalent network on both CIFAR 10 and CIFAR 100. Furthermore, it simultaneously allows for potential training time speedup due to gradually decreasing the number of FLOPs, as we can see in Figures 4a, 4b. This sparsity is also obtained without any “lag" in convergence speed, as at Figure 4c we observe a behaviour that is similar to the dropout network. Finally, we observe that by further increasing $\lambda$ we obtain a model that has a slight error increase but can allow for a larger speedup.
|
| 178 |
+
|
| 179 |
+
# 5 DISCUSSION
|
| 180 |
+
|
| 181 |
+
We have described a general recipe that allows for optimizing the $L _ { 0 }$ norm of parametric models in a principled and effective manner. The method is based on smoothing the combinatorial problem with continuous distributions followed by a hard-sigmoid. To this end, we also proposed a novel distribution which we coin as the hard concrete; it is a “stretched” binary concrete distribution, the samples of which are transformed by a hard-sigmoid. This in turn better mimics the binary nature of Bernoulli distributions while still allowing for efficient gradient based optimization. In experiments we have shown that the proposed $L _ { 0 }$ minimization process leads to neural network sparsification that is competitive with current approaches while theoretically allowing for speedup in training. We have further shown that this process can provide a good inductive bias and regularizer, as on the CIFAR experiments with wide residual networks we improved upon dropout.
|
| 182 |
+
|
| 183 |
+
As for future work; better harnessing the power of conditional computation for efficiently training very large neural networks with learned sparsity patterns is a potential research direction. It would be also interesting to adopt a full Bayesian treatment over the parameters $\pmb \theta$ , such as the one employed at Molchanov et al. (2017); Louizos et al. (2017). This would then allow for further speedup and compression due to the ability of automatically learning the bit precision of each weight. Finally, it would be interesting to explore the behavior of hard concrete r.v.s at binary latent variable models, since they can be used as a drop in replacement that allow us to maintain both the discrete nature as well as the efficient reparametrization gradient optimization.
|
| 184 |
+
|
| 185 |
+
# ACKNOWLEDGEMENTS
|
| 186 |
+
|
| 187 |
+
We would like to thank Taco Cohen, Thomas Kipf, Patrick Forré, and Rianne van den Berg for feedback on an early draft of this paper.
|
| 188 |
+
|
| 189 |
+
# REFERENCES
|
| 190 |
+
|
| 191 |
+
Hirotogu Akaike. Information theory and an extension of the maximum likelihood principle. In Selected Papers of Hirotugu Akaike, pp. 199–213. Springer, 1998.
|
| 192 |
+
|
| 193 |
+
Matthew James Beal. Variational algorithms for approximate Bayesian inference. 2003.
|
| 194 |
+
|
| 195 |
+
Emmanuel Bengio, Pierre-Luc Bacon, Joelle Pineau, and Doina Precup. Conditional computation in neural networks for faster models. arXiv preprint arXiv:1511.06297, 2015.
|
| 196 |
+
|
| 197 |
+
Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 198 |
+
|
| 199 |
+
Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012.
|
| 200 |
+
|
| 201 |
+
Yarin Gal, Jiri Hron, and Alex Kendall. Concrete dropout. arXiv preprint arXiv:1705.07832, 2017.
|
| 202 |
+
|
| 203 |
+
Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
|
| 204 |
+
|
| 205 |
+
Markus Harva and Ata Kabán. Variational learning for rectified factor analysis. Signal Processing, 87(3):509–527, 2007.
|
| 206 |
+
|
| 207 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016a.
|
| 208 |
+
|
| 209 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pp. 630–645. Springer, 2016b.
|
| 210 |
+
|
| 211 |
+
John R Hershey and Peder A Olsen. Approximating the kullback leibler divergence between gaussian mixture models. In Acoustics, Speech and Signal Processing, 2007. ICASSP 2007. IEEE International Conference on, volume 4, pp. IV–317. IEEE, 2007.
|
| 212 |
+
|
| 213 |
+
Geoffrey E Hinton and Zoubin Ghahramani. Generative models for discovering sparse distributed representations. Philosophical Transactions of the Royal Society of London B: Biological Sciences, 352(1358):1177–1190, 1997.
|
| 214 |
+
|
| 215 |
+
Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
|
| 216 |
+
|
| 217 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 218 |
+
|
| 219 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. International Conference on Learning Representations (ICLR), 2014.
|
| 220 |
+
|
| 221 |
+
Diederik P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems, pp. 2575–2583, 2015.
|
| 222 |
+
|
| 223 |
+
Yann LeCun, John S Denker, and Sara A Solla. Optimal brain damage. In Advances in neural information processing systems 2, NIPS 1989, volume 2, pp. 598–605. Morgan-Kaufmann Publishers, 1990.
|
| 224 |
+
|
| 225 |
+
Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 226 |
+
|
| 227 |
+
Christos Louizos, Karen Ullrich, and Max Welling. Bayesian compression for deep learning. arXiv preprint arXiv:1705.08665, 2017.
|
| 228 |
+
|
| 229 |
+
Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016.
|
| 230 |
+
|
| 231 |
+
Toby J Mitchell and John J Beauchamp. Bayesian variable selection in linear regression. Journal of the American Statistical Association, 83(404):1023–1032, 1988.
|
| 232 |
+
|
| 233 |
+
Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. arXiv preprint arXiv:1402.0030, 2014.
|
| 234 |
+
|
| 235 |
+
Andriy Mnih and Danilo Rezende. Variational inference for monte carlo objectives. In International Conference on Machine Learning, pp. 2188–2196, 2016.
|
| 236 |
+
|
| 237 |
+
Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. arXiv preprint arXiv:1701.05369, 2017.
|
| 238 |
+
|
| 239 |
+
Kirill Neklyudov, Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Structured bayesian pruning via log-normal multiplicative noise. arXiv preprint arXiv:1705.07283, 2017.
|
| 240 |
+
|
| 241 |
+
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of the 31th International Conference on Machine Learning, ICML 2014, Beijing, China, 21-26 June 2014, pp. 1278–1286, 2014.
|
| 242 |
+
|
| 243 |
+
Jason Tyler Rolfe. Discrete variational autoencoders. arXiv preprint arXiv:1609.02200, 2016.
|
| 244 |
+
|
| 245 |
+
Tim Salimans. A structured variational auto-encoder for learning deep hierarchies of sparse features. arXiv preprint arXiv:1602.08734, 2016.
|
| 246 |
+
|
| 247 |
+
Gideon Schwarz et al. Estimating the dimension of a model. The annals of statistics, 6(2):461–464, 1978.
|
| 248 |
+
|
| 249 |
+
Suraj Srinivas and R Venkatesh Babu. Generalized dropout. arXiv preprint arXiv:1611.06791, 2016.
|
| 250 |
+
|
| 251 |
+
Suraj Srinivas, Akshayvarun Subramanya, and R Venkatesh Babu. Training sparse neural networks. In Computer Vision and Pattern Recognition Workshops (CVPRW), 2017 IEEE Conference on, pp. 455–462. IEEE, 2017.
|
| 252 |
+
|
| 253 |
+
Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of machine learning research, 15(1):1929–1958, 2014.
|
| 254 |
+
|
| 255 |
+
Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), pp. 267–288, 1996.
|
| 256 |
+
|
| 257 |
+
Jonathan Tompson, Ross Goroshin, Arjun Jain, Yann LeCun, and Christoph Bregler. Efficient object localization using convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 648–656, 2015.
|
| 258 |
+
|
| 259 |
+
George Tucker, Andriy Mnih, Chris J Maddison, and Jascha Sohl-Dickstein. Rebar: Low-variance, unbiased gradient estimates for discrete latent variable models. arXiv preprint arXiv:1703.07370, 2017.
|
| 260 |
+
|
| 261 |
+
Karen Ullrich, Edward Meeds, and Max Welling. Soft weight-sharing for neural network compression. ICLR, 2017.
|
| 262 |
+
|
| 263 |
+
Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2074–2082, 2016.
|
| 264 |
+
|
| 265 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 266 |
+
|
| 267 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
|
| 268 |
+
|
| 269 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
|
| 270 |
+
|
| 271 |
+
# APPENDIX
|
| 272 |
+
|
| 273 |
+
# A RELATION TO VARIATIONAL INFERENCE
|
| 274 |
+
|
| 275 |
+
The objective function described in Eq. 3 is in fact a special case of a variational lower bound over the parameters of the network under a spike and slab (Mitchell & Beauchamp, 1988) prior. The spike and slab distribution is the golden standard in sparsity as far as Bayesian inference is concerned and it is defined as a mixture of a delta spike at zero and a continuous distribution over the real line (e.g. a standard normal):
|
| 276 |
+
|
| 277 |
+
$$
|
| 278 |
+
p ( z ) = { \mathrm { B e r n o u l l i } } ( \pi ) , \qquad p ( \theta | z = 0 ) = \delta ( \theta ) , \qquad p ( \theta | z = 1 ) = { \mathcal { N } } ( \theta | 0 , 1 ) .
|
| 279 |
+
$$
|
| 280 |
+
|
| 281 |
+
Since the true posterior distribution over the parameters under this prior is intractable, we will use variational inference (Beal, 2003). Let $q ( \theta , z )$ be a spike and slab approximate posterior over the parameters $\theta$ and gate variables $z$ , where we assume that it factorizes over the dimensionality of the parameters $\theta$ . It turns out that we can write the following variational free energy under the spike and slab prior and approximate posterior over a parameter vector $\pmb \theta$ :
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
\begin{array} { l } { \displaystyle \mathcal { F } = - \mathrm { E } _ { q ( z ) q ( \theta , z ) } \big [ \log p ( D | \theta ) \big | \Big ] + \displaystyle \sum _ { i = 1 } ^ { \lfloor \theta \rfloor } K L ( q ( z _ { i } ) ) \big | | p ( z _ { i } ) \big ) + } \\ { \displaystyle \quad \quad + \sum _ { j = 1 } ^ { \lfloor \theta \rfloor } \big ( q ( z _ { j } = 1 ) K L ( q ( \theta _ { j } | z _ { j } = 1 ) | | p ( \theta _ { j } | z _ { j } = 1 ) ) + } \\ { \displaystyle \quad \quad + q ( z _ { j } = 0 ) K L ( q ( \theta _ { j } | z _ { j } = 0 ) | | p ( \theta _ { j } | z _ { j } = 0 ) ) \big ) } \\ { = - \mathrm { E } _ { q ( z ) q ( \theta _ { z } ) } \big [ \log p ( D | \theta ) \big | \Big ] + \displaystyle \sum _ { j = 1 } ^ { \lfloor \theta \rfloor } K L ( q ( z _ { j } ) | | p ( z _ { j } ) ) + } \\ { \displaystyle \quad \quad + \sum _ { j = 1 } ^ { \lfloor \theta \rfloor } q ( z _ { j } = 1 ) K L ( q ( \theta _ { j } | z _ { j } = 1 ) | | p ( \theta _ { j } | z _ { j } = 1 ) ) , } \end{array}
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
where the last step is due to $K L ( q ( \theta _ { j } | z _ { j } = 0 ) | | p ( \theta _ { j } | z _ { j } = 0 ) ) = 0 ^ { 5 }$ . The term that involves $K L ( q ( z _ { j } ) | | p ( z _ { j } ) )$ corresponds to the KL-divergence from the Bernoulli prior $p ( z _ { j } )$ to the Bernoulli approximate posterior $q ( z _ { j } )$ and $K L ( q ( \theta _ { j } | z _ { j } = 1 ) | | p ( \theta _ { j } | z _ { j } = 1 ) )$ can be interpreted as the “code cost” or else the amount of information the parameter $\theta _ { j }$ contains about the data $\mathcal { D }$ , measured by the KL-divergence from the prior $p ( \theta _ { j } | z _ { j } = 1 )$ ).
|
| 288 |
+
|
| 289 |
+
Now consider making the assumption that we are optimizing, rather than integrating, over $\pmb { \theta }$ and further assuming that $K L ( q ( \theta _ { j } | z _ { j } = 1 ) | | p ( \theta _ { j } | z _ { j } = \bar { 1 } ) ) = \lambda$ . We can justify this assumption from an empirical Bayesian procedure: there is a hypothetical prior for each parameter $p ( \theta _ { j } | z _ { j } = 1 )$ that adapts to $q ( \bar { \theta } _ { j } | z _ { j } = 1 )$ ) in a way that results into needing, approximately, $\lambda$ nats to transform $p ( \theta _ { j } | z _ { j } = 1 )$ to that particular $q ( \theta _ { j } | z _ { j } = 1 )$ . Those $\lambda$ nats are thus the amount of information the $q ( \theta _ { j } | z _ { j } = 1 )$ ) can encode about the data had we used that $p ( \theta _ { j } | z _ { j } = 1 )$ as the prior. Notice that under this view we can consider $\lambda$ as the amount of flexibility of that hypothetical prior; with $\lambda = 0$ we have a prior that is flexible enough to represent exactly $q ( \theta _ { j } | z _ { j } = 1 )$ , thus resulting into no code cost and possible overfitting. Under this assumption the variational free energy can be re-written as:
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\begin{array} { l } { \displaystyle \mathcal { F } = - \mathbb { E } _ { q ( \mathbf { z } ) } [ \log p ( \mathcal { D } | \widetilde { \pmb { \theta } } \odot \mathbf { z } ) ] + \sum _ { j = 1 } ^ { | \theta | } K L ( q ( z _ { j } ) | | p ( z _ { j } ) ) + \lambda \sum _ { j = 1 } ^ { | \theta | } q ( z _ { j } = 1 ) } \\ { \displaystyle \geq - \mathbb { E } _ { q ( \mathbf { z } ) } [ \log p ( \mathcal { D } | \widetilde { \pmb { \theta } } \odot \mathbf { z } ) ] + \lambda \sum _ { j = 1 } ^ { | \theta | } \pi _ { j } , } \end{array}
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
where $\tilde { \pmb { \theta } }$ corresponds to the optimized $\pmb { \theta }$ and the last step is due to the positivity of the KL-divergence. Now by taking the negative log-probability of the data to be equal to the loss $\mathcal { L } ( \cdot )$ of Eq. 1 we see that Eq. 22 is the same as Eq. 3. Note that in case that we are interested over the uncertainty of the gates $\mathbf { z }$ , we should optimize Eq. 21, rather than Eq. 22, as this will properly penalize the entropy of $q ( \mathbf { z } )$ . Furthermore, Eq. 21 also allows for the incorporation of prior information about the behavior of the gates (e.g. gates being active $10 \%$ of the time, on average). We have thus shown that the expected $L _ { 0 }$ minimization procedure is in fact a close surrogate to a variational bound involving a spike and slab distribution over the parameters and a fixed coding cost for the parameters when the gates are active.
|
| 296 |
+
|
| 297 |
+
# B THE HARD CONCRETE DISTRIBUTION
|
| 298 |
+
|
| 299 |
+
As mentioned in the main text, the hard concrete is a straightforward modification of the binary concrete (Maddison et al., 2016; Jang et al., 2016); let $q _ { s } ( s | \phi )$ be the probability density function
|
| 300 |
+
|
| 301 |
+
(pdf) and $Q _ { s } ( s | \phi )$ the cumulative distribution function (CDF) of a binary concrete random variable $s$ :
|
| 302 |
+
|
| 303 |
+
$$
|
| 304 |
+
\begin{array} { l } { { q _ { s } ( s | \phi ) = \displaystyle \frac { \beta \alpha s ^ { - \beta - 1 } ( 1 - s ) ^ { - \beta - 1 } } { ( \alpha s ^ { - \beta } + ( 1 - s ) ^ { - \beta } ) ^ { 2 } } , \qquad } } \\ { { Q _ { s } ( s | \phi ) = \mathrm { S i g m o i d } ( ( \log s - \log ( 1 - s ) ) \beta - \log \alpha ) . } } \end{array}
|
| 305 |
+
$$
|
| 306 |
+
|
| 307 |
+
Now by stretching this distribution to the $( \gamma , \zeta )$ interval, with $\gamma < 0$ and $\zeta > 1$ we obtain ${ \bar { s } } =$ $s ( \zeta - \gamma ) + \gamma$ with the following pdf and CDF:
|
| 308 |
+
|
| 309 |
+
$$
|
| 310 |
+
q _ { \bar { s } } ( \bar { s } | \phi ) = \frac { 1 } { | \zeta - \gamma | } q _ { s } \biggl ( \frac { \bar { s } - \gamma } { \zeta - \gamma } \biggr | \phi \biggr ) , \qquad Q _ { \bar { s } } ( \bar { s } | \phi ) = Q _ { s } \biggl ( \frac { \bar { s } - \gamma } { \zeta - \gamma } \biggr | \phi \biggr ) .
|
| 311 |
+
$$
|
| 312 |
+
|
| 313 |
+
and by further rectifying $\bar { s }$ with the hard-sigmoid, $z = \operatorname* { m i n } ( 1 , \operatorname* { m a x } ( 0 , \bar { s } ) )$ , we obtain the following distribution over $z$ :
|
| 314 |
+
|
| 315 |
+
$$
|
| 316 |
+
q ( z | \phi ) = Q _ { \bar { s } } ( 0 | \phi ) \delta ( z ) + ( 1 - Q _ { \bar { s } } ( 1 | \phi ) ) \delta ( z - 1 ) + ( Q _ { \bar { s } } ( 1 | \phi ) - Q _ { \bar { s } } ( 0 | \phi ) ) q _ { \bar { s } } ( z | \bar { s } \in ( 0 , 1 ) , \phi ) ,
|
| 317 |
+
$$
|
| 318 |
+
|
| 319 |
+
which is composed by a delta peak at zero with probability $Q _ { \bar { s } } ( 0 | \phi )$ , a delta peak at one with probability $1 \bar { - Q } _ { \bar { s } } ( 1 | \bar { \phi } )$ , and a truncated version of $q _ { \bar { s } } ( { \bar { s } } | \phi )$ in the $( 0 , 1 )$ range.
|
| 320 |
+
|
| 321 |
+
# C NEGATIVE KL-DIVERGENCE FOR HARD CONCRETE DISTRIBUTIONS
|
| 322 |
+
|
| 323 |
+
In case th 21 is to be optimized with a hard concrete $q ( z )$ then we have to compute the KL-divergence from a prior $p ( z )$ to $q ( z )$ . It is necessary for the prior $p ( z )$ to have the same support as $q ( z )$ in order for the KL-divergence to be valid; as a result we can let the prior $p ( z )$ similarly be a hard-sigmoid transformation of an arbitrary continuous distribution $p ( \bar { s } )$ with CDF $P _ { \bar { s } } ( \bar { s } )$ :
|
| 324 |
+
|
| 325 |
+
$$
|
| 326 |
+
p ( z ) = P _ { \bar { s } } ( 0 ) \delta ( z ) + ( 1 - P _ { \bar { s } } ( 1 ) ) \delta ( z - 1 ) + ( P _ { \bar { s } } ( 1 ) - P _ { \bar { s } } ( 0 ) ) p _ { \bar { s } } ( z | \bar { s } \in ( 0 , 1 ) )
|
| 327 |
+
$$
|
| 328 |
+
|
| 329 |
+
Since both $q ( z )$ and $p ( z )$ are mixtures with the same number of components we can use the chain rule of relative entropy (Cover & Thomas, 2012; Hershey & Olsen, 2007) in order to compute the KL-divergence:
|
| 330 |
+
|
| 331 |
+
$$
|
| 332 |
+
\begin{array} { c } { { \displaystyle K L ( q ( z ) | | p ( z ) ) = Q _ { \bar { s } } ( 0 ) \log \frac { Q _ { \bar { s } } ( 0 ) } { P _ { \bar { s } } ( 0 ) } + ( 1 - Q _ { \bar { s } } ( 1 ) ) \log \frac { 1 - Q _ { \bar { s } } ( 1 ) } { 1 - P _ { \bar { s } } ( 1 ) } + } } \\ { { + \left( Q _ { \bar { s } } ( 1 ) - Q _ { \bar { s } } ( 0 ) \right) \mathbb { E } _ { q _ { \bar { s } } ( z | \bar { s } \in ( 0 , 1 ) ) } [ \log q _ { \bar { s } } ( z ) - \log p _ { \bar { s } } ( z ) ] , } } \end{array}
|
| 333 |
+
$$
|
| 334 |
+
|
| 335 |
+
where $\bar { s }$ corresponds to the the pre-rectified variable. Notice that in case that the integral under the truncated distribution $q ( \bar { s } | \bar { s } \in ( \bar { 0 } , 1 ) )$ is not available in closed form we can still obtain a Monte Carlo estimate by sampling the truncated distribution, on e.g. a $( \gamma , \zeta )$ interval, via the inverse transform method:
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
u \sim \mathcal { U } ( 0 , 1 ) , \qquad z = Q _ { \bar { s } } ^ { - 1 } \bigl ( Q _ { \bar { s } } ( \gamma ) + u ( Q _ { \bar { s } } ( \zeta ) - Q _ { \bar { s } } ( \gamma ) ) \bigr ) ,
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
where $Q _ { \bar { s } } ^ { - 1 } ( \cdot )$ corresponds to the quantile function and $Q _ { \bar { s } } ( \cdot )$ to the CDF of the random variable $\bar { s }$ . Furthermore, it should be mentioned that $K L ( q ( z ) | | p ( z ) ) \neq K L ( q ( \bar { s } ) | | p ( \bar { s } ) )$ , since the rectifications are not invertible transformations.
|
md/train/H1efEp4Yvr/H1efEp4Yvr.md
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GLOBAL CONCAVITY AND OPTIMIZATION IN A CLASS OF DYNAMIC DISCRETE CHOICE MODELS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Discrete choice models with unobserved heterogeneity are commonly used Econometric models for dynamic Economic behavior which have been adopted in practice to predict behavior of individuals and firms from schooling and job choices to strategic decisions in market competition. These models feature optimizing agents who choose among a finite set of options in a sequence of periods and receive choice-specific payoffs that depend on both variables that are observed by the agent and recorded in the data and variables that are only observed by the agent but not recorded in the data. Existing work in Econometrics assumes that optimizing agents are fully rational and requires finding a functional fixed point to find the optimal policy. We show that in an important class of discrete choice models the value function is globally concave in the policy. That means that simple algorithms that do not require fixed point computation, such as the policy gradient algorithm, globally converge to the optimal policy. This finding can both be used to relax behavioral assumption regarding the optimizing agents and to facilitate Econometric analysis of dynamic behavior. In particular, we demonstrate significant computational advantages in using a simple implementation policy gradient algorithm over existing “nested fixed point” algorithms used in Econometrics.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Dynamic discrete choice model with unobserved heterogeneity is, arguably, the most popular model that is currently used for Econometric analysis of dynamic behavior of individuals and firms in Economics and Marketing (e.g. see surveys in Eckstein and Wolpin (1989), Dubé et al. (2002) Abbring and Heckman (2007), Aguirregabiria and Mira (2010)). Even most recent Econometric papers on single-agent dynamic decision-making use this setup to showcase their results (e.g. Arcidiacono and Miller, 2011; Aguirregabiria and Magesan, 2016; Müller and Reich, 2018).In this model, pioneered in Rust (1987), the agent chooses between a discrete set of options (typically 2) in a sequence of discrete time periods to maximize the expected cumulative discounted payoff. The reward in each period is a function of the state variable which follows a Markov process and is observed in the data and also a function of an idiosyncratic random variable that is only observed by the agent but is not reported in the data. The unobserved idiosyncratic component is designed to reflect heterogeneity of agents that may value the same choice differently.
|
| 12 |
+
|
| 13 |
+
Despite significant empirical success in prediction of dynamic economic behavior under uncertainty, dynamic discrete choice models frequently lead to seemingly unrealistic optimization problems that economic agents need to solve. For instance, Hendel and Nevo (2006) features an elaborate functional fixed point problem with constraints, which is computationally intensive, especially in continuous state spaces, for consumers to buy laundry detergent in the supermarket. Common approach for this functional fixed point problem is value function iteration (See Section 2.3 for more discussion).
|
| 14 |
+
|
| 15 |
+
At the same time, rich literature on Markov Decision Processes (cf. Sutton and Barto, 2018) have developed several effective optimization algorithms, such as the policy gradient algorithm and its variants, that do not require solving for a functional fixed point. However, the drawback of the policy gradient is that the value function in a generic Markov Decision problem is not concave in the policy. This means that gradient-based algorithms have no guarantees for global convergence for a generic MDP. While for some specific and simple models where closed-form characterizations exist, the convergence results are shown by model-specific technique which is hard to generalize (e.g. Fazel et al., 2018, for linear quadratic regulator).
|
| 16 |
+
|
| 17 |
+
In this paper our main goal is to resolve the dichotomy in empirical social science literature that the rationality of consumers requires for them to be able to solve the functional fixed point problem which is computationally intensive. Our main theoretic contribution is the proof that, in the class of dynamic discrete choice models with unobserved heterogeneity, the value function of the optimizing agent is globally concave in the policy. This implies that a large set of policy gradient algorithms that have a modest computational power requirement for the optimizing agents have a fast convergence guarantee in our considered class of dynamic discrete choice models. The importance of this result is twofold.
|
| 18 |
+
|
| 19 |
+
First, it gives a promise that seemingly complicated dynamic optimization problems faced by consumers can be solved by relatively simple algorithms that do not require fixed point computation or functional optimization. This means that the policy gradient-style methods have an important behavioral interpretation. As a result, consumer behavior following policy gradient can serve as a behavioral assumption for estimating consumer preferences from data which is more natural for consumer choice settings than other assumptions that have been used in the past for estimation of preferences (e.g. -regret learning in Nekipelov et al. (2015)). Second, more importantly, our result showing fast convergence of the policy gradient algorithm makes it an attractive alternative to the search for the functional fixed point in this class of problems. While the goal of the Econometric analysis of the data from dynamically optimizing consumers is to estimate consumer preferences by maximizing the likelihood function, it requires to sequentially solve the dynamic optimization problem for each value of utility parameters along the parameter search path. Existing work in Economics prescribes to use fixed point iterations for the value function to solve the dynamic optimization problem (see Rust (1987), Aguirregabiria and Mira (2007)). The replacement of the fixed point iterations with the policy gradient method significantly speeds up the maximization of the likelihood function. This makes the policy gradient algorithm our recommended approach for use in Econometric analysis, and establishes practical relevance of many newer reinforcement learning algorithms from behavioral perspective for social sciences.
|
| 20 |
+
|
| 21 |
+
# 2 PRELIMINARIES
|
| 22 |
+
|
| 23 |
+
In this section, we introduce the concepts of the Markov decision process (MDP) with choice-specific payoff heterogeneity, the conditional choice probability (CCP) representation and the policy gradient algorithm.
|
| 24 |
+
|
| 25 |
+
# 2.1 MARKOV DECISION PROCESS
|
| 26 |
+
|
| 27 |
+
A discrete-time Markov decision process (MDP) with choice-specific heterogeneity is defined as a 5-tuple $\langle S , { \mathcal { A } } , r , \epsilon , { \mathcal { P } } , \beta \rangle$ , where $s$ is compact convex state space with $\mathrm { d i a m } ( \breve { S } ) \leq \breve { \bar { S } } < \infty$ , $\mathcal { A }$ is the set of actions, $r : \mathcal { S } \times \mathcal { A } \to \mathbb { R } _ { + }$ is the reward function, such that $r ( s , a )$ is the immediate non-negative reward for the state-action pair $( s , a )$ , $\epsilon$ are independent random variables, $\mathcal { P }$ is a Markov transition model where where $p ( s ^ { \prime } | s , a )$ defines the transition density between state $s$ and $s ^ { \prime }$ under action $a$ , and $\beta \in [ 0 , 1 )$ is the discount factor for future payoff. We assume that random variables $\epsilon$ are observed by the optimizing agent and not recorded in the data. These variables reflect idiosyncratic differences in preferences of different optimizing agents over choices. In the following discussion we refer to these variables as “random choice-specific shocks."
|
| 28 |
+
|
| 29 |
+
In each period ${ t = 1 , 2 , \ldots , \infty }$ , the nature realizes the current state $s _ { t }$ based on the Markov transition $\mathcal { P }$ given the state-action pair $( s _ { t - 1 } , a _ { t - 1 } )$ in the previous period $t - 1$ , and the choice-specific shocks $\epsilon _ { t } \overset { \mathbf { \bar { \rho } } } { = } \{ \epsilon _ { t , a } \} _ { a \in \mathcal { A } }$ drawn i.i.d. from distribution $\epsilon$ . The optimizing agent chooses an action $a \in { \mathcal { A } }$ , and her current period payoff is sum of the immediate reward and the choice-specific shock, i.e., $\boldsymbol { \epsilon } _ { t , a }$ . Given initial state $s _ { 1 }$ , the agent’s long-term payoff is $\begin{array} { r } { \mathbf { E } _ { \epsilon _ { 1 } , s _ { 2 } , \epsilon _ { 2 } , \dots } \bigl [ \sum _ { t = 1 } ^ { \infty } \beta ^ { t - 1 } r ( s _ { t } , a _ { t } ) + \epsilon _ { t , a _ { t } } \bigr ] } \end{array}$ $r ( s , a ) +$ This expression makes it clear that random shocks $\epsilon$ play a crucial role in this model by allowing us to define the ex ante value function of the optimizing agent which reflects the expected reward from agent’s choices before the agent observes realization of $\epsilon _ { t }$ . When the distribution of shocks $\epsilon$ is sufficiently smooth (differentiable), the corresponding ex ante value function is smooth (differentiable)
|
| 30 |
+
|
| 31 |
+
as well. This allows us to characterize the impact of agent’s policy on the expected value by considering functional derivatives of the value function with respect to the policy.
|
| 32 |
+
|
| 33 |
+
In the remainder of the paper, we rely on the following assumptions.
|
| 34 |
+
|
| 35 |
+
Assumption 2.1. The state space $s$ is compact in $\mathbb { R }$ and the action space $\mathcal { A }$ is binary, i.e., $\mathcal { A } = \{ 0 , 1 \}$
|
| 36 |
+
|
| 37 |
+
Assumption 2.2. For all states s, the immediate reward $r ( s , 0 )$ for the state-action pair $( s , 0 )$ is zero i.e., $r ( s , 0 ) = 0$ , and the immediate reward $r ( s , 1 )$ for the state-action pair $( s , 1 )$ is bounded between $[ R _ { \mathrm { m i n } } , R _ { \mathrm { m a x } } ]$ .
|
| 38 |
+
|
| 39 |
+
Assumption 2.3. Choice-specific shocks are Type I Extreme Value random variables with location parameter $O$ (cf. Hotz and Miller, 1993) which are independent over choices and time periods.
|
| 40 |
+
|
| 41 |
+
Assumption 2.1, 2.2, 2.3 are present in most of the papers on dynamic decision-making in economics, marketing and finance, (e.g. Dubé et al., 2002; Aguirregabiria and Mira, 2010; Arcidiacono and Miller, 2011; Aguirregabiria and Magesan, 2016; Müller and Reich, 2018)
|
| 42 |
+
|
| 43 |
+
The policy and the value function A stationary Markov policy is a function $\sigma : \mathcal { S } \times \mathbb { R } ^ { A } \to \mathcal { A }$ which maps the current state $s$ and choice-specific shock $\epsilon$ to an action. In our further discussion we will show that there is a natural more restricted definition of the set of all feasible policies in this model.
|
| 44 |
+
|
| 45 |
+
Given any stationary Markov policy $\sigma$ , the value function $V _ { \sigma } : { \mathcal { S } } \mathbb { R }$ is a mapping from the initial state to the long-term payoff under policy $\sigma$ , i.e.,
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
V _ { \sigma } ( s _ { 1 } ) = \mathbf { E } _ { \epsilon _ { 1 } , s _ { 2 } , \epsilon _ { 2 } , \ldots } \left[ \sum _ { t = 1 } ^ { \infty } \beta ^ { t - 1 } \left\{ r ( s _ { t } , \sigma ( s _ { t } , \epsilon _ { t } ) ) + \epsilon _ { t , \sigma ( s _ { t } , \epsilon _ { t } ) } \right\} \right] .
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
Since the reward is non-negative and bounded, and the discount $\beta \in [ 0 , 1 )$ , value function $V _ { \sigma }$ is well-defined and the optimal policy $\tilde { \sigma }$ (i.e., $V _ { \tilde { \sigma } } ( s ) \geq V _ { \sigma } ( s )$ for all policies $\sigma$ and states $s$ ) exists. Furthermore, the following Bellman equation holds
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
V _ { \sigma } ( s ) = \mathbf { E } _ { \epsilon } \bigl [ r ( s , \sigma ( s , \epsilon ) ) + \epsilon _ { \sigma ( s , \epsilon ) } + \beta \mathbf { E } _ { s ^ { \prime } } [ V _ { \sigma } ( s ^ { \prime } ) | s , \sigma ( s , \epsilon ) ] \bigr ] \qquad \mathrm { f o r ~ a l l ~ p o l i c i e s ~ } \sigma _ { \sigma ( s , \epsilon ) } .
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
# 2.2 CONDITIONAL CHOICE PROBABILITY REPRESENTATION
|
| 58 |
+
|
| 59 |
+
Based on the Bellman equation (1) evaluated at the optimal policy, the optimal Conditional Choice Probability $\tilde { \delta } ( a | s )$ (i.e., the probability of choosing action $a$ given state $s$ in the optimal policy $\tilde { \sigma }$ ) can be defined as
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\begin{array} { r } { \tilde { \delta } ( a | s ) = \mathbf { E } _ { \varepsilon } [ \mathbb { I } \{ r ( s , a ) + \epsilon _ { a } + \beta \mathbf { E } _ { s ^ { \prime } } [ V _ { \overline { { \sigma } } } ( s ^ { \prime } ) | s , a ] \geq r ( s , a ^ { \prime } ) + \epsilon _ { a ^ { \prime } } + \beta \mathbf { E } _ { s ^ { \prime } } [ V _ { \overline { { \sigma } } } ( s ^ { \prime } ) | s , a ^ { \prime } ] , \forall a ^ { \prime } \} ] } \end{array}
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
The optimal policy $\tilde { \sigma }$ can, therefore, be equivalently characterized by threshold function ${ \tilde { \pi } } ( s , a ) =$ $r ( s , a ) + \beta \bar { \bf E _ { \tilde { s } ^ { \prime } } } [ \bar { V _ { \tilde { \sigma } } } ( s ^ { \prime } ) \vert s , a ]$ , such that the optimizing agent chooses action $a ^ { \dagger }$ which maximizes the sum of the threshold and the choice-specific shock, i.e., $a ^ { \dagger } = \mathrm { a r g m a x } _ { a } \{ \tilde { \pi } ( s , a ) + \epsilon _ { a } \}$ . Similarly, all non-optimal policies can be characterized by the corresponding threshold functions denoted $\pi$ . Under Assumption 2.3 the conditional choice probability $\delta$ can be explicitly expressed in terms of the respective threshold $\pi$ as (cf. Rust, 1996)
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { r } { \delta ( { a } | s ) = \exp ( \pi ( s , a ) ) \bigg / \left( \sum _ { a ^ { \prime } \in A } \exp ( \pi ( s , a ^ { \prime } ) ) \right) . } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
We note that this expression induces a one-to-one mapping from the thresholds to the conditional choice probabilities. Therefore, all policies are fully characterized by their respective conditional choice probabilities. For notational simplicity, since we consider the binary action space $\mathcal { A } = \{ 0 , 1 \}$ , and the reward $r ( s , 0 )$ is normalized to 0 we denote the immediate reward $r ( s , 1 )$ as $r ( s )$ ; denote the conditional choice probability $\delta ( 0 | s )$ as $\delta ( s )$ ; and denote $\pi ( s , 1 )$ as $\pi ( s )$ .
|
| 72 |
+
|
| 73 |
+
In the subsequent discussion given that the characterization of policy $\sigma$ via its threshold is equivalent to its characterization by conditional choice probability $\delta$ , we interchangeably refer to $\delta$ as the “policy." Then we rewrite the Bellman equation for a given policy $\delta$ as
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { c } { { V _ { \delta } ( s ) = \left( 1 - \delta ( s ) \right) r ( s ) - \delta ( s ) \log { ( \delta ( s ) ) } } } \\ { { - \left( 1 - \delta ( s ) \right) \log ( 1 - \delta ( s ) ) + \beta \mathbf { E } _ { \epsilon , s ^ { \prime } } \Big [ V _ { \delta } ( s ) ( s ^ { \prime } ) \Big | s \Big ] } } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
Now we make two additional assumptions that are compatible with standard assumptions in the Econometrics literature.
|
| 80 |
+
|
| 81 |
+
Assumption 2.4. For all states $s \in S _ { i }$ , the conditional distribution of the next period Markov state $p ( \cdot | s , 1 )$ first-order stochastically dominates distribution $p ( \cdot | s , 0 )$ , i.e., for all $\hat { s } \in \ S$ , $\mathbf { P r } _ { s ^ { \prime } } [ s ^ { \prime } \leq \hat { s } | s , 1 ] \leq \mathbf { P r } _ { s ^ { \prime } } [ s ^ { \prime } \leq \hat { s } | s , 0 ]$ .
|
| 82 |
+
|
| 83 |
+
Assumption 2.5. Under the optimal policy $\tilde { \delta }$ , the value function is non-decreasing in states, i.e., $V _ { \tilde { \delta } } ( s ) \bar { \leq } V _ { \tilde { \delta } } ( s ^ { \prime } )$ for all $s , s ^ { \prime } \in S$ s.t. $s < s ^ { \prime }$ .
|
| 84 |
+
|
| 85 |
+
Consider a myopic policy $\bar { \delta } ( s ) = ( \exp ( r ( s ) ) + 1 ) ^ { - 1 }$ which uses threshold $\bar { \pi } ( s ) = r ( s )$ . This policy corresponds to agent optimizing the immediate reward without considering how current actions impact future rewards. Under Assumption 2.4 and Assumption 2.5, the threshold for optimal policy is at least the threshold of myopic policy, i.e., $\tilde { \pi } ( s ) \geq \bar { \pi } ( s )$ . Hence, Lemma 2.1 holds.
|
| 86 |
+
|
| 87 |
+
Lemma 2.1. The optimal policy $\tilde { \delta }$ chooses action $O$ with weakly lower probability than the myopic policy $\bar { \delta }$ in all states $s \in S$ , i.e., $\tilde { \delta } ( s ) \leq \bar { \delta } ( s )$ .
|
| 88 |
+
|
| 89 |
+
# 2.3 MDP IN ECONOMICS AND POLICY GRADIENT
|
| 90 |
+
|
| 91 |
+
Our motivation in this paper comes from empirical work in Economics and Marketing where optimizing agents are consumers or small firms who make dynamic decisions while observing the current state $s$ and the reward $r ( s , a )$ for their choice $a$ . These agents often have limited computational power making it difficult for them to solve the Bellman equation to find the optimal policy. They also may have only sample access to the distribution of Markov transition which further complicates the computation of the optimal policy. In this context we contrast the value function iteration method which is based on solving the fixed point problem induced by the Bellman equation and the policy gradient method.
|
| 92 |
+
|
| 93 |
+
Value function iteration In the value function iterations, e.g., discussed in Jaksch et al. (2010); Haskell et al. (2016), the exact expectation in the Bellman equation (1) is replaced by an empirical estimate and then functional iteration uses the empirical Bellman equation to find the fixed point, i.e., the optimal policy. Under certain assumptions on MDPs, one can establish convergence guarantees for the value function iterations, e.g., Jaksch et al. (2010); Haskell et al. (2016). However, to run these iterations may require significant computation power which may not be practical when optimizing agents are consumers or small firms.
|
| 94 |
+
|
| 95 |
+
Policy gradient In contrast to value function iterations, policy gradient algorithm and its variations are model-free sample-based methods. At a high level, policy gradient parametrizes policies $\{ \delta _ { \theta } \} _ { \theta \in \Theta }$ by $\theta \in \Theta$ and computes the gradient of the value function with respect to the current policy $\delta _ { \theta }$ and update the policy in the direction of the gradient, i.e., $\theta \theta + \alpha \nabla _ { \theta } V _ { \delta _ { \theta } }$ . Though the individuals considered in the Economic MDP models may not compute the exact gradient with respect to a policy due to having only sample access to the Markov transition, previous work has provided approaches to produce an unbiased estimator of the gradient. For example, REINFORCE (Williams, 1992) updates the policy by $\theta \theta + \alpha R \nabla _ { \theta } \log ( \delta _ { \theta } \bar { ( } a | s ) )$ where $R$ is the long-term payoff on path. Notice that this updating rule is simple comparing with value function iteration. The caveat of the policy gradient approach is the lack of its global convergence guarantee for a generic MDP. In this paper we show that such guarantee can be provided for the specific class of MDPs that we consider.
|
| 96 |
+
|
| 97 |
+
# 3 WARM-UP: LOCAL CONCAVITY OF THE VALUE FUNCTION AT THE OPTIMAL POLICY
|
| 98 |
+
|
| 99 |
+
To understand the convergence of the policy gradient, in this section we introduce our main technique and show that the concavity of the value function with respect to policies is satisfied in a fixed neighborhood around the optimal policy. We rely on the special structure of the value function induced by random shocks $\epsilon$ which essentially “smooth it" making it differentiable. We then use Bellman equation (7) to compute strong Fréchet functional derivatives of the value functions and argue that the respective second derivative is negative at the optimal policy. We use this approach in Section 4 to show the global concavity of the value function with respect to policies.
|
| 100 |
+
|
| 101 |
+
By $\Delta$ we denote the convex compact set that contains all continuous functions $\delta : { \cal S } [ 0 , 1 ]$ such that $\begin{array} { r } { 0 \le \delta ( \cdot ) \le \bar { \delta } ( \cdot ) } \end{array}$ . The Bellman equation (7) defines the functional $V _ { \delta } ( \cdot )$ . Recall that Fréchet derivative of functional $\overset { \cdot } { V _ { \delta } } ( \cdot )$ , which maps bounded linear space $\Delta$ into the space of all continuous bounded functions of $s$ , at a given $\delta ( \cdot )$ is a bounded linear functional $\mathrm Ḋ V Ḍ _ { \delta } ( \cdot )$ such that for all continuous $h ( \cdot )$ with $\| h \| _ { 2 } \leq \bar { H } \colon V _ { \delta + h } ( \cdot ) - V _ { \delta } ( \cdot ) = \mathrm Ḋ V Ḍ _ { \delta } ( \cdot ) h ( \cdot ) + o ( \| h \| _ { 2 } )$ . When functional $\mathrm Ḋ V Ḍ _ { \delta } ( \cdot )$ is also Fréchet differentiable, we refer to its Fréchet derivative as the second Fréchet derivative of functional $V _ { \delta } ( \cdot )$ and denote it $\mathrm { D } ^ { 2 } V _ { \delta } ( \cdot )$ .
|
| 102 |
+
|
| 103 |
+
Theorem 3.1. Value function $V _ { \delta }$ is twice Freéchet differentiable with respect to $\delta$ at the choice probability $\tilde { \delta }$ corresponding to optimal policy and its Fréchet derivative is negative at $\tilde { \delta }$ in all states $s$ , i.e., $\mathrm { D } ^ { 2 } V _ { \tilde { \delta } } ( s ) \le 0$ .
|
| 104 |
+
|
| 105 |
+
We sketch the proof idea of Theorem 3.1 and defer its formal proof to Appendix A. Start with the Bellman equation (7) of the value function, the Fréchet derivative of the value function is the fixed point of the following Bellman equation
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\begin{array} { r l } & { \mathrm { D } V _ { \delta } ( s ) = ( \log ( 1 - \delta ( s ) ) - \log ( \delta ( s ) ) - r ( s ) ) } \\ & { \qquad + \beta \left( \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] - \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] \right) + \beta \mathbf { E } _ { \epsilon , s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s ] , } \end{array}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
and
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\begin{array} { l } { \displaystyle \mathrm { D } ^ { 2 } V _ { \delta } ( s ) = - \frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } } \\ { \displaystyle \qquad - 2 \beta ( { \bf E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - { \bf E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 0 ] ) + \beta { \bf E } _ { s ^ { \prime } } \big [ \mathrm { D } ^ { 2 } V _ { \delta } ( s ^ { \prime } ) | s \big ] . } \end{array}
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
A necessary condition for its optimum yielding $\tilde { \delta }$ is $\mathrm Ḋ V Ḍ _ { \widetilde { \delta } } ( s ) = 0$ for all states $s$ . As a result, equation (9) implies that its second Fréchet derivative is negative for all states, i.e. $\mathrm { J } ^ { 2 } V _ { \tilde { \delta } } ( s ) \le 0$ .
|
| 118 |
+
|
| 119 |
+
The Bellman equation (9) of the second Fréchet derivative suggests that $\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \le 0$ for all states $s$ if
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\frac 1 { \delta ( s ) ( 1 - \delta ( s ) ) } + 2 \beta ( \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 0 ] ) \ge 0
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
The first term in the inequality (5) is always positive for all policies in $\Delta$ , but the second term can be arbitrary small. In the next section, we will introduce a nature smoothness assumption on MDP (i.e., Lipschitz MDP) and show that the local concavity can be extended to global concavity, which implies that the policy gradient algorithm for our problem converges globally under this assumption.
|
| 126 |
+
|
| 127 |
+
# 4 GLOBAL CONCAVITY OF THE VALUE FUNCTION
|
| 128 |
+
|
| 129 |
+
In this section, we introduce the notion of the Lipschitz Markov decision process, and Lipschitz policy space. We then restrict our attention to this subclass of MDPs. Our main result shows the optimal policy belongs to the Lipschitz policy space and the policy gradient globally converges in that space. We defer all the proofs of the results in this section to Appendix B.
|
| 130 |
+
|
| 131 |
+
# 4.1 LIPSCHITZ MARKOV DECISION PROCESS
|
| 132 |
+
|
| 133 |
+
Lipschitz Markov decision process has the property that for two state-action pairs that are close with respect to Euclidean metric in $s$ , their immediate rewards $r$ and Markovian transition $\mathcal { P }$ should be close with respect to the Kantorovich or $L _ { 1 }$ -Wasserstein metric. Kantorovich metric is, arguable, the most common metric used used in the analysis of MDPs (cf. Hinderer, 2005; Rachelson and Lagoudakis, 2010; Pirotta et al., 2015).
|
| 134 |
+
|
| 135 |
+
Definition 4.1 (Kantorovich metric). For any two probability measures $p , q ,$ , the Kantorovich metric between them is
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
{ \mathcal { K } } ( p , q ) = \operatorname* { s u p } _ { f } \left\{ \left| \int _ { X } f d ( p - q ) \right| : f i s \ I - L i p s c h i t z \ c o n t i n u o u s \right\}
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
Definition 4.2 (Lipschitz MDP). A Markov decision process is $( L _ { r } , L _ { p } )$ -Lipschitz $i f$
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\begin{array} { r l r l } & { \forall s , s ^ { \prime } \in S } & & { | r ( s ) - r ( s ^ { \prime } ) | \le L _ { r } | s - s ^ { \prime } | } \\ & { \forall s , s ^ { \prime } \in S , a , a ^ { \prime } \in \mathcal { A } } & & { K ( p ( \cdot | s , a ) , p ( \cdot | s ^ { \prime } , a ^ { \prime } ) ) \le L _ { p } \left( | s - s ^ { \prime } | + | a - a ^ { \prime } | \right) } \end{array}
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
# 4.2 CHARACTERIZATION OF THE OPTIMAL POLICY
|
| 148 |
+
|
| 149 |
+
Our result in Section 3, demonstrates that the second Fréchet derivative of $V _ { \delta }$ with respect to $\delta$ is negative for a given policy $\delta$ when inequality (5) holds. To bound the second term of (5) from below, i.e., $\mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( \bar { s ^ { \prime } } ) | s , \bar { 0 } ] - \dot { \mathbf { E } } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | \bar { s } , 1 ] ,$ , it is sufficient to show that Fréchet derivative $\mathrm Ḋ V Ḍ _ { \delta } ( \cdot )$ is Lipschitz-continuous. Even though we already assume that the Markov transition is Lipschitz, it is still possible that $\mathrm Ḋ V Ḍ _ { \delta }$ is not Lipschitz: Bellman equation (8) for $\mathrm Ḋ V Ḍ _ { \delta }$ depends on policy $\delta ( s )$ via $\log ( \bar { 1 } - \delta ( s ) ) - \log ( \delta ( s ) )$ , which can be non-Lipschitz in state $s$ for general policies $\delta$ . Therefore, to guarantee Lipschitzness of the Fréchet derivative of the value function it is necessary to restrict attention to the space of Lipschitz policies. In this subsection, we show that this restriction is meaningful since the optimal policy is Lipschitz.
|
| 150 |
+
|
| 151 |
+
Theorem 4.1. Given $( L _ { r } , L _ { p } )$ -Lipschitz MDP, the optimal policy $\tilde { \delta }$ satisfies
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\left| \log \left( \frac { 1 - \tilde { \delta } ( s ) } { \tilde { \delta } ( s ) } \right) - \log \left( \frac { 1 - \tilde { \delta } ( s ^ { \dagger } ) } { \tilde { \delta } ( s ^ { \dagger } ) } \right) \right| \leq \left( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } \right) \left| s - s ^ { \dagger } \right|
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
for all state $s , s ^ { \dagger } \in { \mathcal { S } }$ where $R _ { \mathrm { m a x } } = \operatorname* { m a x } _ { s \in \mathcal { S } } r ( s )$ is the maximum of the immediate reward $r$ over $s$ .
|
| 158 |
+
|
| 159 |
+
# 4.3 CONCAVITY OF THE VALUE FUNCTION WITH RESPECT TO LIPSCHITZ POLICIES
|
| 160 |
+
|
| 161 |
+
In this subsection, we present our main result showing the global concavity of the value function for our specific class of Lipschitz MDPs with unobserved heterogeneity over the space of Lipschitz policies.
|
| 162 |
+
|
| 163 |
+
Definition 4.3. Given $( L _ { r } , L _ { p } )$ -Lipschitz MDP, define its Lipschitz policy space $\Delta$ as
|
| 164 |
+
|
| 165 |
+
$\Delta = \{ \delta : \delta ( s ) \leq \bar { \delta } ( s ) \forall s \in \mathcal { S }$ and
|
| 166 |
+
|
| 167 |
+
$$
|
| 168 |
+
| \log ( \frac { 1 - \delta ( s ) } { \delta ( s ) } ) - \log ( \frac { 1 - \delta ( s ^ { \dagger } ) } { \delta ( s ^ { \dagger } ) } ) | \leq ( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } ) | s - s ^ { \dagger } | \forall s , s ^ { \dagger } \in \mathcal { S } \} ,
|
| 169 |
+
$$
|
| 170 |
+
|
| 171 |
+
where $\bar { \delta }$ is the myopic policy.
|
| 172 |
+
|
| 173 |
+
Theorem 4.1 and Lemma 2.1 imply that the optimal policy $\tilde { \delta }$ lies in this Lipschitz policy space $\Delta$ for any Lipschitz MDP.
|
| 174 |
+
|
| 175 |
+
Definition 4.4 (Condition for global convergence). We say that $( L _ { r } , L _ { p } )$ -Lipschitz MDP satisfies the sufficient condition for global convergence $i f$
|
| 176 |
+
|
| 177 |
+
$$
|
| 178 |
+
2 \beta L _ { p } < 1 a n d \frac { 2 \beta L _ { p } } { 1 - 2 \beta L _ { p } } \left( 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } \right) \leq \frac { \left( \exp ( R _ { \mathrm { m i n } } ) + 1 \right) ^ { 2 } } { \exp ( R _ { \mathrm { m i n } } ) } .
|
| 179 |
+
$$
|
| 180 |
+
|
| 181 |
+
Theorem 4.2. Given $( L _ { r } , L _ { p } )$ -Lipschitz MDP which satisfies the condition for global convergence (6), value function $V _ { \delta }$ is concave with respect to policy $\delta$ in the Lipschitz policy space $\Delta$ , i.e., $\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \dot { \le } 0$ for all $s \in \mathcal S , \delta \in \Delta$ .
|
| 182 |
+
|
| 183 |
+
# 4.4 THE RATE OF GLOBAL CONVERGENCE OF THE POLICY GRADIENT ALGORITHM
|
| 184 |
+
|
| 185 |
+
In this subsection, we establish the rate of global convergence a simple version of the policy gradient algorithm assuming oracle access to the Fréchet derivative of the value function. While this analysis provides only a theoretical guarantee, as discussed in Section 2.3, in practice the individuals are able to produce an unbiased estimator of the exact gradient. As a result, the practical application of the policy gradient algorithm would only need to adjust for the impact of stochastic noise in the estimator.
|
| 186 |
+
|
| 187 |
+
Since we assume that individuals know the immediate reward function $r$ , the algorithm can be initialized at the myopic policy $\bar { \delta }$ with threshold $\bar { \pi } ( s ) = r ( s )$ , which is in the Lipschitz policy space $\Delta$ . From Lemma 2.1 it follows that the myopic policy is pointwise in $s$ greater than the optimal policy, i.e., $\bar { \delta } ( s ) \leq \tilde { \delta } ( s )$ . Consider policy $\underline { { \delta } }$ with threshold $\begin{array} { r } { \underline { { \pi } } ( s ) = r ( s ) + \frac { \bar { \beta } } { 1 - \beta } R _ { \mathrm { m a x } } - \frac { \beta } { 2 } R _ { \mathrm { m i n } } } \end{array}$ . Note that Bellman equation (7) implies that $V ( s )$ is between $\frac { R _ { \mathrm { m i n } } } { 2 }$ and Rmax1−β for all states s. Thus, policy $\underline { { \delta } }$ pointwise bounds the optimal policy $\tilde { \delta }$ from below, i.e., $\underline { { \delta } } ( s ) \leq \widetilde { \delta } ( s )$ . Our convergence rate result applies to the policy gradient within the bounded Lipschitz policy set $\hat { \Delta }$ .
|
| 188 |
+
|
| 189 |
+
Definition 4.5. Given $( L _ { r } , L _ { p } )$ -Lipschitz MDP, define its bounded Lipschitz policy space $\hat { \Delta }$ as $\hat { \Delta } = \{ \delta : \underline { { { \delta } } } ( s ) \leq \delta ( s ) \leq \bar { \delta } ( s ) \forall s \in \mathcal { S }$ and
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
| \log ( \frac { 1 - \delta ( s ) } { \delta ( s ) } ) - \log ( \frac { 1 - \delta ( s ^ { \dagger } ) } { \delta ( s ^ { \dagger } ) } ) | \leq ( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } ) | s - s ^ { \dagger } | \forall s , s ^ { \dagger } \in \mathcal { S } \} .
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
For simplicity of notation, we introduce constants $m$ and $M$ which only depend on $\beta , R _ { \mathrm { m i n } } , R _ { \mathrm { m a x } }$ $L _ { r }$ and $L _ { p }$ , whose exact expressions are deferred to the supplementary material for this paper.
|
| 196 |
+
|
| 197 |
+
Theorem 4.3. Given a $( L _ { r } , L _ { p } )$ -Lipschitz MDP, which satisfies the condition for global convergence (6) and constants m and $M$ defined above, for any step size $\begin{array} { r } { \alpha \leq \frac { 1 } { M } } \end{array}$ , the policy gradient initialized at the myopic policy $\bar { \delta }$ and updating as $\delta \gets \alpha \nabla _ { \delta } V _ { \delta }$ in the bounded Lipschitz policy space $\hat { \Delta }$ after $k$ iterations, it produces policy $\delta ^ { ( k ) }$ satisfying
|
| 198 |
+
|
| 199 |
+
$$
|
| 200 |
+
V _ { \tilde { \delta } } ( s ) - V _ { \delta ^ { ( k ) } } ( s ) \leq \frac { ( 1 - \alpha m ) ^ { k } } { \left( \exp ( R _ { \operatorname* { m i n } } ) + 1 \right) ^ { 2 } } \qquad a t a l l s \in \mathcal { S } .
|
| 201 |
+
$$
|
| 202 |
+
|
| 203 |
+
# 5 EMPIRICAL APPLICATION
|
| 204 |
+
|
| 205 |
+
To demonstrate the performance of the algorithm, we use the data from Rust (1987) which made the standard benchmark for the Econometric analysis of MDPs. The paper estimates the cost associated with maintaining and replacing bus engines using data from maintenance records from Madison Metropolitan Bus City Company over the course of 10 years (December, 1974—May, 1985). The data contains monthly observations on the mileage of each bus as well as the dates of major maintenance events (such as bus engine replacement).
|
| 206 |
+
|
| 207 |
+
Rust (1987) assumes that the engine replacement decisions follow an optimal stopping policy derived from solving a dynamic discrete choice model of the type that we described earlier. Using this assumption and the data, he estimates the cost of operating a bus as a function of the running mileage as well as the cost of replacing the bus engine. We use his estimates of the parameters of the return function and the state transition probabilities (bus mileage) to demonstrate convergence of the gradient descent algorithm.
|
| 208 |
+
|
| 209 |
+
In Rust (1987) the state $s _ { t }$ is the running total mileage of the bus accumulated by the end of period $t$ The immediate reward is specified as a function of the running mileage as:
|
| 210 |
+
|
| 211 |
+
$$
|
| 212 |
+
r ( s _ { t } , a , \theta _ { 1 } ) = { \left\{ \begin{array} { l l } { - \mathrm { R C } + \epsilon _ { t 1 } , } & { { \mathrm { i f ~ } } a = 1 } \\ { - c ( s _ { t } , \theta _ { 1 } ) + \epsilon _ { t 0 } , } & { { \mathrm { i f ~ } } a = 0 } \end{array} \right. }
|
| 213 |
+
$$
|
| 214 |
+
|
| 215 |
+
where RC is the cost of replacing the engine, $c ( s _ { t } , \theta _ { 1 } )$ is the cost of operating a bus that has $s _ { t }$ miles.
|
| 216 |
+
|
| 217 |
+
Following Rust (1987), we take $c ( s _ { t } , \theta _ { 1 } ) = \theta _ { 1 } s _ { t }$ . Further, as in the original paper, we discretize the mileage taking values in the range from 0 to 175 miles into an even grid of 2,571 intervals. Given the observed monthly mileage, Rust (1987) assumes that transitions on the grid can only be of increments $0 , 1 , 2 , 3$ and 4. Therefore, transition process for discretized mileage is fully specified by just four parameters $\theta _ { 2 j } = \mathbf { P r } [ s _ { t + 1 } = s _ { t } + j | s _ { t } , a = 0 ]$ , $j = 0 , 1 , 2 , 3$ . Table 1 describes parameter values that we use directly from Rust (1987).
|
| 218 |
+
|
| 219 |
+
Table 1: parameter values in from Rust (1987).
|
| 220 |
+
|
| 221 |
+
<table><tr><td>Parameter</td><td>Value</td></tr><tr><td>RC</td><td>11.7257</td></tr><tr><td>01</td><td>0.001× 2.45569</td></tr><tr><td>(020,021,022,023)</td><td>(0.0937, 0.4475, 0.4459, 0.0127)</td></tr><tr><td>β</td><td>0.99</td></tr></table>
|
| 222 |
+
|
| 223 |
+
We use the gradient descent algorithm to update the policy threshold $\pi : \epsilon _ { 1 } + \pi \geq \epsilon _ { 0 } \Rightarrow a = 1$ , where $a = 1$ denotes the decision to replace the engine. We set the learning rate using the RMSprop method1.
|
| 224 |
+
|
| 225 |
+
We use “the lazy projection" method to guarantee the search over Lipschitz policy space. The policy space is parametrized by the vector of thresholds $( \pi _ { 1 } , \ldots , \pi _ { N } )$ corresponding to discretized state space $( s _ { 1 } , \dotsc , s _ { N } )$ . It is initialized at the myopic policy, i.e. $\pi _ { 1 } ^ { ( 0 ) } =$ $u ( s _ { 1 } ) , \ldots , \pi _ { N } ^ { ( 0 ) } = u ( s _ { N } )$ . At step $k$ the algorithm updates the thresholds to the value $\pi _ { i } ^ { ( k * ) } =$ $\pi _ { i } ^ { ( k - 1 ) } - \alpha \mathrm { D } _ { \delta ^ { ( k - 1 ) } } V ( s _ { i } ) \mathcal { L } ( \pi _ { i } ^ { ( k - 1 ) } ) ( 1 - \mathcal { L } ( \pi _ { i } ^ { ( k - 1 ) } ) )$ $\delta _ { j } ^ { ( k ) } = \mathcal { L } ( \pi _ { j } ^ { ( k - 1 ) } )$ ) for $i , j = 1 , \dots , N$ i . To make the“lazy projection" updated values , where is the logistic function and policy $\pi _ { i } ^ { ( k * ) }$ are adjusted to the closest monotone set of values $\pi _ { 1 } ^ { ( k ) } \leq \pi _ { 2 } ^ { ( k ) } \leq \ldots \leq \pi _ { N } ^ { ( k ) }$ . The algorithm terminates at step $k$ where the norm $\operatorname* { m a x } _ { i } | \mathrm { D } V _ { \delta ^ { ( k ) } } ( s _ { i } ) | \leq \tau$ for a given tolerance $\tau$ .2 The formal definition of lazy projection can be found in Appendix C.
|
| 226 |
+
|
| 227 |
+
Figure 3 demonstrates convergence properties of our considered version of the policy gradient algorithm. We used the “oracle" versions of the gradient and the value function that were obtained by solving the corresponding Bellman equations. We initialized the algorithm using the myopic threshold $\bar { \pi } ( s ) \bar { = } - \mathbf { R C } + c \bar { ( } s , \theta _ { 1 } )$ ; with the convergence criterion set to be based on the value maxi $| \mathrm { D } V _ { \delta } ( s _ { i } ) | ^ { 3 }$
|
| 228 |
+
|
| 229 |
+
In the original model in Rust (1987), the discount factor used when estimating parameters of the cost function was very close to 1. However, performance of the algorithm improves drastically when the discount factor is reduced. This feature is closely related to the Hadamard stability of the solution of the Bellman equation (e.g. observed in Bajari et al. (2013)) and is not algorithm-specific. In all of the follow-up analysis by the same author (e.g. Rust (1996)) the discount factor is set to more moderate values of .99 or .9 indicating that these performance issues were indeed observed with the settings in Rust (1987). Figure 3 illustrates the performance of the algorithm for the case where the discount factor is set to $0 . { \overset { - } { 9 } } 9 ^ { 4 }$ . For the same convergence criterion, the algorithm converges much faster.
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
Figure 1: Convergence of gradient descent, discount factor $\beta = 0 . 9 9$
|
| 233 |
+
|
| 234 |
+

|
| 235 |
+
Figure 2: Performance of the norm $\mathrm { m a x } _ { i }$ $\left| \mathrm Ḋ V Ḍ _ { \delta } ( s _ { i } ) \right|$ and the second derivative $\operatorname { n a x } _ { i } \left| \operatorname { D } ^ { 2 } V _ { \delta } ( s _ { i } ) \right|$ discount factor $\beta = 0 . 9 9$
|
| 236 |
+
|
| 237 |
+
REFERENCES
|
| 238 |
+
Abbring, J. H. and Heckman, J. J. (2007). Econometric evaluation of social programs, part iii: Distributional treatment effects, dynamic treatment effects, dynamic discrete choice, and general equilibrium policy evaluation. Handbook of econometrics, 6:5145–5303.
|
| 239 |
+
Aguirregabiria, V. and Magesan, A. (2016). Solution and estimation of dynamic discrete choice structural models using euler equations. Available at SSRN 2860973.
|
| 240 |
+
Aguirregabiria, V. and Mira, P. (2007). Sequential estimation of dynamic discrete games. Econometrica, 75(1):1–53.
|
| 241 |
+
Aguirregabiria, V. and Mira, P. (2010). Dynamic discrete choice structural models: A survey. Journal of Econometrics, 156(1):38–67.
|
| 242 |
+
Arcidiacono, P. and Miller, R. A. (2011). Conditional choice probability estimation of dynamic discrete choice models with unobserved heterogeneity. Econometrica, 79(6):1823–1867.
|
| 243 |
+
Bajari, P., Hong, H., and Nekipelov, D. (2013). Game theory and econometrics: A survey of some recent research. In Advances in economics and econometrics, 10th world congress, volume 3, pages 3–52.
|
| 244 |
+
Bansal, N. and Gupta, A. (2017). Potential-function proofs for first-order methods. arXiv preprint arXiv:1712.04581.
|
| 245 |
+
Dubé, J.-P., Chintagunta, P., Petrin, A., Bronnenberg, B., Goettler, R., Seetharaman, P., Sudhir, K., Thomadsen, R., and Zhao, Y. (2002). Structural applications of the discrete choice model. Marketing Letters, 13(3):207–220.
|
| 246 |
+
Dunford, N. and Schwartz, J. T. (1957). Linear Operators. Part 1: General Theory. New York Interscience.
|
| 247 |
+
Eckstein, Z. and Wolpin, K. I. (1989). The specification and estimation of dynamic stochastic discrete choice models: A survey. The Journal of Human Resources, 24(4):562–598.
|
| 248 |
+
Fazel, M., Ge, R., Kakade, S., and Mesbahi, M. (2018). Global convergence of policy gradient methods for the linear quadratic regulator. In International Conference on Machine Learning, pages 1466–1475.
|
| 249 |
+
Haskell, W. B., Jain, R., and Kalathil, D. (2016). Empirical dynamic programming. Mathematics of Operations Research, 41(2):402–429.
|
| 250 |
+
Hendel, I. and Nevo, A. (2006). Measuring the implications of sales and consumer inventory behavior. Econometrica, 74(6):1637–1673.
|
| 251 |
+
Hinderer, K. (2005). Lipschitz continuity of value functions in markovian decision processes. Mathematical Methods of Operations Research, 62(1):3–22.
|
| 252 |
+
Hotz, V. J. and Miller, R. A. (1993). Conditional choice probabilities and the estimation of dynamic models. The Review of Economic Studies, 60(3):497–529.
|
| 253 |
+
Jaksch, T., Ortner, R., and Auer, P. (2010). Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(Apr):1563–1600.
|
| 254 |
+
Müller, P. and Reich, G. (2018). Structural estimation using parametric mathematical programming with equilibrium constraints and homotopy path continuation. Available at SSRN 3303999.
|
| 255 |
+
Nekipelov, D., Syrgkanis, V., and Tardos, E. (2015). Econometrics for learning agents. In Proceedings of the Sixteenth ACM Conference on Economics and Computation, pages 1–18. ACM.
|
| 256 |
+
Pirotta, M., Restelli, M., and Bascetta, L. (2015). Policy gradient in lipschitz markov decision processes. Machine Learning, 100(2-3):255–283.
|
| 257 |
+
Rachelson, E. and Lagoudakis, M. G. (2010). On the locality of action domination in sequential decision making.
|
| 258 |
+
Rust, J. (1987). Optimal replacement of gmc bus engines: An empirical model of harold zurcher. Econometrica: Journal of the Econometric Society, pages 999–1033.
|
| 259 |
+
Rust, J. (1996). Numerical dynamic programming in economics. Handbook of computational economics, 1:619–729.
|
| 260 |
+
Sutton, R. S. and Barto, A. G. (2018). Reinforcement learning: An introduction. MIT press.
|
| 261 |
+
Williams, R. J. (1992). Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256.
|
| 262 |
+
|
| 263 |
+
# APPENDIX
|
| 264 |
+
|
| 265 |
+
# A OMITTED PROOF FOR THEOREM 3.1
|
| 266 |
+
|
| 267 |
+
Theorem 3.1. Value function $V _ { \delta }$ is twice Freéchet differentiable with respect to $\delta$ at the choice probability $\tilde { \delta }$ corresponding to optimal policy and its Fréchet derivative is negative at $\tilde { \delta }$ in all states $s$ , i.e., $\mathrm { D } ^ { 2 } V _ { \widetilde { \delta } } ( s ) \le 0$ .
|
| 268 |
+
|
| 269 |
+
Proof. We start with the Bellman equation of the value function.
|
| 270 |
+
|
| 271 |
+
$$
|
| 272 |
+
\begin{array} { c } { { V _ { \delta } ( s ) = \left( 1 - \delta ( s ) \right) r ( s ) - \delta ( s ) \log { ( \delta ( s ) ) } } } \\ { { - \left( 1 - \delta ( s ) \right) \log ( 1 - \delta ( s ) ) + \beta \mathbf { E } _ { \epsilon , s ^ { \prime } } \Big [ V _ { \delta } ( s ) ( s ^ { \prime } ) \Big | s \Big ] } } \end{array}
|
| 273 |
+
$$
|
| 274 |
+
|
| 275 |
+
First of all, note that in (7) the first three terms on the right hand side of the equation simple nonlinear functions $\delta ( \cdot )$ and thus the directional derivative with respect to $\delta ( \cdot )$ can be taken as an ordinary derivative with respect to $\delta$ as a parameter. Next note that if functional ${ \dot { J } } _ { \delta } ( \cdot )$ is directionally differentiable with respect to $\delta$ and for all $h ( \cdot )$ , $\begin{array} { r } { \frac { d } { d \tau } J _ { \delta + \tau h } ( \cdot ) | _ { \tau = 0 } / h ( \cdot ) } \end{array}$ is invariant, then $J _ { \delta } ( \cdot )$ is Fréchet differentiable with respect to $\delta$ and the obove ratio is its Fréchet derivative. As a result, the Fréchet derivative of simple functional $\left( 1 - \delta ( s ) \right) r ( s ) - \delta ( s ) \log \left( \delta ( s ) \right) - ( 1 - \delta ( s ) ) \log ( 1 - \delta ( s ) )$ with respect to $\delta ( \cdot )$ exists and equal to $\log ( 1 - \delta ( s ) ) - \log ( \delta ( s ) ) - r ( s )$ . This expression is itself a Freéchet-differentiable functional with Fréchet derivative equal to $- \mathrm { i } / ( \delta ( s ) ( 1 - \delta ( s ) ) ) .$ , meaning that the original functional $\begin{array} { r } { \left( 1 - \delta ( s ) \right) r ( s ) - \delta ( s ) \log \left( \delta ( s ) \right) - ( 1 - \delta ( s ) ) \log ( 1 - \delta ( s ) ) } \end{array}$ is twice Fréchet differentiable with the second Fréchet derivative $- 1 / ( \delta ( s ) ( 1 - \delta ( s ) ) )$ . Whenever the state transition is affected by the individual decision we need to consider decomposition of the conditional expectation with respect to the future state:
|
| 276 |
+
|
| 277 |
+
$$
|
| 278 |
+
\begin{array} { r } { \mathbf { E } _ { \epsilon , s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s ] = \left( 1 - \delta ( s ) \right) \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] + \delta ( s ) \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] . } \end{array}
|
| 279 |
+
$$
|
| 280 |
+
|
| 281 |
+
er standard technical conditions that allow the swap of the derivative and the integral
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
\mathrm { D } \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s ] = ( \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] - \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] ) + \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s ]
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
Thus, the Fréchet derivative of the value function should be the fixed point of the following Bellman equation
|
| 288 |
+
|
| 289 |
+
$$
|
| 290 |
+
\begin{array} { r l } & { \mathrm { D } V _ { \delta } ( s ) = ( \log ( 1 - \delta ( s ) ) - \log ( \delta ( s ) ) - r ( s ) ) } \\ & { \qquad + \beta \left( \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] - \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] \right) + \beta \mathbf { E } _ { \epsilon , s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s ] , } \end{array}
|
| 291 |
+
$$
|
| 292 |
+
|
| 293 |
+
and
|
| 294 |
+
|
| 295 |
+
$$
|
| 296 |
+
\begin{array} { l } { \displaystyle \mathrm { D } ^ { 2 } V _ { \delta } ( s ) = - \frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } } \\ { \displaystyle \qquad - 2 \beta ( { \bf E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - { \bf E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 0 ] ) + \beta { \bf E } _ { s ^ { \prime } } [ \mathrm { D } ^ { 2 } V _ { \delta } ( s ^ { \prime } ) | s ] . } \end{array}
|
| 297 |
+
$$
|
| 298 |
+
|
| 299 |
+
Given that both these equations are Type II Fredholm integral equations for $\mathrm Ḋ V Ḍ _ { \delta } ( \cdot )$ and $\mathrm { D } ^ { 2 } V _ { \delta } ( \cdot )$ which have unique solutions whenever $\beta < 1$ that are bounded and continuous (see Dunford and Schwartz (1957)) and, thus, unique solutions for both equations exist and $V _ { \delta } ( \cdot )$ is indeed Fréchetdifferentiable. This means that the necessary condition for its optimum yielding $\tilde { \delta }$ is $\mathrm Ḋ V Ḍ _ { \tilde { \delta } } ( s ) = 0$ for all states $s$ . As a result, equation (9) implies that its second Fréchet derivative is negative for all states, i.e., $\mathrm { D } ^ { 2 } V _ { \tilde { \delta } } ( s ) \le 0$ . □
|
| 300 |
+
|
| 301 |
+
# B OMITTED PROOFS IN SECTION 4
|
| 302 |
+
|
| 303 |
+
B.1 OMITTED PROOF OF THEOREM 4.1
|
| 304 |
+
|
| 305 |
+
Theorem 4.1. Given an $( L _ { r } , L _ { p } )$ -Lipschitz MDP, the optimal policy $\tilde { \delta }$ satisfies
|
| 306 |
+
|
| 307 |
+
$$
|
| 308 |
+
\left| \log \left( \frac { 1 - \tilde { \delta } ( s ) } { \tilde { \delta } ( s ) } \right) - \log \left( \frac { 1 - \tilde { \delta } ( s ^ { \dagger } ) } { \tilde { \delta } ( s ^ { \dagger } ) } \right) \right| \leq \left( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } \right) \left| s - s ^ { \dagger } \right|
|
| 309 |
+
$$
|
| 310 |
+
|
| 311 |
+
for all state $s , s ^ { \dagger } \in { \mathcal { S } }$ where $R _ { \mathrm { m a x } } = \operatorname* { m a x } _ { s \in \mathcal { S } } r ( s )$ is the maximum of the immediate reward $r$ over $s$ .
|
| 312 |
+
|
| 313 |
+
Proof. At the optimal policy $\tilde { \delta }$ , the Fréchet derivative of the value function is zero, i.e., $\mathrm Ḋ V Ḍ _ { \widetilde { \delta } } ( s ) = 0$ for all state $s$ . Therefore, from the Bellman equation (8) we establish that
|
| 314 |
+
|
| 315 |
+
$$
|
| 316 |
+
\log \left( \frac { 1 - \tilde { \delta } ( s ) } { \tilde { \delta } ( s ) } \right) = r ( s ) + \beta \left( \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , 1 \right] - \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , 0 \right] \right)
|
| 317 |
+
$$
|
| 318 |
+
|
| 319 |
+
Thus, for all states $s , s ^ { \dagger } \in { \mathcal { S } }$ ,
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
\begin{array} { r l } & { \quad \left| \mathbf { E } _ { s ^ { \prime } } [ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , a ] - \mathbf { E } _ { s ^ { \prime } } [ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s ^ { \dagger } , a ] \right| } \\ & { = \left| \int _ { s ^ { \prime } \in S } V _ { \tilde { \delta } } ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , a ) - p ( s ^ { \prime } | s ^ { \dagger } , a ) ) d s ^ { \prime } \right| } \\ & { = \frac { R _ { \operatorname* { m a x } } } { 1 - \beta } \left| \int _ { s ^ { \prime } \in S } \frac { ( 1 - \beta ) } { R _ { \operatorname* { m a x } } } V _ { \tilde { \delta } } ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , a ) - p ( s ^ { \prime } | s ^ { \dagger } , a ) ) d s ^ { \prime } \right| } \\ & { \leq \frac { R _ { \operatorname* { m a x } } } { 1 - \beta } \underset { \| \boldsymbol { f } \| _ { L ^ { \infty } } } { \operatorname* { s u p } } \left\{ \left| \int _ { s ^ { \prime } \in S } f ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , a ) - p ( s ^ { \prime } | s ^ { \dagger } , a ) ) d s ^ { \prime } \right| \right\} } \\ & { = \frac { R _ { \operatorname* { m a x } } } { 1 - \beta } K ( p ( \cdot | s , a ) , p ( \cdot | s ^ { \dagger } , a ) ) \leq \frac { R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } | s - s ^ { \dagger } | } \end{array}
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
where we use upper bounds $\begin{array} { r } { \operatorname* { s u p } _ { s \in \mathcal { S } } V _ { \tilde { \delta } } ( s ) \le \frac { R _ { \operatorname* { m a x } } } { 1 - \beta } } \end{array}$ and k (1−β)R Vδ˜(s0)kL ≤ 1. Thus,
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
\begin{array} { r l } & { \left| \log \left( \frac { 1 - \tilde { \delta } ( s ) } { \tilde { \delta } ( s ) } \right) - \log \left( \frac { 1 - \tilde { \delta } ( s ^ { \prime } ) } { \tilde { \delta } ( s ^ { \prime } ) } \right) \right| } \\ & { = | r ( s ) - r ( s ^ { \prime } ) + \beta \left( \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , 1 \right] - \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , 0 \right] \right) } \\ & { \qquad - \beta \left( \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s ^ { \dagger } , 1 \right] - \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s ^ { \dagger } , 0 \right] \right) | } \\ & { \leq \left| r ( s ) - r ( s ^ { \dagger } ) \right| + \beta \left| \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , 1 \right] - \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s ^ { \dagger } , 1 \right] \right| } \\ & { \qquad + \beta \left| \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s , 0 \right] - \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \tilde { \delta } } ( s ^ { \prime } ) | s ^ { \dagger } , 0 \right] \right| } \\ & { \leq \left( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } \right) \left| s - s ^ { \dagger } \right| } \end{array}
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
# B.2 OMITTED PROOF OF THEOREM 4.2
|
| 332 |
+
|
| 333 |
+
Theorem 4.2. Given an $( L _ { r } , L _ { p } )$ -Lipschitz MDP which satisfies the condition for global convergence (6), the value function $V _ { \delta }$ is concave with respect to policy $\delta$ in the Lipschitz policy space $\Delta$ , i.e., $\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \le 0$ for all $s \in \mathcal S , \delta \in \Delta$ .
|
| 334 |
+
|
| 335 |
+
To show Theorem 4.2, we first introduce the following lemma establishing Lipschitz continuity of the Fréchet derivative of the value function.
|
| 336 |
+
|
| 337 |
+
Lemma B.1. Given a $( L _ { r } , L _ { p } )$ -Lipschitz MDP, for all policies $\delta$ in the the Lipschitz policy space $\Delta$ , the Fréchet derivative of the respective value function $\mathrm Ḋ V Ḍ _ { \delta } ( \cdot )$ is $\left( \frac { 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } } { 1 - 2 \beta L _ { p } } \right)$ -Lipschitz
|
| 338 |
+
|
| 339 |
+
continuous, i.e., for all states $s , s ^ { \dagger } \in { \mathcal { S } }$ ,
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
\bigl | \mathrm { D } V _ { \delta } ( s ) - \mathrm { D } V _ { \delta } ( s ^ { \dagger } ) \bigr | \leq \left( \frac { 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } } { 1 - 2 \beta L _ { p } } \right) \bigl | s - s ^ { \dagger } \bigr | .
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
Proof. We begin with the Bellman equation (8) for the Fréchet derivative of value function.
|
| 346 |
+
|
| 347 |
+
$$
|
| 348 |
+
\begin{array} { r l } & { \mathrm { D } V _ { \delta } ( s ) = \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - r ( s ) } \\ & { \qquad + \left. \beta \left( \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] - \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] \right) + \beta \mathbf { E } _ { \epsilon , s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s ] \right) } \end{array}
|
| 349 |
+
$$
|
| 350 |
+
|
| 351 |
+
We use the concept of the contraction mapping to prove the result of the Lemma.
|
| 352 |
+
|
| 353 |
+
Definition B.1. Let $T : X X$ be a mapping from a metric space $X$ to itself,
|
| 354 |
+
|
| 355 |
+
• $T$ is a contraction mapping (with modulus $\gamma \in [ 0 , 1 )$ ) i $f \rho ( T ( x ) , T ( y ) ) \leq \gamma \rho ( x , y )$ for all $x , y \in X$ , where $\rho$ is a metric on $X$ .
|
| 356 |
+
• $x$ is a fixed point of $T$ if $T ( x ) = x$ .
|
| 357 |
+
|
| 358 |
+
Lemma B.2. Suppose that $X$ is a complete metric space and that $T : X \to X$ is a contraction mapping with modulus $\gamma .$ . Then,
|
| 359 |
+
|
| 360 |
+
• $T$ has a unique fixed point $x ^ { * }$ .
|
| 361 |
+
• If $X ^ { \prime } \subseteq X$ is a closed subset for which $T ( X ^ { \prime } ) \subseteq X ^ { \prime }$ , then $x ^ { * } \in X ^ { \prime }$ .
|
| 362 |
+
|
| 363 |
+
Consider the contraction mapping $\begin{array} { r } { T _ { \delta } ( x ) ( s ) ~ = ~ \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) ~ - ~ r ( s ) ~ + ~ \beta \left( \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] ~ - ~ \right. } \end{array}$ $\mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] ) + \beta \mathbf { E } _ { \epsilon , s ^ { \prime } } [ x ( s ^ { \prime } ) | s ]$ , then the Bellman equation implies that $\mathrm Ḋ V Ḍ _ { \delta }$ is the fixed point of contraction mapping $T _ { \delta }$ . Since the Lipschitz continuity property forms a closed subset, by Lemma B.2, it is sufficient to show for any $L _ { D V }$ -Lipschitz continuous $x$ , $T _ { \delta } ( x )$ is also $L _ { D V }$ -Lipschitz continuous, where $\begin{array} { r } { L _ { D V } = \frac { 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } } { 1 - 2 \beta L _ { p } } } \end{array}$ . Thus, consider states $s , s ^ { \dagger } \in { \mathcal { S } }$ ,
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\begin{array} { r l } & { \quad \left| T ( x ) ( s ) - T ( x ) ( s ^ { \dagger } ) \right| } \\ & { \leq \left| \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - \log \left( \frac { 1 - \delta ( s ^ { \dagger } ) } { \delta ( s ^ { \dagger } ) } \right) \right| + \left| r ( s ) - r ( s ^ { \dagger } ) \right| } \\ & { \qquad + \left. \beta \left| { \bf E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 0 ] - { \bf E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s ^ { \dagger } , 0 ] \right| \right. } \\ & { \qquad + \left. \beta \left| { \bf E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - { \bf E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) | s ^ { \dagger } , 1 ] \right| \right. } \\ & { \qquad + \left. \beta \left| { \bf E } _ { s ^ { \prime } } [ x ( s ^ { \prime } ) | s , 0 ] \delta ( s ) - { \bf E } _ { s ^ { \prime } } [ x ( s ^ { \prime } ) | s ^ { \dagger } , 0 ] \right. \delta ( s ^ { \dagger } ) \right| } \\ & { \qquad + \left. \beta \left| { \bf E } _ { s ^ { \prime } } [ x ( s ^ { \prime } ) | s , 1 ] \left( 1 - \delta ( s ) \right) - { \bf E } _ { s ^ { \prime } } [ x ( s ^ { \prime } ) | s ^ { \dagger } , 1 ] \right. \left( 1 - \delta ( s ^ { \dagger } ) \right) \right| } \end{array}
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
where
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
\left| \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - \log \left( \frac { 1 - \delta ( s ^ { \dagger } ) } { \delta ( s ^ { \dagger } ) } \right) \right| \leq \left( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } \right) \left| s - s ^ { \dagger } \right|
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
by the same calculation in the proof of Theorem 4.1, for $a = 0 , 1$ ,
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\beta \left| \mathbf { E } _ { s ^ { \prime } } [ V _ { \delta } ( s ^ { \prime } ) ] s , a ] - \mathbf { E } _ { s ^ { \prime } } \left[ V _ { \delta } ( s ^ { \prime } ) \vert s ^ { \dagger } , a \right] \right| \leq \left( L _ { r } + \frac { 2 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } \right) \left| s - s ^ { \dagger } \right|
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
and
|
| 382 |
+
|
| 383 |
+
$$
|
| 384 |
+
\begin{array} { r l } & { \quad \left| \mathbf { E } _ { s ^ { \prime } } [ x ( s ^ { \prime } ) | s , 0 ] \delta ( s ) - \mathbf { E } _ { s ^ { \prime } } \bigl [ x ( s ^ { \prime } ) | s ^ { \dagger } , 0 \bigr ] \delta ( s ^ { \dagger } ) \right| } \\ & { = \left| \displaystyle \int _ { s ^ { \prime } \in S } ( \delta ( s ) - \delta ( s ^ { \dagger } ) ) x ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , a ) - p ( s ^ { \prime } | s ^ { \dagger } , a ) ) d s ^ { \prime } \right| } \\ & { = L _ { D V } \left| \displaystyle \int _ { s ^ { \prime } \in S } \frac { ( \delta ( s ) - \delta ( s ^ { \dagger } ) ) x ( s ^ { \prime } ) } { L _ { D V } } ( p ( s ^ { \prime } | s , a ) - p ( s ^ { \prime } | s ^ { \dagger } , a ) ) d s ^ { \prime } \right| } \\ & { \le L _ { D V } \underset { \| f \| _ { L } \leq 1 } { \operatorname* { s u p } } \left. \left| \displaystyle \int _ { s ^ { \prime } \in S } f ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , a ) - p ( s ^ { \prime } | s ^ { \dagger } , a ) ) d s ^ { \prime } \right| \right. } \\ & { = L _ { D V } K ( p ( \cdot | s , a ) , p ( \cdot | s ^ { \dagger } , a ) ) \le L _ { D V } L _ { p } \left| s - s ^ { \dagger } \right| } \end{array}
|
| 385 |
+
$$
|
| 386 |
+
|
| 387 |
+
where we use the bound $\left| \delta ( s ) - \delta ( s ^ { \dagger } ) \right| \leq 1$ and thus $\| \frac { ( \delta ( s ) - \delta ( s ^ { \dagger } ) ) x ( s ^ { \prime } ) } { L _ { D V } } \| _ { L } \leq 1$ . Similarly,
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\left| \mathbf { E } _ { s ^ { \prime } } [ x ( s ^ { \prime } ) | s , 1 ] \left( 1 - \delta ( s ) \right) - \mathbf { E } _ { s ^ { \prime } } \left[ x ( s ^ { \prime } ) | s ^ { \dagger } , 1 \right] \left( 1 - \delta ( s ^ { \dagger } ) \right) \right| \leq L _ { D V } L _ { p } \left| s - s ^ { \dagger } \right|
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
Combining all the bounds, we obtain that
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
\left| T ( x ) ( s ) - T ( x ) ( s ^ { \dagger } ) \right| \le \left( 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } + 2 \beta L _ { D V } L _ { p } \right) \left| s - s ^ { \dagger } \right| .
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
Substitution $\begin{array} { r } { L _ { D V } = \frac { 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } } { 1 - 2 \beta L _ { p } } } \end{array}$ yields the statement of the Lemma.
|
| 400 |
+
|
| 401 |
+
Proof of Theorem 4.2. From the Bellman equation (9), it is sufficient to show
|
| 402 |
+
|
| 403 |
+
$$
|
| 404 |
+
\frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } \geq 2 \beta ( \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 0 ] )
|
| 405 |
+
$$
|
| 406 |
+
|
| 407 |
+
We bound both sides separately. Since the policy satisfies $\delta ( s ) \leq { \bar { \delta } } ( s )$ for all states $s$ , and $\bar { \delta } ( s ) =$ 1exp(r(s))+1 ≤ 12 , the left hand side can be bounded from below as
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } \geq \frac { 1 } { \bar { \delta } ( s ) ( 1 - \bar { \delta } ( s ) ) } \geq \frac { \left( \exp ( R _ { \operatorname* { m i n } } ) + 1 \right) ^ { 2 } } { \exp ( R _ { \operatorname* { m i n } } ) }
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
Meanwhile, the righthand side can be bounded from above by Lemma B.1. Let $\begin{array} { r l } { L _ { D V } } & { { } = } \end{array}$ $\frac { 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } } { 1 - 2 \beta L _ { p } }$
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
\begin{array} { r l } & { \quad 2 \beta \left| \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 0 ] \right| } \\ & { = 2 \beta \left| \int _ { s ^ { \prime } \in S } \mathrm { D } V _ { \delta } ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , 1 ) - p ( s ^ { \prime } | s , 0 ) ) d s ^ { \prime } \right| } \\ & { = 2 \beta L _ { D V } \left| \int _ { s ^ { \prime } \in S } \frac { \mathrm { D } V _ { \delta } ( s ^ { \prime } ) } { L _ { D V } } ( p ( s ^ { \prime } | s , 1 ) - p ( s ^ { \prime } | s , 0 ) ) d s ^ { \prime } \right| } \\ & { \leq 2 \beta L _ { D V } \underset { \| f \| _ { L } \leq 1 } { \operatorname* { s u p } } \left\{ \left| \int _ { s ^ { \prime } \in S } f ( s ^ { \prime } ) ( p ( s ^ { \prime } | s , 1 ) - p ( s ^ { \prime } | s , 0 ) ) d s ^ { \prime } \right| \right\} } \\ & { = 2 \beta L _ { D V } K ( p ( \cdot | s , 1 ) , p ( \cdot | s , 0 ) ) \leq \frac { 2 \beta L _ { D } } { 1 - 2 \beta L _ { D } } \left( 2 L _ { r } + \frac { 4 \beta L _ { m a x } L _ { p } } { 1 - \beta } \right) } \end{array}
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
From the condition of global convergence
|
| 420 |
+
|
| 421 |
+
$$
|
| 422 |
+
\frac { 2 \beta L _ { p } } { 1 - 2 \beta L _ { p } } \left( 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } \right) \leq \frac { \left( \exp ( R _ { \mathrm { m i n } } ) + 1 \right) ^ { 2 } } { \exp ( R _ { \mathrm { m i n } } ) }
|
| 423 |
+
$$
|
| 424 |
+
|
| 425 |
+
it follows that the inequality (10) is satisfied and the Bellman equation (9) implies that $\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \le 0$ for all states $s \in S$ . □
|
| 426 |
+
|
| 427 |
+
# B.3 OMITTED PROOF OF THEOREM 4.3
|
| 428 |
+
|
| 429 |
+
For notation simplicity, we introduce notations $m$ and $M$ such that
|
| 430 |
+
|
| 431 |
+
$$
|
| 432 |
+
\begin{array} { l } { m = \displaystyle \frac { 1 } { 1 - \beta } \left( \frac { \left( \exp \left( R _ { \mathrm { m i n } } \right) + 1 \right) ^ { 2 } } { \exp ( R _ { \mathrm { m i n } } ) } - \frac { 2 \beta L _ { p } } { 1 - 2 \beta L _ { p } } \left( 2 L _ { r } + \frac { 4 \beta R _ { \mathrm { m a x } } L _ { p } } { 1 - \beta } \right) \right) } \\ { M = \displaystyle \frac { 1 } { ( 1 - \beta ) ^ { 2 } } \left( ( 1 - \beta ) \frac { \left( \exp \left( \frac { 1 } { 1 - \beta } R _ { \mathrm { m a x } } - \frac { \beta } { 2 } R _ { \mathrm { m i n } } \right) + 1 \right) ^ { 2 } } { \exp \left( \frac { 1 } { 1 - \beta } R _ { \mathrm { m a x } } - \frac { \beta } { 2 } R _ { \mathrm { m i n } } \right) } \right. } \\ { \displaystyle \left. + 2 \beta \left( \exp \left( \frac { 1 } { 1 - \beta } R _ { \mathrm { m a x } } - \frac { \beta } { 2 } R _ { \mathrm { m i n } } \right) + \frac { 2 \beta } { 1 - \beta } R _ { \mathrm { m a x } } - ( 1 + \beta ) R _ { \mathrm { m i n } } \right) \right) } \end{array}
|
| 433 |
+
$$
|
| 434 |
+
|
| 435 |
+
Theorem 4.3. Given a $( L _ { r } , L _ { p } )$ -Lipschitz MDP, which satisfies the condition for global convergence (6) and constants $m$ and $M$ defined above, for any step size $\begin{array} { r } { \alpha \leq \frac { 1 } { M } } \end{array}$ , the policy gradient initialized at the myopic policy $\bar { \delta }$ and updating as $\delta \gets \alpha \nabla _ { \delta } V _ { \delta }$ in the bounded Lipschitz policy space $\hat { \Delta }$ after $k$ iterations, it produces policy $\delta ^ { ( k ) }$ satisfying
|
| 436 |
+
|
| 437 |
+
$$
|
| 438 |
+
V _ { \tilde { \delta } } ( s ) - V _ { \delta ^ { ( k ) } } ( s ) \leq \frac { ( 1 - \alpha m ) ^ { k } } { \left( \exp ( R _ { \operatorname* { m i n } } ) + 1 \right) ^ { 2 } }
|
| 439 |
+
$$
|
| 440 |
+
|
| 441 |
+
at all $s \in S$
|
| 442 |
+
|
| 443 |
+
Our analysis follows the standard steps establishing convergence of the conventional gradient descent algorithm which bounds the second Fréchet derivative of the value function $V _ { \delta }$ with respect to the policy $\delta$ from above and from below by $m$ and $M$ respectively.
|
| 444 |
+
|
| 445 |
+
Lemma B.3. Given a $( L _ { r } , L _ { p } )$ -Lipschitz MDP, which satisfies the condition for global convergence (6), for all policies $\delta$ in the bounded Lipschitz policy space $\hat { \Delta }$ , for all states $s \in S$ , the second Fréchet derivative of the value function $V _ { \delta }$ with respect to the policy $\delta$ is upperbounded as
|
| 446 |
+
|
| 447 |
+
$$
|
| 448 |
+
\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \leq - m .
|
| 449 |
+
$$
|
| 450 |
+
|
| 451 |
+
Proof. The Bellman equation (9) implies that
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\begin{array} { l } { \displaystyle \operatorname* { m a x } _ { s } \mathrm { D } ^ { 2 } V _ { \delta } ( s ) \leq \frac { 1 } { 1 - \beta } \left( - \operatorname* { m i n } _ { s } \frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } \right. } \\ { \displaystyle \qquad + \left. 2 \beta \operatorname* { m a x } _ { s } ( \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 0 ] - \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] ) \right) } \end{array}
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
By the same argument as in Theorem 4.2,
|
| 458 |
+
|
| 459 |
+
$$
|
| 460 |
+
\begin{array} { r l } & { \underset { s } { \operatorname* { m i n } } \frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } \geq \frac { \left( \exp ( R _ { \operatorname* { m i n } } ) + 1 \right) ^ { 2 } } { \exp ( R _ { \operatorname* { m i n } } ) } } \\ & { \underset { s } { \operatorname* { m a x } } ( \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s , 1 ] - \mathbf { E } _ { s ^ { \prime } } [ \mathrm { D } V _ { \delta } ( s ^ { \prime } ) | s ^ { \dagger } , 0 ] ) \leq \frac { 2 \beta L _ { p } } { 1 - 2 \beta L _ { p } } \left( 2 L _ { r } + \frac { 4 \beta R _ { \operatorname* { m a x } } L _ { p } } { 1 - \beta } \right) } \end{array}
|
| 461 |
+
$$
|
| 462 |
+
|
| 463 |
+
Thus, for all state $s \in S$ ,
|
| 464 |
+
|
| 465 |
+
$$
|
| 466 |
+
\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \leq - m . \quad \bigsqcup
|
| 467 |
+
$$
|
| 468 |
+
|
| 469 |
+
Lemma B.4. Given a $( L _ { r } , L _ { p } )$ -Lipschitz MDP, which satisfies the condition for global convergence, for all policy $\delta$ in the bounded Lipschitz policy space $\hat { \Delta } ,$ , for all state $s \in S$ , the second derivative of the value function $V _ { \delta }$ with respect to the policy $\delta$ is is lowerbounded as
|
| 470 |
+
|
| 471 |
+
$$
|
| 472 |
+
\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \geq - M .
|
| 473 |
+
$$
|
| 474 |
+
|
| 475 |
+
Proof. The Bellman equation (9) implies that
|
| 476 |
+
|
| 477 |
+
$$
|
| 478 |
+
\operatorname* { m i n } _ { s } \mathrm { D } ^ { 2 } V _ { \delta } ( s ) \geq \frac { 1 } { 1 - \beta } \left( - \operatorname* { m a x } _ { s } \frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } \right.
|
| 479 |
+
$$
|
| 480 |
+
|
| 481 |
+
By restricting policy to the bounded Lipschitz policy space $\hat { \Delta }$ we bound
|
| 482 |
+
|
| 483 |
+
$$
|
| 484 |
+
\operatorname* { m a x } _ { s } \frac { 1 } { \delta ( s ) ( 1 - \delta ( s ) ) } \leq \operatorname* { m a x } _ { s } \frac { 1 } { \underline { { \delta } } ( s ) ( 1 - \underline { { \delta } } ( s ) ) } \leq \frac { \left( \exp \left( \frac { 1 } { 1 - \beta } R _ { \operatorname* { m a x } } - \frac { \beta } { 2 } R _ { \operatorname* { m i n } } \right) + 1 \right) ^ { 2 } } { \exp ( \frac { 1 } { 1 - \beta } R _ { \operatorname* { m a x } } - \frac { \beta } { 2 } R _ { \operatorname* { m i n } } ) }
|
| 485 |
+
$$
|
| 486 |
+
|
| 487 |
+
Provided
|
| 488 |
+
|
| 489 |
+
$$
|
| 490 |
+
\begin{array} { r l } & { \underset { s } { \operatorname* { m i n } } V _ { \delta } ( s ) \geq \frac { R _ { \operatorname* { m i n } } } { 2 } } \\ & { \underset { s } { \operatorname* { m a x } } V _ { \delta } ( s ) \leq \frac { R _ { \operatorname* { m a x } } } { 1 - \beta } } \\ & { \underset { s } { \operatorname* { m i n } } \left( \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - r ( s ) \right) \geq \underset { s } { \operatorname* { m i n } } \left( \log \left( \frac { 1 - \bar { \delta } ( s ) } { \delta ( s ) } \right) - r ( s ) \right) = 0 } \\ & { \underset { s } { \operatorname* { m a x } } \left( \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - r ( s ) \right) \leq \underset { s } { \operatorname* { m a x } } \log \left( \frac { 1 - \bar { \delta } ( s ) } { \bar { \delta } ( s ) } \right) - \underset { s } { \operatorname* { m i n } } r ( s ) } \\ & { \qquad \quad \leq \exp \left( \frac { 1 } { 1 - \beta } R _ { \operatorname* { m a x } } - \frac { \beta } { 2 } R _ { \operatorname* { m i n } } \right) - R _ { \operatorname* { m i n } } } \end{array}
|
| 491 |
+
$$
|
| 492 |
+
|
| 493 |
+
it follows from Bellman equation (8) that
|
| 494 |
+
|
| 495 |
+
$$
|
| 496 |
+
\begin{array} { l } { \displaystyle \operatorname* { m i n } _ { s } \mathrm { D } V _ { \delta } ( s ) \geq \frac { 1 } { 1 - \beta } \left( \operatorname* { m i n } _ { s } \left( \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - r ( s ) \right) + \beta ( \operatorname* { m i n } _ { s } V _ { \delta } ( s ) - \operatorname* { m a x } _ { s } V _ { \delta } ( s ) ) \right) } \\ { \displaystyle \qquad \geq \frac { \beta } { 1 - \beta } \left( \frac { R _ { \operatorname* { m i n } } } { 2 } - \frac { R _ { \operatorname* { m a x } } } { 1 - \beta } \right) } \\ { \displaystyle \operatorname* { m a x } _ { s } \mathrm { D } V _ { \delta } ( s ) \leq \frac { 1 } { 1 - \beta } \left( \operatorname* { m a x } _ { s } \left( \log \left( \frac { 1 - \delta ( s ) } { \delta ( s ) } \right) - r ( s ) \right) + \beta ( \operatorname* { m a x } _ { s } V _ { \delta } ( s ) - \operatorname* { m i n } _ { s } V _ { \delta } ( s ) ) \right) } \\ { \displaystyle \qquad \leq \frac { 1 } { 1 - \beta } \left( \exp \left( \frac { 1 } { 1 - \beta } R _ { \operatorname* { m a x } } - \frac { \beta } { 2 } R _ { \operatorname* { m i n } } \right) + \frac { \beta } { 1 - \beta } R _ { \operatorname* { m a x } } - \frac { 2 + \beta } { 2 } R _ { \operatorname* { m i n } } \right) } \end{array}
|
| 497 |
+
$$
|
| 498 |
+
|
| 499 |
+
Thus, for all state $s \in S$ ,
|
| 500 |
+
|
| 501 |
+
$$
|
| 502 |
+
\mathrm { D } ^ { 2 } V _ { \delta } ( s ) \geq - M . \quad \bigsqcup
|
| 503 |
+
$$
|
| 504 |
+
|
| 505 |
+
Proof of Theorem 4.3. The convergence rate guarantee follows from Lemma B.3 and Lemma B.4, under the standard arguments for the gradient descent algorithm for $m$ -strongly concave and $M$ - smooth (i.e., $M$ -Lipschitz gradient) functions (cf. Bansal and Gupta, 2017). □
|
| 506 |
+
|
| 507 |
+
# C MORE RESULTS IN SECTION 5
|
| 508 |
+
|
| 509 |
+
<table><tr><td>Algorithm 1"Lazy projection”, (π1,...,πN): thresholds corresponding to discretized state space (S1, ..,SN); L(.): logistic function; policy δj = L(πj); α: step size; T: termination tolerance</td></tr><tr><td>(0) ←u(s1),.,π 1: (0) ← u(s n) // Initialize π(O) at the myopic policy T while maxi [DV(e)(si)≤Tdo 2:</td></tr><tr><td>(k*) (k-1) 3: 下 ↑</td></tr><tr><td>(k) (k)) the closest monotone thresholds of(π( (k*) (k*)) 4: (i 个 ) // Lazy projection T N πN , (k) (k)) 5: return πN</td></tr></table>
|
| 510 |
+
|
| 511 |
+
We list the convergence of gradient descent and its derivative, second derivative at smaller discount factor $\beta = 0 . 9$ .
|
| 512 |
+
|
| 513 |
+

|
| 514 |
+
Figure 3: Convergence of gradient descent, discount factor $\beta = 0 . 9$
|
| 515 |
+
|
| 516 |
+

|
| 517 |
+
Figure 4: Performance of the norm $\mathrm { m a x } _ { i }$ $\left| \mathrm Ḋ V Ḍ _ { \delta } ( s _ { i } ) \right|$ and the second derivative maxi $ { \left| \mathrm { D } ^ { 2 } V _ { \delta } ( s _ { i } ) \right| }$ , discount factor $\beta = 0 . 9$
|
md/train/H1gza2NtwH/H1gza2NtwH.md
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOWARDS UNDERSTANDING THE TRUE LOSS SURFACE OF DEEP NEURAL NETWORKS USING RANDOM MATRIX THEORY AND ITERATIVE SPECTRAL METHODS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The geometric properties of loss surfaces, such as the local flatness of a solution, are associated with generalization in deep learning. The Hessian is often used to understand these geometric properties. We investigate the differences between the eigenvalues of the neural network Hessian evaluated over the empirical dataset, the Empirical Hessian, and the eigenvalues of the Hessian under the data generating distribution, which we term the True Hessian. Under mild assumptions, we use random matrix theory to show that the True Hessian has eigenvalues of smaller absolute value than the Empirical Hessian. We support these results for different SGD schedules on both a 110-Layer ResNet and VGG-16. To perform these experiments we propose a framework for spectral visualization, based on GPU accelerated stochastic Lanczos quadrature. This approach is an order of magnitude faster than state-of-the-art methods for spectral visualization, and can be generically used to investigate the spectral properties of matrices in deep learning.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The extraordinary success of deep learning in computer vision and natural language processing has been accompanied by an explosion of theoretical (Choromanska et al., 2015a;b; Pennington & Bahri, 2017) and empirical interest in their loss surfaces, typically through the study of the Hessian and its eigenspectrum (Ghorbani et al., 2019; Li et al., 2017; Sagun et al., 2016; 2017; Wu et al., 2017).
|
| 12 |
+
|
| 13 |
+
Exploratory work on the Hessian, and its evolution during training (e.g., Jastrz˛ebski et al., 2018), attempts to understand why optimization procedures such as SGD can discover good solutions for training neural networks, given complex non-convex loss surfaces. For example, the ratio of the largest to smallest eigenvalues, known as the condition number, determines the convergence rate for first-order optimization methods on convex objectives (Nesterov, 2013). The presence of negative eigenvalues indicates non-convexity even at a local scale. Hessian analysis has also been a primary tool in further explaining the difference in generalization of solutions obtained, where under Bayesian complexity frameworks, flatter minima, which require less information to store, generalize better than sharp minima (Hochreiter & Schmidhuber, 1997). Further work has considered how large batch vs small batch stochastic gradient descent (SGD) alters the sharpness of solutions (Keskar et al., 2016), with smaller batches leading to convergence to flatter solutions, leading to better generalization. These geometrical insights have led to generalization procedures, such as taking the Cesàro mean of the weights along the SGD trajectory (Garipov et al., 2018; Izmailov et al., 2018), and algorithms that optimize the model to select for local flatness (Chaudhari et al., 2016). Flat regions of weight space are more robust under adversarial attack (Yao et al., 2018). Moreover, the Hessian defines the curvature of the posterior over weights in the Laplace approximation for Bayesian neural networks (MacKay, 1992; 2003), and thus crucially determines its performance.
|
| 14 |
+
|
| 15 |
+
In this paper we use random matrix theory to analyze the spectral differences between the Empirical Hessian, evaluated via a finite data sample (hence related to the empirical risk) and what we term the True Hessian, given under the expectation of the true data generating distribution.1
|
| 16 |
+
|
| 17 |
+
In particular, we show that the differences in extremal eigenvalues between the True Hessian and the Empirical Hessian depend on the ratio of model parameters to dataset size and the variance per element of the Hessian. Moreover, we show that that the Empirical Hessian spectrum, relative to that of the True Hessian, is broadened; i.e. the largest eigenvalues are larger and the smallest smaller. We support this theory with experiments on the CIFAR-10 and CIFAR-100 datasets for different learning rate schedules using a large modern neural network, the 110 Layer PreResNet.
|
| 18 |
+
|
| 19 |
+
It is not currently known if key results, such as (1) the flatness or sharpness of good and bad optima, (2) local non-convexity at the end of training, or (3) rank degeneracy hold for the True Hessian in the same way as for the Empirical Hessian. We hence provide an investigation of these foundational questions.
|
| 20 |
+
|
| 21 |
+
# 2 RELATED WORK, CONTRIBUTIONS AND PAPER STRUCTURE
|
| 22 |
+
|
| 23 |
+
Previous work has used random matrix theory to study the spectra of neural network Hessians under assumptions such as normality of inputs and weights, to show results such as the decreasing difference in loss value between the local and global minima (Choromanska et al., 2015a) and the fraction of negative eigenvalues at final points in training (Pennington & Bahri, 2017). To the authors knowledge no theoretical work has been done on the nature of the difference in spectra between the True Hessian and Empirical Hessian in machine learning. Previous empirical work on neural network loss surfaces (Ghorbani et al., 2019; Papyan, 2018; Sagun et al., 2017; 2016; Jastrz˛ebski et al., 2018) has also exclusively focused on the Empirical Hessian or a sub-sample thereof.
|
| 24 |
+
|
| 25 |
+
The work closest in spirit to our work is the spiked covariance literature, which studies the problem of learning the true covariance matrix given by the generating distribution, from the noisy sample covariance matrix. This problem is studied in mathematics and physics (Baik & Silverstein, 2004; Bloemendal et al., 2016b;a) with applications leading to extensively improved results in both sparse Principal Component Analysis (Johnstone & Lu, 2004), portfolio theory (Laloux et al., 1999) and Bayesian covariance matrix spectrum estimation (Everson & Roberts, 2000). A key concept from this literature, is the ratio of parameters to data samples and its effect on the observed spectrum; this ratio is mentioned in (Pennington & Bahri, 2017), but it is not used to determine the perturbation between the Empirical Hessian and True Hessian. (Kunstner et al., 2019) consider circumstances under which the Empirical Fisher information matrix is a bad proxy to the True Fisher matrix, but do not use a random matrix theory to characterise the spectral perturbations between the two. We list our main contributions below.
|
| 26 |
+
|
| 27 |
+
• We introduce the concept of the True Hessian, discuss its importance and investigate it both theoretically and empirically.
|
| 28 |
+
• We use random matrix theory to analytically derive the eigenvalue perturbations between the True Hessian and the Empirical Hessian, showing the spectrum of the Empirical Hessian to be broadened.
|
| 29 |
+
• We visualize the True Hessian spectrum by combining a GPU accelerated stochastic Lanczos quadrature (Gardner et al., 2018) with data-augmentation. Our spectral visualization technique is an order of magnitude faster than recent iterative methods (Ghorbani et al., 2019; Papyan, 2018), requires one less hand-tuned hyper-parameter, and is consistent with the observed moment information. This procedure can be generically used to compute the spectra of large matrices (e.g., Hessians, Fisher information matrices) in deep learning.
|
| 30 |
+
|
| 31 |
+
# 3 PROBLEM FORMULATION
|
| 32 |
+
|
| 33 |
+
For an input $\pmb { x } \in \mathbb { R } ^ { d _ { x } }$ and output $\boldsymbol { y } \in \mathbb { R } ^ { d _ { y } }$ we have a given prediction function $h ( \cdot ; \cdot ) : \mathbb { R } ^ { d _ { x } } \times \mathbb { R } ^ { P } $ $\mathbb { R } ^ { d _ { y } }$ , we consider the family of prediction functions parameterised by a weight vector $\pmb { w }$ , i.e., $\mathcal { H } : = \{ h ( \cdot ; w ) : w \in \mathbb { R } ^ { P } \}$ with a given loss $\ell ( h ( \pmb { x } ; \pmb { w } ) , \pmb { y } ) : \mathbb { R } ^ { d _ { x } } \times \mathbb { R } ^ { \tilde { d _ { y } } } \mathbb { R }$ . Ideally we would vary $\pmb { w }$ such that we minimize the loss over our data generating distribution $\psi ( { \pmb x } , { \pmb y } )$ , known as the true risk.
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
R _ { t r u e } ( { \pmb w } ) = \int _ { { \mathbb R } ^ { d _ { x } } \times { \mathbb R } ^ { d _ { y } } } \ell ( h ( { \pmb x } ; { \pmb w } ) , { \pmb y } ) d \psi ( { \pmb x } , { \pmb y } ) = { \mathbb E } [ \ell ( h ( { \pmb x } ; { \pmb w } ) , { \pmb y } ) ]
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
with corresponding gradient $\mathbf { \sigma } \mathbf { g } _ { t r u e } ( \mathbf { w } ) = \nabla R _ { t r u e } ( \mathbf { w } )$ and Hessian $\pmb { H } _ { t r u e } ( \pmb { w } ) = \nabla \nabla R _ { t r u e } ( \pmb { w } )$ . If the loss is a negative log likelihood, then the true risk is the expected negative log likelihood per data point under the data generating distribution. However, given a dataset of size $N$ , we only have access to the empirical or full risk
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
R _ { e m p } ( { \pmb w } ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \ell ( h ( \pmb x _ { i } ; { \pmb w } ) , \pmb y _ { i } )
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
and the gradients $\mathbf { \mathit { g } } _ { e m p } ( \mathbf { \boldsymbol { w } } )$ and Hessians ${ \pmb { H } } _ { e m p } ( { \pmb { w } } )$ thereof. The Hessian describes the curvature at that point in weight space $\pmb { w }$ and hence the risk surface can be studied through the Hessian. Weight vectors which achieve low values of equation 2 do not necessarily achieve low values of equation 1. Their difference is known as the generalization gap. We rewrite our Empirical Hessian as
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
{ { H } _ { e m p } } ( { \pmb w } ) = { { H } _ { t r u e } } ( { \pmb w } ) + \varepsilon ( { \pmb w } )
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where2 $\pmb { \varepsilon } ( \pmb { w } ) \equiv \pmb { H } _ { e m p } ( \pmb { w } ) - \pmb { H } _ { t r u e } ( \pmb { w } )$ . A symmetric matrix with independent normally distributed elements of equal variance is known as the Gaussian Orthogonal Ensemble (GOE) and a matrix with independent non-Gaussian elements of equal variance is known as the Wigner ensemble.
|
| 52 |
+
|
| 53 |
+
# 3.1 FLATNESS AND GENERALIZATION WITH THE EMPIRICAL HESSIAN
|
| 54 |
+
|
| 55 |
+
By the spectral theorem, we can rewrite $H _ { e m p }$ in terms of its eigenvalue, eigenvector pairs, $[ \lambda _ { i } , \phi _ { i } ]$
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
{ \cal H } _ { e m p } = \sum _ { i = 1 } ^ { P } \lambda _ { i } \phi _ { i } \phi _ { i } ^ { T } .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
The magnitude of the eigenvalues represent the magnitude of the curvature in the direction of the corresponding eigenvectors. Often the magnitude of the largest eige(given by the square root of the sum of all the eigenvalues squared $\lambda _ { 1 }$ e Frobenius norm, is used to define $( \textstyle \sum _ { i = 1 } ^ { P } \lambda _ { i } ^ { 2 } ) ^ { 1 / 2 } )$ spectrum, also known as the trace $P ^ { - 1 } \textstyle \sum _ { i } ^ { P } \lambda _ { i } ^ { 2 }$ , has also been used (Dinh et al., 2017). In all of these cases a larger value indicates greater sharpness. Other definitions of flatness have looked at counting the number of 0 (Sagun et al., 2016), or close to 0 (Chaudhari et al., 2016), eigenvalues.
|
| 62 |
+
|
| 63 |
+
It is often argued that flat solutions provide better generalization because they are more robust to shifts between the train and test loss surfaces (e.g., Keskar et al., 2016) that exist because of statistical differences between the training and test samples. It is then compelling to understand whether flat solutions associated with the True Hessian would also provide better generalization, since the True Hessian is formed from the full data generating distribution. If so, there may be other important reasons why flat solutions provide better generalization.
|
| 64 |
+
|
| 65 |
+
Reparametrization can give the appearance of flatness or sharpness from the perspective of the Hessian. However, it is common practice to hold the parametrization of the model fixed when comparing the Hessian at different parameter settings, or evaluated over different datasets.
|
| 66 |
+
|
| 67 |
+
# 4 ANALYZING THE TRUE RISK SURFACE USING RANDOM MATRIX THEORY
|
| 68 |
+
|
| 69 |
+
We show that the elementwise difference between the True and Empirical Hessian converges to a zero mean normal random variable, assuming a Lipshitz bounded gradient. Moreover, we derive a precise analytic relationship between the values of the extremal values for both the Empirical and True Hessians, showing the eigenvalues for the Empirical Hessian to be larger in magnitude. This result indicates that the true risk surface is flatter than its empirical counterpart.
|
| 70 |
+
|
| 71 |
+
# 4.1 REGULARITY CONDITIONS
|
| 72 |
+
|
| 73 |
+
We establish some weak regularity conditions on the loss function and data, under which the elements of $\varepsilon ( w )$ converge to zero mean normal random variables.
|
| 74 |
+
|
| 75 |
+
Lemma 1. For an $L$ -Lipshitz-continuous-gradient and almost everywhere twice differentiable loss√ function $\ell ( h ( { \boldsymbol { \mathbf { \mathit { x } } } } ; { \boldsymbol { \mathbf { \mathit { w } } } } ) , { \boldsymbol { \mathbf { \mathit { y } } } } )$ , the True Hessian elements are strictly bounded in the range $- \sqrt { P } L \leq$ $H _ { j , k } \leq \sqrt { P } L$ .
|
| 76 |
+
|
| 77 |
+
Proof. By the fundamental theorem of calculus and the definition of Lipshitz continuity $\lambda _ { m a x } \le L$
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\begin{array} { l } { { \displaystyle \mathrm { T r } ( { \pmb H } ^ { 2 } ) = \sum _ { i = 1 } ^ { P } \lambda _ { i } ^ { 2 } = \sum _ { j , k = 1 } ^ { P } H _ { j , k } ^ { 2 } = H _ { j = j ^ { \prime } , k = k ^ { \prime } } ^ { 2 } + \sum _ { j \neq j ^ { \prime } , k \neq k ^ { \prime } } ^ { P } H _ { j , k } ^ { 2 } } } \\ { { \displaystyle \pmb H _ { j = j ^ { \prime } , k = k ^ { \prime } } ^ { 2 } \leq \sum _ { i = 1 } ^ { P } \lambda _ { i } ^ { 2 } \leq P L ^ { 2 } } } \\ { { \displaystyle - \sqrt { P } L \leq H _ { j = j ^ { \prime } , k = k ^ { \prime } } \leq \sqrt { P } L } } \end{array}
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Lemma 2. For unbiased independent samples drawn from the data generating distribution and an $L$ -Lipshitz loss $\ell$ the difference between the True Hessian and Empirical Hessian converges element-wise to a zero mean, normal random variable with variance $\propto 1 / N$ .
|
| 84 |
+
|
| 85 |
+
Proof. The difference between the Empirical and True Hessian $\varepsilon ( w )$ is given as
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\nabla \nabla R _ { t r u e } ( w ) - \nabla \nabla R _ { e m p } ( w ) ] _ { j k } = \mathbb { E } \frac { \partial ^ { 2 } } { \partial w _ { j } \partial w _ { k } } \ell ( h ( x ; w ) , y ) - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \frac { \partial ^ { 2 } } { \partial w _ { j } \partial w _ { k } } \ell ( h ( x _ { i } ; w ) , y _ { i } )
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
By Lemma 1, the Hessian elements are bounded, hence the moments are bounded and using independence and the central limit theorem, equation 6 converges almost surely to a normal random variable $\mathbb { P } ( \mu _ { j k } , \sigma _ { j k } ^ { 2 } / N )$ . □
|
| 92 |
+
|
| 93 |
+
Remark. For finite $P$ and $N \to \infty$ , i.e. $q = P / N \to 0$ , $\lvert \varepsilon ( \pmb { w } ) \rvert 0$ we recover the True Hessian. Similarly in this limit our empirical risk converges almost surely to our true risk, i.e. we eliminate the generalization gap. However, in deep learning typically the network size eclipses the dataset size by orders of magnitude.3
|
| 94 |
+
|
| 95 |
+
# 4.2 A RANDOM MATRIX THEORY APPROACH
|
| 96 |
+
|
| 97 |
+
In order to derive analytic results, we move to the large Dimension limit, where $P , N \to \infty$ but $P / N = q > 0$ and employ the machinery of random matrix theory to derive results for the perturbations on the eigenspectrum between the True Hessian and Empirical Hessian. This differs from the classical statistical regime where $q \to 0$ . We primarily focus on the regime when $q \gg 1$ . In order to make the analysis tractable, we introduce two further assumptions on the nature of the elements $\varepsilon ( w )$ .
|
| 98 |
+
|
| 99 |
+
Assumption 1. The elements of $\varepsilon ( w )$ are identically and independently Gaussian distributed $\mathcal { N } ( 0 , \sigma _ { \epsilon } ^ { \bar { 2 } } )$ up to the Hermitian condition.
|
| 100 |
+
|
| 101 |
+
Assumption 2. ${ \mathbf { } } H _ { t r u e }$ is of low rank $r \ll P$ .
|
| 102 |
+
|
| 103 |
+
Under assumption 1, $\varepsilon ( w )$ becomes a Gaussian Orthogonal Ensemble (GOE) and for the GOE we can prove the following Lemma 3. We discuss the necessity of the assumptions in Section 4.3.
|
| 104 |
+
|
| 105 |
+
Lemma 3. The extremal eigenvalues $[ \lambda _ { 1 } ^ { \prime } , \lambda _ { P } ^ { \prime } ]$ of the matrix sum $A + B / \sqrt { P }$ , where $\pmb { A } \in \mathbb { R } ^ { P \times P }$ is a matrix of finite rank $r$ with extremal eigenvalues $[ \lambda _ { 1 } , \lambda _ { P } ]$ and $\boldsymbol { B } \in \mathbb { R } ^ { P \times P }$ is a GOE matrix with element variance $\sigma _ { \epsilon } ^ { 2 }$ are given by
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\lambda _ { 1 } ^ { \prime } = \left\{ \begin{array} { l l } { { \lambda _ { 1 } + \frac { \sigma _ { \epsilon } ^ { 2 } } { \lambda _ { 1 } } , } } & { { i f \lambda _ { 1 } > \sigma _ { \epsilon } } } \\ { { 2 \sigma _ { \epsilon } , } } & { { o t h e r w i s e } } \end{array} \right\} \mathrm { , ~ } { \lambda _ { P } ^ { \prime } } = \left\{ \begin{array} { l l } { { \lambda _ { P } + \frac { \sigma _ { \epsilon } ^ { 2 } } { \lambda _ { n } } , } } & { { i f \lambda _ { n } < - \sigma _ { \epsilon } } } \\ { { - 2 \sigma _ { \epsilon } , } } & { { o t h e r w i s e } } \end{array} \right\}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
Proof. See Appendix.
|
| 112 |
+
|
| 113 |
+
Theorem 1. The extremal eigenvalues $[ \lambda _ { 1 } ^ { \prime } , \lambda _ { P } ^ { \prime } ]$ of the matrix sum $H _ { e m p }$ , where $\lambda _ { 1 } ^ { \prime } \ge \lambda _ { 2 } ^ { \prime } . . . \ge \lambda _ { P } ^ { \prime }$ (such that assumptions $^ { l }$ and 2 are satisfied), where $H _ { t r u e }$ has extremal eigenvalues $[ \lambda _ { 1 } , \lambda _ { P } ]$ , are given by
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\lambda _ { 1 } ^ { \prime } = \left\{ \begin{array} { l l } { \lambda _ { 1 } + \frac { P } { N } \frac { \sigma _ { \epsilon } ^ { 2 } } { \lambda _ { 1 } } , } & { i f \lambda _ { 1 } > \sqrt { \frac { P } { N } } \sigma _ { \epsilon } } \\ { 2 \sqrt { \frac { P } { N } } \sigma _ { \epsilon } , } & { o t h e r w i s e } \end{array} \right\} \mathrm { , ~ } \lambda _ { P } ^ { \prime } = \left\{ \begin{array} { l l } { \lambda _ { P } + \frac { P } { N } \frac { \sigma _ { \epsilon } ^ { 2 } } { \lambda _ { P } } , } & { i f \lambda _ { P } < - \sqrt { \frac { P } { N } } \sigma _ { \epsilon } } \\ { - 2 \sqrt { \frac { P } { N } } \sigma _ { \epsilon } , } & { o t h e r w i s e } \end{array} \right\} \mathrm { . }
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
Proof. The result follows directly from Lemmas 2 and 3.
|
| 120 |
+
|
| 121 |
+
Remark. This result shows that the extremal eigenvalues of the Empirical Hessian are larger in magnitude than those of the True Hessian: Although we only state this result for the extremal eigenvalues, it holds for any number of well separated outlier eigenvalues. This spectral broadening effect has already been observed empirically when moving from (larger) training to the (smaller) test set (Papyan, 2018). Intuitively variance of the Empirical Hessian eigenvalues can be seen as the variance of the True Hessian eigenvalues plus the variance of the Hessian, as we show in Appendix F. We also note that if the condition $| \lambda _ { i } | > \sqrt { P / N } \sigma _ { \epsilon }$ is not met, the value of the positive and negative extremal eigenvalues are completely determined by the noise matrix.
|
| 122 |
+
|
| 123 |
+
# 4.3 NOTE ON GENERALIZING ASSUMPTIONS
|
| 124 |
+
|
| 125 |
+
For Assumption 1, we note that the results for the Wigner ensemble (of which the GOE is a special case) can be extended to non-identical element variances (Tao, 2012) and element dependence (Götze et al., 2012; Schenker & Schulz-Baldes, 2005). Hence, similarly to Pennington & Bahri (2017), under extended technical conditions we expect our results to hold more generally. Assumption 2 can be relaxed if the number of extremal eigenvalues is much smaller than $P$ , and the bulk of $\pmb { H } _ { t r u e } ( \pmb { w } )$ ’s eigenspectra also follows a Wigner ensemble which is mutually free with that of $\varepsilon ( w )$ . Furthermore, corrections to our results for finite $P$ scale as $P ^ { - 1 / 4 }$ for matrices with finite 4’th moments and $P ^ { - 2 / 5 }$ for all finite moments (Bai, 2008).
|
| 126 |
+
|
| 127 |
+
# 5 EFFICIENT COMPUTATION OF HESSIAN EIGENVALUES
|
| 128 |
+
|
| 129 |
+
In order to perform spectral analysis on the Hessian of typical neural networks, with tens of millions of parameters, we avoid the infeasible $\mathcal { O } ( P ^ { 3 } )$ eigen-decomposition and use the stochastic Lanczos quadrature (SLQ) algorithm, in conjunction with GPU acceleration. Our procedure in this section is a general-purpose approach for efficiently computing the spectra of large matrices in deep learning.
|
| 130 |
+
|
| 131 |
+
# 5.1 STOCHASTIC LANCZOS QUADRATURE
|
| 132 |
+
|
| 133 |
+
The Lanczos algorithm (Meurant & Strakoš, 2006) is a power iteration algorithm variant which by enforcing orthogonality and storing the Krylov subspace, ${ \ K } _ { m + 1 } ( H , v ) \stackrel { - } { = } \{ v , H v , . . , H ^ { m } v \}$ , optimally approximates the extremal and interior eigenvalues (known as Ritz values). It requires Hessian vector products, for which we use the Pearlmutter trick (Pearlmutter, 1994) with computational cost $\mathcal { O } ( N P )$ , where $N$ is the dataset size and $P$ is the number of parameters. Hence for $m$ steps the total computational complexity including re-orthogonalisation is $\mathcal { O } ( N P m )$ and memory cost of $\mathcal { O } ( P m )$ . In order to obtain accurate spectral density estimates we re-orthogonalise at every step (Meurant & Strakoš, 2006). We exploit the relationship between the Lanczos method and Gaussian quadrature, using random vectors to allow us to learn a discrete approximation of the spectral density. A quadrature rule is a relation of the form,
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\int _ { a } ^ { b } f ( \lambda ) d \mu ( \lambda ) = \sum _ { j = 1 } ^ { M } \rho _ { j } f ( t _ { j } ) + R [ f ]
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
for a function $f$ , such that its Riemann-Stieltjes integral and all the moments exist on the measure $d \mu ( \lambda )$ , on the interval $[ a , b ]$ and where $R [ f ]$ denotes the unknown remainder. The nodes $t _ { j }$ of the Gauss quadrature rule are given by the Ritz values and the weights (or mass) $\rho _ { j }$ by the squares of the
|
| 140 |
+
|
| 141 |
+
first elements of the normalized eigenvectors of the Lanczos tri-diagonal matrix (Golub & Meurant, 1994). For zero mean, unit variance random vectors, using the linearity of trace and expectation
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\mathbb { E } _ { v } \mathrm { T r } ( v ^ { T } H ^ { m } v ) = \mathrm { T r } \mathbb { E } _ { v } ( v v ^ { N } H ^ { m } ) = \mathrm { T r } ( H ^ { m } ) = \sum _ { i = 1 } ^ { P } \lambda _ { i } ^ { m } = P \int _ { \lambda \in \mathcal { D } } \lambda ^ { m } d \mu ( \lambda )
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
hence the measure on the LHS of equation 9 corresponds to that of the underlying spectral density. The error between the expectation over the set of all zero mean, unit variance vectors $v$ and the Monte Carlo sum used in practice can be bounded (Hutchinson, 1990; Roosta-Khorasani & Ascher, 2015), but the bounds are too loose to be of any practical value (Granziol $\&$ Roberts, 2017). However, in the high dimensional regime $N \to \infty$ , we expect the squared overlap of each random vector with an eigenvector of $\pmb { H }$ , $\begin{array} { r } { | \pmb { v } ^ { T } \pmb { \phi } _ { i } | ^ { 2 } \approx \frac { 1 } { P } \forall i } \end{array}$ , with high probability (Cai et al., 2013). This result can be seen intuitively by looking at the normalized overlap squared between two random Rademacher vectors, where each element is drawn from the distribution $\pm 1$ with equal probability, which gives $1 / P$ . The Lanczos algorithm can also be easily parallelized, since it largely involves matrix multiplications — a major advantage for computing eigenvalues of large matrices in deep learning. We exploit GPU parallelization in performing Lanczos (Gardner et al., 2018), for significant acceleration.
|
| 148 |
+
|
| 149 |
+
# 5.2 WHY TO AVOID MULTIPLE RANDOM VECTORS AND KERNEL SMOOTHING
|
| 150 |
+
|
| 151 |
+
In recent work using SLQ for evaluating neural network spectra (Papyan, 2018; Ghorbani et al., 2019), the Hessian vector product is averaged over a set of random vectors, typically $\approx 1 0$ . The resulting discrete moment matched approximation to the spectra in equation 9 is smoothed using a Gaussian kernel $\mathcal { N } ( \lambda _ { i } , \sigma ^ { 2 } )$ . The use of multiple random vectors can be seen as reducing the variance of the vector overlap in a geometric equivalent of the central limit theorem. Whilst this may be desirable for general spectra, if we believe the spectra to be composed of outliers and a bulk as is empirically observed (Sagun et al., 2016; 2017), then the same self-averaging procedure happens with the bulk. We converge to the spectral outliers quickly using the Lanczos algorithm, as shown in the Appendix by the known convergence theorem 3. Hence all the spectral information we need can be gleaned from a single random vector. Furthermore, it has been proven that kernel smoothing biases the moment information obtained by the Lanczos method (Granziol et al., 2018). We hence avoid smoothing (and the problem of choosing $\sigma$ ), along with the $\approx 1 0 \times$ increased computational cost, by plotting the discrete spectral density implied by equation 9 for a single random vector, in the form of a stem plot.
|
| 152 |
+
|
| 153 |
+
# 5.3 WEAKNESSES OF STOCHASTIC LANCZOS QUADRATURE
|
| 154 |
+
|
| 155 |
+
It is possible to determine what fraction of eigenvalues is near the origin by evaluating the weight of the Ritz value(s) closest to the origin. But due to the discrete nature of the Ritz values, which give the nodes of the associated moment-matched spectral density in equation 9, it is not possible to see exactly whether the Hessian of neural networks is rank degenerate. It is also not possible to exactly determine what fraction of eigenvalues are negative. Furthermore, smoothing the density and using quadrature has the problems discussed in Section 5.2. Instead, we determine the fraction of negative eigenvalues as the weight of negative Ritz values which are well separated from the smallest magnitude Ritz value(s), to avoid counting a split of the degenerate mass.
|
| 156 |
+
|
| 157 |
+
# 6 EXPERIMENTS
|
| 158 |
+
|
| 159 |
+
In order to test the validity of our theoretical results in Section 4.2, we control the parameter $q = P / N$ by applying data-augmentation and then running GPU powered Lanczos method (Gardner et al., 2018) on the augmented dataset at the final set of weights ${ \pmb w } _ { f i n a l }$ at the end of the training procedure. We use random horizontal flips, $4 \times 4$ padding with zeros and random $3 2 \times 3 2$ crops. We neglect the dependence of the augmented dataset on the input dataset in our analysis, but we would expect the effective number of data points $N _ { e f f } < N$ due to degeneracy in the samples. For the Emprical Hessian, we use the full training and test dataset $N = 5 0 , 0 0 0$ with no augmentation. We use PyTorch (Paszke et al., 2017). We train a 110 layer pre-activated ResNet (He et al., 2016) neural network architecture on CIFAR-10 and CIFAR-100 using SGD with momentum set at $\rho = 0 . 9$ and data-augmentation. We include further plots and detail the training procedure for the VGG-16 (Simonyan & Zisserman, 2014) in Appendix I.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 1: Empirical Hessian spectrum for CIFAR-100 SGD.
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 2: Empirical Hessian spectrum for CIFAR-10 SGD.
|
| 166 |
+
|
| 167 |
+
In order to investigate whether empirically observed phenomena for the Empirical Hessian such as sharp minima generalizing more poorly than their flatter counterparts also hold for the True Hessian, we run two slightly different SGD decayed learning rate schedules (equation 11) on a 110-Layer ResNet (Izmailov et al., 2018).
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
\alpha _ { t } = \left\{ \begin{array} { l l } { \alpha _ { 0 } , } & { \mathrm { i f ~ } \frac { t } { T } \leq 0 . 5 } \\ { \alpha _ { 0 } [ 1 - \frac { ( 1 - r ) ( \frac { t } { T } - 0 . 5 ) } { 0 . 4 } ] } & { \mathrm { i f ~ } 0 . 5 < \frac { t } { T } \leq 0 . 9 } \\ { \alpha _ { 0 } r , } & { \mathrm { o t h e r w i s e } } \end{array} \right.
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
For both schedules we use $r = 0 . 0 1$ . For the Normal schedule we use $\alpha _ { 0 } = 0 . 1$ and $T = 2 2 5$ whereas for the Overfit schedule we use $\alpha _ { 0 } = 0 . 0 0 1$ and $T = 1 0 0 0$ .
|
| 174 |
+
|
| 175 |
+
We plot the training curves in the Appendices B, C and include the best training and test accuracies and losses, along with the extremal eigenvalues of the Empirical Hessian and Augmented Hessian in Table 1 for CIFAR-100 and Table 2 for CIFAR-10. The Normal schedule achieves a best test accuracy of [77.24/95.32] on CIFAR-100/CIFAR-10 respectively and best training accuracy of [99.85/99.98]. The Overfit schedule achieves a best test accuracy of [56.85/86.46] on CIFAR-100/CIFAR-10 respectively and best training accuracy of [99.62/99.91].
|
| 176 |
+
|
| 177 |
+
We then run SLQ with $m = 1 0 0$ on the final set of training weights to compute an approximation to the spectrum for both schedules on the full 50, 000 training set (i.e the Empirical Hessian) and with $m = 8 0$ on an augmented 1, 500, 000 data-set as a proxy for the True Hessian, which we denote the Augmented Hessian. The 110-Layer ResNet has $1 , \dot { 1 6 9 } , 9 7 2 / 1$ , 146, 842 parameters for CIFAR-100/CIFAR-10 respectively, hence for both we have $q < 1$ . We primarily comment on the extremal eigenvalues of the Augmented Hessian and their deviation from those of the Empirical Hessian. We also investigate the spectral density at the origin and the change in negative spectral mass. A sharp drop in negative spectral mass, indicates due to Theorem 1 that most of the negative spectral mass is due to the perturbing GOE.
|
| 178 |
+
|
| 179 |
+
# 6.1 NORMAL SGD SCHEDULE - EMPIRICAL AND AUGMENTED HESSIAN ANALYSIS
|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
Figure 3: Augmented 1, 500, 000 data Hessian spectrum for CIFAR-10 SGD.
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 4: Augmented 1, 500, 000 data Hessian spectrum for CIFAR-100 SGD.
|
| 186 |
+
|
| 187 |
+
We plot the Empirical Hessian spectrum for the end of training for CIFAR-100 in Figure 1 and the Augmented Hessian in Figure 4. We plot the same discrete spectral density plots for the Empirical Hessian for CIFAR-10 in Figure 2 and the Augmented Hessian in Figure 3. We note that the effects predicted by Theorem 1 are empirically supported by the differences between the Empirical and Augmented Hessian. For CIFAR-100 the extremal eigenvalues shrink from $[ - 6 . 5 4 , 2 0 . 5 6 ]$ (Figure 1) for the full dataset to $[ - 0 . 0 1 4 , 3 . 0 2 6 ]$ (Figure 4) for the Augmented dataset. The Empirical Hessian has $4 3 / 1 0 0$ negative Ritz values with a negative spectral mass total of 0.05. The Augmented Hessian has $5 / 8 0$ negative Ritz values with total negative spectral mass of 0.00016. For CIFAR-10 the extremal eigenvalues shrink from $[ - 1 . 3 7 4 , 6 . 8 2 1 ]$ (Figure 2) to $\left[ - 0 . 0 0 6 1 , 0 . 5 8 2 5 \right]$ (Figure 3). The fraction of negative Ritz values shrinks from 35/100 with total weight 0.09 to $3 / 8 { \bar { 0 } }$ with total mass 0.03.
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
6.2 OVERFITTING SGD SCHEDULE - EMPIRICAL AND AUGMENTED HESSIAN ANALYSIS
|
| 191 |
+
Figure 5: Empirical Hessian Spectrum C100 OverFit SGD.
|
| 192 |
+
|
| 193 |
+

|
| 194 |
+
Figure 6: Empirical Hessian Spectrum C10 OverFit SGD.
|
| 195 |
+
|
| 196 |
+
As can be seen from the spectral plots of the full Hessians for both CIFAR-100 and CIFAR-10 in Figures 6 & 5, and their respective Augmented Hessian 7 & 8, we also observe extreme spectral shrinkage, with the largest eigenvalue decreasing from [281.32, 184.4] to [45.68, 15.6] and the smallest increasing from $[ - 7 . 3 3 , - 2 . 9 ]$ to $[ 2 \times 1 0 ^ { - 5 } , - 9 \times 1 0 ^ { - 4 } ]$ respectively for CIFAR-100/CIFAR10. We note that despite reasonably extreme spectral shrinkage, the sharpest values of the Overfit schedule augmented Hessians are still significantly larger than those of the Normal schedule, hence the intuition of sharp minima generalizing poorly still holds for the True Hessian. The fraction of negative Ritz values for the Empirical Hessian is $4 3 / 1 0 0$ , with relative negative spectral mass of 0.032. For the Augmented Hessian, the number of negative Ritz values is 0. For the CIFAR10 Overfit Augmented Hessian, there is one negative Ritz value very close to the origin with a large relative spectral mass 0.086, hence it could also be part of the spectral peak at the origin.
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 7: Augmented Data 1, 500, 000 Hessian Spectrum C100 OverFit SGD.
|
| 202 |
+
Figure 8: Augmented Data 1, 500, 000 Hessian Spectrum C10 OverFit SGD.
|
| 203 |
+
|
| 204 |
+
# 6.3 RANK DEGENERACY AND RIGHT SKEW
|
| 205 |
+
|
| 206 |
+
The vast majority of eigen-directions of the Augmented Hessian are, like those of the Empirical Hessian, locally extremely close to flat. We show this by looking at the 3 Ritz values of largest weight for all learning rate schedules and datasets, shown in Table 3. The majority of the spectral bulk is carried by the 3 closest weights $( \approx 0 . 9 9 )$ to the origin for all learning rate schedules and datasets. In instances (CIFAR-100 SGD OverFit) where it looks like the largest weight has been reduced, the second largest weight (which is close in spectral distance) is amplified massively.
|
| 207 |
+
|
| 208 |
+
We further note that, as we move from the $q \gg 1$ regime to $q < 1$ , we move from having a symmetric to right skew bulk. Both have a significant spike near the origin. This experimentally corroborates the result derived in (Pennington & Bahri, 2017), where under normality of weights, inputs and further assumptions the symmetric bulk is given by the Wigner semi-circle law and the right skew bulk is given by the Marcenko-Pastur. The huge spectral peak near the origin, indicates that the result lies in a low effective dimension.
|
| 209 |
+
|
| 210 |
+
For all Augmented spectra, the negative spectral mass shrinks drastically and we see for the Overfit Schedule for CIFAR-100 that there is no spectral mass below 0 and for CIFAR-10 there is one negative Ritz value (and 79 positive). This Ritz value $\lambda _ { n } = - 0 . 0 0 0 9 3$ has a weight of $\rho = 0 . 0 8 5$ compared to the largest spike at $\lambda = 0 . 0 0 0 1$ with weight 0.889, hence we cannot rule out that both values belong to a true spectral peak at the origin.
|
| 211 |
+
|
| 212 |
+
# 7 DISCUSSION
|
| 213 |
+
|
| 214 |
+
The geometric properties of loss landscapes in deep learning have a profound effect on generalization performance. We introduced the True Hessian to investigate the difference between the landscapes for the true and empirical loss surfaces. We derived analytic forms for the perturbation between the extremal eigenvalues of the True and Empirical Hessians, modelling the difference between the two as a Gaussian Orthogonal Ensemble. Moreover, we developed a method for fast eigenvalue computation and visualization, which we used in conjunction with data augmentation to approximate the True Hessian spectrum.
|
| 215 |
+
|
| 216 |
+
We show both theoretically and empirically that the True Hessian has smaller variation in eigenvalues and that its extremal eigenvalues are smaller in magnitude than the Empirical Hessian. We also show under our framework that we expect the Empirical Hessian to have a greater negative spectral density than the True Hessian and our experiments support this conclusion. This result may provide some insight as to why first order (curvature blind) methods perform so well on neural networks. Reported non-convexity and pathological curvature is far worse for the empirical risk than the true risk, which is what we wish to descend.
|
| 217 |
+
|
| 218 |
+
The shape of the true risk is particularly crucial for understanding how to develop effective procedures for Bayesian deep learning. With a Bayesian approach, we not only want to find a single point that optimizes a risk, but rather to integrate over a loss surface to form a Bayesian model average. The geometric properties of the loss surface, rather than the specific location of optima, therefore greatly influences the predictive distribution in a Bayesian procedure. Furthermore, the posterior representation for neural network weights with popular approaches such as the Laplace approximation has curvature directly defined by the Hessian.
|
| 219 |
+
|
| 220 |
+
In future work, one could also replace the GOE noise matrix $\varepsilon ( w )$ with a positive semi-definite white Wishart kernel in order to derive results for the empirical Gauss-Newton and Fisher information matrices, which are by definition positive semi-definite and are commonly employed in second order deep learning (Martens & Grosse, 2015). Our approach to efficient eigenvalue computation and visualization can be used as a general-purpose tool to empirically investigate spectral properties of large matrices in deep learning, such as the Fisher information matrix.
|
| 221 |
+
|
| 222 |
+
# REFERENCES
|
| 223 |
+
|
| 224 |
+
Zhi Dong Bai. Convergence rate of expected spectral distributions of large random matrices part i: Wigner matrices. In Advances In Statistics, pp. 60–83. World Scientific, 2008.
|
| 225 |
+
|
| 226 |
+
Jinho Baik and Jack W Silverstein. Eigenvalues of large sample covariance matrices of spiked population models. arXiv preprint math/0408165, 2004.
|
| 227 |
+
|
| 228 |
+
Alex Bloemendal, Antti Knowles, Horng-Tzer Yau, and Jun Yin. On the principal components of sample covariance matrices. Probability theory and related fields, 164(1-2):459–552, 2016a.
|
| 229 |
+
|
| 230 |
+
Alex Bloemendal, Bálint Virág, et al. Limits of spiked random matrices ii. The Annals of Probability, 44(4):2726–2769, 2016b.
|
| 231 |
+
|
| 232 |
+
Joël Bun, Jean-Philippe Bouchaud, and Marc Potters. Cleaning large correlation matrices: tools from random matrix theory. Physics Reports, 666:1–109, 2017.
|
| 233 |
+
|
| 234 |
+
Tony Cai, Jianqing Fan, and Tiefeng Jiang. Distributions of angles in random packing on spheres. The Journal of Machine Learning Research, 14(1):1837–1864, 2013.
|
| 235 |
+
|
| 236 |
+
Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-SGD: Biasing gradient descent into wide valleys. arXiv preprint arXiv:1611.01838, 2016.
|
| 237 |
+
|
| 238 |
+
Anna Choromanska, Mikael Henaff, Michael Mathieu, Gérard Ben Arous, and Yann LeCun. The loss surfaces of multilayer networks. In Artificial Intelligence and Statistics, pp. 192–204, 2015a.
|
| 239 |
+
|
| 240 |
+
Anna Choromanska, Yann LeCun, and Gérard Ben Arous. Open problem: The landscape of the loss surfaces of multilayer networks. In Conference on Learning Theory, pp. 1756–1760, 2015b.
|
| 241 |
+
|
| 242 |
+
Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1019–1028. JMLR. org, 2017.
|
| 243 |
+
|
| 244 |
+
Richard Everson and Stephen Roberts. Inferring the eigenvalues of covariance matrices from limited, noisy data. IEEE transactions on signal processing, 48(7):2083–2091, 2000.
|
| 245 |
+
|
| 246 |
+
Jacob Gardner, Geoff Pleiss, Kilian Q Weinberger, David Bindel, and Andrew G Wilson. Gpytorch: Blackbox matrix-matrix Gaussian process inference with GPU acceleration. In Advances in Neural Information Processing Systems, pp. 7576–7586, 2018.
|
| 247 |
+
|
| 248 |
+
Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry P Vetrov, and Andrew G Wilson. Loss surfaces, mode connectivity, and fast ensembling of DNNs. In Advances in Neural Information Processing Systems, pp. 8789–8798, 2018.
|
| 249 |
+
|
| 250 |
+
Behrooz Ghorbani, Shankar Krishnan, and Ying Xiao. An investigation into neural net optimization via Hessian eigenvalue density. arXiv preprint arXiv:1901.10159, 2019.
|
| 251 |
+
|
| 252 |
+
Gene H Golub and Gérard Meurant. Matrices, moments and quadrature. Pitman Research Notes in Mathematics Series, pp. 105–105, 1994.
|
| 253 |
+
|
| 254 |
+
Gene H Golub and Charles F Van Loan. Matrix computations, volume 3. JHU press, 2012.
|
| 255 |
+
|
| 256 |
+
Friedrich Götze, A Naumov, and A Tikhomirov. Semicircle law for a class of random matrices with dependent entries. arXiv preprint arXiv:1211.0389, 2012.
|
| 257 |
+
|
| 258 |
+
Diego Granziol and Stephen J. Roberts. Entropic determinants of massive matrices. In 2017 IEEE International Conference on Big Data, BigData 2017, Boston, MA, USA, December 11-14, 2017, pp. 88–93, 2017.
|
| 259 |
+
|
| 260 |
+
Diego Granziol, Binxin Ru, Stefan Zohren, Xiaowen Dong, Michael Osborne, and Stephen Roberts. Entropic spectral learning for large-scale graphs. arXiv preprint arXiv:1804.06802, 2018.
|
| 261 |
+
|
| 262 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
|
| 263 |
+
|
| 264 |
+
Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
|
| 265 |
+
|
| 266 |
+
Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for Laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 19(2):433–450, 1990.
|
| 267 |
+
|
| 268 |
+
Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging weights leads to wider optima and better generalization. arXiv preprint arXiv:1803.05407, 2018.
|
| 269 |
+
|
| 270 |
+
Stanisław Jastrz˛ebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in SGD. arXiv preprint arXiv:1711.04623, 2017.
|
| 271 |
+
|
| 272 |
+
Stanisław Jastrz˛ebski, Zachary Kenton, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. On the relation between the sharpest directions of DNN loss and the SGD step length. 2018.
|
| 273 |
+
|
| 274 |
+
Iain M Johnstone and Arthur Yu Lu. Sparse Principal Components Analysis. Unpublished manuscript, 7, 2004.
|
| 275 |
+
|
| 276 |
+
Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv preprint arXiv:1609.04836, 2016.
|
| 277 |
+
|
| 278 |
+
Frederik Kunstner, Lukas Balles, and Philipp Hennig. Limitations of the empirical Fisher approximation. arXiv preprint arXiv:1905.12558, 2019.
|
| 279 |
+
|
| 280 |
+
Laurent Laloux, Pierre Cizeau, Jean-Philippe Bouchaud, and Marc Potters. Noise dressing of financial correlation matrices. Physical review letters, 83(7):1467, 1999.
|
| 281 |
+
|
| 282 |
+
Olivier Ledoit and Michael Wolf. A well-conditioned estimator for large-dimensional covariance matrices. Journal of multivariate analysis, 88(2):365–411, 2004.
|
| 283 |
+
|
| 284 |
+
Hao Li, Zheng Xu, Gavin Taylor, and Tom Goldstein. Visualizing the loss landscape of neural nets. arXiv preprint arXiv:1712.09913, 2017.
|
| 285 |
+
|
| 286 |
+
David JC MacKay. Bayesian methods for adaptive models. PhD thesis, California Institute of Technology, 1992.
|
| 287 |
+
|
| 288 |
+
David JC MacKay. Information theory, inference and learning algorithms. Cambridge university press, 2003.
|
| 289 |
+
|
| 290 |
+
James Martens and Roger Grosse. Optimizing neural networks with Kronecker-factored approximate curvature. In International conference on machine learning, pp. 2408–2417, 2015.
|
| 291 |
+
|
| 292 |
+
Gérard Meurant and Zdenek Strakoš. The Lanczos and conjugate gradient algorithms in finite ˇ precision arithmetic. Acta Numerica, 15:471–542, 2006.
|
| 293 |
+
|
| 294 |
+
Yurii Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer Science & Business Media, 2013.
|
| 295 |
+
|
| 296 |
+
Vardan Papyan. The full spectrum of deep net Hessians at scale: Dynamics with sample size. arXiv preprint arXiv:1811.07062, 2018.
|
| 297 |
+
|
| 298 |
+
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in Pytorch. 2017.
|
| 299 |
+
|
| 300 |
+
Barak A Pearlmutter. Fast exact multiplication by the Hessian. Neural computation, 6(1):147–160, 1994.
|
| 301 |
+
|
| 302 |
+
Jeffrey Pennington and Yasaman Bahri. Geometry of neural network loss surfaces via random matrix theory. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2798–2806. JMLR. org, 2017.
|
| 303 |
+
|
| 304 |
+
Farbod Roosta-Khorasani and Uri Ascher. Improved bounds on sample size for implicit matrix trace estimators. Foundations of Computational Mathematics, 15(5):1187–1212, 2015.
|
| 305 |
+
|
| 306 |
+
Levent Sagun, Léon Bottou, and Yann LeCun. Eigenvalues of the Hessian in deep learning: Singularity and beyond. arXiv preprint arXiv:1611.07476, 2016.
|
| 307 |
+
|
| 308 |
+
Levent Sagun, Utku Evci, V Ugur Guney, Yann Dauphin, and Leon Bottou. Empirical analysis of the Hessian of over-parametrized neural networks. arXiv preprint arXiv:1706.04454, 2017.
|
| 309 |
+
|
| 310 |
+
Jeffrey H Schenker and Hermann Schulz-Baldes. Semicircle law and freeness for random matrices with symmetries or correlations. arXiv preprint math-ph/0505003, 2005.
|
| 311 |
+
|
| 312 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 313 |
+
|
| 314 |
+
Terence Tao. Topics in random matrix theory, volume 132. American Mathematical Soc., 2012.
|
| 315 |
+
|
| 316 |
+
Lei Wu, Zhanxing Zhu, et al. Towards understanding generalization of deep learning: Perspective of loss landscapes. arXiv preprint arXiv:1706.10239, 2017.
|
| 317 |
+
|
| 318 |
+
Zhewei Yao, Amir Gholami, Qi Lei, Kurt Keutzer, and Michael W Mahoney. Hessian-based analysis of large batch training and robustness to adversaries. In Advances in Neural Information Processing Systems, pp. 4949–4959, 2018.
|
| 319 |
+
|
| 320 |
+
A TABLE SUMMARIES
|
| 321 |
+
|
| 322 |
+
<table><tr><td>Schedule</td><td>X</td><td></td><td>1XnIX1|n</td><td></td><td>Test Acc</td><td>Train Acc |Test Loss</td><td></td><td>|Train Loss</td></tr><tr><td>Normal</td><td>20.56</td><td>-6.54</td><td>3.025</td><td>-0.014</td><td>77.24</td><td>99.85</td><td>0.99</td><td>0.021</td></tr><tr><td>Overfit</td><td>281.32</td><td>-7.33</td><td>45.68</td><td>2×10-5</td><td>56.85</td><td>99.62</td><td>1.85</td><td>0.026</td></tr></table>
|
| 323 |
+
|
| 324 |
+
Table 1: CIFAR-100 statistics table including extremal eigenvalues of the Empirical Hessian $[ \lambda _ { 1 } ^ { \prime } , \lambda _ { n } ^ { \prime } ]$ , the True Hessian $[ \lambda _ { 1 } , \lambda _ { n } ]$ and test/train accuracies and losses.
|
| 325 |
+
|
| 326 |
+
Table 2: CIFAR-10 statistics table including extremal eigenvalues of the Empirical Hessian $[ \lambda _ { 1 } ^ { \prime } , \lambda _ { n } ^ { \prime } ]$ , the True Hessian $[ \lambda _ { 1 } , \lambda _ { n } ]$ and test/train accuracies and losses
|
| 327 |
+
|
| 328 |
+
<table><tr><td>Schedule</td><td>x</td><td></td><td>IXn|X1Iλn</td><td></td><td>Test Acc</td><td>Train Acc</td><td>Test Loss</td><td>Train Loss</td></tr><tr><td>Normal</td><td>6.82</td><td>-1.37</td><td>3.025</td><td>-0.014</td><td>95.32</td><td>99.98</td><td>0.18</td><td>0.0034</td></tr><tr><td>Overfit</td><td>184.4</td><td>-2.9</td><td>15.6</td><td>-9×10-4</td><td>86.46</td><td>99.91</td><td>1.85</td><td>0.026</td></tr></table>
|
| 329 |
+
|
| 330 |
+
<table><tr><td>LearningSchedule&DataSet</td><td>[po,入o]</td><td>[p1,入1]</td><td>[p2,入2]</td></tr><tr><td>CIFAR-100 SGD Normal</td><td>[0.92,0.0014]</td><td>[0.05,-0.03]</td><td>[0.018,0.06]</td></tr><tr><td>CIFAR-100 SGD Normal (Augmented)</td><td>[0.84,0.0017]</td><td>[0.1,-0.0007]</td><td>[0.045,0.003]</td></tr><tr><td>CIFAR-1O SGD Normal</td><td>[0.88,0.007]</td><td>[0.085,-0.01]</td><td>[0.023,0.02]]</td></tr><tr><td>CIFAR-10 SGD Normal (Augmented)</td><td>[0.88,-3.87e-6]</td><td>[0.073,0.0006]</td><td>[0.03,-0.0007]</td></tr><tr><td>CIFAR-100 SGD Overfit</td><td>[0.65,-0.026]</td><td>[0.34,0.05]</td><td>[0.006,0.58]</td></tr><tr><td>CIFAR-100 SGD Overfit (Augmented)</td><td>[0.86,1.67e-5]</td><td>[0.1,0.0039]</td><td>[0.019,0.018]</td></tr><tr><td>CIFAR-10 SGD Overfit</td><td>[0.77,0.01]</td><td>[0.22,-0.04]</td><td>[0.005,0.32]</td></tr><tr><td>CIFAR-10 SGD Overfit (Augmented)</td><td>[0.89,0.00013]</td><td>[0.086,-0.00094]</td><td>[0.016,0.0058]</td></tr></table>
|
| 331 |
+
|
| 332 |
+
Table 3: Largest 3 weight Ritz values for different learning schedules and datasets. $[ \rho _ { i } , \lambda _ { i } ]$ denotes the weight and corresponding eigenvalue $\rho _ { 0 } \geq \rho _ { 1 } . . . . \geq \rho _ { P }$ .
|
| 333 |
+
|
| 334 |
+
# B SGD TRAINING CURVES
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 9: SGD CIFAR-100 training and test curves
|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
Figure 10: SGD CIFAR-10 training and test curves
|
| 341 |
+
|
| 342 |
+
# C OVERFIT TRAINING CURVES
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 11: OverFitSGD CIFAR-100 training and test curves
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
Figure 12: OverFitSGD CIFAR-10 training and test curves
|
| 349 |
+
|
| 350 |
+
# D RANDOM MATRIX THEORY
|
| 351 |
+
|
| 352 |
+
Following the notation of (Bun et al., 2017) the resolvent of a matrix $H$ is defined as
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
G _ { H } ( z ) = ( z I _ { N } - H ) ^ { - 1 }
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
with $z = x + i \eta \in \mathbb { C }$ . The normalised trace operator of the resolvent, in the $N \to \infty$ limit
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
{ \cal S } _ { N } ( z ) = \frac { 1 } { N } \mathrm { T r } [ G _ { H } ( z ) ] \xrightarrow { N \infty } { \cal S } ( z ) = \int \frac { \rho ( u ) } { z - u } d u
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
is known as the Stieltjes transform of $\rho$ . The functional inverse of the Siteltjes transform, is denoted the blue function $\boldsymbol { B } ( \boldsymbol { S } ( z ) ) = \boldsymbol { z }$ . The $\mathbf { R }$ transform is defined as
|
| 365 |
+
|
| 366 |
+
$$
|
| 367 |
+
\mathcal { R } ( w ) = B ( w ) - \frac { 1 } { w }
|
| 368 |
+
$$
|
| 369 |
+
|
| 370 |
+
crucially for our calculations, it is known that the $\mathcal { R }$ transform of the Wigner ensemble is
|
| 371 |
+
|
| 372 |
+
$$
|
| 373 |
+
\mathcal { R } _ { W } ( z ) = \sigma ^ { 2 } z
|
| 374 |
+
$$
|
| 375 |
+
|
| 376 |
+
Definition D.1. Let $\{ Y _ { i } \}$ and $\{ Z _ { i j } \} _ { 1 \leq i \leq j }$ be two real-valued families of zero mean, i.i.d random variables, Furthermore suppose that $\mathbb { E } Z _ { 1 2 } ^ { 2 } = 1$ and for each $k \in \mathbb N$
|
| 377 |
+
|
| 378 |
+
$$
|
| 379 |
+
m a x ( E | Z _ { 1 2 } ^ { k } , E | Y _ { 1 } | ^ { k } ) < \infty
|
| 380 |
+
$$
|
| 381 |
+
|
| 382 |
+
Consider an $n \times n$ symettric matrix $M _ { n }$ , whose entries are given by
|
| 383 |
+
|
| 384 |
+
$$
|
| 385 |
+
\begin{array} { r } { \left\{ \begin{array} { l l } { M _ { n } ( i , i ) = Y _ { i } } \\ { M _ { n } ( i , j ) = Z _ { i j } = M _ { n } ( j , i ) , } & { i f x \geq 1 } \end{array} \right. } \end{array}
|
| 386 |
+
$$
|
| 387 |
+
|
| 388 |
+
The Matrix $M _ { n }$ is known as a real symmetric Wigner matrix.
|
| 389 |
+
|
| 390 |
+
Theorem 2. Let $\{ M _ { n } \} _ { n = 1 } ^ { \infty }$ be a sequence of Wigner matrices, and for each $n$ denote $X _ { n } = M _ { n } / \sqrt { n }$ Then $\mu _ { X _ { n } }$ , converges weakly, almost surely to the semi circle distribution,
|
| 391 |
+
|
| 392 |
+
$$
|
| 393 |
+
\sigma ( x ) d x = \frac { 1 } { 2 \pi } \sqrt { 4 - x ^ { 2 } } { \bf 1 } _ { | x | \leq 2 }
|
| 394 |
+
$$
|
| 395 |
+
|
| 396 |
+
the property of freeness for non commutative random matrices can be considered analogously to the moment factorisation property of independent random variables. The normalized trace operator, which is equal to the first moment of the spectral density
|
| 397 |
+
|
| 398 |
+
$$
|
| 399 |
+
\psi ( H ) = \frac { 1 } { N } \mathrm { T r } H = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \lambda _ { i } = \int _ { \lambda \in \mathcal { D } } d \mu ( \lambda ) \lambda
|
| 400 |
+
$$
|
| 401 |
+
|
| 402 |
+
We say matrices $A \& B$ for which $\psi ( A ) = \psi ( B ) = 0 ^ { 4 }$ are free if they satisfy for any integers $n _ { 1 } . . n _ { k }$ with $\dot { k } \in \mathbb { N } ^ { + }$
|
| 403 |
+
|
| 404 |
+
$$
|
| 405 |
+
\psi ( A ^ { n _ { 1 } } B ^ { n _ { 2 } } A ^ { n _ { 3 } } B ^ { n _ { 4 } } ) = \psi ( A ^ { n _ { 1 } } ) \psi ( B ^ { n _ { 2 } } ) \psi ( A ^ { n _ { 3 } } ) \psi ( A ^ { n _ { 4 } } )
|
| 406 |
+
$$
|
| 407 |
+
|
| 408 |
+
# E DERIVATION
|
| 409 |
+
|
| 410 |
+
The Stijeles transform of Wigners semi circle law, can be written as (Tao, 2012)
|
| 411 |
+
|
| 412 |
+
$$
|
| 413 |
+
\mathcal { S } _ { W } ( z ) = \frac { z \pm \sqrt { z ^ { 2 } - 4 \sigma ^ { 2 } } } { 2 \sigma ^ { 2 } }
|
| 414 |
+
$$
|
| 415 |
+
|
| 416 |
+
from the definition of the Blue transform, we hence have
|
| 417 |
+
|
| 418 |
+
$$
|
| 419 |
+
\begin{array} { l } { \displaystyle z = \frac { | \mathcal { B } _ { W } ( z ) \pm \sqrt { | \mathcal { B } _ { W } ^ { 2 } ( z ) - 4 \sigma ^ { 2 } } } { 2 \sigma ^ { 2 } } } \\ { \displaystyle ( 2 \sigma ^ { 2 } z - \mathcal { B } _ { W } ( z ) ) ^ { 2 } = \mathcal { B } _ { W } ^ { 2 } ( z ) - 4 \sigma ^ { 2 } } \\ { \displaystyle . . \mathcal { B } _ { W } ( z ) = \frac { 1 } { z } + \sigma ^ { 2 } z } \\ { \displaystyle . . . \mathcal { R } _ { W } ( z ) = \sigma ^ { 2 } z } \end{array}
|
| 420 |
+
$$
|
| 421 |
+
|
| 422 |
+
4We can always consider the transform $A - \psi ( A ) I$
|
| 423 |
+
|
| 424 |
+
Computing the $\mathcal { R }$ transform of the rank 1 matrix $H _ { t r u e }$ , with largest non-trivial eigenvalue $\beta$ , on the effect of the spectrum of a matrix $A$ , using the Stieltjes transform we easily find following (Bun et al., 2017) that
|
| 425 |
+
|
| 426 |
+
$$
|
| 427 |
+
\mathcal { S } _ { H _ { t r u e } } ( u ) = \frac { 1 } { N } \frac { 1 } { u - \beta } + \bigg ( 1 - \frac { 1 } { N } \bigg ) \frac { 1 } { u } = \frac { 1 } { u } \bigg [ 1 + \frac { 1 } { N } \frac { \beta } { 1 - u ^ { - 1 } \beta } \bigg ]
|
| 428 |
+
$$
|
| 429 |
+
|
| 430 |
+
We can use perturbation theory similar to in equation equation 22 to find the blue transform which to leading order gives
|
| 431 |
+
|
| 432 |
+
$$
|
| 433 |
+
\begin{array} { l } { \displaystyle B _ { H _ { t r u e } } ( \omega ) = \frac { 1 } { w } + \frac { \beta } { N ( 1 - \omega \beta ) } + \mathcal { O } ( N ^ { - 2 } ) } \\ { \displaystyle \mathcal { R } _ { H _ { t r u e } } ( \omega ) = \frac { \beta } { N ( 1 - \omega \beta ) } + \mathcal { O } ( N ^ { - 2 } ) } \end{array}
|
| 434 |
+
$$
|
| 435 |
+
|
| 436 |
+
setting $\omega = S _ { M } ( z )$
|
| 437 |
+
|
| 438 |
+
$$
|
| 439 |
+
z = \mathcal { B } _ { H _ { t r u e } } ( \mathcal { S } _ { M } ( z ) ) + \frac { \beta } { N ( 1 - \beta \mathcal { S } _ { M } ( z ) ) } + \mathcal { O } ( N ^ { - 2 } )
|
| 440 |
+
$$
|
| 441 |
+
|
| 442 |
+
using the ansatz of $\begin{array} { r } { S _ { M } ( z ) = S _ { 0 } ( z ) + \frac { S _ { 1 } ( z ) } { N } + \mathcal { O } ( N ^ { - 2 } ) } \end{array}$ we find that $S _ { 0 } ( z ) = S _ { \epsilon ( w ) } ( z )$ and using that $B _ { M } ^ { \prime } ( z ) = 1 / g ^ { \prime } ( z )$ , we conclude that
|
| 443 |
+
|
| 444 |
+
$$
|
| 445 |
+
S _ { 1 } ( z ) = - \frac { \beta { S ^ { \prime } } _ { \epsilon ( w ) } ( z ) } { 1 - { S _ { \epsilon ( w ) } } ( z ) \beta }
|
| 446 |
+
$$
|
| 447 |
+
|
| 448 |
+
and hence
|
| 449 |
+
|
| 450 |
+
$$
|
| 451 |
+
\mathcal { S } _ { M } ( z ) \approx { \cal S } _ { \epsilon ( w ) } ( z ) - \frac { 1 } { N } \frac { \beta { \cal S } ^ { \prime } { } _ { \epsilon ( w ) } ( z ) } { 1 - { \cal S } _ { \epsilon ( w ) } ( z ) \beta }
|
| 452 |
+
$$
|
| 453 |
+
|
| 454 |
+
and hence in the large $N$ limit the correction only survives if $S _ { \epsilon ( w ) } ( z ) = 1 / \beta$
|
| 455 |
+
|
| 456 |
+
$$
|
| 457 |
+
\begin{array} { l } { \displaystyle \mathcal { S } _ { \epsilon ( w ) } ( z ) = \frac 1 \beta } \\ { \displaystyle \frac { 2 \sigma ^ { 2 } } \beta = z \pm \sqrt { z ^ { 2 } - 4 \sigma ^ { 2 } } } \\ { \displaystyle \cdot \cdot z = \beta + \frac { \sigma ^ { 2 } } \beta } \end{array}
|
| 458 |
+
$$
|
| 459 |
+
|
| 460 |
+
clearly for $\beta - \beta$ we have
|
| 461 |
+
|
| 462 |
+
$$
|
| 463 |
+
z = - \beta - \frac { \sigma ^ { 2 } } { \beta }
|
| 464 |
+
$$
|
| 465 |
+
|
| 466 |
+
# F AN INTUITIVE EXPLANATION OF THE KEY RESULT
|
| 467 |
+
|
| 468 |
+
An extensive linear algebraic and geometric discussion about spectral broadening for sample covariance matrices can be found in (Ledoit & Wolf, 2004) and whilst the Hessian is not a covariance matrix (the generalized Gauss-Newton or Fisher matrices can be seen as a co-variance of gradients), identical arguments will hold here 5. The dispersion of the Empirical Hessian eigenvalues around their mean will equal the dispersion of the True Hessian eigenvalues around their mean plus the variance of the Empirical Hessian (from its true value), which is in general $> 0$ . Our theoretical assumptions in sections 4.1 and 4.2 allow us to derive analytic results for this broadening. Our assumptions are significantly stricter than those in (Ledoit & Wolf, 2004) and hence automatically fulfil their requirements.
|
| 469 |
+
|
| 470 |
+
# G LANCZOS ALGORITHM
|
| 471 |
+
|
| 472 |
+
In order to empirically analyse properties of modern neural network spectra with tens of millions of parameters $N { \dot { = } } O ( { \dot { 1 } } 0 ^ { 7 } )$ , we use the Lanczos algorithm (Meurant & Strakoš, 2006) with Hessian vector products using the Pearlmutter trick (Pearlmutter, 1994) with computational cost $\mathcal { O } ( N T m )$ , where $N$ is the dataset size and $m$ is the number of Lanczos steps. The main properties of the Lanczos algorithm are summarized in the theorems 3,4
|
| 473 |
+
|
| 474 |
+
Theorem 3. Let $H ^ { N \times N }$ be a symmetric matrix with eigenvalues $\lambda _ { 1 } \geq . . \geq \lambda _ { n }$ and corresponding orthonormal eigenvectors $z _ { 1 } , . . . z _ { n }$ . If $\theta _ { 1 } \ge . . \ge \theta _ { m }$ are the eigenvalues of the matrix $T _ { m }$ obtained after m Lanczos steps and $q _ { 1 } , . . . q _ { k }$ the corresponding Ritz eigenvectors then
|
| 475 |
+
|
| 476 |
+
$$
|
| 477 |
+
\begin{array} { r l } & { \lambda _ { 1 } \geq \theta _ { 1 } \geq \lambda _ { 1 } - \frac { \left( \lambda _ { 1 } - \lambda _ { n } \right) \tan ^ { 2 } ( \theta _ { 1 } ) } { \left( c _ { k - 1 } ( 1 + 2 \rho _ { 1 } ) \right) ^ { 2 } } } \\ & { \lambda _ { n } \leq \theta _ { k } \leq \lambda _ { m } + \frac { \left( \lambda _ { 1 } - \lambda _ { n } \right) \tan ^ { 2 } ( \theta _ { 1 } ) } { \left( c _ { k - 1 } ( 1 + 2 \rho _ { 1 } ) \right) ^ { 2 } } } \end{array}
|
| 478 |
+
$$
|
| 479 |
+
|
| 480 |
+
where $c _ { k }$ is the chebyshev polyomial of order $k$
|
| 481 |
+
|
| 482 |
+
Proof: see (Golub & Van Loan, 2012).
|
| 483 |
+
|
| 484 |
+
Theorem 4. The eigenvalues of $T _ { k }$ are the nodes $t _ { j }$ of the Gauss quadrature rule, the weights $w _ { j }$ are the squares of the first elements of the normalized eigenvectors of $T _ { k }$
|
| 485 |
+
|
| 486 |
+
Proof: See (Golub & Meurant, 1994). The first term on the RHS of equation 9 using Theorem 4 can be seen as a discrete approximation to the spectral density matching the first $m$ moments $v ^ { T } H ^ { m } v$ (Golub & Meurant, 1994; Golub & Van Loan, 2012), where $v$ is the initial seed vector. Using the expectation of quadratic forms, for zero mean, unit variance random vectors, using the linearity of trace and expectation
|
| 487 |
+
|
| 488 |
+
$$
|
| 489 |
+
\mathbb { E } _ { v } \mathrm { T r } ( v ^ { T } H ^ { m } v ) = \mathrm { T r } \mathbb { E } _ { v } ( v v ^ { T } H ^ { m } ) = \mathrm { T r } ( H ^ { m } ) = \sum _ { i = 1 } ^ { N } \lambda _ { i } = N \int _ { \lambda \in \mathcal { D } } \lambda d \mu ( \lambda )
|
| 490 |
+
$$
|
| 491 |
+
|
| 492 |
+
The error between the expectation over the set of all zero mean, unit variance vectors $v$ and the monte carlo sum used in practice can be bounded (Hutchinson, 1990; Roosta-Khorasani $\&$ Ascher, 2015). However in the high dimensional regime $N \infty$ , we expect the squared overlap of each random vector with an eigenvector of $H$ , $\begin{array} { r } { | v ^ { \tilde { T } } \phi _ { i } | ^ { 2 } \approx \frac { 1 } { N } \forall i } \end{array}$ , with high probability. This result can be seen by computing the moments of the overlap between Rademacher vectors, containing elements $P ( v _ { j } = \pm 1 ) \bar { = } 0 . \bar { 5 }$ . Further analytical results for Gaussian vectors have been obtained (Cai et al., 2013).
|
| 493 |
+
|
| 494 |
+

|
| 495 |
+
Figure 13: Augmented CIFAR-100 PreResNet 110 Eigenspectrum Epoch 300, 5 million samples and $m = 1 0$ Lanczos steps
|
| 496 |
+
|
| 497 |
+

|
| 498 |
+
Figure 14: CIFAR-100 PreResNet110 0’th epoch full dataspectrum
|
| 499 |
+
|
| 500 |
+

|
| 501 |
+
Figure 15: CIFAR-100 PreResNet110 25’th epoch full dataspectrum
|
| 502 |
+
|
| 503 |
+

|
| 504 |
+
Figure 16: CIFAR-100 PreResNet110 50’th epoch full dataspectrum
|
| 505 |
+
|
| 506 |
+

|
| 507 |
+
Figure 17: CIFAR-100 PreResNet110 75’th epoch full dataspectrum
|
| 508 |
+
|
| 509 |
+

|
| 510 |
+
Figure 18: CIFAR-100 PreResNet110 125’th epoch full dataspectrum
|
| 511 |
+
|
| 512 |
+

|
| 513 |
+
Figure 19: CIFAR-100 PreResNet110 150’th epoch full dataspectrum
|
| 514 |
+
|
| 515 |
+

|
| 516 |
+
Figure 20: CIFAR-100 PreResNet110 150’th epoch full dataspectrum
|
| 517 |
+
|
| 518 |
+
# I SPECTRAL PLOTS - CIFAR-100 VGG16BN
|
| 519 |
+
|
| 520 |
+
The number of Parameters in the $V G G - 1 6$ network is $P = 1 5 2 9 1 3 0 0$ so our augmentation procedure is unable to probe the limit $q < 1$ . The training procedure is identical to the PreResNet except for an initial learning rate of 0.05 and $T = 3 0 0$ epochs. Here we also see a reduction in both extremal eigenvalues.
|
| 521 |
+
|
| 522 |
+

|
| 523 |
+
Figure 21: CIFAR-100 VGG16BN 300’th epoch full dataspectrum
|
| 524 |
+
|
| 525 |
+

|
| 526 |
+
Figure 22: Augmented CIFAR-100 VGG16BN Eigenspectrum Epoch 300, 5 million samples and $m = 1 0$ Lanczos steps
|
| 527 |
+
|
| 528 |
+

|
| 529 |
+
Figure 23: CIFAR-100 VGG16BN 0’th epoch full dataspectrum
|
| 530 |
+
|
| 531 |
+

|
| 532 |
+
Figure 24: CIFAR-100 VGG16BN 25’th epoch full dataspectrum
|
| 533 |
+
|
| 534 |
+

|
| 535 |
+
Figure 25: CIFAR-100 VGG16BN 50’th epoch full dataspectrum
|
| 536 |
+
|
| 537 |
+

|
| 538 |
+
Figure 26: CIFAR-100 VGG16BN 75’th epoch full dataspectrum
|
| 539 |
+
|
| 540 |
+

|
| 541 |
+
Figure 27: CIFAR-100 VGG16BN 125’th epoch full dataspectrum
|
| 542 |
+
|
| 543 |
+

|
| 544 |
+
Figure 28: CIFAR-100 VGG16BN 150’th epoch full dataspectrum
|
| 545 |
+
|
| 546 |
+

|
| 547 |
+
Figure 29: CIFAR-100 VGG16BN 150’th epoch full dataspectrum
|
| 548 |
+
|
| 549 |
+

|
| 550 |
+
Figure 30: CIFAR-10 PreResNet110 50’th epoch full dataspectrum
|
| 551 |
+
|
| 552 |
+

|
| 553 |
+
Figure 31: CIFAR-10 PreResNet110 300’th epoch full dataspectrum
|
| 554 |
+
|
| 555 |
+

|
| 556 |
+
Figure 32: CIFAR-10 VGG16BN 0’th epoch full dataspectrum
|
| 557 |
+
|
| 558 |
+

|
| 559 |
+
Figure 33: CIFAR-10 VGG16BN 300’th epoch full dataspectrum
|
md/train/H1meywxRW/H1meywxRW.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DCN+: MIXED OBJECTIVE AND DEEP RESIDUAL COATTENTION FOR QUESTION ANSWERING
|
| 2 |
+
|
| 3 |
+
Caiming Xiong∗, Victor Zhong∗, Richard Socher
|
| 4 |
+
|
| 5 |
+
Salesforce Research
|
| 6 |
+
Palo Alto, CA 94301, USA
|
| 7 |
+
{cxiong, vzhong, rsocher}@salesforce.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Traditional models for question answering optimize using cross entropy loss, which encourages exact answers at the cost of penalizing nearby or overlapping answers that are sometimes equally accurate. We propose a mixed objective that combines cross entropy loss with self-critical policy learning. The objective uses rewards derived from word overlap to solve the misalignment between evaluation metric and optimization objective. In addition to the mixed objective, we improve dynamic coattention networks (DCN) with a deep residual coattention encoder that is inspired by recent work in deep self-attention and residual networks. Our proposals improve model performance across question types and input lengths, especially for long questions that requires the ability to capture long-term dependencies. On the Stanford Question Answering Dataset, our model achieves state-of-the-art results with $7 5 . 1 \%$ exact match accuracy and $8 3 . 1 \%$ F1, while the ensemble obtains $7 8 . 9 \%$ exact match accuracy and $8 6 . 0 \%$ F1.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Existing state-of-the-art question answering models are trained to produce exact answer spans for a question and a document. In this setting, a ground truth answer used to supervise the model is defined as a start and an end position within the document. Existing training approaches optimize using cross entropy loss over the two positions. However, this suffers from a fundamental disconnect between the optimization, which is tied to the position of a particular ground truth answer span, and the evaluation, which is based on the textual content of the answer. This disconnect is especially harmful in cases where answers that are textually similar to, but distinct in positions from, the ground truth are penalized in the same fashion as answers that are textually dissimilar. For example, suppose we are given the sentence “Some believe that the Golden State Warriors team of 2017 is one of the greatest teams in NBA history”, the question “which team is considered to be one of the greatest teams in NBA history”, and a ground truth answer of “the Golden State Warriors team of 2017”. The span “Warriors” is also a correct answer, but from the perspective of traditional cross entropy based training it is no better than the span “history”.
|
| 16 |
+
|
| 17 |
+
To address this problem, we propose a mixed objective that combines traditional cross entropy loss over positions with a measure of word overlap trained with reinforcement learning. We obtain the latter objective using self-critical policy learning in which the reward is based on word overlap between the proposed answer and the ground truth answer. Our mixed objective brings two benefits: (i) the reinforcement learning objective encourages answers that are textually similar to the ground truth answer and discourages those that are not; (ii) the cross entropy objective significantly facilitates policy learning by encouraging trajectories that are known to be correct. The resulting objective is one that is both faithful to the evaluation metric and converges quickly in practice.
|
| 18 |
+
|
| 19 |
+
In addition to our mixed training objective, we extend the Dynamic Coattention Network (DCN) by Xiong et al. (2017) with a deep residual coattention encoder. This allows the network to build richer representations of the input by enabling each input sequence to attend to previous attention contexts. Vaswani et al. (2017) show that the stacking of attention layers helps model long-range dependencies. We merge coattention outputs from each layer by means of residual connections to reduce the length of signal paths. He et al. (2016) show that skip layer connections facilitate signal propagation and alleviate gradient degradation.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Deep residual coattention encoder.
|
| 23 |
+
|
| 24 |
+
The combination of the deep residual coattention encoder and the mixed objective leads to higher performance across question types, question lengths, and answer lengths on the Stanford Question Answering Dataset (SQuAD) (Rajpurkar et al., 2016) compared to our DCN baseline. The improvement is especially apparent on long questions, which require the model to capture long-range dependencies between the document and the question. Our model, which we call $\mathrm { D C N + }$ , achieves state-of-the-art results on SQuAD, with $7 5 . 1 \%$ exact match accuracy and $8 3 . 1 \%$ F1. When ensembled, the $\mathrm { D C N + }$ obtains $78 . 9 \%$ exact match accuracy and $8 6 . 0 \%$ F1.
|
| 25 |
+
|
| 26 |
+
# 2 $\mathrm { D C N + }$
|
| 27 |
+
|
| 28 |
+
We consider the question answering task in which we are given a document and a question, and are asked to find the answer in the document. Our model is based on the DCN by Xiong et al. (2017), which consists of a coattention encoder and a dynamic decoder. The encoder first encodes the question and the document separately, then builds a codependent representation through coattention. The decoder then produces a start and end point estimate given the coattention. The DCN decoder is dynamic in the sense that it iteratively estimates the start and end positions, stopping when estimates between iterations converge to the same positions or when a predefined maximum number of iterations is reached. We make two significant changes to the DCN by introducing a deep residual coattention encoder and a mixed training objective that combines cross entropy loss from maximum likelihood estimation and reinforcement learning rewards from self-critical policy learning.
|
| 29 |
+
|
| 30 |
+
# 2.1 DEEP RESIDUAL COATTENTION ENCODER
|
| 31 |
+
|
| 32 |
+
Because it only has a single-layer coattention encoder, the DCN is limited in its ability to compose complex input representations. Vaswani et al. (2017) proposed stacked self-attention modules to facilitate signal traversal. They also showed that the network’s ability to model long-range dependencies can be improved by reducing the length of signal paths. We propose two modifications to the coattention encoder to leverage these findings. First, we extend the coattention encoder with self-attention by stacking coattention layers. This allows the network to build richer representations over the input. Second, we merge coattention outputs from each layer with residual connections. This reduces the length of signal paths. Our encoder is shown in Figure 1.
|
| 33 |
+
|
| 34 |
+
Suppose we are given a document of $m$ words and a question of $n$ words. Let $L ^ { D } \in \mathbb { R } ^ { e \times m }$ and $L ^ { \mathcal { Q } ^ { \star } } \in \mathbb { R } ^ { e \times n }$ respectively denote the word embeddings for the document and the question, where $e$ is the dimension of the word embeddings. We obtain document encodings $E _ { 1 } ^ { \hat { D } }$ and question encodings $E _ { 1 } ^ { Q }$ through a bidirectional Long Short-Term Memory Network (LSTM) (Hochreiter & Schmidhuber, 1997), where we use integer subscripts to denote the coattention layer number.
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\begin{array} { r c l } { E _ { 1 } ^ { D } } & { = } & { \mathrm { b i L S T M } _ { 1 } \left( L ^ { D } \right) \in \mathbb { R } ^ { h \times ( m + 1 ) } } \\ { E _ { 1 } ^ { Q } } & { = } & { \operatorname { t a n h } \big ( W \mathrm { \ b i L S T M } _ { 1 } \left( L ^ { Q } \right) + b \big ) \in \mathbb { R } ^ { h \times ( n + 1 ) } } \end{array}
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
Here, $h$ denotes the hidden state size and the $+ 1$ indicates the presence of an additional sentinel word which allows the coattention to not focus on any part of the input. Like the original DCN, we add a non-linear transform to the question encoding.
|
| 41 |
+
|
| 42 |
+
We compute the affinity matrix between the document and the question as $A \ = \ \left( E _ { 1 } ^ { D } \right) ^ { \boldsymbol { \mathsf { T } } } E _ { 1 } ^ { Q } \ \in$ $\mathbb { R } ^ { ( m + 1 ) \times ( n + 1 ) }$ . Let softmax $( X )$ denote the softmax operation over the matrix $X$ that normalizes $X$ column-wise. The document summary vectors and question summary vectors are computed as
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\begin{array} { r c l } { S _ { 1 } ^ { D } } & { = } & { E _ { 1 } ^ { Q } \operatorname { s o f t m a x } \left( A ^ { \boldsymbol { \mathsf { T } } } \right) \in \mathbb { R } ^ { h \times ( m + 1 ) } } \\ { S _ { 1 } ^ { Q } } & { = } & { E _ { 1 } ^ { D } \operatorname { s o f t m a x } \left( A \right) \in \mathbb { R } ^ { h \times ( n + 1 ) } } \end{array}
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
We define the document coattention context as follows. Note that we drop the dimension corresponding to the sentinel vector – it has already been used during the summary computation and is not a potential position candidate for the decoder.
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\begin{array} { r c l } { C _ { 1 } ^ { D } } & { = } & { S _ { 1 } ^ { Q } \operatorname { s o f t m a x } \left( A ^ { \intercal } \right) \in \mathbb { R } ^ { h \times m } } \end{array}
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
We further encode the summaries using another bidirectional LSTM.
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\begin{array} { r l r } { E _ { 2 } ^ { D } } & { = } & { \mathrm { b i L S T M _ { 2 } } \left( S _ { 1 } ^ { D } \right) \in \mathbb { R } ^ { 2 h \times m } } \\ { E _ { 2 } ^ { Q } } & { = } & { \mathrm { b i L S T M _ { 2 } } \left( S _ { 1 } ^ { Q } \right) \in \mathbb { R } ^ { 2 h \times n } } \end{array}
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
Equation 3 to equation 5 describe a single coattention layer. We compute the second coattention layer in a similar fashion. Namely, let coattn denote a multi-valued mapping whose inputs are the two input sequences $E _ { 1 } ^ { D }$ and $E _ { 1 } ^ { Q }$ . We have
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
{ \begin{array} { l l l } { \operatorname { c o a t t n _ { 1 } } \left( E _ { 1 } ^ { D } , E _ { 1 } ^ { Q } \right) } & { \to } & { S _ { 1 } ^ { D } , S _ { 1 } ^ { Q } , C _ { 1 } ^ { D } } \\ & & { \operatorname { c o a t t n _ { 2 } } \left( E _ { 2 } ^ { D } , E _ { 2 } ^ { Q } \right) } \\ { \operatorname { c o a t t n _ { 2 } } \left( E _ { 2 } ^ { D } , E _ { 2 } ^ { Q } \right) } & { \to } & { S _ { 2 } ^ { D } , S _ { 2 } ^ { Q } , C _ { 2 } ^ { D } } \end{array} }
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
The output of our encoder is then obtained as
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
U = \mathrm { b i L S T M } \left( \mathrm { c o n c a t } \left( E _ { 1 } ^ { D } ; E _ { 2 } ^ { D } ; S _ { 1 } ^ { D } ; S _ { 2 } ^ { D } ; C _ { 1 } ^ { D } ; C _ { 2 } ^ { D } \right) \right) \in \mathbb { R } ^ { 2 h \times m }
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where concat $( A , B )$ denotes the concatenation between the matrices $A$ and $B$ along the first dimension.
|
| 73 |
+
|
| 74 |
+
This encoder is different than the original DCN in its depth and its use of residual connections. We use not only the output of the deep coattention network $\bar { C } _ { 2 } ^ { D }$ as input to the final bidirectional LSTM, but add skip connections to initial encodings $E _ { 1 } ^ { D }$ , $E _ { 2 } ^ { D }$ 2, summary vectors $S _ { 1 } ^ { D } , S _ { 2 } ^ { D }$ , and coattention context $C _ { 1 } ^ { \bar { D } }$ . This is akin to transformer networks (Vaswani et al., 2017), which achieved stateof-the-art results on machine translation using deep self-attention layers to help model long-range dependencies, and residual networks (He et al., 2016), which achieved state-of-the-art results in image classification through the addition of skip layer connections to facilitate signal propagation and alleviate gradient degradation.
|
| 75 |
+
|
| 76 |
+
The DCN produces a distribution over the start position of the answer and a distribution over the end position of the answer. Let $s$ and $e$ denote the respective start and end points of the ground truth answer. Because the decoder of the DCN is dynamic, we denote the start and end distributions produced at the tth decoding step by $p _ { t } ^ { \mathrm { s t a r t } } \in \mathbb { R } ^ { m }$ and $p _ { t } ^ { \mathrm { e n d } } \in \mathbb { R } ^ { m }$ . For convenience, we denote the greedy estimate of the start and end positions by the model at the tth decoding step by $s _ { t }$ and $e _ { t }$ . Moreover, let $\Theta$ denote the parameters of the model.
|
| 77 |
+
|
| 78 |
+
Similar to other question answering models, the DCN is supervised using the cross entropy loss on the start position distribution and the end position distribution:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
l _ { c e } ( \Theta ) = - \sum _ { t } \left( \log p _ { t } ^ { \mathrm { s t a r t } } \left( s \mid s _ { t - 1 } , e _ { t - 1 } ; \Theta \right) + \log p _ { t } ^ { \mathrm { e n d } } \left( e \mid s _ { t - 1 } , e _ { t - 1 } ; \Theta \right) \right)
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
Equation 11 states that the model accumulates a cross entropy loss over each position during each decoding step given previous estimates of the start and end positions.
|
| 85 |
+
|
| 86 |
+
The question answering task consists of two evaluation metrics. The first, exact match, is a binary score that denotes whether the answer span produced by the model has exact string match with the ground truth answer span. The second, F1, computes the degree of word overlap between the answer span produced by the model and the ground truth answer span. We note that there is a disconnect between the cross entropy optimization objective and the evaluation metrics. For example, suppose we are given the answer estimates $A$ and $B$ , neither of which match the ground truth positions. However, $A$ has an exact string match with the ground truth answer whereas $B$ does not. The cross entropy objective penalizes $A$ and $B$ equally, despite the former being correct under both evaluation metrics. In the less extreme case where $A$ does not have exact match but has some degree of word overlap with the ground truth, the F1 metric still prefers $A$ over $B$ despite its wrongly predicted positions.
|
| 87 |
+
|
| 88 |
+
We encode this preference using reinforcement learning, using the F1 score as the reward function. Let $\hat { s _ { t } } \sim p _ { t } ^ { \mathrm { s t a r t } }$ and $\hat { e _ { t } } \sim p _ { t } ^ { \mathrm { s t a r t } }$ denote the sampled start and end positions from the estimated distributions at decoding step $t$ . We define a trajectory $\hat { \tau }$ as a sequence of sampled start and end points $\hat { s _ { t } }$ and $\hat { e _ { t } }$ through all $T$ decoder time steps. The reinforcement learning objective is then the negative expected rewards $R$ over trajectories.
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\begin{array} { r l r } { l _ { r l } \left( \Theta \right) } & { = } & { - \mathbb { E } _ { \hat { r } \sim p _ { \tau } } \left[ R \left( s , e , \hat { s } _ { T } , \hat { e } _ { T } ; \Theta \right) \right] } \\ & { \approx } & { - \mathbb { E } _ { \hat { \tau } \sim p _ { \tau } } \left[ F _ { 1 } \left( \mathrm { a n s } \left( \hat { \mathrm { s } } _ { \mathrm { T } } , \hat { \mathrm { e } } _ { \mathrm { T } } \right) , \mathrm { a n s } \left( \mathrm { s } , \mathrm { e } \right) \right) - F _ { 1 } \left( \mathrm { a n s } \left( \mathrm { s } _ { \mathrm { T } } , \mathrm { e } _ { \mathrm { T } } \right) , \mathrm { a n s } \left( \mathrm { s } , \mathrm { e } \right) \right) \right] } \end{array}
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
We use $F _ { 1 }$ to denote the F1 scoring function and ans $( \mathrm { s } , \mathrm { e } )$ to denote the answer span retrieved using the start point $s$ and end point $e$ . In equation 13, instead of using only the F1 word overlap as the reward, we subtract from it a baseline. Greensmith et al. (2001) show that a good baseline reduces the variance of gradient estimates and facilitates convergence. In our case, we employ a self-critic (Konda $\&$ Tsitsiklis, 1999) that uses the F1 score produced by the current model during greedy inference without teacher forcing.
|
| 95 |
+
|
| 96 |
+
For ease of notation, we abbreviate $R \left( s , e , \hat { s } _ { T } , \hat { e } _ { T } ; \Theta \right)$ as $R$ . As per Sutton et al. (1999) and Schulman et al. (2015), the expected gradient of a non-differentiable reward function can be computed as
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\begin{array} { r c l } { \displaystyle \mathcal { T } _ { \Theta } l _ { r l } ( \Theta ) } & { = } & { \displaystyle - \nabla _ { \Theta } ( \mathbb { E } _ { \hat { r } \sim p _ { r } } [ R ] ) } \\ & { = } & { \displaystyle - \mathbb { E } _ { \hat { r } \sim p _ { r } } [ R \nabla _ { \Theta } \log p _ { r } ( \boldsymbol { r } ; \Theta ) ] } \\ & { = } & { \displaystyle - \mathbb { E } _ { \hat { r } \sim p _ { r } } [ R \nabla _ { \Theta } ( \sum _ { t } ^ { T } ( \log p _ { t } ^ { \mathrm { s t a r t } } ( \hat { s } _ { t } | \hat { s } _ { t - 1 } , \hat { e } _ { t - 1 } ; \Theta ) + \log p _ { t } ^ { \mathrm { e n d } } ( \hat { e } _ { t } | \hat { s } _ { t - 1 } , \hat { e } _ { t - 1 } ; \Theta ) ) ) ] } \\ & { \approx } & { \displaystyle - R \nabla _ { \Theta } ( \sum _ { t } ^ { T } ( \log p _ { t } ^ { \mathrm { s t a r t } } ( \hat { s } _ { t } | \hat { s } _ { t - 1 } , \hat { e } _ { t - 1 } ; \Theta ) + \log p _ { t } ^ { \mathrm { e n d } } ( \hat { e } _ { t } | \hat { s } _ { t - 1 } , \hat { e } _ { t - 1 } ; \Theta ) ) ) \qquad ( \mathrm { l } \Theta ) \mathrm { ~ } } \end{array}
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 2: Computation of the mixed objective.
|
| 104 |
+
|
| 105 |
+
In equation 16, we approximate the expected gradient using a single Monte-Carlo sample $\tau$ drawn from $p _ { \tau }$ . This sample trajectory $\tau$ contains the start and end positions $\hat { s } _ { t }$ and $\hat { e } _ { t }$ sampled during all decoding steps.
|
| 106 |
+
|
| 107 |
+
One of the key problems in applying RL to natural language processing is the discontinuous and discrete space the agent must explore in order to find a good policy. For problems with large exploration space, RL approaches tend to be applied as fine-tuning steps after a maximum likelihood model has already been trained (Paulus et al., 2017; Wu et al., 2016). The resulting model is constrained in its exploration during fine-tuning because it is biased by heavy pretraining. We instead treat the optimization problem as a multi-task learning problem. The first task is to optimize for positional match with the ground truth answer using the the cross entropy objective. The second task is to optimize for word overlap with the ground truth answer with the self-critical reinforcement learning objective. In a similar fashion to Kendall et al. (2017), we combine the two losses using homoscedastic uncertainty as task-dependent weightings.
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
l = \frac { 1 } { 2 \sigma _ { c e } ^ { 2 } } l _ { c e } \left( \Theta \right) + \frac { 1 } { 2 \sigma _ { r l } ^ { 2 } } l _ { r l } \left( \Theta \right) + \log \sigma _ { c e } ^ { 2 } + \log \sigma _ { r l } ^ { 2 }
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Here, $\sigma _ { c e }$ and $\sigma _ { r l }$ are learned parameters. The gradient of the cross entropy objective can be derived using straight-forward backpropagation. The gradient of the self-critical reinforcement learning objective is shown in equation 16. Figure 2 illustrates how the mixed objective is computed. In practice, we find that adding the cross entropy task significantly facilitates policy learning by pruning the space of candidate trajectories - without the former, it is very difficult for policy learning to converge due to the large space of potential answers, documents, and questions.
|
| 114 |
+
|
| 115 |
+
# 3 EXPERIMENTS
|
| 116 |
+
|
| 117 |
+
We train and evaluate our model on the Stanford Question Answering Dataset (SQuAD). We show our test performance of our model against other published models, and demonstrate the importance of our proposals via ablation studies on the development set. To preprocess the corpus, we use the reversible tokenizer from Stanford CoreNLP (Manning et al., 2014). For word embeddings, we use GloVe embeddings pretrained on the 840B Common Crawl corpus (Pennington et al., 2014) as well as character ngram embeddings by Hashimoto et al. (2017). In addition, we concatenate these embeddings with context vectors (CoVe) trained on WMT (McCann et al., 2017). For out of vocabulary words, we set the embeddings and context vectors to zero. We perform word dropout on the document which zeros a word embedding with probability 0.075. In addition, we swap the first maxout layer of the highway maxout network in the DCN decoder with a sparse mixture of experts layer (Shazeer et al., 2017). This layer is similar to the maxout layer, except instead of taking the top scoring expert, we take the top $k = 2$ expert. The model is trained using ADAM (Kingma & Ba,
|
| 118 |
+
|
| 119 |
+
2014) with default hyperparameters. Hyperparameters of our model are identical to the DCN. We implement our model using PyTorch.
|
| 120 |
+
|
| 121 |
+
3.1 RESULTS
|
| 122 |
+
|
| 123 |
+
<table><tr><td></td><td colspan="2">Single Model Dev</td><td colspan="2">Single Model Test</td><td colspan="2">Ensemble Test</td></tr><tr><td>Model</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>DCN+ (ours)</td><td>74.5%</td><td>83.1%</td><td>75.1%</td><td>83.1%</td><td>78.9%</td><td>86.0%</td></tr><tr><td>rnet</td><td>72.3%</td><td>80.6%</td><td>72.3%</td><td>80.7%</td><td>76.9%</td><td>84.0%</td></tr><tr><td>DCN w/ CoVe (baseline)</td><td>71.3%</td><td>79.9%</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Mnemonic Reader</td><td>70.1%</td><td>79.6%</td><td>69.9%</td><td>79.2%</td><td>73.7%</td><td>81.7%</td></tr><tr><td>Document Reader</td><td>69.5%</td><td>78.8%</td><td>70.0%</td><td>79.0%</td><td>1</td><td>1</td></tr><tr><td>FastQA</td><td>70.3%</td><td>78.5%</td><td>70.8%</td><td>78.9%</td><td>1</td><td>一</td></tr><tr><td>ReasoNet</td><td>1</td><td>1</td><td>69.1%</td><td>78.9%</td><td>73.4%</td><td>81.8%</td></tr><tr><td>SEDT</td><td>67.9%</td><td>77.4%</td><td>68.5%</td><td>78.0%</td><td>73.0%</td><td>80.8%</td></tr><tr><td>BiDAF</td><td>67.7%</td><td>77.3%</td><td>68.0%</td><td>77.3%</td><td>73.7%</td><td>81.5%</td></tr><tr><td>DCN</td><td>65.4%</td><td>75.6%</td><td>66.2%</td><td>75.9%</td><td>71.6%</td><td>80.4%</td></tr></table>
|
| 124 |
+
|
| 125 |
+
Table 1: Test performance on SQuAD. The papers are as follows: rnet (Microsoft Asia Natural Language Computing Group, 2017), SEDT (Liu et al., 2017), BiDAF (Seo et al., 2017), DCN w/ CoVe (McCann et al., 2017), ReasoNet (Shen et al., 2017), Document Reader (Chen et al., 2017), FastQA (Weissenborn et al., 2017), DCN (Xiong et al., 2017). The CoVe authors did not submit their model, which we use as our baseline, for SQuAD test evaluation.
|
| 126 |
+
|
| 127 |
+
The performance of our model is shown in Table 1. Our model achieves state-of-the-art results on SQuAD dataset with $7 5 . 1 \%$ exact match accuracy and $8 3 . 1 \%$ F1. When ensembled, our model obtains $78 . 9 \%$ exact match accuracy and $8 6 . 0 \%$ F1. To illustrate the effectiveness of our proposals, we use the DCN with context vectors as a baseline (McCann et al., 2017). This model is identical to the DCN by Xiong et al. (2017), except that it augments the word representations with context vectors trained on WMT16.
|
| 128 |
+
|
| 129 |
+
Comparison to baseline DCN with CoVe. $\mathrm { D C N + }$ outperforms the baseline by $3 . 2 \%$ exact match accuracy and $3 . 2 \%$ F1 on the SQuAD development set. Figure 3 shows the consistent performance gain of $\mathrm { D C N + }$ over the baseline across question types, question lengths, and answer lengths. In particular, $\mathrm { D C N + }$ provides a significant advantage for long questions.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 3: Performance comparison between $\mathrm { D C N + }$ and the baseline DCN with CoVe on the SQuAD development set.
|
| 133 |
+
|
| 134 |
+
Ablation study. The contributions of each part of our model are shown in Table 2. We note that the deep residual coattention yielded the highest contribution to model performance, followed by the mixed objective. The sparse mixture of experts layer in the decoder added minor improvements to the model performance.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Model</td><td>EM</td><td>△EM</td><td>F1</td><td>△F1</td></tr><tr><td>DCN+ (ours)</td><td>74.5%</td><td>1</td><td>83.1%</td><td>1</td></tr><tr><td>- Deep residual coattention</td><td>73.1%</td><td>-1.4%</td><td>81.5%</td><td>-1.6%</td></tr><tr><td> - Mixed objective</td><td>73.8%</td><td>-0.7%</td><td>82.1%</td><td>-1.0%</td></tr><tr><td>- Mixture of experts</td><td>74.0%</td><td>-0.5%</td><td>82.4%</td><td>-0.7%</td></tr><tr><td>DCN w/ CoVe (baseline)</td><td>71.3%</td><td>-3.2%</td><td>79.9%</td><td>-3.2%</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Table 2: Ablation study on the development set of SQuAD.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 4: Training curve of $\mathrm { D C N + }$ with and without reinforcement learning. In the latter case, only the cross entropy objective is used. The mixed objective initially performs worse as it begins policy learning from scratch, but quickly outperforms the cross entropy model.
|
| 142 |
+
|
| 143 |
+
Mixed objective convergence. The training curves for $\mathrm { D C N + }$ with reinforcement learning and $\mathrm { D C N + }$ without reinforcement learning are shown in Figure 4 to illustrate the effectiveness of our proposed mixed objective. In particular, we note that without mixing in the cross entropy loss, it is extremely difficult to learn the policy. When we combine the cross entropy loss with the reinforcement learning objective, we find that the model initially performs worse early on as it begins policy learning from scratch (shown in Figure 4b). However, with the addition of cross entropy loss, the model quickly learns a reasonable policy and subsequently outperforms the purely cross entropy model (shown in Figure 4a).
|
| 144 |
+
|
| 145 |
+
Sample predictions. Figure 5 compares predictions by $\mathrm { D C N + }$ and by the baseline on the development set. Both models retrieve answers that have sensible entity types. For example, the second example asks for “what game” and both models retrieve an American football game; the third example asks for “type of Turing machine” and both models retrieve a type of turing machine. We find, however, that $\mathrm { D C N + }$ consistently make less mistakes on finding the correct entity. This is especially apparent in the examples we show, which contain several entities or candidate answers of the correct type. In the first example, Gasquet wrote about the plague and called it “Great Pestilence”. While he likely did think of the plague as a “great pestilence”, the phrase “suggested that it would appear to be some form of ordinary Eastern or bubonic plague” provides evidence for the correct answer – “some form of ordinary Eastern or bubonic plague”. Similarly, the second example states that Thomas Davis was injured in the “NFC Championship Game”, but the game he insisted on playing in is the “Super Bowl”. Finally, “multi-tape” and “single-tape” both appear in the sentence that provides provenance for the answer to the question. However, it is the “single-tape” Turing machine that implies quadratic time. In these examples, $\mathrm { D C N + }$ finds the correct entity out of ones that have the right type whereas the baseline does not.
|
| 146 |
+
|
| 147 |
+
# 4 RELATED WORK
|
| 148 |
+
|
| 149 |
+
Neural models for question answering. Current state-of-the-art approaches for question answering over unstructured text tend to be neural approaches. Wang & Jiang (2017) proposed one of the first conditional attention mechanisms in the Match-LSTM encoder. Coattention (Xiong et al., 2017), bidirectional attention flow (Seo et al., 2017), and self-matching attention (Microsoft Asia Natural Language Computing Group, 2017) all build codependent representations of the question and the document. These approaches of conditionally encoding two sequences are widely used in
|
| 150 |
+
|
| 151 |
+
What did Gasquet think the plague was?
|
| 152 |
+
|
| 153 |
+
The historian Francis Aidan Gasquet wrote about the 'Great Pestilence' in 1893 and suggested that "it would appear to be some form of the ordinary Eastern or bubonic plague". He was able to adopt the epidemiology of the bubonic plague for the Black Death for the second edition in 1908, implicating rats and fleas in the process, and his interpretation was widely accepted for other ancient and medieval epidemics, such as the Justinian plague that was prevalent in the Eastern Roman Empire from 541 to 700 CE.
|
| 154 |
+
|
| 155 |
+
What game did Thomas Davis say he would play in, despite breaking a bone earlier on?
|
| 156 |
+
|
| 157 |
+
Carolina suffered a major setback when Thomas Davis, an 11-year veteran who had already overcome three ACL tears in his career, went down with a broken arm in the NFC Championship Game. Despite this, he insisted he would still find a way to play in the Super Bowl. His prediction turned out to be accurate.
|
| 158 |
+
|
| 159 |
+
A language solved in quadratic time implies the use of what type of Turing machine?
|
| 160 |
+
|
| 161 |
+
But bounding the computation time above by some concrete function f(n) often yields complexity classes that depend on the chosen machine model. For instance, the language $\{ \times \times | \times$ is any binary string} can be solved in linear time on a multi-tape Turing machine, but necessarily requires quadratic time in the model of single-tape Turing machines. If we allow polynomial variations in running time, Cobham-Edmonds thesis states that "the time complexities in any two reasonable and general models of computation are polynomially related" (Goldreich 2008, Chapter 1.2). This forms the basis for the complexity class P, which is the set of decision problems solvable by a deterministic Turing machine within polynomial time. The corresponding set of function problems is FP.
|
| 162 |
+
|
| 163 |
+
Figure 5: Predictions by $\mathrm { D C N + }$ (red) and DCN with CoVe (blue) on the SQuAD development set.
|
| 164 |
+
|
| 165 |
+
question answering. After building codependent encodings, most models predict the answer by generating the start position and the end position corresponding to the estimated answer span. The generation process utilizes a pointer network (Vinyals et al., 2015) over the positions in the document. Xiong et al. (2017) also introduced the dynamic decoder, which iteratively proposes answers by alternating between start position and end position estimates, and in some cases is able to recover from initially erroneous predictions.
|
| 166 |
+
|
| 167 |
+
Neural attention models. Neural attention models saw early adoption in machine translation (Bahdanau et al., 2015) and has since become to de-facto architecture for neural machine translation models. Self-attention, or intra-attention, has been applied to language modeling, sentiment analysis, natural language inference, and abstractive text summarization (Chen et al., 2017; Paulus et al., 2017). Vaswani et al. (2017) extended this idea to a deep self-attentional network which obtained state-of-the-art results in machine translation. Coattention, which builds codependent representations of multiple inputs, has been applied to visual question answering (Lu et al., 2016). Xiong et al. (2017) introduced coattention for question answering. Bidirectional attention flow (Seo et al., 2017) and self-matching attention (Microsoft Asia Natural Language Computing Group, 2017) also build codependent representations between the question and the document.
|
| 168 |
+
|
| 169 |
+
Reinforcement learning in NLP. Many tasks in natural language processing have evaluation metrics that are not differentiable. Dethlefs & Cuayahuitl ´ (2011) proposed a hierarchical reinforcement learning technique for generating text in a simulated way-finding domain. Narasimhan et al. (2015) applied deep Q-networks to learn policies for text-based games using game rewards as feedback. Li et al. (2016) introduced a neural conversational model trained using policy gradient methods, whose reward function consisted of heuristics for ease of answering, information flow, and semantic coherence. Bahdanau et al. (2017) proposed a general actor-critic temporal-difference method for sequence prediction, performing metric optimization on language modeling and machine translation. Direct word overlap metric optimization has also been applied to summarization (Paulus et al., 2017), and machine translation (Wu et al., 2016).
|
| 170 |
+
|
| 171 |
+
# 5 CONCLUSION
|
| 172 |
+
|
| 173 |
+
We introduced $\mathrm { D C N + }$ , an state-of-the-art question answering model with deep residual coattention trained using a mixed objective that combines cross entropy supervision with self-critical policy learning. We showed that our proposals improve model performance across question types, question lengths, and answer lengths on the Stanford Question Answering Dataset ( SQuAD). On SQuAD, the $\mathrm { D C N + }$ achieves $7 5 . 1 \%$ exact match accuracy and $8 3 . 1 \%$ F1. When ensembled, the $\mathrm { D C N + }$ obtains $7 8 . 9 \%$ exact match accuracy and $8 6 . 0 \%$ F1.
|
| 174 |
+
|
| 175 |
+
# REFERENCES
|
| 176 |
+
|
| 177 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
|
| 178 |
+
|
| 179 |
+
Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron C. Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. In ICLR, 2017.
|
| 180 |
+
|
| 181 |
+
Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer opendomain questions. In ACL, 2017.
|
| 182 |
+
|
| 183 |
+
Nina Dethlefs and Heriberto Cuayahuitl. Combining hierarchical reinforcement learning and ´ bayesian networks for natural language generation in situated dialogue. In Proceedings of the 13th European Workshop on Natural Language Generation, pp. 110–120. Association for Computational Linguistics, 2011.
|
| 184 |
+
|
| 185 |
+
Evan Greensmith, Peter L. Bartlett, and Jonathan Baxter. Variance reduction techniques for gradient estimates in reinforcement learning. Journal of Machine Learning Research, 5:1471–1530, 2001.
|
| 186 |
+
|
| 187 |
+
Kazuma Hashimoto, Caiming Xiong, Yoshimasa Tsuruoka, and Richard Socher. A joint many-task model: Growing a neural network for multiple NLP tasks. In EMNLP, 2017.
|
| 188 |
+
|
| 189 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770– 778, 2016.
|
| 190 |
+
|
| 191 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. Neural computation, 9 8: 1735–80, 1997.
|
| 192 |
+
|
| 193 |
+
Alex Kendall, Yarin Gal, and Roberto Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. CoRR, abs/1705.07115, 2017.
|
| 194 |
+
|
| 195 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
|
| 196 |
+
|
| 197 |
+
Vijay R. Konda and John N. Tsitsiklis. Actor-critic algorithms. In NIPS, 1999.
|
| 198 |
+
|
| 199 |
+
Jiwei Li, Will Monroe, Alan Ritter, Michel Galley, Jianfeng Gao, and Dan Jurafsky. Deep reinforcement learning for dialogue generation. In EMNLP, 2016.
|
| 200 |
+
|
| 201 |
+
Rui Liu, Junjie Hu, Wei Wei, Zi Yang, and Eric Nyberg. Structural embedding of syntactic trees for machine comprehension. In ACL, 2017.
|
| 202 |
+
|
| 203 |
+
Jiasen Lu, Jianwei Yang, Dhruv Batra, and Devi Parikh. Hierarchical question-image co-attention for visual question answering. In NIPS, 2016.
|
| 204 |
+
|
| 205 |
+
Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Rose Finkel, Steven Bethard, and David McClosky. The stanford corenlp natural language processing toolkit. In ACL, 2014.
|
| 206 |
+
|
| 207 |
+
Bryan McCann, James Bradbury, Caiming Xiong, and Richard Socher. Learned in translation: Contextualized word vectors. In NIPS, 2017.
|
| 208 |
+
|
| 209 |
+
Microsoft Asia Natural Language Computing Group. R-net: Machine reading comprehension with self-matching networks. 2017.
|
| 210 |
+
|
| 211 |
+
Karthik Narasimhan, Tejas D. Kulkarni, and Regina Barzilay. Language understanding for textbased games using deep reinforcement learning. In EMNLP, 2015.
|
| 212 |
+
|
| 213 |
+
Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. CoRR, abs/1705.04304, 2017.
|
| 214 |
+
|
| 215 |
+
Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
|
| 216 |
+
|
| 217 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. In EMNLP, 2016.
|
| 218 |
+
|
| 219 |
+
John Schulman, Nicolas Heess, Theophane Weber, and Pieter Abbeel. Gradient estimation using stochastic computation graphs. In NIPS, 2015.
|
| 220 |
+
|
| 221 |
+
Min Joon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. In ICLR, 2017.
|
| 222 |
+
|
| 223 |
+
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In ICLR, 2017.
|
| 224 |
+
|
| 225 |
+
Yelong Shen, Po-Sen Huang, Jianfeng Gao, and Weizhu Chen. Reasonet: Learning to stop reading in machine comprehension. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1047–1055. ACM, 2017.
|
| 226 |
+
|
| 227 |
+
Richard S. Sutton, David A. McAllester, Satinder P. Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In NIPS, 1999.
|
| 228 |
+
|
| 229 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017.
|
| 230 |
+
|
| 231 |
+
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In NIPS, 2015.
|
| 232 |
+
|
| 233 |
+
Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. In ICLR, 2017.
|
| 234 |
+
|
| 235 |
+
Dirk Weissenborn, Georg Wiese, and Laura Seiffe. Making neural qa as simple as possible but not simpler. In CoNLL, 2017.
|
| 236 |
+
|
| 237 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 238 |
+
|
| 239 |
+
Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. In ICLR, 2017.
|
md/train/HJ0UKP9ge/HJ0UKP9ge.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BI-DIRECTIONAL ATTENTION FLOW FOR MACHINE COMPREHENSION
|
| 2 |
+
|
| 3 |
+
Minjoon $\mathbf { S e o ^ { 1 * } }$ Aniruddha Kembhavi2 Ali Farhadi1,2 Hananneh Hajishirzi1 University of Washington1, Allen Institute for Artificial Intelligence2 {minjoon,ali,hannaneh}@cs.washington.edu, $\{ \mathtt { a n i k } \} \ @ \mathtt { a l l e n a i . o r g }$
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Machine comprehension (MC), answering a query about a given context paragraph, requires modeling complex interactions between the context and the query. Recently, attention mechanisms have been successfully extended to MC. Typically these methods use attention to focus on a small portion of the context and summarize it with a fixed-size vector, couple attentions temporally, and/or often form a uni-directional attention. In this paper we introduce the Bi-Directional Attention Flow (BIDAF) network, a multi-stage hierarchical process that represents the context at different levels of granularity and uses bidirectional attention flow mechanism to obtain a query-aware context representation without early summarization. Our experimental evaluations show that our model achieves the state-of-the-art results in Stanford Question Answering Dataset (SQuAD) and CNN/DailyMail cloze test.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The tasks of machine comprehension (MC) and question answering (QA) have gained significant popularity over the past few years within the natural language processing and computer vision communities. Systems trained end-to-end now achieve promising results on a variety of tasks in the text and image domains. One of the key factors to the advancement has been the use of neural attention mechanism, which enables the system to focus on a targeted area within a context paragraph (for MC) or within an image (for Visual QA), that is most relevant to answer the question (Weston et al., 2015; Antol et al., 2015; Xiong et al., 2016a). Attention mechanisms in previous works typically have one or more of the following characteristics. First, the computed attention weights are often used to extract the most relevant information from the context for answering the question by summarizing the context into a fixed-size vector. Second, in the text domain, they are often temporally dynamic, whereby the attention weights at the current time step are a function of the attended vector at the previous time step. Third, they are usually uni-directional, wherein the query attends on the context paragraph or the image.
|
| 12 |
+
|
| 13 |
+
In this paper, we introduce the Bi-Directional Attention Flow (BIDAF) network, a hierarchical multi-stage architecture for modeling the representations of the context paragraph at different levels of granularity (Figure 1). BIDAF includes character-level, word-level, and contextual embeddings, and uses bi-directional attention flow to obtain a query-aware context representation. Our attention mechanism offers following improvements to the previously popular attention paradigms. First, our attention layer is not used to summarize the context paragraph into a fixed-size vector. Instead, the attention is computed for every time step, and the attended vector at each time step, along with the representations from previous layers, is allowed to flow through to the subsequent modeling layer. This reduces the information loss caused by early summarization. Second, we use a memory-less attention mechanism. That is, while we iteratively compute attention through time as in Bahdanau et al. (2015), the attention at each time step is a function of only the query and the context paragraph at the current time step and does not directly depend on the attention at the previous time step. We hypothesize that this simplification leads to the division of labor between the attention layer and the modeling layer. It forces the attention layer to focus on learning the attention between the query and the context, and enables the modeling layer to focus on learning the interaction within the query-aware context representation (the output of the attention layer). It also allows the attention at each time step to be unaffected from incorrect attendances at previous time steps. Our experiments show that memory-less attention gives a clear advantage over dynamic attention. Third, we use attention mechanisms in both directions, query-to-context and context-to-query, which provide complimentary information to each other.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: BiDirectional Attention Flow Model (best viewed in color)
|
| 17 |
+
|
| 18 |
+
Our BIDAF model1 outperforms all previous approaches on the highly-competitive Stanford Question Answering Dataset (SQuAD) test set leaderboard at the time of submission. With a modification to only the output layer, BIDAF achieves the state-of-the-art results on the CNN/DailyMail cloze test. We also provide an in-depth ablation study of our model on the SQuAD development set, visualize the intermediate feature spaces in our model, and analyse its performance as compared to a more traditional language model for machine comprehension (Rajpurkar et al., 2016).
|
| 19 |
+
|
| 20 |
+
# 2 MODEL
|
| 21 |
+
|
| 22 |
+
Our machine comprehension model is a hierarchical multi-stage process and consists of six layers (Figure 1):
|
| 23 |
+
|
| 24 |
+
1. Character Embedding Layer maps each word to a vector space using character-level CNNs.
|
| 25 |
+
2. Word Embedding Layer maps each word to a vector space using a pre-trained word embedding model.
|
| 26 |
+
3. Contextual Embedding Layer utilizes contextual cues from surrounding words to refine the embedding of the words. These first three layers are applied to both the query and context.
|
| 27 |
+
4. Attention Flow Layer couples the query and context vectors and produces a set of queryaware feature vectors for each word in the context.
|
| 28 |
+
5. Modeling Layer employs a Recurrent Neural Network to scan the context.
|
| 29 |
+
6. Output Layer provides an answer to the query.
|
| 30 |
+
|
| 31 |
+
1. Character Embedding Layer. Character embedding layer is responsible for mapping each word to a high-dimensional vector space. Let $\{ \pmb { x } _ { 1 } , \hdots \pmb { x } _ { T } \}$ and $\{ q _ { 1 } , \dots q _ { J } \}$ represent the words in the input context paragraph and query, respectively. Following Kim (2014), we obtain the characterlevel embedding of each word using Convolutional Neural Networks (CNN). Characters are embedded into vectors, which can be considered as 1D inputs to the CNN, and whose size is the input channel size of the CNN. The outputs of the CNN are max-pooled over the entire width to obtain a fixed-size vector for each word.
|
| 32 |
+
|
| 33 |
+
2. Word Embedding Layer. Word embedding layer also maps each word to a high-dimensional vector space. We use pre-trained word vectors, GloVe (Pennington et al., 2014), to obtain the fixed word embedding of each word.
|
| 34 |
+
|
| 35 |
+
The concatenation of the character and word embedding vectors is passed to a two-layer Highway Network (Srivastava et al., 2015). The outputs of the Highway Network are two sequences of $d$ - dimensional vectors, or more conveniently, two matrices: $\breve { \mathbf { X } } \in \breve { \mathbb { R } } ^ { d \times T }$ for the context and $\mathbf { Q } \in \mathbb { R } ^ { d \times J }$ for the query.
|
| 36 |
+
|
| 37 |
+
3. Contextual Embedding Layer. We use a Long Short-Term Memory Network (LSTM) (Hochreiter & Schmidhuber, 1997) on top of the embeddings provided by the previous layers to model the temporal interactions between words. We place an LSTM in both directions, and concatenate the outputs of the two LSTMs. Hence we obtain $\mathbf { H } \in \mathbb { R } ^ { 2 d \times T }$ from the context word vectors $\mathbf { X }$ , and $\mathbf { U } \in \mathbb { R } ^ { 2 d \times J }$ from query word vectors $\mathbf { Q }$ . Note that each column vector of $\mathbf { H }$ and $\mathbf { U }$ is $2 d$ -dimensional because of the concatenation of the outputs of the forward and backward LSTMs, each with $d .$ -dimensional output.
|
| 38 |
+
|
| 39 |
+
It is worth noting that the first three layers of the model are computing features from the query and context at different levels of granularity, akin to the multi-stage feature computation of convolutional neural networks in the computer vision field.
|
| 40 |
+
|
| 41 |
+
4. Attention Flow Layer. Attention flow layer is responsible for linking and fusing information from the context and the query words. Unlike previously popular attention mechanisms (Weston et al., 2015; Hill et al., 2016; Sordoni et al., 2016; Shen et al., 2016), the attention flow layer is not used to summarize the query and context into single feature vectors. Instead, the attention vector at each time step, along with the embeddings from previous layers, are allowed to flow through to the subsequent modeling layer. This reduces the information loss caused by early summarization.
|
| 42 |
+
|
| 43 |
+
The inputs to the layer are contextual vector representations of the context H and the query U. The outputs of the layer are the query-aware vector representations of the context words, $\mathbf { G }$ , along with the contextual embeddings from the previous layer.
|
| 44 |
+
|
| 45 |
+
In this layer, we compute attentions in two directions: from context to query as well as from query to context. Both of these attentions, which will be discussed below, are derived from a shared similarity matrix, $\mathbf { S } \in \mathbb { R } ^ { T \times J }$ , between the contextual embeddings of the context $( \mathbf { H } )$ and the query (U), where $\mathbf { S } _ { t j }$ indicates the similarity between $t$ -th context word and $j$ -th query word. The similarity matrix is computed by
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\mathbf { S } _ { t j } = \alpha ( \mathbf { H } _ { : t } , \mathbf { U } _ { : j } ) \in \mathbb { R }
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $\alpha$ is a trainable scalar function that encodes the similarity between its two input vectors, $\mathbf { H } _ { : t }$ is $t$ -th column vector of $\mathbf { H }$ , and $\mathbf { U } _ { : j }$ is $j$ -th column vector of $\mathbf { U }$ , We choose $\alpha ( \mathbf { h } , \mathbf { u } ) { \bf \bar { \alpha } } = \mathbf { w } _ { ( \mathbf { s } ) } ^ { \top } [ \mathbf { h } ; \mathbf { u } ; \mathbf { h } \circ$ $\mathbf { u } ]$ , where $\mathbf { w } _ { ( \mathbf { S } ) } \in \mathbb { R } ^ { 6 d }$ is a trainable weight vector, $\circ$ is elementwise multiplication, $[ ; ]$ is vector concatenation across row, and implicit multiplication is matrix multiplication. Now we use $\mathbf { S }$ to obtain the attentions and the attended vectors in both directions.
|
| 52 |
+
|
| 53 |
+
Context-to-query Attention. Context-to-query (C2Q) attention signifies which query words are most relevant to each context word. Let $\mathbf { a } _ { t } \in \mathbf { \overline { { \mathbb { R } } } } ^ { J }$ represent the attention weights on the query words by $t { \cdot }$ -th context word, $\textstyle \sum { \mathbf { a } } _ { t j } = 1$ for all $t$ . The attention weight is computed by $\mathbf { a } _ { t } = \mathrm { s o f t m a x } ( \mathbf { S } _ { t : } ) \in$ $\mathbb { R } ^ { J }$ , and subsequently each attended query vector is $\begin{array} { r } { \tilde { \mathbf { U } } _ { : t } = \sum _ { j } \mathbf { a } _ { t j } \mathbf { U } _ { : j } } \end{array}$ . Hence $\tilde { \textbf { U } }$ is a $2 d$ -by- $\mathcal { T }$ matrix containing the attended query vectors for the entire context.
|
| 54 |
+
|
| 55 |
+
Query-to-context Attention. Query-to-context (Q2C) attention signifies which context words have the closest similarity to one of the query words and are hence critical for answering the query.
|
| 56 |
+
|
| 57 |
+
We obtain the attention weights on the context words by $\mathbf { b } = \mathrm { s o f t m a x } ( \operatorname* { m a x } _ { c o l } ( \mathbf { S } ) ) \in \mathbb { R } ^ { T }$ , where the maximum function $( \mathrm { m a x } _ { c o l } )$ is performed across the column. Then the attended context vector is $\begin{array} { r } { \tilde { \mathbf { h } } = \sum _ { t } \mathbf { b } _ { t } \mathbf { H } _ { : t } \in \mathbb { R } ^ { 2 d } } \end{array}$ . This vector indicates the weighted sum of the most important words in the context with respect to the query. $\tilde { \mathbf { h } }$ is tiled $T$ times across the column, thus giving $\tilde { \mathbf { H } } \in \mathbb { R } ^ { 2 d \times T }$ .
|
| 58 |
+
|
| 59 |
+
Finally, the contextual embeddings and the attention vectors are combined together to yield $\mathbf { G }$ , where each column vector can be considered as the query-aware representation of each context word. We define $\mathbf { G }$ by
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\mathbf { G } _ { : t } = \beta ( \mathbf { H } _ { : t } , \tilde { \mathbf { U } } _ { : t } , \tilde { \mathbf { H } } _ { : t } ) \in \mathbb { R } ^ { d _ { \mathbf { G } } }
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where $\mathbf { G } _ { : t }$ is the $t { \cdot }$ -th column vector (corresponding to $t$ -th context word), $\beta$ is a trainable vector function that fuses its (three) input vectors, and $d _ { \mathbf { G } }$ is the output dimension of the $\beta$ function. While the $\beta$ function can be an arbitrary trainable neural network, such as multi-layer perceptron, a simple concatenation as following still shows good performance in our experiments: $\bar { \beta } ( { \bf h } , \bar { \tilde { \bf u } } , \tilde { \bf h } ) =$ $[ \mathbf { h } ; \tilde { \mathbf { u } } ; \mathbf { h } \circ \tilde { \mathbf { u } } ; \mathbf { h } \circ \tilde { \mathbf { h } } ] \in \mathbb { R } ^ { 8 d \times T }$ (i.e., $d _ { \mathbf { G } } = 8 d _ { \mathbf { \rho } }$ ).
|
| 66 |
+
|
| 67 |
+
5. Modeling Layer. The input to the modeling layer is $\mathbf { G }$ , which encodes the query-aware representations of context words. The output of the modeling layer captures the interaction among the context words conditioned on the query. This is different from the contextual embedding layer, which captures the interaction among context words independent of the query. We use two layers of bi-directional LSTM, with the output size of $d$ for each direction. Hence we obtain a matrix $\mathbf { M } \in \mathbb { R } ^ { 2 d \times T }$ , which is passed onto the output layer to predict the answer. Each column vector of M is expected to contain contextual information about the word with respect to the entire context paragraph and the query.
|
| 68 |
+
|
| 69 |
+
6. Output Layer. The output layer is application-specific. The modular nature of BIDAF allows us to easily swap out the output layer based on the task, with the rest of the architecture remaining exactly the same. Here, we describe the output layer for the QA task. In section 5, we use a slight modification of this output layer for cloze-style comprehension.
|
| 70 |
+
|
| 71 |
+
The QA task requires the model to find a sub-phrase of the paragraph to answer the query. The phrase is derived by predicting the start and the end indices of the phrase in the paragraph. We obtain the probability distribution of the start index over the entire paragraph by
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathbf { p } ^ { 1 } = \mathrm { s o f t m a x } ( \mathbf { w } _ { ( \mathbf { p } ^ { 1 } ) } ^ { \top } [ \mathbf { G } ; \mathbf { M } ] ) ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $\mathbf { w } _ { ( \mathbf { p } ^ { 1 } ) } \in \mathbb { R } ^ { 1 0 d }$ is a trainable weight vector. For the end index of the answer phrase, we pass $\mathbf { M }$ to another bidirectional LSTM layer and obtain $\mathbf { M } ^ { 2 } \in \mathbb { R } ^ { 2 d \times T }$ . Then we use $\mathbf { M } ^ { 2 }$ to obtain the probability distribution of the end index in a similar manner:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\mathbf { p } ^ { 2 } = \mathrm { s o f t m a x } ( \mathbf { w } _ { ( \mathbf { p } ^ { 2 } ) } ^ { \top } [ \mathbf { G } ; \mathbf { M } ^ { 2 } ] )
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Training. We define the training loss (to be minimized) as the sum of the negative log probabilities of the true start and end indices by the predicted distributions, averaged over all examples:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
L ( \theta ) = - \frac { 1 } { N } \sum _ { i } ^ { N } \log ( \mathbf { p } _ { y _ { i } ^ { 1 } } ^ { 1 } ) + \log ( \mathbf { p } _ { y _ { i } ^ { 2 } } ^ { 2 } )
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\theta$ is the set of all trainable weights in the model (the weights and biases of CNN filters and LSTM cells, $\mathbf { w } _ { ( \mathbf { S } ) } , \mathbf { w } _ { ( \mathbf { p } ^ { 1 } ) }$ and $\mathbf { w } _ { ( \mathbf { p } ^ { 2 } ) , }$ ), $N$ is the number of examples in the dataset, $y _ { i } ^ { 1 }$ and $y _ { i } ^ { 2 }$ are the true start and end indices of the $i$ -th example, respectively, and $\mathbf { p } _ { k }$ indicates the $k$ -th value of the vector $\mathbf { p }$ .
|
| 90 |
+
|
| 91 |
+
Test. The answer span $( k , l )$ where $k \leq l$ with the maximum value of $\mathbf { p } _ { k } ^ { 1 } \mathbf { p } _ { l } ^ { 2 }$ is chosen, which can be computed in linear time with dynamic programming.
|
| 92 |
+
|
| 93 |
+
# 3 RELATED WORK
|
| 94 |
+
|
| 95 |
+
Machine comprehension. A significant contributor to the advancement of MC models has been the availability of large datasets. Early datasets such as MCTest (Richardson et al., 2013) were too small to train end-to-end neural models. Massive cloze test datasets (CNN/DailyMail by Hermann et al. (2015) and Childrens Book Test by Hill et al. (2016)), enabled the application of deep neural architectures to this task. More recently, Rajpurkar et al. (2016) released the Stanford Question Answering (SQuAD) dataset with over 100,000 questions. We evaluate the performance of our comprehension system on both SQuAD and CNN/DailyMail datasets.
|
| 96 |
+
|
| 97 |
+
Previous works in end-to-end machine comprehension use attention mechanisms in three distinct ways. The first group (largely inspired by Bahdanau et al. (2015)) uses a dynamic attention mechanism, in which the attention weights are updated dynamically given the query and the context as well as the previous attention. Hermann et al. (2015) argue that the dynamic attention model performs better than using a single fixed query vector to attend on context words on CNN & DailyMail datasets. Chen et al. (2016) show that simply using bilinear term for computing the attention weights in the same model drastically improves the accuracy. Wang & Jiang (2016) reverse the direction of the attention (attending on query words as the context RNN progresses) for SQuAD. In contrast to these models, BIDAF uses a memory-less attention mechanism.
|
| 98 |
+
|
| 99 |
+
The second group computes the attention weights once, which are then fed into an output layer for final prediction (e.g., Kadlec et al. (2016)). Attention-over-attention model (Cui et al., 2016) uses a 2D similarity matrix between the query and context words (similar to Equation 1) to compute the weighted average of query-to-context attention. In contrast to these models, BIDAF does not summarize the two modalities in the attention layer and instead lets the attention vectors flow into the modeling (RNN) layer.
|
| 100 |
+
|
| 101 |
+
The third group (considered as variants of Memory Network (Weston et al., 2015)) repeats computing an attention vector between the query and the context through multiple layers, typically referred to as multi-hop (Sordoni et al., 2016; Dhingra et al., 2016). Shen et al. (2016) combine Memory Networks with Reinforcement Learning in order to dynamically control the number of hops. One can also extend our BIDAF model to incorporate multiple hops.
|
| 102 |
+
|
| 103 |
+
Visual question answering. The task of question answering has also gained a lot of interest in the computer vision community. Early works on visual question answering (VQA) involved encoding the question using an RNN, encoding the image using a CNN and combining them to answer the question (Antol et al., 2015; Malinowski et al., 2015). Attention mechanisms have also been successfully employed for the VQA task and can be broadly clustered based on the granularity of their attention and the approach to construct the attention matrix. At the coarse level of granularity, the question attends to different patches in the image (Zhu et al., 2016; Xiong et al., 2016a). At a finer level, each question word attends to each image patch and the highest attention value for each spatial location (Xu & Saenko, 2016) is adopted. A hybrid approach is to combine questions representations at multiple levels of granularity (unigrams, bigrams, trigrams) (Yang et al., 2015). Several approaches to constructing the attention matrix have been used including element-wise product, element-wise sum, concatenation and Multimodal Compact Bilinear Pooling (Fukui et al., 2016).
|
| 104 |
+
|
| 105 |
+
Lu et al. (2016) have recently shown that in addition to attending from the question to image patches, attending from the image back to the question words provides an improvement on the VQA task. This finding in the visual domain is consistent with our finding in the language domain, where our bi-directional attention between the query and context provides improved results. Their model, however, uses the attention weights directly in the output layer and does not take advantage of the attention flow to the modeling layer.
|
| 106 |
+
|
| 107 |
+
# 4 QUESTION ANSWERING EXPERIMENTS
|
| 108 |
+
|
| 109 |
+
In this section, we evaluate our model on the task of question answering using the recently released SQuAD (Rajpurkar et al., 2016), which has gained a huge attention over a few months. In the next section, we evaluate our model on the task of cloze-style reading comprehension.
|
| 110 |
+
|
| 111 |
+
Dataset. SQuAD is a machine comprehension dataset on a large set of Wikipedia articles, with more than 100,000 questions. The answer to each question is always a span in the context. The model is given a credit if its answer matches one of the human written answers. Two metrics are used to evaluate models: Exact Match (EM) and a softer metric, F1 score, which measures the weighted average of the precision and recall rate at character level. The dataset consists of $9 0 \mathrm { k } / 1 0 \mathrm { k }$
|
| 112 |
+
|
| 113 |
+
<table><tr><td></td><td colspan="2">Single Model</td><td colspan="2">Ensemble</td></tr><tr><td></td><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>Logistic Regression Baselinea</td><td>40.4</td><td>51.0</td><td>-</td><td>-</td></tr><tr><td>Dynamic Chunk Readerb</td><td>62.5</td><td>71.0</td><td>-</td><td>-</td></tr><tr><td>Fine-Grained Gatingc</td><td>62.5</td><td>73.3</td><td>1</td><td>-</td></tr><tr><td>Match-LSTMd</td><td>64.7</td><td>73.7</td><td>67.9</td><td>77.0</td></tr><tr><td>Multi-Perspective Matchinge</td><td>65.5</td><td>75.1</td><td>68.2</td><td>77.2</td></tr><tr><td>Dynamic Coattention Networksf</td><td>66.2</td><td>75.9</td><td>71.6</td><td>80.4</td></tr><tr><td>R-Net9</td><td>68.4</td><td>77.5</td><td>72.1</td><td>79.7</td></tr><tr><td>BIDAF (Ours)</td><td>68.0</td><td>77.3</td><td>73.3</td><td>81.1</td></tr></table>
|
| 114 |
+
|
| 115 |
+
(a) Results on the SQuAD test set
|
| 116 |
+
|
| 117 |
+
<table><tr><td></td><td>EM</td><td>F1</td></tr><tr><td>No char embedding No word embedding No C2Q attention</td><td>65.0 55.5 57.2</td><td>75.4 66.8 67.7</td></tr><tr><td>No Q2C attention Dynamic attention</td><td>63.6 63.5</td><td>73.7 73.6</td></tr><tr><td>BIDAF (single)</td><td>67.7</td><td>77.3</td></tr><tr><td>BIDAF (ensemble)</td><td>72.6</td><td>80.7</td></tr></table>
|
| 118 |
+
|
| 119 |
+
(b) Ablations on the SQuAD dev set
|
| 120 |
+
|
| 121 |
+
Table 1: (1a) The performance of our model BIDAF and competing approaches by Rajpurkar et al. $( 2 0 1 6 ) ^ { a }$ , Yu et al. $( 2 0 1 6 ) ^ { b }$ , Yang et al. $( 2 0 1 6 ) ^ { c }$ , Wang & Jiang $( 2 0 1 6 ) ^ { d }$ , IBM Watsone (unpublished), Xiong et al. $( 2 0 1 6 \mathrm { b } ) ^ { f }$ , and Microsoft Research $\mathrm { A s i a } ^ { g }$ (unpublished) on the SQuAD test set. A concurrent work by Lee et al. (2016) does not report the test scores. All results shown here reflect the SQuAD leaderboard (stanford-qa.com) as of 6 Dec 2016, $1 2 \mathrm { p m }$ PST. (1b) The performance of our model and its ablations on the SQuAD dev set. Ablation results are presented only for single runs.
|
| 122 |
+
|
| 123 |
+
train/dev question-context tuples with a large hidden test set. It is one of the largest available MC datasets with human-written questions and serves as a great test bed for our model.
|
| 124 |
+
|
| 125 |
+
Model Details. The model architecture used for this task is depicted in Figure 1. Each paragraph and question are tokenized by a regular-expression-based word tokenizer (PTB Tokenizer) and fed into the model. We use $1 0 0 ~ 1 \mathrm { D }$ filters for CNN char embedding, each with a width of 5. The hidden state size $( d )$ of the model is 100. The model has about 2.6 million parameters. We use the AdaDelta (Zeiler, 2012) optimizer, with a minibatch size of 60 and an initial learning rate of 0.5, for 12 epochs. A dropout (Srivastava et al., 2014) rate of 0.2 is used for the CNN, all LSTM layers, and the linear transformation before the softmax for the answers. During training, the moving averages of all weights of the model are maintained with the exponential decay rate of 0.999. At test time, the moving averages instead of the raw weights are used. The training process takes roughly 20 hours on a single Titan X GPU. We also train an ensemble model consisting of 12 training runs with the identical architecture and hyper-parameters. At test time, we choose the answer with the highest sum of confidence scores amongst the 12 runs for each question.
|
| 126 |
+
|
| 127 |
+
Results. The results of our model and competing approaches on the hidden test are summarized in Table 1a. BIDAF (ensemble) achieves an EM score of 73.3 and an F1 score of 81.1, outperforming all previous approaches.
|
| 128 |
+
|
| 129 |
+
Ablations. Table 1b shows the performance of our model and its ablations on the SQuAD dev set. Both char-level and word-level embeddings contribute towards the model’s performance. We conjecture that word-level embedding is better at representing the semantics of each word as a whole, while char-level embedding can better handle out-of-vocab (OOV) or rare words. To evaluate bidirectional attention, we remove C2Q and Q2C attentions. For ablating C2Q attention, we replace the attended question vector $\tilde { \textbf { U } }$ with the average of the output vectors of the question’s contextual embedding layer (LSTM). C2Q attention proves to be critical with a drop of more than 10 points on both metrics. For ablating Q2C attention, the output of the attention layer, G, does not include terms that have the attended Q2C vectors, $\tilde { \bf H }$ . To evaluate the attention flow, we study a dynamic attention model, where the attention is dynamically computed within the modeling layer’s LSTM, following previous work (Bahdanau et al., 2015; Wang & Jiang, 2016). This is in contrast with our approach, where the attention is pre-computed before flowing to the modeling layer. Despite being a simpler attention mechanism, our proposed static attention outperforms the dynamically computed attention by more than 3 points. We conjecture that separating out the attention layer results in a richer set of features computed in the first 4 layers which are then incorporated by the modeling layer. We also show the performance of BIDAF with several different definitions of $\alpha$ and $\beta$ functions (Equation 1 and 2) in Appendix B.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Layer</td><td>Query</td><td>Closest words in the Context using cosine similarity</td></tr><tr><td>Word</td><td>When</td><td>when,When,After,after,He,he,But,but,before,Before</td></tr><tr><td>Contextual</td><td>When</td><td>When, when,1945,1991,1971,1967,1990,1972,1965,1953</td></tr><tr><td>Word</td><td>Where</td><td>Where,where,It,IT,it,they,They,that,That,city</td></tr><tr><td>Contextual</td><td>Where</td><td>where,Where,Rotterdam,area,Nearby,location,outside,Area,across,locations</td></tr><tr><td>Word Contextual</td><td>Who Who</td><td>Who,who,He,he,had,have,she,She,They,they who,whose,whom,Guiscard, person, John,Thomas,families,Elway,Louis</td></tr><tr><td>Word Contextual</td><td>city</td><td>City,city, town,Town, Capital,capital, district, cities,province,Downtown</td></tr><tr><td>Word</td><td>city January</td><td>city,City,Angeles,Paris,Prague,Chicago,Port,Pittsburgh,London,Manhattan July,December,June,October,Juary,eptember,February,April,November,rch</td></tr><tr><td>Contextual</td><td>January</td><td>January,March,December,August,December,July,July,July,March,December</td></tr><tr><td>Word</td><td>Seahawks</td><td>Seahawks,Broncos,49ers,Ravens,Chargers,Steelers,quarterback,Vikings,Colts,NFL</td></tr><tr><td>Contextual Word</td><td>Seahawks</td><td>Seahawks,Broncos,Panthers,Vikings,Packers,Ravens,Patriots,Falcons,Steelers,Chargers</td></tr><tr><td>Contextual</td><td>date</td><td>date,dates,until,Until,June,July,Year,year,December,deadline</td></tr><tr><td></td><td>date</td><td>date,dates,December,July,January,October,June,November,March,February</td></tr></table>
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Table 2: Closest context words to a given query word, using a cosine similarity metric computed in the Word Embedding feature space and the Phrase Embedding feature space.
|
| 135 |
+
Figure 2: (a) t-SNE visualizations of the months names embedded in the two feature spaces. The contextual embedding layer is able to distinguish the two usages of the word May using context from the surrounding text. (b) Venn diagram of the questions answered correctly by our model and the more traditional baseline (Rajpurkar et al., 2016). (c) Correctly answered questions broken down by the 10 most frequent first words in the question.
|
| 136 |
+
|
| 137 |
+
Visualizations. We now provide a qualitative analysis of our model on the SQuAD dev set. First, we visualize the feature spaces after the word and contextual embedding layers. These two layers are responsible for aligning the embeddings between the query and context words which are the inputs to the subsequent attention layer. To visualize the embeddings, we choose a few frequent query words in the dev data and look at the context words that have the highest cosine similarity to the query words (Table 2). At the word embedding layer, query words such as When, Where and Who are not well aligned to possible answers in the context, but this dramatically changes in the contextual embedding layer which has access to context from surrounding words and is just 1 layer below the attention layer. When begins to match years, Where matches locations, and Who matches names.
|
| 138 |
+
|
| 139 |
+
We also visualize these two feature spaces using t-SNE in Figure 2. t-SNE is performed on a large fraction of dev data but we only plot data points corresponding to the months of the year. An interesting pattern emerges in the Word space, where May is separated from the rest of the months because May has multiple meanings in the English language. The contextual embedding layer uses contextual cues from surrounding words and is able to separate the usages of the word May. Finally we visualize the attention matrices for some question-context tuples in the dev data in Figure 3. In the first example, Where matches locations and in the second example, many matches quantities and numerical symbols. Also, entities in the question typically attend to the same entities in the context, thus providing a feature for the model to localize possible answers.
|
| 140 |
+
|
| 141 |
+
Discussions. We analyse the performance of our our model with a traditional language-featurebased baseline (Rajpurkar et al., 2016). Figure 2b shows a Venn diagram of the dev set questions correctly answered by the models. Our model is able to answer more than $86 \%$ of the questions correctly answered by the baseline. The $14 \%$ that are incorrectly answered does not have a clear pattern. This suggests that neural architectures are able to exploit much of the information captured by the language features. We also break this comparison down by the first words in the questions (Figure 2c). Our model outperforms the traditional baseline comfortably in every category.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 3: Attention matrices for question-context tuples. The left palette shows the context paragraph (correct answer in red and underlined), the middle palette shows the attention matrix (each row is a question word, each column is a context word), and the right palette shows the top attention points for each question word, above a threshold.
|
| 145 |
+
|
| 146 |
+
Error Analysis. We randomly select 50 incorrect questions (based on EM) and categorize them into 6 classes. $50 \%$ of errors are due to the imprecise boundaries of the answers, $28 \%$ involve syntactic complications and ambiguities, $14 \%$ are paraphrase problems, $4 \%$ require external knowledge, $2 \%$ need multiple sentences to answer, and $2 \%$ are due to mistakes during tokenization. See Appendix A for the examples of the error modes.
|
| 147 |
+
|
| 148 |
+
# 5 CLOZE TEST EXPERIMENTS
|
| 149 |
+
|
| 150 |
+
We also evaluate our model on the task of cloze-style reading comprehension using the CNN and Daily Mail datasets (Hermann et al., 2015).
|
| 151 |
+
|
| 152 |
+
Dataset. In a cloze test, the reader is asked to fill in words that have been removed from a passage, for measuring one’s ability to comprehend text. Hermann et al. (2015) have recently compiled a massive Cloze-style comprehension dataset, consisting of $3 0 0 \mathrm { k } / 4 \mathrm { k } / 3 \mathrm { k }$ and 879k/65k/53k (train/dev/test) examples from CNN and DailyMail news articles, respectively. Each example has a news article and an incomplete sentence extracted from the human-written summary of the article. To distinguish this task from language modeling and force one to refer to the article to predict the correct missing word, the missing word is always a named entity, anonymized with a random ID. Also, the IDs must be shuffled constantly during test, which is also critical for full anonymization.
|
| 153 |
+
|
| 154 |
+
Model Details. The model architecture used for this task is very similar to that for SQuAD (Section 4) with only a few small changes to adapt it to the cloze test. Since each answer in the CNN/DailyMail datasets is always a single word (entity), we only need to predict the start index $( \mathbf { p } ^ { 1 } )$ ; the prediction for the end index $( \mathbf { p } ^ { 2 } )$ is omitted from the loss function. Also, we mask out all non-entity words in the final classification layer so that they are forced to be excluded from possible answers. Another important difference from SQuAD is that the answer entity might appear more than once in the context paragraph. To address this, we follow a similar strategy from Kadlec et al. (2016). During training, after we obtain $\mathbf { p } ^ { 1 }$ , we sum all probability values of the entity instances in the context that correspond to the correct answer. Then the loss function is computed from the summed probability. We use a minibatch size of 48 and train for 8 epochs, with early stop when the accuracy on validation data starts to drop. Inspired by the window-based method (Hill et al., 2016), we split each article into short sentences where each sentence is a 19-word window around each entity (hence the same word might appear in multiple sentences). The RNNs in BIDAF are not feed-forwarded or back-propagated across sentences, which speed up the training process by parallelization. The entire training process takes roughly 60 hours on eight Titan X GPUs. The other hyper-parameters are identical to the model described in Section 4.
|
| 155 |
+
|
| 156 |
+
Results. The results of our single-run models and competing approaches on the CNN/DailyMail datasets are summarized in Table 3. ∗ indicates ensemble methods. BIDAF outperforms previous single-run models on both datasets for both val and test data. On the DailyMail test, our single-run model even outperforms the best ensemble method.
|
| 157 |
+
|
| 158 |
+
Table 3: Results on CNN/DailyMail datasets. We also include the results of previous ensemble methods (marked with $^ *$ ) for completeness.
|
| 159 |
+
|
| 160 |
+
<table><tr><td rowspan="2"></td><td colspan="2">CNN</td><td colspan="2">DailyMail</td></tr><tr><td>val</td><td>test</td><td>val</td><td>test</td></tr><tr><td>Attentive Reader (Hermann et al.,2015)</td><td>61.6</td><td>63.0</td><td>70.5</td><td>69.0</td></tr><tr><td>MemNN (Hill et al.,2016)</td><td>63.4</td><td>6.8</td><td>=</td><td></td></tr><tr><td>AS Reader (Kadlec et al.,2016)</td><td>68.6</td><td>69.5</td><td>75.0</td><td>73.9</td></tr><tr><td>DER Network (Kobayashi et al.,2016)</td><td>71.3</td><td>72.9</td><td>1</td><td>-</td></tr><tr><td>Iterative Attention (Sordoni et al.,2016)</td><td>72.6</td><td>73.3</td><td>-</td><td>=</td></tr><tr><td>EpiReader (Trischler et al.,2016) Stanford AR (Chen et al.,2016)</td><td>73.4</td><td>74.0</td><td>=</td><td>-</td></tr><tr><td>GAReader (Dhingra et al.,2016)</td><td>73.8</td><td>73.6</td><td>77.6</td><td>76.6</td></tr><tr><td>AoA Reader (Cui et al., 2016)</td><td>73.0</td><td>73.8</td><td>76.7</td><td>75.7</td></tr><tr><td></td><td>73.1</td><td>74.4</td><td></td><td>=</td></tr><tr><td>ReasoNet (Shen et al.,2016) BIDAF (Ours)</td><td>72.9</td><td>74.7</td><td>77.6</td><td>76.6</td></tr><tr><td>MemNN* (Hill et al., 2016)</td><td>76.3</td><td>76.9</td><td>80.3</td><td>79.6</td></tr><tr><td></td><td>66.2</td><td>69.4</td><td>-</td><td>=</td></tr><tr><td>ASReader* (Kadlec et al.,2016)</td><td>73.9</td><td>75.4</td><td>78.7</td><td>77.7</td></tr><tr><td>Iterative Attention*(Sordoni et al.,2016)</td><td>74.5</td><td>75.7</td><td>-</td><td>-</td></tr><tr><td>GA Reader* (Dhingra et al.,2016)</td><td>76.4</td><td>77.4</td><td>79.1</td><td>78.1</td></tr><tr><td>Stanford AR*(Chen et al., 2016)</td><td>77.2</td><td>77.6</td><td>80.2</td><td>79.2</td></tr></table>
|
| 161 |
+
|
| 162 |
+
# 6 CONCLUSION
|
| 163 |
+
|
| 164 |
+
In this paper, we introduce BIDAF, a multi-stage hierarchical process that represents the context at different levels of granularity and uses a bi-directional attention flow mechanism to achieve a queryaware context representation without early summarization. The experimental evaluations show that our model achieves the state-of-the-art results in Stanford Question Answering Dataset (SQuAD) and CNN/DailyMail cloze test. The ablation analyses demonstrate the importance of each component in our model. The visualizations and discussions show that our model is learning a suitable representation for MC and is capable of answering complex questions by attending to correct locations in the given paragraph. Future work involves extending our approach to incorporate multiple hops of the attention layer.
|
| 165 |
+
|
| 166 |
+
# ACKNOWLEDGMENTS
|
| 167 |
+
|
| 168 |
+
This research was supported by the NSF (IIS 1616112), NSF (III 1703166), Allen Institute for AI (66-9175), Allen Distinguished Investigator Award, Google Research Faculty Award, and Samsung GRO Award. We thank the anonymous reviewers for their helpful comments.
|
| 169 |
+
|
| 170 |
+
# REFERENCES
|
| 171 |
+
|
| 172 |
+
Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015.
|
| 173 |
+
|
| 174 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2015.
|
| 175 |
+
|
| 176 |
+
Danqi Chen, Jason Bolton, and Christopher D. Manning. A thorough examination of the cnn/daily mail reading comprehension task. In ACL, 2016.
|
| 177 |
+
|
| 178 |
+
Yiming Cui, Zhipeng Chen, Si Wei, Shijin Wang, Ting Liu, and Guoping Hu. Attention-overattention neural networks for reading comprehension. arXiv preprint arXiv:1607.04423, 2016.
|
| 179 |
+
|
| 180 |
+
Bhuwan Dhingra, Hanxiao Liu, William W Cohen, and Ruslan Salakhutdinov. Gated-attention readers for text comprehension. arXiv preprint arXiv:1606.01549, 2016.
|
| 181 |
+
|
| 182 |
+
Akira Fukui, Dong Huk Park, Daylen Yang, Anna Rohrbach, Trevor Darrell, and Marcus Rohrbach. Multimodal compact bilinear pooling for visual question answering and visual grounding. In EMNLP, 2016.
|
| 183 |
+
|
| 184 |
+
Karl Moritz Hermann, Tomas Kocisk ´ y, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa ´ Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In NIPS, 2015.
|
| 185 |
+
|
| 186 |
+
Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The goldilocks principle: Reading children’s books with explicit memory representations. In ICLR, 2016.
|
| 187 |
+
|
| 188 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. Neural Computation, 1997.
|
| 189 |
+
|
| 190 |
+
Rudolf Kadlec, Martin Schmid, Ondrej Bajgar, and Jan Kleindienst. Text understanding with the attention sum reader network. In ACL, 2016.
|
| 191 |
+
|
| 192 |
+
Yoon Kim. Convolutional neural networks for sentence classification. In EMNLP, 2014.
|
| 193 |
+
|
| 194 |
+
Sosuke Kobayashi, Ran Tian, Naoaki Okazaki, and Kentaro Inui. Dynamic entity representation with max-pooling improves machine reading. In NAACL-HLT, 2016.
|
| 195 |
+
|
| 196 |
+
Kenton Lee, Tom Kwiatkowski, Ankur Parikh, and Dipanjan Das. Learning recurrent span representations for extractive question answering. arXiv preprint arXiv:1611.01436, 2016.
|
| 197 |
+
|
| 198 |
+
Jiasen Lu, Jianwei Yang, Dhruv Batra, and Devi Parikh. Hierarchical question-image co-attention for visual question answering. In NIPS, 2016.
|
| 199 |
+
|
| 200 |
+
Mateusz Malinowski, Marcus Rohrbach, and Mario Fritz. Ask your neurons: A neural-based approach to answering questions about images. In ICCV, 2015.
|
| 201 |
+
|
| 202 |
+
Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
|
| 203 |
+
|
| 204 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In EMNLP, 2016.
|
| 205 |
+
|
| 206 |
+
Matthew Richardson, Christopher JC Burges, and Erin Renshaw. Mctest: A challenge dataset for the open-domain machine comprehension of text. In EMNLP, 2013.
|
| 207 |
+
|
| 208 |
+
Yelong Shen, Po-Sen Huang, Jianfeng Gao, and Weizhu Chen. Reasonet: Learning to stop reading in machine comprehension. arXiv preprint arXiv:1609.05284, 2016.
|
| 209 |
+
|
| 210 |
+
Alessandro Sordoni, Phillip Bachman, and Yoshua Bengio. Iterative alternating neural attention for machine reading. arXiv preprint arXiv:1606.02245, 2016.
|
| 211 |
+
|
| 212 |
+
Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 2014.
|
| 213 |
+
|
| 214 |
+
Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ arXiv preprint arXiv:1505.00387, 2015.
|
| 215 |
+
|
| 216 |
+
Adam Trischler, Zheng Ye, Xingdi Yuan, and Kaheer Suleman. Natural language comprehension with the epireader. In EMNLP, 2016.
|
| 217 |
+
Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. arXiv preprint arXiv:1608.07905, 2016.
|
| 218 |
+
Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. In ICLR, 2015.
|
| 219 |
+
Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic memory networks for visual and textual question answering. In ICML, 2016a.
|
| 220 |
+
Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. arXiv preprint arXiv:1611.01604, 2016b.
|
| 221 |
+
Huijuan Xu and Kate Saenko. Ask, attend and answer: Exploring question-guided spatial attention for visual question answering. In ECCV, 2016.
|
| 222 |
+
Zhilin Yang, Bhuwan Dhingra, Ye Yuan, Junjie Hu, William W Cohen, and Ruslan Salakhutdinov. Words or characters? fine-grained gating for reading comprehension. arXiv preprint arXiv:1611.01724, 2016.
|
| 223 |
+
Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alex Smola. Stacked attention networks for image question answering. arXiv preprint arXiv:1511.02274, 2015.
|
| 224 |
+
Yang Yu, Wei Zhang, Kazi Hasan, Mo Yu, Bing Xiang, and Bowen Zhou. End-to-end reading comprehension with dynamic answer chunk ranking. arXiv preprint arXiv:1610.09996, 2016.
|
| 225 |
+
Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
|
| 226 |
+
Yuke Zhu, Oliver Groth, Michael S. Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images. In CVPR, 2016.
|
| 227 |
+
|
| 228 |
+
# A ERROR ANALYSIS
|
| 229 |
+
|
| 230 |
+
Table 4 summarizes the modes of errors by BIDAF and shows examples for each category of error in SQuAD.
|
| 231 |
+
|
| 232 |
+
<table><tr><td>Error type</td><td>Ratio (%)</td><td>Example</td></tr><tr><td>Imprecise answer boundaries</td><td>50</td><td>Context: “The Free Movement of Workers Regulation articles 1 to 7 set out the main provisions on equal treatment of workers.” Question:“Which articles of the Free Movement of Workers Regulation set out the primary provisions on equal treatment of workers?” Prediction: “1 to 7", Answer: “articles 1 to 7”</td></tr><tr><td>Syntactic complications and ambiguities</td><td>28</td><td>Context: “A piece of paper was later found on which Luther had written his last statement.” Question: “What was later discovered written by Luther?" Prediction: “A piece of paper",Answer: “his last statement"</td></tr><tr><td>Paraphrase problems</td><td>14</td><td>tier model which includes primary education (primary schools), followed by secondary education (secondary schools/high schools) and tertiary education (universities and/or TAFE colleges).” Question:“What is the first model of education, in the Aus- tralian system?” Prediction: “three-tier”,Answer: “primary education"</td></tr><tr><td>External knowledge</td><td>4</td><td>Context:“On June 4, 2014, the NFL announced that the practice of branding Super Bowl games with Roman numerals, a practice established at Super Bowl V,would be temporarily suspended,and that the game would be named using Arabic numerals as Super Bowl 50 as opposed to Super Bowl L." Question: “If Roman numerals were used in the naming of the 50th Super Bowl, which one would have been used?' Prediction: “Super Bowl 5O”, Answer: “L"</td></tr><tr><td>Multi- sentence</td><td>2 starting in the mid-1980s."</td><td>interactive connections the network was enhanced to support terminal to host connections,host to host batch connections (remote job submission,remote printing,batch file transfer), interactive file transfer, gateways to the Tymnet and Telenet public data networks, X.25 host atachments, gateways to X.25 data networks,Ethernet attached hosts,and eventually TCP/IP and additional public universities in Michigan join the network. All of this set the stage for Merit's role in the NSFNET project Question: “What set the stage for Merits role in NSFNET" Prediction:“All of this set the stage for Merit 's role in the</td></tr><tr><td>Incorrect preprocessing</td><td>2</td><td>this work by showing that fire requires only a part of air that he called spiritus nitroaereus or just nitroaereus." Question: “John Mayow died in what year?" Prediction: “1641-1679",Answer: “1679"</td></tr></table>
|
| 233 |
+
|
| 234 |
+
into 6 different categories. Only relevant sentence(s) from the context shown for brevity.
|
| 235 |
+
|
| 236 |
+
# B VARIATIONS OF SIMILARITY AND FUSION FUNCTIONS
|
| 237 |
+
|
| 238 |
+
<table><tr><td></td><td>EM</td><td>F1</td></tr><tr><td>Eqn. 1: dot product Eqn. 1: linear Eqn. 1: bilinear</td><td>65.5 59.5 61.6</td><td>75.5 69.7 71.8</td></tr><tr><td>Eqn. 1: linear after MLP</td><td>66.2</td><td>76.4</td></tr><tr><td>Eqn. 2: MLP after concat</td><td>67.1</td><td>77.0</td></tr><tr><td>BIDAF (single)</td><td>68.0</td><td>77.3</td></tr></table>
|
| 239 |
+
|
| 240 |
+
Table 5: Variations of similarity function $\alpha$ (Equation 1) and fusion function $\beta$ (Equation 2) and their performance on the dev data of SQuAD. See Appendix B for the details of each variation.
|
| 241 |
+
|
| 242 |
+
In this appendix section, we experimentally demonstrate how different choices of the similarity function $\alpha$ (Equation 1) and the fusion function $\beta$ (Equation 2) impact the performance of our model. Each variation is defined as following:
|
| 243 |
+
|
| 244 |
+
Eqn. 1: dot product. Dot product $\alpha$ is defined as
|
| 245 |
+
|
| 246 |
+
$$
|
| 247 |
+
\alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { h } ^ { \top } \mathbf { u }
|
| 248 |
+
$$
|
| 249 |
+
|
| 250 |
+
where $\top$ indicates matrix transpose. Dot product has been used for the measurement of similarity between two vectors by Hill et al. (2016).
|
| 251 |
+
|
| 252 |
+
Eqn. 1: linear. Linear $\alpha$ is defined as
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
\alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { w } _ { \mathrm { l i n } } ^ { \top } [ \mathbf { h } ; \mathbf { u } ]
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
where $\mathbf { w } _ { \mathrm { l i n } } ^ { \top } \in \mathbb { R } ^ { 4 d }$ is a trainable weight matrix. This can be considered as the simplification of Equation 1 by dropping the term $\mathbf { h } \circ \mathbf { u }$ in the concatenation.
|
| 259 |
+
|
| 260 |
+
Eqn. 1: bilinear. Bilinear $\alpha$ is defined as
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { h } ^ { \top } \mathbf { W } _ { \mathbf { \mathrm { b i } } } \mathbf { u }
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
where $\mathbf { W _ { \mathrm { b i } } } \in \mathbb { R } ^ { 2 d \times 2 d }$ is a trainable weight matrix. Bilinear term has been used by Chen et al.
|
| 267 |
+
(2016).
|
| 268 |
+
|
| 269 |
+
Eqn. 1: linear after MLP. We can also perform linear mapping after single layer of perceptron:
|
| 270 |
+
|
| 271 |
+
$$
|
| 272 |
+
\alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { w } _ { \mathrm { l i n } } ^ { \top } \operatorname { t a n h } ( \mathbf { W } _ { \mathrm { m l p } } [ \mathbf { h } ; \mathbf { u } ] + \mathbf { b } _ { \mathrm { m l p } } )
|
| 273 |
+
$$
|
| 274 |
+
|
| 275 |
+
where $\mathbf { W } _ { \mathrm { m l p } }$ and $\mathbf { b } _ { \mathrm { m l p } }$ are trainable weight matrix and bias, respectively. Linear mapping after perceptron layer has been used by Hermann et al. (2015).
|
| 276 |
+
|
| 277 |
+
Eqn. 2: MLP after concatenation. We can define $\beta$ as
|
| 278 |
+
|
| 279 |
+
$$
|
| 280 |
+
\beta ( \mathbf { h } , { \tilde { \mathbf { u } } } , { \tilde { \mathbf { h } } } ) = \operatorname* { m a x } ( 0 , \mathbf { W } _ { \mathrm { m l p } } [ \mathbf { h } ; { \tilde { \mathbf { u } } } ; \mathbf { h } \circ { \tilde { \mathbf { u } } } ; \mathbf { h } \circ { \tilde { \mathbf { h } } } ] + \mathbf { b } _ { \mathrm { m l p } } )
|
| 281 |
+
$$
|
| 282 |
+
|
| 283 |
+
where $\mathbf { W } _ { \mathrm { m l p } } \in \mathbb { R } ^ { 2 d \times 8 d }$ and ${ \bf b } _ { \mathrm { m l p } } \in \mathbb { R } ^ { 2 d }$ are trainable weight matrix and bias. This is equivalent to adding ReLU after linearly transforming the original definition of $\beta$ . Since the output dimension of $\beta$ changes, the input dimension of the first LSTM of the modeling layer will change as well.
|
| 284 |
+
|
| 285 |
+
The results of these variations on the dev data of SQuAD are shown in Table 5. It is important to note that there are non-trivial gaps between our definition of $\alpha$ and other definitions employed by previous work. Adding MLP in $\beta$ does not seem to help, yielding slightly worse result than $\beta$ without MLP.
|
md/train/HyGySsAct7/HyGySsAct7.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TARGETED ADVERSARIAL EXAMPLES FOR BLACK BOX AUDIO SYSTEMS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The application of deep recurrent networks to audio transcription has led to impressive gains in automatic speech recognition (ASR) systems. Many have demonstrated that small adversarial perturbations can fool deep neural networks into incorrectly predicting a specified target with high confidence. Current work on fooling ASR systems have focused on white-box attacks, in which the model architecture and parameters are known. In this paper, we adopt a black-box approach to adversarial generation, combining the approaches of both genetic algorithms and gradient estimation to solve the task. We achieve a $8 9 . 2 5 \%$ targeted attack similarity after 3000 generations while maintaining $9 4 . 6 \%$ audio file similarity.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Although neural networks have incredible expressive capacity, which allow them to be well suited for a variety of machine learning tasks, they have been shown to be vulnerable to adversarial attacks over multiple network architectures and datasets Goodfellow et al. (2014). These attacks can be done by adding small perturbations to the original input so that the network misclassifies the input but a human does not notice the difference.
|
| 12 |
+
|
| 13 |
+
So far, there has been much more work done in generating adversarial examples for image inputs than for other domains, such as audio. Voice control systems are widely used in many products from personal assistants, like Amazon Alexa and Apple Siri, to voice command technologies in cars. One main challenge for such systems is determining exactly what the user is saying and correctly interpreting the statement. As deep learning helps these systems better understand the user, one potential issue is targeted adversarial attacks on the system, which perturb the waveform of what the user says to the system to cause the system to behave in a predetermined inappropriate way. For example, a seemingly benign TV advertisement could be adversely perturbed to cause Alexa to interpret the audio as “Alexa, buy 100 headphones.” If the original user went back to listen to the audio clip that prompted the order, the noise would be almost undetectable to the human ear.
|
| 14 |
+
|
| 15 |
+
There are multiple different methods of performing adversarial attacks depending on what information the attacker has about the network. If given access to the parameters of a network, white box attacks are most successful, such as the Fast Gradient Sign Method Goodfellow et al. (2014) or DeepFool Moosavi-Dezfooli et al. (2015). However, assuming an attacker has access to all the parameters of a network is unrealistic in practice. In a black box setting, when an attacker only has access to the logits or outputs of a network, it is much harder to consistently create successful adversarial attacks.
|
| 16 |
+
|
| 17 |
+
In certain special black box settings, white box attack methods can be reused if an attacker creates a model that approximates the original targeted model. However, even though attacks can transfer across networks for some domains, this requires more knowledge of how to solve the task that the original model is solving than an attacker may have Liu et al. (2016); Papernot et al. (2016). Instead, we propose a novel combination of genetic algorithms and gradient estimation to solve this task. The first phase of the attack is carried out by genetic algorithms, which are a gradient-free method of optimization that iterate over populations of candidates until a suitable sample is produced. In order to limit excess mutations and thus excess noise, we improve the standard genetic algorithm with a new momentum mutation update. The second phase of the attack utilizes gradient estimation, where the gradients of individual audio points are estimated, thus allowing for more careful noise placement when the adversarial example is nearing its target. The combination of these two approaches provides a $8 9 . 2 5 \%$ average targeted attack similarity with a $9 4 . 6 \%$ audio file similarity after 3000 generations.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Example of targeted adversarial attack on speech to text systems in practice
|
| 21 |
+
|
| 22 |
+
# 1.1 PROBLEM STATEMENT
|
| 23 |
+
|
| 24 |
+
Adversarial attacks can be created given a variety of information about the neural network, such as the loss function or the output probabilities. However in a natural setting, usually the neural network behind such a voice control system will not be publicly released so an adversary will only have access to an API which provides the text the system interprets given a continuous waveform. Given this constraint, we use the open sourced Mozilla DeepSpeech implementation as a black box system, without using any information on how the transcription is done.
|
| 25 |
+
|
| 26 |
+
We perform our black box targeted attack on a model $M$ given a benign input $x$ and a target $t$ by perturbing $x$ to form the adversarial input $x ^ { \prime } = x + \delta$ , such that $M ( x ^ { \prime } ) = t$ . To minimize the audible noise added to the input, so a human cannot notice the target, we maximize the cross correlation between $x$ and $x ^ { \prime }$ . A sufficient value of $\delta$ is determined using our novel black box approach, so we do not need access to the gradients of $M$ to perform the attack.
|
| 27 |
+
|
| 28 |
+
# 1.2 PRIOR WORK
|
| 29 |
+
|
| 30 |
+
Compared to images, audio presents a much more significant challenge for models to deal with. While convolutional networks can operate directly on the pixel values of images, ASR systems typically require heavy pre-processing of the input audio. Most commonly, the Mel-Frequency Cepstrum (MFC) transform, essentially a fourier transform of the sampled audio file, is used to convert the input audio into a spectogram which shows frequencies over time. Models such as DeepSpeech (Fig. 2) use this spectogram as the initial input.
|
| 31 |
+
|
| 32 |
+
In a foundational study for adversarial attacks, Cisse et al. (2017) developed a general attack framework to work across a wide variety of models including images and audio. When applying their method to audio samples, they ran into the roadblock of backpropagating through the MFC conversion layer. Thus, they were able to produce adversarial spectograms but not adversarial .wav files.
|
| 33 |
+
|
| 34 |
+
Carlini & Wagner (2018) overcame this challenge by developing a method of passing gradients through the MFC layer, a task which was previously proved to be difficult Cisse et al. (2017). They applied their method to the Mozilla DeepSpeech model, which is a complex, recurrent, character-level network that can decode translations at up to 50 characters per second. With a gradient connection all the way to the raw input, they were able to achieve impressive results, including generating samples over $9 9 . 9 \%$ similar with a targeted attack accuracy of $100 \%$ . While the success of this attack opens new doors for white box attacks, adversaries in a real-life setting commonly do not have knowledge of model architectures or parameters.
|
| 35 |
+
|
| 36 |
+
Alzantot et al. (2018) have demonstrated that black-box approaches for targeted attacks on ASR systems are possible. Using a genetic algorithm approach, they were able to iteratively apply noise to audio samples, pruning away poor performers at each generation, and ultimately end up with a perturbed version of the input that successfully fooled a classification system. This attack was conducted on the Speech Commands classification model Alzantot et al. (2018), which is a lightweight convolutional model for classifying up to 50 different single-word phrases.
|
| 37 |
+
|
| 38 |
+
Extending the research done by Alzantot et al. (2018), we propose a genetic algorithm and gradient estimation approach to create targeted adversarial audio, but on the more complex DeepSpeech system. The difficulty of this task comes in attempting to apply black-box optimization to a deeplylayered, highly nonlinear decoder model that has the ability to decode phrases of arbitrary length. Nevertheless, the combination of two differing approaches as well as the momentum mutation update bring new success to this task.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Diagram of Baidu’s DeepSpeech model Hannun et al. (2014)
|
| 42 |
+
|
| 43 |
+
# 1.3 BACKGROUND
|
| 44 |
+
|
| 45 |
+
Dataset For the attack, we follow Carlini & Wagner (2018) and take the first 100 audio samples from the CommonVoice test set. For each, we randomly generate a 2-word target phrase and apply our black-box approach to construct an adversarial example. More details on evaluation can be found in section 3. Each sample in the dataset is a .wav file, which can easily be deserialized into a numpy array. Our algorithm operates directly on the numpy arrays, thus bypassing the difficulty of dealing with the MFC conversion.
|
| 46 |
+
|
| 47 |
+
Victim model The model we attack is Baidu’s DeepSpeech model Hannun et al. (2014), implemented in Tensorflow and open-sourced by Mozilla.1 Though we have access to the full model, we treat it as if in a black box setting and only access the output logits of the model. In line with other speech to text systems Chiu et al. (2017); Cisse et al. (2017), DeepSpeech accepts a spectrogram of the audio file. After performing the MFC conversion, the model consists 3 layers of convolutions, followed by a bi-directional LSTM, followed by a fully connected layer. This layer is then fed into the decoder RNN, which outputs logits over the distribution of output characters, up to 50 characters per second of audio. The model is illustrated in figure 2.
|
| 48 |
+
|
| 49 |
+
Connectionist temporal classication While the DeepSpeech model is designed to allow arbitrary length translations, there is no given labeled alignment of the output and input sequences during training time. Thus the connectionist temporal classication loss (CTC Loss) is introduced, as it allows computing a loss even when the position of a decoded word in the original audio is unknown Carlini & Wagner (2018).
|
| 50 |
+
|
| 51 |
+
DeepSpeech outputs a probability distribution over all characters at every frame, for 50 frames per second of audio. In addition to outputting the normal alphabet a-z and space, it can output special character $\epsilon$ . Then CTC decoder $C ( \cdot )$ decodes the logits as such: for every frame, take the character with the max logit. Then first, remove all adjacent duplicate characters, and then second, remove any special $\epsilon$ characters. Thus aabb will decode to abb Carlini & Wagner (2018).
|
| 52 |
+
|
| 53 |
+
As we can see, multiple outputs can decode to the same phrase. Following the notation in Carlini & Wagner (2018), for any target phrase $p$ , we call $\pi$ an alignment of $p$ if $C ( \pi ) = p$ . Let us also call the output distribution of our model $y$ . Now, in order to find the likelihood of alignment $\pi$ under $y$ :
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
P r ( p | y ) = \sum _ { \pi | C ( \pi ) = p } P r ( \pi | y ) = \sum _ { \pi | C ( \pi ) = p } \prod _ { i } y _ { \pi } ^ { i }
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
as noted by Carlini & Wagner (2018). This is the objective we use when scoring samples from the populations in each generation of our genetic algorithm as well as the score used in estimating gradients.
|
| 60 |
+
|
| 61 |
+
Greedy decoding As in traditional recurrent decoder systems, DeepSpeech typically uses a beam search of beam width 500. At each frame of decoding, 500 of the most likely $\pi$ will be evaluated, each producing another 500 candidates for a total of 2500, which are pruned back down to 500 for the next timestep. Evaluating multiple assignments this way increases the robustness of the model decoding. However, following work in Carlini & Wagner (2018), we set the model to use greedy decoding. At each timestep only $1 \pi$ is evaluated, leading to a greedy assignment:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
d e c o d e ( x ) = C ( \arg \operatorname* { m a x } _ { \pi } P r ( { y } ( { x } ) | \pi ) )
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
Thus, our genetic algorithm will focus on creating perturbations to the most likely sequence (if greedily approximated).
|
| 68 |
+
|
| 69 |
+
# 2 BLACK BOX ATTACK ALGORITHM
|
| 70 |
+
|
| 71 |
+
<table><tr><td>Algorithm1 Black box algorithm for generating adversarial audio sample</td></tr><tr><td>Input: Original benign input x Target phrase t Output: Adversarial Audio Sample x' population ← [x] * populationSize while iter<maxIters and Decode(best)!= t do scores ← -CTCLoss(population,t) best ← population[Argmax(scores)]</td></tr><tr><td>if EditDistance(t,Decode(best)) >2 then / phase 1 - do genetic algorithm while populationSize children have not been made do</td></tr><tr><td>Select parent1 from topk(population) according to softmax(their score) Select parent2 from topk(population) according to softmax(their score) child ← Mutate(Crossover(parent1,parent2), p)</td></tr><tr><td>end while newScores ← -CTCLoss(newPopulation,t)</td></tr><tr><td>p ← MomentumUpdate(p,newScores, scores) else</td></tr><tr><td>/ phase 2 - do gradient estimation top-element ← top(population) grad-pop ← n copies of top-element, each mutated slightly at one index grad ←(-CTCLoss(grad-pop)- scores)/mutation-delta pop ← top-element + grad</td></tr></table>
|
| 72 |
+
|
| 73 |
+
# 2.1 GENETIC ALGORITHM
|
| 74 |
+
|
| 75 |
+
As mentioned previously, Alzantot et al. (2018) demonstrated the success of a black-box adversarial attack on speech-to-text systems using a standard genetic algorithm. The basic premise of our algorithm is that it takes in the benign audio sample and, through trial and error, adds noise to the sample such that the perturbed adversarial audio is similar to the benign input yet is decoded as the target, as shown in Figure 3. A genetic algorithm works well for a problem of this nature because it is completely independent of the gradients of the model. Alzantot et al. (2018) used a limited dataset consisting of audio samples with just one word and a classification with a predefined number of classes. In order to extend this algorithm to work with phrases and sentences, as well as with CTC Loss, we make modifications to the genetic algorithm and introduce our novel momentum mutation.
|
| 76 |
+
|
| 77 |
+
The genetic algorithm works by improving on each iteration, or generation, through evolutionary methods such as Crossover and Mutation Holland (1992). For each iteration, we compute the score for each sample in the population to determine which samples are the best. Our scoring function was the CTC-Loss, which as mentioned previously, is used to determine the similarity between an input audio sequence and a given phrase. We then form our elite population by selecting the best scoring samples from our population. The elite population contains samples with desirable traits that we want to carry over into future generations. We then select parents from the elite population and perform Crossover, which creates a child by taking around half of the elements from parent1 and the other half from parent2. The probability that we select a sample as a parent is a function of the sample’s score. With some probability, we then add a mutation to our new child. Finally, we update our mutation probabilities according to our momentum update, and move to the next iteration. The population will continue to improve over time as only the best traits of the previous generations as well as the best mutations will remain. Eventually, either the algorithm will reach the max number of iterations, or one of the samples is exactly decoded as the target, and the best sample is returned.
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
Figure 3: Diagram of our genetic algorithm
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 4: Overlapping of adversarial (blue) and original (orange) audio sample waveforms. The perturbation is barely noticeable
|
| 84 |
+
|
| 85 |
+
# 2.2 MOMENTUM MUTATION
|
| 86 |
+
|
| 87 |
+
<table><tr><td>Algorithm 2 Mutation</td></tr><tr><td>Input: Audio Sample x</td></tr><tr><td>Mutation Probability p</td></tr><tr><td>Output: Mutated Audio Sample x'</td></tr><tr><td></td></tr><tr><td>for all e in x do</td></tr><tr><td>noise ← Sample(N(μ,σ²)) if Sample(Unif(O,1))<p then</td></tr><tr><td>e' ←e+ filterhighpass(noise)</td></tr><tr><td>end if</td></tr><tr><td>end for</td></tr><tr><td>return x</td></tr></table>
|
| 88 |
+
|
| 89 |
+
The mutation step is arguably the most crucial component of the genetic algorithm and is our only source of noise in the algorithm. In the mutation step, with some probability, we randomly add noise to our sample. Random mutations are critical because it may cause a trait to appear that is beneficial for the population, which can then be proliferated through crossover. Without mutation, very similar samples will start to appear across generations; thus, the way out of this local maximum is to nudge it in a different direction in order to reach higher scores.
|
| 90 |
+
|
| 91 |
+
Furthermore, since this noise is perceived as background noise, we apply a filter to the noise before adding it onto the audio sample. The audio is sampled at a rate of $f _ { s } = 1 6 k H z$ , which means that the maximum frequency response $f _ { m a x } = 8 k H z$ . As seen by Reichenbach & Hudspeth (2012), given that the human ear is more sensitive to lower frequencies than higher ones, we apply a highpass filter at a cutoff frequency of $f _ { c u t o f f } = 7 k H z$ . This limits the noise to only being in the high-frequency range, which is less audible and thus less detectable by the human ear.
|
| 92 |
+
|
| 93 |
+
While mutation helps the algorithm overcome local maxima, the effect of mutation is limited by the mutation probability. Much like the step size in SGD, a low mutation probability may not provide enough randomness to get past a local maximum. If mutations are rare, they are very unlikely to occur in sequence and add on to each other. Therefore, while a mutation might be beneficial when accumulated with other mutations, due to the low mutation probability, it is deemed as not beneficial by the algorithm in the short term, and will disappear within a few iterations. This parallels the step size in SGD, because a small step size will eventually converge back at the local minimum/maximum. However, too large of a mutation probability, or step size, will add an excess of variability and prevent the algorithm from finding the global maximum/minimum. To combat these issues, we propose Momentum Mutation, which is inspired by the Momentum Update for Gradient Descent. With this update, our mutation probability changes in each iteration according to the following exponentially weighted moving average update:
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
p _ { n e w } = \alpha \times p _ { o l d } + \frac { \beta } { | c u r r S c o r e - p r e v S c o r e | }
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
With this update equation, the probability of a mutation increases as our population fails to adapt meaning the current score is close to the previous score. The momentum update adds acceleration to the mutation probability, allowing mutations to accumulate and add onto each other by keeping the mutation probability high when the algorithm is stuck at a local maximum. By using a moving average, the mutation probability becomes a smooth function and is less susceptible to outliers in the population. While the momentum update may overshoot the target phrase by adding random noise, overall it converges faster than a constant mutation probability by allowing for more acceleration in the right directions.
|
| 100 |
+
|
| 101 |
+
# Algorithm 3 Momentum Mutation Update
|
| 102 |
+
|
| 103 |
+
<table><tr><td>Input: Mutation Probability p Scores for the new population new Scores Scores for the previous population scores Output: Updated mutation probability pnew currScore = max(newScores)</td></tr><tr><td>prevScore = max(scores) β</td></tr><tr><td>Pnew =αX Pold + lcurrScore-prevScorel return pnew</td></tr></table>
|
| 104 |
+
|
| 105 |
+
# 2.3 GRADIENT ESTIMATION
|
| 106 |
+
|
| 107 |
+
Genetic algorithms work well when the target space is large and a relatively large number of mutation directions are potentially beneficial; the strength of these algorithms lies in being able to search large amounts of space efficiently Godefroi & Khurshid (unkown). When an adversarial sample nears its target perturbation, this strength of genetic algorithms turn into a weakness, however. Close to the end, adversarial audio samples only need a few perturbations in a few key areas to get the correct decoding. In this case, gradient estimation techniques tend to be more effective. Specifically, when edit distance of the current decoding and the target decoding drops below some threshold, we switch to phase 2. When approximating the gradient of a black box system, we can use the technique proposed by Nitin Bhagoji et al. (2017):
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
F D _ { x } ( x , \delta ) = \binom { \lceil { ( g ( x + \delta _ { 1 } ) - g ( x ) ) } / \delta } { \vdots }
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Here, $x$ refers to the vector of inputs representing the audio file. $\delta _ { i }$ refers to a vector of all zeros, except at the $i ^ { t h }$ position in which the value is a small $\delta$ . $g ( \cdot )$ represents the evaluation function, which in our case is CTCLoss. Essentially, we are performing a small perturbation at each index and individually seeing what the difference in CTCLoss would be, allowing us to compute a gradient estimate with respect to the input $x$ .
|
| 114 |
+
|
| 115 |
+
However, performing this calculation in full would be prohibitively expensive, as the audio is sampled at $1 6 k H z$ and so a simple 5-second clip would require 80,000 queries to the model for just one gradient evaluation! Thus, we only randomly sample 100 indices to perturb each generation when using this method. When the adversarial example is already near the goal, gradient estimation makes the tradeoff for more informed perturbations in exchange for higher compute.
|
| 116 |
+
|
| 117 |
+
# 3 EVALUATION
|
| 118 |
+
|
| 119 |
+
# 3.1 METRICS
|
| 120 |
+
|
| 121 |
+
We tested our algorithm by running it on a 100 sample subset of the Common Voice dataset. For each audio sample, we generated a single random target phrase by selecting two words uniformly without replacement from the set of 1000 most common words in the English language. The algorithm was then run for each audio sample and target phrase pair for 3000 generations to produce a single adversarial audio sample.
|
| 122 |
+
|
| 123 |
+
We evaluated the performance of our algorithm in two primary ways. The first method is determining the accuracy with which the adversarial audio sample gets decoded to the desired target phrase. For this, we use the Levenshtein distance, or the minimum character edit distance, between the desired target phrase and the decoded phrase as the metric of choice. We then calculated the percent similarity between the desired target and the decoded phrase by calculating the ratio of the Levenshtein distance and the character length of the original input, ie. $\begin{array} { r } { \dot { 1 } - \frac { L e v e n s { \bar { h } } t e i n ( M ( x ^ { \prime } ) , t ) } { l e n ( M ( x ) ) } } \end{array}$ . The second method is determining the similarity between the original audio sample and the adversarial audio sample. For this, we use the accepted metric of the cross correlation coefficient between the two audio samples.
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 5: Histogram of levenshtein distances of attacks.
|
| 127 |
+
|
| 128 |
+
# 3.2 RESULTS
|
| 129 |
+
|
| 130 |
+
Of the audio samples for which we ran our algorithm on, we achieved a $8 9 . 2 5 \%$ similarity between the final decoded phrase and the target using Levenshtein distance, with an average of $9 4 . 6 \%$ correlation similarity between the final adversarial sample and the original sample. The average final Levenshtein distance after 3000 iterations is 2.3, with $3 5 \%$ of the adversarial samples achieving an exact decoding in less than 3000 generations, and $22 \%$ of the adversarial samples achieving an exact decoding in less than 1000 generations.
|
| 131 |
+
|
| 132 |
+
One thing to note is that our algorithm was $3 5 \%$ successful in getting the decoded phrase to match the target exactly; however, noting from figure 5, the vast majority of failure cases are only a few edit distances away from the target. This suggests that running the algorithm for a few more iterations could produce a higher success rate, although at the cost of correlation similarity. Indeed, it becomes apparent that there is a tradeoff between success rate and audio similarity such that this threshold could be altered for the attacker’s needs.
|
| 133 |
+
|
| 134 |
+
A comparison of white box targeted attacks, black box targeted attacks on single words (classification), and our method:
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Metric</td><td>WhiteBoxAttacks</td><td>Our Method</td><td>Single Word Black Box</td></tr><tr><td>Targeted attack success rate Average similarity score Similarity score method Loss used for attack Dataset tested on</td><td>100% 99.9% cross-correlation CTC</td><td>35% 94.6% cross-correlation CTC</td><td>87% 89% human study Softmax</td></tr></table>
|
| 137 |
+
|
| 138 |
+
One helpful visualization of the similarity between the original audio sample and the adversarial audio sample through the overlapping of both waveforms, as shown in figure 4. As the visualization shows, the audio is largely unchanged, and the majority of the changes to the audio is in the relatively low volume noise applied uniformly around the audio sample. This results in an audio sample that still appears to transcribe to the original intended phrase when heard by humans, but is decoded as the target adversarial phrase by the DeepSpeech model.
|
| 139 |
+
|
| 140 |
+
That $3 5 \%$ of random attacks were successful in this respect highlights the fact that black box adversarial attacks are definitely possible and highly effective at the same time.
|
| 141 |
+
|
| 142 |
+
# 4 CONCLUSION
|
| 143 |
+
|
| 144 |
+
In combining genetic algorithms and gradient estimation we are able to achieve a black box adversarial example for audio that produces better samples than each algorithm would produce individually. By initially using a genetic algorithm as a means of exploring more space through encouragement of random mutations and ending with a more guided search with gradient estimation, we are not only able to achieve perfect or near-perfect target transcriptions on most of the audio samples, we were able to do so while retaining a high degree of similarity. While this remains largely as a proof-of-concept demonstration, this paper shows that targeted adversarial attacks are achievable on black box models using straightforward methods.
|
| 145 |
+
|
| 146 |
+
Furthermore, the inclusion of momentum mutation and adding noise exclusively to high frequencies improved the effectiveness of our approach. Momentum mutation exaggerated the exploration at the beginning of the algorithm and annealed it at the end, emphasizing the benefits intended by combining genetic algorithms and gradient estimation. Restricting noise to the high frequency domain improved upon our similarity both subjectively by keeping it from interfering with human voice as well as objectively in our audio sample correlations. By combining all of these methods, we are able to achieve our top results.
|
| 147 |
+
|
| 148 |
+
In conclusion, we introduce a new domain for black box attacks, specifically on deep, nonlinear ASR systems that can output arbitrary length translations. Using a combination of existing and novel methods, we are able to exhibit the feasibility of our approach and open new doors for future research.
|
| 149 |
+
|
| 150 |
+
# REFERENCES
|
| 151 |
+
|
| 152 |
+
M. Alzantot, B. Balaji, and M. Srivastava. Did you hear that? Adversarial Examples Against Automatic Speech Recognition. ArXiv e-prints, January 2018.
|
| 153 |
+
N. Carlini and D. Wagner. Towards Evaluating the Robustness of Neural Networks. ArXiv e-prints, August 2016.
|
| 154 |
+
N. Carlini and D. Wagner. Audio Adversarial Examples: Targeted Attacks on Speech-to-Text. ArXiv e-prints, January 2018.
|
| 155 |
+
C.-C. Chiu, T. N. Sainath, Y. Wu, R. Prabhavalkar, P. Nguyen, Z. Chen, A. Kannan, R. J. Weiss, K. Rao, E. Gonina, N. Jaitly, B. Li, J. Chorowski, and M. Bacchiani. State-of-the-art Speech Recognition With Sequence-to-Sequence Models. ArXiv e-prints, December 2017.
|
| 156 |
+
|
| 157 |
+
M. Cisse, Y. Adi, N. Neverova, and J. Keshet. Houdini: Fooling Deep Structured Prediction Models. ArXiv e-prints, July 2017.
|
| 158 |
+
|
| 159 |
+
Patrice Godefroi and Sarfraz Khurshid. Exploring Very Large State Spaces Using Genetic Algorithm. MIT, unkown.
|
| 160 |
+
|
| 161 |
+
I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and Harnessing Adversarial Examples. ArXiv e-prints, December 2014.
|
| 162 |
+
|
| 163 |
+
A. Hannun, C. Case, J. Casper, B. Catanzaro, G. Diamos, E. Elsen, R. Prenger, S. Satheesh, S. Sengupta, A. Coates, and A. Y. Ng. Deep Speech: Scaling up end-to-end speech recognition. ArXiv e-prints, December 2014.
|
| 164 |
+
|
| 165 |
+
J. H. Holland. Genetic algorithms. Scientific american, 1992.
|
| 166 |
+
|
| 167 |
+
Y. Liu, X. Chen, C. Liu, and D. Song. Delving into Transferable Adversarial Examples and Black-box Attacks. ArXiv e-prints, November 2016.
|
| 168 |
+
|
| 169 |
+
S.-M. Moosavi-Dezfooli, A. Fawzi, and P. Frossard. DeepFool: a simple and accurate method to fool deep neural networks. ArXiv e-prints, November 2015.
|
| 170 |
+
|
| 171 |
+
A. Nitin Bhagoji, W. He, B. Li, and D. Song. Exploring the Space of Black-box Attacks on Deep Neural Networks. ArXiv e-prints, December 2017.
|
| 172 |
+
|
| 173 |
+
Nicolas Papernot, Patrick D. McDaniel, Ian J. Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. CoRR, abs/1602.02697, 2016. URL http://arxiv.org/abs/1602.02697.
|
| 174 |
+
|
| 175 |
+
T. Reichenbach and A. J. Hudspeth. Discrimination of Low-Frequency Tones Employs Temporal Fine Structure. PLoS ONE, 7:e45579, September 2012. doi: 10.1371/journal.pone.0045579.
|
md/train/Hye-LiR5Y7/Hye-LiR5Y7.md
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SOSELETO: A UNIFIED APPROACH TO TRANSFER LEARNING AND TRAINING WITH NOISY LABELS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present SOSELETO (SOurce SELEction for Target Optimization), a new method for exploiting a source dataset to solve a classification problem on a target dataset. SOSELETO is based on the following simple intuition: some source examples are more informative than others for the target problem. To capture this intuition, source samples are each given weights; these weights are solved for jointly with the source and target classification problems via a bilevel optimization scheme. The target therefore gets to choose the source samples which are most informative for its own classification task. Furthermore, the bilevel nature of the optimization acts as a kind of regularization on the target, mitigating overfitting. SOSELETO may be applied to both classic transfer learning, as well as the problem of training on datasets with noisy labels; we show state of the art results on both of these problems.
|
| 8 |
+
|
| 9 |
+

|
| 10 |
+
Figure 1: SOSELETO applied to a synthetic noisy labels problem. (a) A binary classification problem with points split by the y-axis. Input labels are marked as diamonds and triangles. $2 0 \%$ of the input labels are noisy (have the wrong label). SOSELETO assigns a weight per instance. (b) All correctly labeled input points are assigned high weights. (c) Most noisy points are assigned a low weight. (d) Mean weight of clean and noisy instances throughout training. (e) High accuracy and high recall are achieved for a broad range of weight thresholds.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Deep learning has made possible many remarkable successes, leading to state of the art algorithms in computer vision, speech and audio, and natural language processing. A key ingredient in this success has been the availability of large datasets. While such datasets are common in certain settings, in other scenarios this is not true. Examples of the latter include “specialist” scenarios, for instance a dataset which is entirely composed of different species of tree; and medical imaging, in which datasets on the order of hundreds to a thousand are common.
|
| 15 |
+
|
| 16 |
+
A natural question is then how one may apply the techniques of deep learning within these relatively data-poor regimes. A standard approach involves the concept of transfer learning: one uses knowledge gleaned from the source (data-rich regime), and transfers it over to the target (data-poor regime). One of the most common versions of this approach involves a two-stage technique. In the first stage, a network is trained on the source classification task; in the second stage, this network is adapted to the target classification task. There are two variants for this second stage. In feature extraction (e.g. Donahue et al. (2014)), only the parameters of the last layer (i.e. the classifier) are allowed to adapt to the target classification task; whereas in fine-tuning (e.g. Girshick et al. (2014)), the parameters of all of the network layers (i.e. both the features/representation and the classifier) are allowed to adapt. The idea is that by pre-training the network on the source data, a useful feature representation may be learned, which may then be recycled – either partially or completely – for the target regime. This two-stage approach has been quite popular, and works reasonably well on a variety of applications.
|
| 17 |
+
|
| 18 |
+
Despite this success, we claim that the two-stage approach misses an essential insight: some source examples are more informative than others for the target classification problem. For example, if the source is a large set of natural images and the target consists exclusively of cars, then we might expect that source images of cars, trucks, and motorcycles might be more relevant for the target task than, say, spoons. However, this example is merely illustrative; in practice, the source and target datasets may have no overlapping classes at all. As a result, we don’t know a priori which source examples will be important. Thus, we propose to learn this source filtering as part of an end-to-end training process.
|
| 19 |
+
|
| 20 |
+
The resulting algorithm is SOSELETO: SOurce SELEction for Target Optimization. Each training sample in the source dataset is given a weight, corresponding to how important it is. The shared source/target representation is then optimized by means of a bilevel optimization. In the interior level, the source minimizes its classification loss with respect to the representation parameters, for fixed values of the sample weights. In the exterior level, the target minimizes its classification loss with respect to both the source sample weights and its own classification layer. The sample weights implicitly control the representation through the interior level. The target therefore gets to choose the source samples which are most informative for its own classification task. Furthermore, the bilevel nature of the optimization acts as a kind of regularization on the target, mitigating overfitting, as the target does not directly control the representation parameters. Finally, note that the entire process – training of the shared representation, target classifier, and source weights – happens simultaneously.
|
| 21 |
+
|
| 22 |
+
We pause here to note that the general philosophy behind SOSELETO is related to the literature on instance reweighting for domain adaptation, see for example Sugiyama et al. (2008); Yan et al. (2017). However, there is a crucial difference between SOSELETO and this literature, which is related to the difference between domain adaptation and more general transfer learning. Domain adaptation is concerned with the situation in which there is either full overlap between the source and target label sets; or in some more recent work Zhang et al. (2018), partial but significant overlap. Transfer learning, by contrast, refers to the more general situation in which there may be zero overlap between label sets, or possibly very minimal overlap. (For example, if the source consists of natural images and the target of medical images.) The instance reweighting literature is concerned with domain adaptation; the techniques are therefore relevant to the case in which source and target have the same labels. SOSELETO is quite different: it makes no such assumptions, and is therefore a more general approach which can be applied to both “pure” transfer learning, in which there is no overlap between source and target label sets, as well as domain adaptation. (Note also a further distinction with domain adaptation: the target is often – though not always – taken to be unlabelled in domain adaptation. This is not the case for our setting of transfer learning.)
|
| 23 |
+
|
| 24 |
+
Above, we have illustrated how SOSELETO may be applied to the problem of transfer learning. However, the same algorithm can be applied to the problem of training with noisy labels. Concretely, we assume that there is a large noisy dataset, as well as a much smaller clean dataset; the latter can be constructed cheaply through careful hand-labelling, given its small size. Then if we take the source to be the large noisy dataset, and the target to the small clean dataset, SOSELETO can be applied to the problem. The algorithm will assign high weights to samples with correct labels and low weights to those with incorrect labels, thereby implicitly denoising the source, and allowing for an accurate classifier to be trained.
|
| 25 |
+
|
| 26 |
+
The remainder of the paper is organized as follows. Section 2 presents related work. Section 3 presents the SOSELETO algorithm, deriving descent equations as well as convergence properties of the bilevel optimization. Section 4 presents results of experiments on both transfer learning as well as training with noisy labels. Section 5 concludes.
|
| 27 |
+
|
| 28 |
+
# 2 RELATED WORK
|
| 29 |
+
|
| 30 |
+
Transfer learning As described in Section 1, the most common techniques for transfer learning are feature extraction and fine-tuning, see for example Donahue et al. (2014) and Girshick et al. (2014), respectively. An older survey of transfer learning techniques may be found in Pan & Yang (2010). Domain adaptation Saenko et al. (2010) is concerned with transferring knowledge when the source and target classes are the same. Earlier techniques aligned the source and target via matching of feature space statistics Tzeng et al. (2014); Long et al. (2015); subsequent work used adversarial methods to improve the domain adaptation performance Ganin & Lempitsky (2015); Tzeng et al. (2015; 2017); Hoffman et al. (2017).
|
| 31 |
+
|
| 32 |
+
In this paper, we are more interested in transfer learning where the source and target classes are different. A series of recent papers Long et al. (2017); Pei et al. (2018); Cao et al. (2018a;b) address domain adaptation that is closer to our setting. In particular, Cao et al. (2018b) examines “partial transfer learning”, the case in which there is partial overlap between source and target classes (particularly when the target classes are a subset of the source). This setting is also dealt with in Busto & Gall (2017).
|
| 33 |
+
|
| 34 |
+
Ge & Yu (2017) examine the scenario where the source and target classes are completely different. Similar to SOSELETO, they propose selecting a portion of the source dataset. However, the selection is not performed in an end-to-end fashion, as in SOSELETO; rather, selection is performed prior to training, by finding source examples which are similar to the target dataset, where similarity is measured by using filter bank descriptors.
|
| 35 |
+
|
| 36 |
+
Another recent work of interest is Luo et al. (2017), which focuses on a slightly different scenario: the target consists of a very small number of labelled examples (i.e. the few-shot regime), but a very large number of unlabelled examples. Training is achieved via an adversarial loss to align the source and the target representations, and a special entropy-based loss for the unlabelled part of the data.
|
| 37 |
+
|
| 38 |
+
Instance reweighting for domain adaptation is a well studied technique, demonstrated e.g. in Covariate Shift methods Shimodaira (2000); Sugiyama et al. (2007; 2008). In these works, the source and target label spaces are the same. We, however, allow for different – even entirely nonoverlapping – classes in the source and target. Crucially, we do not make assumptions on the similarity of the distributions nor do we explicitly optimize for it. The same distinction applies for the recent work of Yan et al. (2017), and for the partial overlap assumption of Zhang et al. (2018). In addition, these two works propose an unsupervised approach, whereas our proposed method is completely supervised. Covariate shift determines the weighting for an instance as the ratio of its probability of being in the training set and being in the prediction set. Consequently, the feature vectors are used in re-weighting, regardless of their labels. This renders covariate shift unsuitable for handling noisy labels. Our re-weighing scheme is instead gradient-based and as we show next performs well in this task.
|
| 39 |
+
|
| 40 |
+
Learning with noisy labels Classification with noisy labels is a longstanding problem in the machine learning literature, see the review paper Frenay & Verleysen (2014) and the references therein. ´ Within the realm of deep learning, it has been observed that with sufficiently large data, learning with label noise – without modification to the learning algorithms – actually leads to reasonably high accuracy Krause et al. (2016); Sun et al. (2017).
|
| 41 |
+
|
| 42 |
+
The setting that is of greatest interest to us is when the large noisy dataset is accompanied by a small clean dataset. Sukhbaatar et al. (2014) introduce an additional noise layer into the CNN which attempts to adapt the output to align with the noisy label distribution; the parameters of this layer are also learned. Xiao et al. (2015) use a more general noise model, in which the clean label, noisy label, noise type, and image are jointly specified by a probabilistic graphical model. Both the clean label and the type of noise must be inferred given the image, in this case by two separate CNNs. Li et al. (2017) consider the same setting, but with additional information in the form of a knowledge graph on labels.
|
| 43 |
+
|
| 44 |
+
Other recent work on label noise includes Rolnick et al. (2017), which shows that adding many copies of an image with noisy labels to a clean dataset barely dents performance; Malach & ShalevShwartz (2017), in which two separate networks are simultaneously trained, and a sample only contributes to the gradient descent step if there is disagreement between the networks (if there is agreement, that probably means the label is wrong); and Drory et al. (2018), which analyzes theoretically the situations in which CNNs are more and less resistant to noise. A pair of papers Liu & Tao (2016); Yu et al. (2017) combine ideas of learning with label noise with instance reweighting.
|
| 45 |
+
|
| 46 |
+
Bilevel optimization Bilevel optimization problems have a nested structure: the interior level (sometimes called the lower level) is a standard optimization problem; and the exterior level (sometimes called the upper level) is an optimization problem where the objective is a function of the optimal arguments from the interior level. A branch of mathematical programming, bilevel optimization has been extensively studied within this community Colson et al. (2007); Bard (2013). For recent developments, readers are referred to the review paper Sinha et al. (2018). Bilevel optimization has been used in both machine learning, e.g. Bennett et al. (2006; 2008) and computer vision, e.g. Ochs et al. (2015).
|
| 47 |
+
|
| 48 |
+
# 3 SOSELETO: SOURCE SELECTION FOR TARGET OPTIMIZATION
|
| 49 |
+
|
| 50 |
+
We have two datasets. The source set is the data-rich set, on which we can learn extensively. It is denoted by $\{ ( x _ { i } ^ { s } , y _ { i } ^ { s } ) \} _ { i = 1 } ^ { n ^ { s } }$ , where as usual $\boldsymbol { x } _ { i } ^ { s }$ is the $i ^ { t h }$ source training image, and $y _ { i } ^ { s }$ is its corresponding label. The second dataset is the target set, which is data-poor; but it is this set which ultimately interests us. That is, the goal in the end is to learn a classifier on the target set, and the source set is only useful insofar as it helps in achieving this goal. The target set is denoted $\{ ( x _ { i } ^ { t } , y _ { i } ^ { t } ) \} _ { i = 1 } ^ { n ^ { t } }$ , and it is assumed that is much smaller than the source set, i.e. $n ^ { t } \ll n ^ { s }$ .
|
| 51 |
+
|
| 52 |
+
Our goal is to exploit the source set to solve the target classification problem. The key insight is that not all source examples contribute equally useful information in regards to the target problem. For example, suppose that the source set consists of a broad collection of natural images; whereas the target set consists exclusively of various breeds of dog. We would assume that any images of dogs in the source set would help in the target classification task; images of wolves might also help, as might cats. Further afield it might be possible that objects with similar textures as dog fur might be useful, such as rugs. On the flip side, it is probably less likely that images of airplanes and beaches will be relevant (though not impossible). However, the idea is not to come with any preconceived notions (semantic or otherwise) as to which source images will help; rather, the goal is to let the algorithm choose the relevant source images, in an end-to-end fashion.
|
| 53 |
+
|
| 54 |
+
We assume that the source and target classifier networks have the same architecture, but different network parameters. In particular, the architecture is given by
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
F ( x ; \theta , \phi )
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\phi$ is last layer, or possibly last few layers, and $\theta$ constitutes all of the remaining layers. We will refer to $\phi$ colloquially as the “classifier”, and to $\theta$ as the “features” or “representation”. (This is consistent with the usage in related papers, see for example Tzeng et al. (2017).) Now, the source and target will share features, but not classifiers; that is, the source network will be given by $F ( x ; \theta , \phi ^ { s } )$ , whereas the target network will be $F ( x ; \theta , \phi ^ { t } )$ . The features $\theta$ are shared between the two, and this is what allows for transfer learning.
|
| 61 |
+
|
| 62 |
+
The weighted source loss is given by
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
L _ { s } ( \theta , \phi ^ { s } , \alpha ) = \frac { 1 } { n ^ { s } } \sum _ { j = 1 } ^ { n ^ { s } } \alpha _ { j } \ell ( y _ { j } ^ { s } , F ( x _ { j } ^ { s } ; \theta , \phi ^ { s } ) )
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $\alpha _ { j } \in [ 0 , 1 ]$ is a weight assigned to each source training example; and $\ell ( \cdot , \cdot )$ is a per example classification loss, in this case cross-entropy. The use of the weights $\alpha _ { j }$ will allow us to decide which source images are most relevant for the target classification task.
|
| 69 |
+
|
| 70 |
+
The target loss is standard:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
L _ { t } ( \theta , \phi ^ { t } ) = \frac { 1 } { n ^ { t } } \sum _ { i = 1 } ^ { n ^ { t } } \ell ( y _ { i } ^ { t } , F ( x _ { i } ^ { t } ; \theta , \phi ^ { t } ) )
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
As noted in Section 1, this formulation allows us to address both the transfer learning problem as well as learning with label noise. In the former case, the source and target may have non-overlapping label spaces; high weights will indicate which source examples have relevant knowledge for the target classification task. In the latter case, the source is the noisy dataset, the target is the clean dataset, and they share a classifier (i.e. $\phi ^ { t } = \phi ^ { s \cdot }$ ) as well as a label space; high weights will indicate which source examples do not have label noise, and are therefore reliable. In either case, the target is much smaller than the source.
|
| 77 |
+
|
| 78 |
+
The question now becomes: how can we combine the source and target losses into a single optimization problem? A simple idea is to create a weighted sum of source and target losses. Unfortunately, issues are likely to arise regardless of the weight chosen. If the target is weighted equally to the source, then overfitting may likely result given the small size of the target. On the other hand, if the weights are proportional to the size of the two sets, then the source will simply drown out the target.
|
| 79 |
+
|
| 80 |
+
A more promising idea is to use bilevel optimization. Specifically, in the interior level we find the optimal features and source classifier as a function of the weights $\alpha$ , by minimizing the source loss:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\theta ^ { * } ( \alpha ) , \phi ^ { s * } ( \alpha ) = \operatorname* { m i n } _ { \theta , \phi ^ { s } } L _ { s } ( \theta , \phi ^ { s } , \alpha )
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
In the exterior level, we minimize the target loss, but only through access to the source weights; that is, we solve:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\operatorname* { m i n } _ { \alpha , \phi ^ { t } } L _ { t } ( \theta ^ { * } ( \alpha ) , \phi ^ { t } )
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Why might we expect this bilevel formulation to succeed? The key is that the target only has access to the features in an indirect manner, by controlling which source examples are included in the source classification problem. Thus, the target can influence the features chosen, but only in this roundabout way. This serves as an extra form of regularization, mitigating overfitting, which is the main threat when dealing with a small set such as the target.
|
| 93 |
+
|
| 94 |
+
Implementing the bilevel optimization is rendered somewhat challenging due to the need to solve the optimization problem in the interior level (1). Note that this optimization problem must be solved at every point in time; thus, if we choose to solve the optimization (2) for the exterior level via gradient descent, we will need to solve the interior level optimization (1) at each iteration of the gradient descent. This is clearly inefficient. Furthermore, it is counter to the standard deep learning practice of taking small steps which improve the loss. Thus, we instead propose the following procedure.
|
| 95 |
+
|
| 96 |
+
At a given iteration, we will take a gradient descent step for the interior level problem (1):
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\begin{array} { c } { { \theta _ { m + 1 } = \theta _ { m } - \lambda _ { p } \frac { \partial L _ { s } } { \partial \theta } ( \theta _ { m } , \phi _ { m } ^ { s } , \alpha _ { m } ) } } \\ { { = \theta _ { m } - \lambda _ { p } Q ( \theta _ { m } , \phi _ { m } ^ { s } ) \alpha _ { m } } } \end{array}
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where $m$ is the iteration number; $\lambda _ { p }$ is the learning rate (where the subscript $p$ stands for “parameters”, to distinguish it from a second learning rate for $\alpha$ , to appear shortly); and $Q ( \theta , \phi ^ { s } )$ is a matrix whose $j ^ { t h }$ column is given by
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
q _ { j } = \frac { 1 } { n ^ { s } } \frac { \partial } { \partial \theta } \ell ( y _ { j } ^ { s } , F ( x _ { j } ^ { s } ; \theta , \phi ^ { s } ) )
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
Thus, Equation (3) leads to an improvement in the features $\theta$ , for a fixed set of source weights $\alpha$ .
|
| 109 |
+
Note that there will be an identical descent equation for the classifier $\phi ^ { s }$ , which we omit for clarity.
|
| 110 |
+
|
| 111 |
+
Given this iterative version of the interior level of the bilevel optimization, we may now turn to the exterior level. Plugging Equation (3) into Equation (2) gives the following problem:
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\operatorname* { m i n } _ { \alpha , \phi ^ { t } } L _ { t } ( \theta _ { m } - \lambda _ { p } Q \alpha , \phi ^ { t } )
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
# Algorithm 1 SOSELETO: SOurce SELEction for Target Optimization
|
| 118 |
+
|
| 119 |
+
where we have suppressed $Q$ ’s arguments for readability. We can then take a gradient descent step of this equation, yielding:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { l } { \displaystyle \alpha _ { m + 1 } = \alpha _ { m } - \lambda _ { \alpha } \frac { \partial } { \partial \alpha } L _ { t } ( \theta _ { m } - \lambda _ { p } Q \alpha , \phi ^ { t } ) } \\ { \displaystyle = \alpha _ { m } + \lambda _ { \alpha } \lambda _ { p } Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } ( \theta _ { m } - Q \alpha _ { m } \lambda _ { p } ) } \\ { \displaystyle \approx \alpha _ { m } + \lambda _ { \alpha } \lambda _ { p } Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } ( \theta _ { m } ) } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where in the final line, we have made use of the fact that $\lambda _ { p }$ is small. Of course, there will also be a descent equation for the classifier $\phi ^ { t }$ . The resulting update scheme is quite intuitive: source example weights are update according to how well they align with the target aggregated gradient.
|
| 126 |
+
|
| 127 |
+
We have not yet dealt with the weight constraint. That is, we would like to explicitly require that each $\alpha _ { j } \in [ 0 , 1 ]$ . We may achieve this by requiring $\alpha _ { j } = \sigma ( \beta _ { j } )$ where the new variable $\beta _ { j } \in \mathbb { R }$ , and $\sigma : \mathbb { R } [ 0 , 1 ]$ is a sigmoid-type function. As shown in Appendix A, for a particular piecewise linear sigmoid function, replacing the Update Equation (4) with a corresponding update equation for $\beta$ is equivalent to modifying Equation (4) to read
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\alpha _ { m + 1 } = \mathbf { C L I P } _ { [ 0 , 1 ] } \left( \alpha _ { m } + \lambda _ { \alpha } \lambda _ { p } Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } ( \theta _ { m } ) \right)
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
where $\mathrm { C L I P _ { [ 0 , 1 ] } }$ clips the values below 0 to be $0$ ; and above 1 to be 1.
|
| 134 |
+
|
| 135 |
+
Thus, SOSELETO consists of alternating Equations (3) and (5), along with the descent equations for the source and target classifiers $\phi ^ { s }$ and $\phi ^ { t }$ . As usual, the whole operation is done on a mini-batch basis, rather than using the entire set; note that if processing is done in parallel, then source minibatches are taken to be non-overlapping, so as to avoid conflicts in the weight updates. SOSELETO is summarized in Algorithm 1. Note that the target derivatives $\partial L _ { t } / \partial \theta$ and $\partial \bar { L _ { t } } / \partial { \phi } ^ { t }$ are evaluated over a target mini-batch; we suppress this for clarity.
|
| 136 |
+
|
| 137 |
+
In terms of time-complexity, we note that each iteration requires both a source batch and a target batch; assuming identical batch sizes, this means that SOSELETO requires about twice the time as the ordinary source classification problem. Regarding space-complexity, in addition to the ordinary network parameters we need to store the source weights $\alpha$ . Thus, the additional relative spacecomplexity required is the ratio of the source dataset size to the number of network parameters. This is obviously problem and architecture dependent; a typical number might be given by taking the source dataset to be Imagenet ILSVRC-2012 (size 1.2M) and the architecture to be ResNeXt-101 Xie et al. (2017) (size 44.3M parameters), yielding a relative space increase of about $3 \%$ .
|
| 138 |
+
|
| 139 |
+
Convergence properties SOSELETO is only an approximation to the solution of a bilevel optimization problem. As a result, it is not entirely clear whether it will even converge. In Appendix B, we demonstrate a set of sufficient conditions for SOSELETO to converge to a local minimum of the target loss $L _ { t }$ .
|
| 140 |
+
|
| 141 |
+
# 4 RESULTS
|
| 142 |
+
|
| 143 |
+
We briefly discuss some implementation details. In all experiments, we use the SGD optimizer without learning rate decay, and we use $\lambda _ { \alpha } = 1$ . We initialize the $\alpha$ -values to be 1, and in practice clip them to be in the slightly expanded range [0, 1.1]; this allows more relevant source points some room to grow. Other settings are experiment specific, and are discussed in the relevant sections.
|
| 144 |
+
|
| 145 |
+
# 4.1 NOISY LABELS: SYNTHETIC EXPERIMENT
|
| 146 |
+
|
| 147 |
+
To illustrate how SOSELETO works on the problem of learning with noisy labels, we begin with a synthetic experiment, see Figure 1. The setting is straightforward: the source dataset consists of 500 points which lie in $\mathbb { R } ^ { 2 }$ . There are two labels / classes, and the ideal separator between the classes is the $y$ -axis. However, of the 500 points, 100 are corrupted: that is, they lie on the wrong side of the separator. This is shown in Figure 1(a), in which one class is shown as white triangles and the second as black pluses. The target dataset is a set of 50 points, which are “clean”, in the sense that they lie on the correct sides of the separator. (For the sake of simplicity, the target set is not illustrated.)
|
| 148 |
+
|
| 149 |
+
SOSELETO is run for 100 epochs. In Figures 1(b) and 1(c), we choose a threshold of 0.1 on the weights $\alpha$ , and colour the points accordingly. In particular, in Figure 1(b) the clean (i.e. correctly labelled) instances which are above the threshold are labelled in green, while those below the threshold are labelled in red; as can be seen, all of the clean points lie above the threshold for this choice of threshold, meaning that SOSELETO has correctly identified all of the clean points. In Figure 1(c), the noisy (i.e. incorrectly labelled) instances which are below the threshold are labelled in green; and those above the threshold are labelled in red. In this case, SOSELETO correctly identifies most of these noisy labels by assigning them small weights (below 0.1); in fact, 92 out of 100 points are assigned such small weights. The remaining 8 points, those shown in red, are all near the separator, and it is therefore not very surprising that SOSELETO mislabels them. All told, using this particular threshold the algorithm correctly accounts for 492 out of 500 points, i.e. $9 8 . 4 \%$ .
|
| 150 |
+
|
| 151 |
+
Further analysis appears in Figures 1(d) and 1(e). In Figure 1(e), a plot is shown of mean weight vs. training epoch for clean instances and noisy instances; the width of each plot is the $9 5 \%$ confidence interval of the weights of that type. All weights are initialized at 0.5; after 100 epochs, the clean instances have a mean weight of about 0.8, whereas the noisy instances have a mean weight of about 0.05. The evolution is exactly as one would expect. Figure 1(e) examines the role of the threshold, chose as 0.1 in the above discussion; although 0.1 is a good choice in this case, the good behaviour is fairly robust to choices in the range of 0.1 to 0.4.
|
| 152 |
+
|
| 153 |
+
# 4.2 NOISY LABELS: CIFAR-10
|
| 154 |
+
|
| 155 |
+
We now turn to a real-world setting of the problem of learning with label noise. We use a noisy version of CIFAR-10 Krizhevsky & Hinton (2009), following the settings used in Sukhbaatar et al. (2014); Xiao et al. (2015). In particular, an overall noise level is selected. Based on this, a label confusion matrix is chosen such that the diagonal entries of the matrix are equal to one minus the noise level, and the off-diagonals are chosen randomly (while maintaining the matrix’s stochasticity). Noisy labels are then sampled according to this confusion matrix. We run experiments for various overall noise levels.
|
| 156 |
+
|
| 157 |
+
The target consists of a small clean dataset. CIFAR-10’s train set consists of 50K images; of this 50K, both Sukhbaatar et al. (2014); Xiao et al. (2015) set aside 10K clean examples for pre-training, a necessary step in both of these algorithms. In contrast, we use a smaller clean dataset of half the size, i.e. 5K examples while the rest of the 45K samples are noisy. We compare our results to the two state of the art methods Sukhbaatar et al. (2014); Xiao et al. (2015), as they both address the same setting as we do – the large noisy dataset is accompanied by a small clean dataset, with no extra side-information available. In addition, we compare with the baseline of simply training on the noisy labels without modification. In all cases, Caffes CIFAR-10 Quick cif architecture has been used. For SOSELETO, we use the following settings: $\lambda _ { p } = 1 0 ^ { - 4 }$ , the target batch-size is 32, and the source batch-size is 256. We use a larger source batch-size to enable more $\alpha$ -values to be affected quickly.
|
| 158 |
+
|
| 159 |
+
Table 1: Noisy labels: CIFAR-10. Best results in bold.
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Noise Level</td><td>CIFAR-10 Quick</td><td>Sukhbaatar et al. (2014) 10K clean examples</td><td>Xiao et al. (2015) 10K clean examples</td><td>SOSELETO 5K clean examples</td></tr><tr><td>30%</td><td>65.57</td><td>69.73</td><td>69.81</td><td>72.41</td></tr><tr><td>40%</td><td>62.38</td><td>66.66</td><td>66.76</td><td>69.98</td></tr><tr><td>50%</td><td>57.36</td><td>63.39</td><td>63.00</td><td>66.33</td></tr></table>
|
| 162 |
+
|
| 163 |
+
Table 2: SVHN 0-4 → MNIST 5-9. Best results in bold.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Uses Unlabelled Data?</td><td>Method</td><td>nt =20</td><td>nt=25</td></tr><tr><td>No</td><td>Target only</td><td>80.1</td><td>84.0</td></tr><tr><td>No</td><td>Fine-tuning</td><td>80.2</td><td>83.0</td></tr><tr><td>No</td><td>SOSELETO</td><td>83.2</td><td>87.9</td></tr><tr><td>Yes</td><td>Vinyals et al. (2016)</td><td>56.6</td><td>51.3</td></tr><tr><td>Yes</td><td>Fine-tuned variant of Vinyals et al. (2016)</td><td>79.3</td><td>82.7</td></tr><tr><td>Yes</td><td>Luo et al. (2017)</td><td>80.4</td><td>83.1</td></tr><tr><td>Yes</td><td>Label-efficient version of Luo et al. (2017)</td><td>94.2</td><td>95.0</td></tr></table>
|
| 166 |
+
|
| 167 |
+
Results are shown in Table 1 for three different overall noise levels, $30 \%$ , $40 \%$ , and $50 \%$ . Performance is reported for CIFAR-10’s test set, which is of size 10K. (Note that the competitors’ performance numbers are taken from Xiao et al. (2015).) SOSELETO achieves state of the art on all three noise levels, with considerably better performance than both Sukhbaatar et al. (2014) and Xiao et al. (2015): between $2 . 6 \%$ to $3 . 2 \%$ absolute improvement. Furthermore, it does so in each case with only half of the clean samples used in Sukhbaatar et al. (2014); Xiao et al. (2015).
|
| 168 |
+
|
| 169 |
+
We perform further analysis by examining the $\alpha$ -values that SOSELETO chooses on convergence, see Figure 4.2. To visualize the results, we imagine thresholding the training samples in the source set on the basis of their $\alpha$ -values; we only keep those samples with $\alpha$ greater than a given threshold. By increasing the threshold, we both reduce the total number of samples available, as well as change the effective noise level, which is the fraction of remaining samples which have incorrect labels. We may therefore plot these two quantities against each other, as shown in Figure 4.2; we show three plots, one for each noise level. Looking at these plots, we see for example that for the $3 0 \%$ noise level, if we take the half of the training samples with the highest $\alpha$ -values, we are left with only about $4 \%$ which have incorrect labels. We can therefore see that SOSELETO has effectively filtered out the incorrect labels in this instance. For the $4 0 \%$ and $5 0 \%$ noise levels, the corresponding numbers are about $1 0 \%$ and $2 0 \%$ incorrect labels; while not as effective in the $3 0 \%$ noise level, SOSELETO is still operating as designed. Further evidence for this is provided by the large slopes of all three curves on the righthand side of the graph.
|
| 170 |
+
|
| 171 |
+

|
| 172 |
+
Figure 2: Noisy labels on CIFAR-10: Effect of $\alpha$ -values chosen by SOSELETO. Blue is $3 0 \%$ noise, green is $4 0 \%$ noise, red is $5 0 \%$ noise. See accompanying explanation in the text.
|
| 173 |
+
|
| 174 |
+
# 4.3 TRANSFER LEARNING: SVHN 0-4 TO MNIST 5-9
|
| 175 |
+
|
| 176 |
+
We now examine the performance of SOSELETO on a transfer learning task. In order to provide a challenging setting, we choose to (a) use source and target sets with disjoint label sets, and (b) use a very small target set. In particular, the source dataset is chosen to the subset of Google Street View House Numbers (SVHN) Netzer et al. (2011) corresponding to digits 0-4. SVHN’s train set is of size 73,257 images, with about half of those belonging to the digits 0-4. The target dataset is a very small subset of MNIST LeCun et al. (1998) corresponding to digits 5-9. While MNIST’s train set is of size 60K, with 30K corresponding to digits 5-9, we use very small subsets: either 20 or 25 images, with equal numbers sampled from each class (4 and 5, respectively). Thus, as mentioned, there is no overlap between source and target classes, making it a true transfer learning (rather than domain adaptation) problem; and the small target set size adds further challenge. Furthermore, this task has already been examined in Luo et al. (2017).
|
| 177 |
+
|
| 178 |
+
We compare our results with the following techniques. Target only, which indicates training on just the target set; standard fine-tuning; Matching Nets Vinyals et al. (2016), a few-shot technique which is relevant given the small target size; fine-tuned Matching Nets, in which the previous result is then fine-tuned on the target set; and two variants of the Label Efficient Learning technique Luo et al. (2017) – one which includes fine-tuning plus a domain adversarial loss, and the other the full technique presented in Luo et al. (2017). Note that besides the target only and fine-tuning approaches, all other approaches depend on unlabelled target data. Specifically, they use all of the remaining MNIST 5-9 examples – about 30,000 – in order to aid in transfer learning. SOSELETO, by contrast, does not make use of any of this data.
|
| 179 |
+
|
| 180 |
+
For each of the above methods, the simple LeNet architecture LeCun et al. (1998) was used. For SOSELETO, we use the following settings: $\lambda _ { p } = 1 0 ^ { - 2 }$ , the source batch-size is 32, and the target batch-size is 10 (it is chosen to be small since the target itself is very small). Additionally, the SVHN images were resized to $2 8 \times 2 8$ , to match the MNIST size. The performance of the various methods is shown in Table 2, and is reported for MNIST’s test set which is of size 10K. We have divided Table 2 into two parts: those techniques which use the 30K examples of unlabelled data, and those which do not. SOSELETO has superior performance to all of the techniques which do not use unlabelled data. Furthermore, SOSELETO has superior performance to all of the techniques which do use unlabelled data, except the Label Efficient technique. It is noteworthy in particular that SOSELETO outperforms the few-shot techniques, despite not being designed to deal with such small amounts of data.
|
| 181 |
+
|
| 182 |
+
In Appendix C we further analyze which SVHN instances are considered more useful than others by SOSELETO, by transfering all of SVHN classes to MNSIT 5-9.
|
| 183 |
+
|
| 184 |
+
Two-stage SOSELETO Finally, we note that although SOSELETO is not designed to use unlabelled data, one may do so using the following two-stage procedure. Stage 1: run SOSELETO as described above. Stage 2: use the learned SOSELETO classifier to classify the unlabelled data. This will now constitute a dataset with noisy labels, and SOSELETO can now be run in the mode of training with label noise, where the noisily labelled unsupervised data is now the source, and the target remains the same small clean set. In the case of $n ^ { t } = 2 5$ , this procedure elevates the accuracy to above ${ \bf 9 2 \% }$ .
|
| 185 |
+
|
| 186 |
+
# 5 CONCLUSIONS
|
| 187 |
+
|
| 188 |
+
We have presented SOSELETO, a technique for exploiting a source dataset to learn a target classification task. This exploitation takes the form of joint training through bilevel optimization, in which the source loss is weighted by sample, and is optimized with respect to the network parameters; while the target loss is optimized with respect to these weights and its own classifier. We have derived an efficient algorithm for performing this bilevel optimization, through joint descent in the network parameters and the source weights, and have analyzed the algorithm’s convergence properties. We have empirically shown the effectiveness of the algorithm on both learning with label noise, as well as transfer learning problems. An interesting direction for future research involves incorporating an additional domain alignment term into SOSELETO, in the case where the source and target dataset have overlapping labels. We note that SOSELETO is architecture-agnostic, and thus may be easily deployed. Furthermore, although we have focused on classification tasks, the technique is general and may be applied to other learning tasks within computer vision; this is an important direction for future research.
|
| 189 |
+
|
| 190 |
+
REFERENCES
|
| 191 |
+
CIFAR-10 Quick network. https://github.com/BVLC/caffe/blob/master/ examples/cifar10/cifar10_quick_train_test.prototxt.
|
| 192 |
+
Jonathan F Bard. Practical bilevel optimization: algorithms and applications, volume 30. Springer Science & Business Media, 2013.
|
| 193 |
+
Kristin P Bennett, Jing Hu, Xiaoyun Ji, Gautam Kunapuli, and Jong-Shi Pang. Model selection via bilevel optimization. In Neural Networks, 2006. IJCNN’06. International Joint Conference on, pp. 1922–1929. IEEE, 2006.
|
| 194 |
+
Kristin P Bennett, Gautam Kunapuli, Jing Hu, and Jong-Shi Pang. Bilevel optimization and machine learning. In IEEE World Congress on Computational Intelligence, pp. 25–47. Springer, 2008.
|
| 195 |
+
P Panareda Busto and Juergen Gall. Open set domain adaptation. In The IEEE International Conference on Computer Vision (ICCV), volume 1, pp. 3, 2017.
|
| 196 |
+
Yue Cao, Mingsheng Long, and Jianmin Wang. Unsupervised domain adaptation with distribution matching machines. In AAAI Conference on Artificial Intelligence, 2018a.
|
| 197 |
+
Zhangjie Cao, Mingsheng Long, Jianmin Wang, and Michael I Jordan. Partial transfer learning with selective adversarial networks. In Proc. IEEE Conference on Computer Vision and Pattern Recognition, 2018b.
|
| 198 |
+
Benoˆıt Colson, Patrice Marcotte, and Gilles Savard. An overview of bilevel optimization. Annals of operations research, 153(1):235–256, 2007.
|
| 199 |
+
Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pp. 647–655, 2014.
|
| 200 |
+
Amnon Drory, Shai Avidan, and Raja Giryes. On the resistance of neural nets to label noise. arXiv preprint arXiv:1803.11410, 2018.
|
| 201 |
+
Benoˆıt Frenay and Michel Verleysen. Classification in the presence of label noise: a survey. ´ IEEE transactions on neural networks and learning systems, 25(5):845–869, 2014.
|
| 202 |
+
Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In International Conference on Machine Learning, pp. 1180–1189, 2015.
|
| 203 |
+
Weifeng Ge and Yizhou Yu. Borrowing treasures from the wealthy: Deep transfer learning through selective joint fine-tuning. In Proc. IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, volume 6, 2017.
|
| 204 |
+
Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580–587, 2014.
|
| 205 |
+
Judy Hoffman, Eric Tzeng, Taesung Park, Jun-Yan Zhu, Phillip Isola, Kate Saenko, Alexei A Efros, and Trevor Darrell. Cycada: Cycle-consistent adversarial domain adaptation. arXiv preprint arXiv:1711.03213, 2017.
|
| 206 |
+
Jonathan Krause, Benjamin Sapp, Andrew Howard, Howard Zhou, Alexander Toshev, Tom Duerig, James Philbin, and Li Fei-Fei. The unreasonable effectiveness of noisy data for fine-grained recognition. In European Conference on Computer Vision, pp. 301–320. Springer, 2016.
|
| 207 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical Report, 2009.
|
| 208 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 209 |
+
|
| 210 |
+
Yuncheng Li, Jianchao Yang, Yale Song, Liangliang Cao, Jiebo Luo, and Li-Jia Li. Learning from noisy labels with distillation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1910–1918, 2017.
|
| 211 |
+
|
| 212 |
+
Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Transactions on pattern analysis and machine intelligence, 38(3):447–461, 2016.
|
| 213 |
+
|
| 214 |
+
Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. In Proceedings of the 32nd International Conference on International Conference on Machine Learning-Volume 37, pp. 97–105. JMLR. org, 2015.
|
| 215 |
+
|
| 216 |
+
Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In International Conference on Machine Learning, pp. 2208–2217, 2017.
|
| 217 |
+
|
| 218 |
+
Zelun Luo, Yuliang Zou, Judy Hoffman, and Li F Fei-Fei. Label efficient learning of transferable representations acrosss domains and tasks. In Advances in Neural Information Processing Systems, pp. 164–176, 2017.
|
| 219 |
+
|
| 220 |
+
Eran Malach and Shai Shalev-Shwartz. Decoupling” when to update” from” how to update”. In Advances in Neural Information Processing Systems, pp. 961–971, 2017.
|
| 221 |
+
|
| 222 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, 2011.
|
| 223 |
+
|
| 224 |
+
Peter Ochs, Rene Ranftl, Thomas Brox, and Thomas Pock. Bilevel optimization with nonsmooth´ lower level problems. In International Conference on Scale Space and Variational Methods in Computer Vision, pp. 654–665. Springer, 2015.
|
| 225 |
+
|
| 226 |
+
Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2010.
|
| 227 |
+
|
| 228 |
+
Zhongyi Pei, Zhangjie Cao, Mingsheng Long, and Jianmin Wang. Multi-adversarial domain adaptation. In AAAI Conference on Artificial Intelligence, 2018.
|
| 229 |
+
|
| 230 |
+
David Rolnick, Andreas Veit, Serge Belongie, and Nir Shavit. Deep learning is robust to massive label noise. arXiv preprint arXiv:1705.10694, 2017.
|
| 231 |
+
|
| 232 |
+
Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In European conference on computer vision, pp. 213–226. Springer, 2010.
|
| 233 |
+
|
| 234 |
+
Hidetoshi Shimodaira. Improving predictive inference under covariate shift by weighting the loglikelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000.
|
| 235 |
+
|
| 236 |
+
Ankur Sinha, Pekka Malo, and Kalyanmoy Deb. A review on bilevel optimization: from classical to evolutionary approaches and applications. IEEE Transactions on Evolutionary Computation, 22 (2):276–295, 2018.
|
| 237 |
+
|
| 238 |
+
Masashi Sugiyama, Matthias Krauledat, and Klaus-Robert MA˜ zller. Covariate shift adaptation by ˇ importance weighted cross validation. Journal of Machine Learning Research, 8(May):985–1005, 2007.
|
| 239 |
+
|
| 240 |
+
Masashi Sugiyama, Shinichi Nakajima, Hisashi Kashima, Paul V Buenau, and Motoaki Kawanabe. Direct importance estimation with model selection and its application to covariate shift adaptation. In Advances in neural information processing systems, pp. 1433–1440, 2008.
|
| 241 |
+
|
| 242 |
+
Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. arXiv preprint arXiv:1406.2080, 2014.
|
| 243 |
+
|
| 244 |
+
Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 843–852. IEEE, 2017.
|
| 245 |
+
|
| 246 |
+
Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
|
| 247 |
+
|
| 248 |
+
Eric Tzeng, Judy Hoffman, Trevor Darrell, and Kate Saenko. Simultaneous deep transfer across domains and tasks. In Computer Vision (ICCV), 2015 IEEE International Conference on, pp. 4068–4076. IEEE, 2015.
|
| 249 |
+
|
| 250 |
+
Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In Computer Vision and Pattern Recognition (CVPR), volume 1, 2017.
|
| 251 |
+
|
| 252 |
+
Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
|
| 253 |
+
|
| 254 |
+
Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2691–2699, 2015.
|
| 255 |
+
|
| 256 |
+
Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- ´ formations for deep neural networks. In Computer Vision and Pattern Recognition (CVPR), 2017 IEEE Conference on, pp. 5987–5995. IEEE, 2017.
|
| 257 |
+
|
| 258 |
+
Hongliang Yan, Yukang Ding, Peihua Li, Qilong Wang, Yong Xu, and Wangmeng Zuo. Mind the class weight bias: Weighted maximum mean discrepancy for unsupervised domain adaptation. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume 3, 2017.
|
| 259 |
+
|
| 260 |
+
Xiyu Yu, Tongliang Liu, Mingming Gong, Kun Zhang, and Dacheng Tao. Transfer learning with label noise. arXiv preprint arXiv:1707.09724, 2017.
|
| 261 |
+
|
| 262 |
+
Jing Zhang, Zewei Ding, Wanqing Li, and Philip Ogunbona. Importance weighted adversarial nets for partial domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8156–8164, 2018.
|
| 263 |
+
|
| 264 |
+
# APPENDIX A CONSTRAINING THE WEIGHTS
|
| 265 |
+
|
| 266 |
+
Recall that our goal is to explicitly require that $\alpha _ { j } \in [ 0 , 1 ]$ . We may achieve this by requiring
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\alpha _ { j } = \sigma ( \beta _ { j } ) = \left\{ { \begin{array} { l l } { 0 } & { { \mathrm { i f ~ } } \beta _ { j } < 0 } \\ { \beta _ { j } } & { { \mathrm { i f ~ } } 0 \leq \beta _ { j } \leq 1 } \\ { 1 } & { { \mathrm { i f ~ } } \beta _ { j } > 1 } \end{array} } \right.
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
where the new variable $\beta _ { j } \in \mathbb { R }$ , and $\sigma ( \cdot )$ is a kind of piecewise linear sigmoid function.
|
| 273 |
+
|
| 274 |
+
Now we will wish to replace the Update Equation (4), the update for $\alpha$ , with a corresponding update equation for $\beta$ . This is straightforward. Define the Jacobian $\partial \alpha / \partial \beta$ by
|
| 275 |
+
|
| 276 |
+
$$
|
| 277 |
+
\left( \frac { \partial \alpha } { \partial \beta } \right) _ { i j } = \frac { \partial \alpha _ { i } } { \partial \beta _ { j } }
|
| 278 |
+
$$
|
| 279 |
+
|
| 280 |
+
Then we modify Equation (4) to read
|
| 281 |
+
|
| 282 |
+
$$
|
| 283 |
+
\beta _ { m + 1 } = \beta _ { m } + \lambda _ { \alpha } \lambda _ { p } \left( \frac { \partial \boldsymbol { \alpha } } { \partial \beta } \right) ^ { T } Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } ( \theta _ { m } )
|
| 284 |
+
$$
|
| 285 |
+
|
| 286 |
+
The Jacobian is easy to compute analytically:
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
{ \frac { \partial \alpha } { \partial \beta } } = \mathrm { d i a g } ( \sigma ^ { \prime } ( \beta _ { j } ) ) , \quad { \mathrm { w h e r e } } \quad \sigma ^ { \prime } ( z ) = { \left\{ \begin{array} { l l } { 0 } & { { \mathrm { i f } } \ z < 0 } \\ { 1 } & { { \mathrm { i f } } \ 0 \leq z \leq 1 } \\ { 0 } & { { \mathrm { i f } } \ z > 1 } \end{array} \right. }
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
Due to this very simple form, it is easy to see that $\beta _ { m }$ will never lie outside of $[ 0 , 1 ]$ ; and thus that $\alpha _ { m } = \beta _ { m }$ for all time. Hence, we can simply replace this equation with
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\alpha _ { m + 1 } = \mathbf { C L I P } _ { [ 0 , 1 ] } \left( \alpha _ { m } + \lambda _ { \alpha } \lambda _ { p } Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } ( \theta _ { m } ) \right)
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
where $\mathrm { C L I P _ { [ 0 , 1 ] } }$ clips the values below 0 to be $0$ ; and above 1 to be 1.
|
| 299 |
+
|
| 300 |
+
# APPENDIX B PROOF OF CONVERGENCE
|
| 301 |
+
|
| 302 |
+
SOWETO is only an approximation to the solution of a bilevel optimization problem. As a result, it is not entirely clear whether it will even converge. In this section, we demonstrate a set of sufficient conditions for SOWETO to converge to a local minimum of the target loss $L _ { t }$ .
|
| 303 |
+
|
| 304 |
+
To this end, let us examine the change in the target loss from iteration $m$ to $m + 1$ :
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
\begin{array} { l } { \displaystyle \Delta L _ { t } = L _ { t } ( \theta _ { m + 1 } , \phi _ { m + 1 } ^ { t } ) - L _ { t } ( \theta _ { m } , \phi _ { m } ^ { t } ) } \\ { \displaystyle \quad = L _ { t } \left( \theta _ { m } - \lambda _ { p } Q \alpha _ { m } , \phi _ { m } ^ { t } - \lambda _ { p } \frac { \partial L _ { t } } { \partial \phi ^ { t } } \right) - L _ { t } ( \theta _ { m } , \phi _ { m } ^ { t } ) } \\ { \displaystyle \approx L _ { t } ( \theta _ { m } , \phi _ { m } ^ { t } ) - \lambda _ { p } \left( \frac { \partial L _ { t } } { \partial \theta } \right) ^ { T } Q \alpha _ { m } - \lambda _ { p } \left( \frac { \partial L _ { t } } { \partial \phi ^ { t } } \right) ^ { T } \frac { \partial L _ { t } } { \partial \phi ^ { t } } - L _ { t } ( \theta _ { m } , \phi _ { m } ^ { t } ) } \\ { \displaystyle \quad = - \lambda _ { p } \left( \frac { \partial L _ { t } } { \partial \theta } \right) ^ { T } Q \alpha _ { m } - \lambda _ { p } \left. \frac { \partial L _ { t } } { \partial \phi ^ { t } } \right. ^ { 2 } } \end{array}
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
Now, we can use the evolution of the weights $\alpha$ . Specifically, we substitute Equation (4) into the above, to get
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
\begin{array} { r } { \Delta L _ { t } \approx - \lambda _ { p } \left( \displaystyle \frac { \partial L _ { t } } { \partial \theta } \right) ^ { T } Q \left( \alpha _ { m - 1 } + \lambda _ { \alpha } \lambda _ { p } Q ^ { T } \displaystyle \frac { \partial L _ { t } } { \partial \theta } \right) - \lambda _ { p } \left\| \displaystyle \frac { \partial L _ { t } } { \partial \phi ^ { t } } \right\| ^ { 2 } } \\ { = - \lambda _ { p } \left( \displaystyle \frac { \partial L _ { t } } { \partial \theta } \right) ^ { T } Q \alpha _ { m - 1 } - \lambda _ { \alpha } \lambda _ { p } ^ { 2 } \left\| Q ^ { T } \displaystyle \frac { \partial L _ { t } } { \partial \theta } \right\| ^ { 2 } - \lambda _ { p } \left\| \displaystyle \frac { \partial L _ { t } } { \partial \phi ^ { t } } \right\| ^ { 2 } } \\ { \equiv \Delta L _ { t } ^ { F O } } \end{array}
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
where $\Delta L _ { t } ^ { F O }$ indicates the change in the target loss, to first order.
|
| 317 |
+
|
| 318 |
+
Note that the latter two terms in $\Delta L _ { t } ^ { F O }$ are both negative, and will therefore cause the first order approximation of the target loss to decrease, as desired. As regards the first term, matters are unclear. However, it is clear that if we set the learning rate $\lambda _ { \alpha }$ sufficiently large, the second term will eventually dominate the first term, and the target loss will be decreased. Indeed, we can do a slightly finer analysis. Ignoring the final term (which is always negative), and setting $\begin{array} { r } { v = Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } } \end{array}$ ∂Lt∂θ , we have that
|
| 319 |
+
|
| 320 |
+
$$
|
| 321 |
+
\begin{array} { r l } & { \Delta L _ { t } ^ { F O } \leq - \lambda _ { p } v ^ { T } \alpha _ { m - 1 } - \lambda _ { \alpha } \lambda _ { p } ^ { 2 } \| v \| ^ { 2 } } \\ & { \qquad \leq \lambda _ { p } \| v \| _ { 1 } - \lambda _ { \alpha } \lambda _ { p } ^ { 2 } \| v \| _ { 2 } ^ { 2 } } \\ & { \qquad \leq \lambda _ { p } \sqrt { n ^ { s } } \| v \| _ { 2 } - \lambda _ { \alpha } \lambda _ { p } ^ { 2 } \| v \| _ { 2 } ^ { 2 } } \\ & { \qquad = \lambda _ { p } \| v \| _ { 2 } \left( \sqrt { n ^ { s } } - \lambda _ { \alpha } \lambda _ { p } \| v \| _ { 2 } \right) } \end{array}
|
| 322 |
+
$$
|
| 323 |
+
|
| 324 |
+
where in the second line we have used the fact that all elements of $\alpha$ are in $[ 0 , 1 ]$ ; and in the third line, we have used a standard bound on the $L _ { 1 }$ norm of a vector.
|
| 325 |
+
|
| 326 |
+
Thus, a sufficient condition for the first order approximation of the target loss to decrease is if
|
| 327 |
+
|
| 328 |
+
$$
|
| 329 |
+
\lambda _ { \alpha } \geq \frac { \sqrt { n ^ { s } } } { \lambda _ { p } \left. Q ^ { T } \frac { \partial L _ { t } } { \partial \theta } \right. }
|
| 330 |
+
$$
|
| 331 |
+
|
| 332 |
+
If this is true at all iterations, then the target loss will continually decrease and converge to a local minimum (given that the loss is bounded from below by 0).
|
| 333 |
+
|
| 334 |
+
# APPENDIX C ANALYZING SVHN 0-9 TO MNIST 5-9
|
| 335 |
+
|
| 336 |
+
SOSELETO is capable of automatically pruning unhelpful instances at train time. The experiment presented in Section 4.3 demonstrates how SOSELETO can improve classification of MNIST 5-9 by making use of different digits from a different dataset (SVHN 0-4). To further reason about which instances are chosen as useful, we have conducted another experiment: SVHN 0-9 to MNIST 5-9. There is now a partial overlap in classes between source and target. Our findings are summarized in what follows. An immediate effect of increasing the source set, was a dramatic improvement in accuracy to $9 0 . 3 \%$ .
|
| 337 |
+
|
| 338 |
+
Measuring the percentage of “good” instances (i.e. instances with weight above a certain threshold) didn’t reveal a strong correlation with the labels. In Figure 3 we show this result for a threshold of 0.8. As can be seen, labels 7-9 are slightly higher than the rest but there is no strong evidence of labels 5-9 being more useful than 0-4, as one might hope for.
|
| 339 |
+
|
| 340 |
+
That said, a more careful examination of low- and high-weighted instances, revealed that the usefulness of an instance, as determined by SOSELETO, is more tied to its appearance: namely, whether the digit is centered, at a similar size as MNIST, the amount of blur, and rotation. In Figure 4 we show a random sample of some “good” and “bad” (i.e. high and low weights, respectively). A close look reveals that “good” instances often tend to be complete, centered, axis aligned, and at a good size (wrt MNIST sizes). Especially interesting was that, among the “bad” instances, we found about $3 - 5 \%$ wrongly labeled instances! In Figure 5 we display several especially problematic instances of the SVHN, all of which are labeled as $\mathbf { \vec { \Delta } } ^ { 6 } 0 ^ { 9 }$ in the dataset. As can be seen, some examples are very clear errors. The highly weighted instances, on the other hand, had almost no such errors.
|
| 341 |
+
|
| 342 |
+

|
| 343 |
+
Figure 3: Percentage of good instances from SVHN per class. Classes 0-4 are colored blue and classes 5-9 are colored orange.
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
Figure 4: SVHN “good” (left) and “bad” (right) instances of class label 0.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 5: Hand-picked examples from the pool of “bad” instances with label 0.
|
md/train/Hygab1rKDS/Hygab1rKDS.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/HylTBhA5tQ/HylTBhA5tQ.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# THE LIMITATIONS OF ADVERSARIAL TRAINING AND THE BLIND-SPOT ATTACK
|
| 2 |
+
|
| 3 |
+
Huan Zhang1∗, Hongge Chen2∗, Zhao Song3, Duane Boning2, Inderjit Dhillon3, Cho-Jui Hsieh1
|
| 4 |
+
|
| 5 |
+
1UCLA, Los Angeles, CA 90095
|
| 6 |
+
2MIT, Cambridge, MA 02139
|
| 7 |
+
3UT Austin, Austin, TX 78712
|
| 8 |
+
huan@huan-zhang.com, chenhg@mit.edu, zhaos@utexas.edu
|
| 9 |
+
boning@mtl.mit.edu, inderjit@cs.utexas.edu, chohsieh@cs.ucla.edu ∗Huan Zhang and Hongge Chen contributed equally to this work.
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
The adversarial training procedure proposed by Madry et al. (2018) is one of the most effective methods to defend against adversarial examples in deep neural networks (DNNs). In our paper, we shed some lights on the practicality and the hardness of adversarial training by showing that the effectiveness (robustness on test set) of adversarial training has a strong correlation with the distance between a test point and the manifold of training data embedded by the network. Test examples that are relatively far away from this manifold are more likely to be vulnerable to adversarial attacks. Consequentially, an adversarial training based defense is susceptible to a new class of attacks, the “blind-spot attack”, where the input images reside in “blind-spots” (low density regions) of the empirical distribution of training data but is still on the ground-truth data manifold. For MNIST, we found that these blind-spots can be easily found by simply scaling and shifting image pixel values. Most importantly, for large datasets with high dimensional and complex data manifold (CIFAR, ImageNet, etc), the existence of blind-spots in adversarial training makes defending on any valid test examples difficult due to the curse of dimensionality and the scarcity of training data. Additionally, we find that blind-spots also exist on provable defenses including (Kolter & Wong, 2018) and (Sinha et al., 2018) because these trainable robustness certificates can only be practically optimized on a limited set of training data.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Since the discovery of adversarial examples in deep neural networks (DNNs) (Szegedy et al., 2013), adversarial training under the robustness optimization framework (Madry et al., 2018; Sinha et al., 2018) has become one of the most effective methods to defend against adversarial examples. A recent study by Athalye et al. (2018) showed that adversarial training does not rely on obfuscated gradients and delivers promising results for defending adversarial examples on small datasets. Adversarial training approximately solves the following min-max optimization problem:
|
| 18 |
+
|
| 19 |
+
$$
|
| 20 |
+
\operatorname* { m i n } _ { \theta } \operatorname { \mathbb { E } } _ { ( x , y ) \in \mathcal { X } } \left[ \operatorname* { m a x } _ { \delta \in S } L ( x + \delta ; y ; \theta ) \right] ,
|
| 21 |
+
$$
|
| 22 |
+
|
| 23 |
+
where $\mathcal { X }$ is the set of training data, $L$ is the loss function, $\theta$ is the parameter of the network, and $S$ is usually a norm constrained $\ell _ { p }$ ball centered at 0. Madry et al. (2018) propose to use projected gradient descent (PGD) to approximately solve the maximization problem within $S = \{ \delta \mid \| \delta \| _ { \infty } \leq \epsilon \}$ , where $\epsilon = 0 . 3$ for MNIST dataset on a 0-1 pixel scale, and $\epsilon = 8$ for CIFAR-10 dataset on a 0-255 pixel scale. This approach achieves impressive defending results on the MNIST test set: so far the best available white-box attacks by Zheng et al. (2018) can only decrease the test accuracy from approximately $98 \%$ to $8 8 \% ^ { 1 }$ . However, on CIFAR-10 dataset, a simple 20-step PGD can decrease the test accuracy from $87 \%$ to less than $5 0 \% ^ { 2 }$ .
|
| 24 |
+
|
| 25 |
+
The effectiveness of adversarial training is measured by the robustness on the test set. However, the adversarial training process itself is done on the training set. Suppose we can optimize (1) perfectly, then certified robustness may be obtained on those training data points. However, if the empirical distribution of training dataset differs from the true data distribution, a test point drawn from the true data distribution might lie in a low probability region in the empirical distribution of training dataset and is not “covered” by the adversarial training procedure. For datasets that are relatively simple and have low intrinsic dimensions (MNIST, Fashion MNIST, etc), we can obtain enough training examples to make sure adversarial training covers most part of the data distribution. For high dimensional datasets (CIFAR, ImageNet), adversarial training have been shown difficult (Kurakin et al., 2016; Tramèr et al., 2018) and only limited success was obtained.
|
| 26 |
+
|
| 27 |
+
A recent attack proposed by Song et al. (2018) shows that adversarial training can be defeated when the input image is produced by a generative model (for example, a generative adversarial network) rather than selected directly from the test examples. The generated images are well recognized by humans and thus valid images in the ground-truth data distribution. In our interpretation, this attack effective finds the “blind-spots” in the input space that the training data do not well cover.
|
| 28 |
+
|
| 29 |
+
For higher dimensional datasets, we hypothesize that many test images already fall into these blindspots of training data and thus adversarial training only obtains a moderate level of robustness. It is interesting to see that for those test images that adversarial training fails to defend, if their distances (in some metrics) to the training dataset are indeed larger. In our paper, we try to explain the success of robust optimization based adversarial training and show the limitations of this approach when the test points are slightly off the empirical distribution of training data. Our main contributions are:
|
| 30 |
+
|
| 31 |
+
We show that on the original set of test images, the effectiveness of adversarial training is highly correlated with the distance (in some distance metrics) from the test image to the manifold of training images. For MNIST and Fashion MNIST datasets, most test images are close to the training data and very good robustness is observed on these points. For CIFAR, there is a clear trend that the adversarially trained network gradually loses its robustness property when the test images are further away from training data. We identify a new class of attacks, “blind-spot attacks”, where the input image resides in a “blind-spot” of the empirical distribution of training data (far enough from any training examples in some embedding space) but is still in the ground-truth data distribution (well recognized by humans and correctly classified by the model). Adversarial training cannot provide good robustness on these blind-spots and their adversarial examples have small distortions. • We show that blind-spots can be easily found on a few strong defense models including Madry et al. (2018), Kolter & Wong (2018) and Sinha et al. (2018). We propose a few simple transformations (slightly changing contrast and background), that do not noticeably affect the accuracy of adversarially trained MNIST and Fashion MNIST models, but these models become vulnerable to adversarial attacks on these sets of transformed input images. These transformations effectively move the test images slightly out of the manifold of training images, which does not affect generalization but poses a challenge for robust learning.
|
| 32 |
+
|
| 33 |
+
Our results imply that current adversarial training procedures cannot scale to datasets with a large (intrinsic) dimension, where any practical amount of training data cannot cover all the blind-spots. This explains the limited success for applying adversarial training on ImageNet dataset, where many test images can be sufficiently far away from the empirical distribution of training dataset.
|
| 34 |
+
|
| 35 |
+
# 2 RELATED WORKS
|
| 36 |
+
|
| 37 |
+
# 2.1 DEFENDING AGAINST ADVERSARIAL EXAMPLES
|
| 38 |
+
|
| 39 |
+
Adversarial examples in DNNs have brought great threats to the deep learning-based AI applications such as autonomous driving and face recognition. Therefore, defending against adversarial examples is an urgent task before we can safely deploy deep learning models to a wider range of applications. Following the emergence of adversarial examples, various defense methods have been proposed, such as defensive distillation by Papernot et al. (2016) and feature squeezing by Xu et al. (2017). Some of these defense methods have been proven vulnerable or ineffective under strong attack methods such as C&W in Carlini & Wagner (2017). Another category of recent defense methods is based on gradient masking or obfuscated gradient (Buckman et al. (2018); Ma et al.
|
| 40 |
+
|
| 41 |
+
(2018); Guo et al. (2017); Song et al. (2017); Samangouei et al. (2018)), but these methods are also successfully evaded by the stronger BPDA attack (Athalye et al. (2018)). Randomization in DNNs (Dhillon et al., 2018; Xie et al., 2017; Liu et al., 2018) is also used to reduce the success rate of adversarial attacks, however, it usually incurs additional computational costs and still cannot fully defend against an adaptive attacker (Athalye et al., 2018; Athalye & Sutskever, 2017).
|
| 42 |
+
|
| 43 |
+
An effective defense method is adversarial training, which trains the model with adversarial examples freshly generated during the entire training process. First introduced by Goodfellow et al., adversarial training demonstrates the state-of-the-art defending performance. Madry et al. (2018) formulated the adversarial training procedure into a min-max robust optimization problem and has achieved state-of-the-art defending performance on MNIST and CIFAR datasets. Several attacks have been proposed to attack the model release by Madry et al. (2018). On the MNIST testset, so far the best attack by Zheng et al. (2018) can only reduce the test accuracy from $98 \%$ to $8 8 \%$ . Analysis by Athalye et al. (2018) shows that this adversarial training framework does not rely on obfuscated gradient and truly increases model robustness; gradient based attacks with random starts can only achieve less than $10 \%$ success rate with given distortion constraints and are unable to penetrate this defense. On the other hand, attacking adversarial training using generative models have also been investigated; both Xiao et al. (2018) and Song et al. (2018) propose to use GANs to produce adversarial examples in black-box and white-box settings, respectively.
|
| 44 |
+
|
| 45 |
+
Finally, a few certified defense methods (Raghunathan et al., 2018; Sinha et al., 2018; Kolter & Wong, 2018) were proposed, which are able to provably increase model robustness. Besides adversarial training, in our paper we also consider several certified defenses which can achieve relatively good performance (i.e., test accuracy on natural images does not drop significantly and training is computationally feasible), and can be applied to medium-sized networks with multiple layers. Notably, Sinha et al. (2018) analyzes adversarial training using distributional robust optimization techniques. Kolter & Wong (2018) and Wong et al. (2018) proposed a robustness certificate based on the dual of a convex relaxation for ReLU networks, and used it for training to provably increase robustness. During training, certified defense methods can provably guarantee that the model is robust on training examples; however, on unseen test examples a non-vacuous robustness generalization guarantee is hard to obtain.
|
| 46 |
+
|
| 47 |
+
# 2.2 ANALYZING ADVERSARIAL EXAMPLES
|
| 48 |
+
|
| 49 |
+
Along with the attack-defense arms race, some insightful findings have been discovered to understand the natural of adversarial examples, both theoretically and experimentally. Schmidt et al. (2018) show that even for a simple data distribution of two class-conditional Gaussians, robust generalization requires significantly larger number of samples than standard generalization. Cullina et al. (2018) extend the well-known PAC learning theory to the case with adversaries, and derive the adversarial VC-dimension which can be either larger or smaller than the standard VC-dimension. Bubeck et al. (2018b) conjecture that a robust classifier can be computationally intractable to find, and give a proof for the computation hardness under statistical query (SQ) model. Recently, Bubeck et al. (2018a) prove a computational hardness result under a standard cryptographic assumption. Additionally, finding the safe area approximately is computationally hard according to Katz et al. (2017) and Weng et al. (2018). Mahloujifar et al. (2018) explain the prevalence of adversarial examples by making a connection to the “concentration of measure” phenomenon in metric measure spaces. Su et al. (2018) conduct large scale experiments on ImageNet and find a negative correlation between robustness and accuracy. Tsipras et al. (2019) discover that data examples consist of robust and non-robust features and adversarial training tends to find robust features that have strongly-correlations with the labels.
|
| 50 |
+
|
| 51 |
+
Both adversarial training and certified defenses significantly improve robustness on training data, but it is still unknown if the trained model has good robust generalization property. Typically, we evaluate the robustness of a model by computing an upper bound of error on the test set; specifically, given a norm bounded distortion $\epsilon$ , we verify if each image in test set has a robustness certificate (Zhang et al., 2018; Dvijotham et al., 2018; Singh et al., 2018). There might exist test images that are still within the capability of standard generalization (i.e., correctly classified by DNNs with high confidence, and well recognized by humans), but behaves badly in robust generalization (i.e., adversarial examples can be easily found with small distortions). Our paper complements those existing findings by showing the strong correlation between the effectiveness of adversarial defenses (both adversarial training and some certified defenses) and the distance between training data and test points. Additionally, we show that a tiny shift in input distribution (which may or may not be detectable in embedding space) can easily destroy the robustness property of an robust model.
|
| 52 |
+
|
| 53 |
+
# 3 METHODOLOGY
|
| 54 |
+
|
| 55 |
+
# 3.1 MEASURING THE DISTANCE BETWEEN TRAINING DATASET AND A TEST DATA POINT
|
| 56 |
+
|
| 57 |
+
To verify the correlation between the effectiveness of adversarial training and how close a test point is to the manifold of training dataset, we need to propose a reasonable distance metric between a test example and a set of training examples. However, defining a meaningful distance metric for high dimensional image data is a challenging problem. Naively using an Euclidean distance metric in the input space of images works poorly as it does not reflect the true distance between the images on their ground-truth manifold. One strategy is to use (kernel-)PCA, t-SNE (Maaten & Hinton, 2008), or UMAP (McInnes & Healy, 2018) to reduce the dimension of training data to a low dimensional space, and then define distance in that space. These methods are sufficient for small and simple datasets like MNIST, but for more general and complicated dataset like CIFAR, extracting a meaningful low-dimensional manifold directly on the input space can be really challenging.
|
| 58 |
+
|
| 59 |
+
On the other hand, using a DNN to extract features of input images and measuring the distance in the deep feature embedding space has demonstrated better performance in many applications (Hu et al., 2014; 2015), since DNN models can capture the manifold of image data much better than simple methods such as PCA or t-SNE. Although we can form an empirical distribution using kernel density estimation (KDE) on the deep feature embedding space and then obtain probability densities for test points, our experience showed that KDE work poorly in this case because the features extracted by DNNs are still high dimensional (hundreds or thousands dimensions).
|
| 60 |
+
|
| 61 |
+
Taking the above considerations into account, we propose a simple and intuitive distance metric using deep feature embeddings and $k$ -nearest neighbour. Given a feature extraction neural network $h ( x )$ , a set of $n$ training data points ${ \mathcal { X } } _ { \mathrm { t r a i n } } ~ = ~ \bar { \{ x _ { \mathrm { t r a i n } } ^ { 1 } , x _ { \mathrm { t r a i n } } ^ { 2 } , \cdot \cdot \cdot , x _ { \mathrm { t r a i n } } ^ { n } \} }$ , and a set of $m$ test data points ${ \mathcal { X } } _ { \mathrm { t e s t } } = \{ x _ { \mathrm { t e s t } } ^ { 1 } , x _ { \mathrm { t e s t } } ^ { 2 } , \cdot \cdot \cdot , \bar { x _ { \mathrm { t e s t } } ^ { m } } \}$ from the true data distribution, for each $j \in [ m ]$ , we define the following distance between $x _ { \mathrm { t e s t } } ^ { j }$ and $\mathcal { X } _ { \mathrm { t r a i n } }$ :
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
D ( x _ { \mathrm { t e s t } } ^ { j } , \boldsymbol { \mathcal { X } } _ { \mathrm { t r a i n } } ) : = \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \| h ( x _ { \mathrm { t e s t } } ^ { j } ) - h ( x _ { \mathrm { t r a i n } } ^ { \pi _ { j } ( i ) } ) \| _ { p }
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $\pi _ { j } : [ n ] \to [ n ]$ is a permutation that $\{ \pi _ { j } ( 1 ) , \pi _ { j } ( 2 ) , \cdot \cdot \cdot , \pi _ { j } ( n ) \}$ is an ascending ordering of training data based on the $\ell _ { p }$ distance between $x _ { \mathrm { t e s t } } ^ { j }$ and $x _ { \mathrm { t r a i n } } ^ { i }$ in the deep embedding space, i.e.,
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\forall i < i ^ { \prime } , \| h ( x _ { \mathrm { t e s t } } ^ { j } ) - h ( x _ { \mathrm { t r a i n } } ^ { \pi _ { j } ( i ) } ) \| _ { p } \leq \| h ( x _ { \mathrm { t e s t } } ^ { j } ) - h ( x _ { \mathrm { t r a i n } } ^ { \pi _ { j } ( i ^ { \prime } ) } ) \| _ { p }
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
In other words, we average the embedding space distance of $k$ nearest neighbors of $x _ { j }$ in the training dataset. This simple metric is non-parametric and we found that the results are not sensitive to the selection of $k$ ; also, for naturally trained and adversarially trained feature extractors, the distance metrics obtained by different feature extractors reveal very similar correlations with the effectiveness of adversarial training.
|
| 74 |
+
|
| 75 |
+
# 3.2 MEASURING THE DISTANCE BETWEEN TRAINING AND TEST DATASETS
|
| 76 |
+
|
| 77 |
+
We are also interested to investigate the “distance” between the training dataset and the test dataset to gain some insights on how adversarial training performs on the entire test set. Unlike the setting in Section 3.1, this requires to compute a divergence between two empirical data distributions.
|
| 78 |
+
|
| 79 |
+
$n$ a points , we first ply a non- ${ \mathcal { X } } _ { \mathrm { t r a i n } } ~ = ~ \{ x _ { \mathrm { t r a i n } } ^ { 1 } , x _ { \mathrm { t r a i n } } ^ { 2 } , \cdot \cdot \cdot , x _ { \mathrm { t r a i n } } ^ { n } \}$ and themse t- $m$ test data points hich is the same aE) to project both $\chi _ { \mathrm { t e s t } } \ =$
|
| 80 |
+
$\{ x _ { \mathrm { t e s t } } ^ { 1 } , x _ { \mathrm { t e s t } } ^ { 2 } , \cdot \cdot \cdot , \bar { x } _ { \mathrm { t e s t } } ^ { m } \}$ $h$ $h ( x _ { \mathrm { t r a i n } } ^ { i } )$
|
| 81 |
+
and $h ( x _ { \mathrm { t e s t } } ^ { j } )$ to a low dimensional space, and obtain $\bar { x } _ { \mathrm { t r a i n } } ^ { i } = \mathrm { p r o j } ( h ( x _ { \mathrm { t r a i n } } ^ { i } ) )$ and $\bar { x } _ { \mathrm { t e s t } } ^ { j } = \mathrm { p r o j } ( h ( x _ { \mathrm { t e s t } } ^ { j } ) )$ .
|
| 82 |
+
test train The dataset after feature extraction and projection is denoted as $\bar { \mathcal X } _ { \mathrm { t r a i n } }$ nand $\bar { \mathcal X } _ { \mathrm { t e s t } }$ test . Because $\bar { x } _ { \mathrm { t r a i n } } ^ { i }$ estand
|
| 83 |
+
$\bar { x } _ { \mathrm { t e s t } } ^ { j }$ areons dimand onal, we can use kfor them. We use densand estimation (KDE) to form empirical distri-to denote the true distributions. Then, we $\bar { p } _ { \mathrm { t r a i n } }$ $\bar { p } _ { \mathrm { t e s t } }$ $p _ { \mathrm { t r a i n } }$ $p _ { \mathrm { t e s t } }$
|
| 84 |
+
|
| 85 |
+
approximate the K-L divergence between $p _ { \mathrm { t r a i n } }$ and $p _ { \mathrm { t e s t } }$ via a numerical integration of Eq.(3):
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
D _ { \mathrm { K L } } ( p _ { \mathrm { t r a i n } } | | p _ { \mathrm { t e s t } } ) \approx \int _ { V } \bar { p } _ { \mathrm { t r a i n } } ( x ) \log \frac { \bar { p } _ { \mathrm { t r a i n } } ( x ) } { \bar { p } _ { \mathrm { t e s t } } ( x ) } \mathrm { d } x ,
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $\begin{array} { r } { \bar { p } _ { \mathrm { t r a i n } } ( x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } K ( x - \bar { x } _ { \mathrm { t r a i n } } ^ { i } ; H ) } \end{array}$ and $\begin{array} { r } { \bar { p } _ { \mathrm { t e s t } } ( x ) = \frac { 1 } { m } \sum _ { j = 1 } ^ { m } K ( x - \bar { x } _ { \mathrm { t e s t } } ^ { j } ; H ) } \end{array}$ are KDE $K$ $H$ bandwidth parameter automatically selected by Scott’s rule (Scott, 2015). $V$ is chosen as a box bounding all training and test data points. For a multi-class dataset, we compute the aforementioned KDE and K-L divergence for each class separately.
|
| 92 |
+
|
| 93 |
+
# 3.3 THE BLIND-SPOT ATTACK: A NEW CLASS OF ADVERSARIAL ATTACKS
|
| 94 |
+
|
| 95 |
+
Inspired by our findings of the negative correlation between the effectiveness of adversarial training and the distance between a test image and training dataset, we identify a new class of adversarial attacks called “blind-spot attacks”, where we find input images that are “far enough” from any existing training examples such that:
|
| 96 |
+
|
| 97 |
+
They are still drawn from the ground-truth data distribution (i.e. well recognized by humans) and classified correctly by the model (within the generalization capability of the model); Adversarial training cannot provide good robustness properties on these images, and we can easily find their adversarial examples with small distortions using a simple gradient based attack.
|
| 98 |
+
|
| 99 |
+
Importantly, blind-spot images are not adversarial images themselves. However, after performing adversarial attacks, we can find their adversarial examples with small distortions, despite adversarial training. In other words, we exploit the weakness in a model’s robust generalization capability.
|
| 100 |
+
|
| 101 |
+
We find that these blind-spots are prevalent and can be easily found without resorting to complex generative models like in Song et al. (2018). For the MNIST dataset which Madry et al. (2018), Kolter & Wong (2018) and Sinha et al. (2018) demonstrate the strongest defense results so far, we propose a simple transformation to find the blind-spots in these models. We simply scale and shift each pixel value. Suppose the input image $x \in [ - 0 . 5 , 0 . 5 ] ^ { d }$ , we scale and shift each test data example $x$ element-wise to form a new example $x ^ { \prime }$ :
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
x ^ { \prime } = \alpha x + \beta , ~ { \mathrm { s . t . } } ~ x ^ { \prime } \in [ - 0 . 5 , 0 . 5 ] ^ { d }
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
where $\alpha$ is a constant close to 1 and $\beta$ is a constant close to 0. We make sure that the selection of $\alpha$ and $\beta$ will result in a $x ^ { \prime }$ that is still in the valid input range $[ - 0 . 5 , 0 . 5 ] ^ { d }$ . This transformation effectively adjusts the contrast of the image, and/or adds a gray background to the image. We then perform Carlini $\&$ Wagner’s attacks on these transformed images $x ^ { \prime }$ to find their adversarial examples $x _ { \mathrm { a d v } } ^ { \prime }$ . It is important that the blind-spot images $x ^ { \prime }$ are still undoubtedly valid images; for example, a digit that is slightly darker than the one in test set is still considered as a valid digit and can be well recognized by humans. Also, we found that with appropriate $\alpha$ and $\beta$ the accuracy of MNIST and Fashion-MNIST models barely decreases; the model has enough generalization capability for this set of slightly transformed images, yet their adversarial examples can be easily found.
|
| 108 |
+
|
| 109 |
+
Although the blind-spot attack is beyond the threat model considered in adversarial training (e.g. $\ell _ { \infty }$ norm constrained perturbations), our argument is that adversarial training (and some other defense methods with certifications only on training examples such as Kolter & Wong (2018)) are unlikely to scale well to datasets that lie in a high dimensional manifold, as the limited training data only guarantees robustness near these training examples. The blind-spots are almost inevitable in high dimensional case. For example, in CIFAR-10, about $50 \%$ of test images are already in blind-spots and their adversarial examples with small distortions can be trivially found despite adversarial training. Using data augmentation may eliminate some blind-spots, however for high dimensional data it is impossible to enumerate all possible inputs due to the curse of dimensionality.
|
| 110 |
+
|
| 111 |
+
# 4 EXPERIMENTS
|
| 112 |
+
|
| 113 |
+
In this section we present our experimental results on adversarially trained models by Madry et al. (2018). Results on certified defense models by Kolter & Wong (2018); Wong et al. (2018) and Sinha et al. (2018) are very similar and are demonstrated in Section 6.4 in the Appendix.
|
| 114 |
+
|
| 115 |
+
# 4.1 SETUP
|
| 116 |
+
|
| 117 |
+
We conduct experiments on adversarially trained models by Madry et al. (2018) on four datasets: MNIST, Fashion MNIST, and CIFAR-10. For MNIST, we use the “secret” model release for the MNIST attack challenge3. For CIFAR-10, we use the public “adversarially trained” model4. For Fashion MNIST, we train our own model with the same model structure and parameters as the robust MNIST model, except that the iterative adversary is allowed to perturb each pixel by at most $\epsilon = 0 . 1$ as a larger $\epsilon$ will significantly reduce model accuracy.
|
| 118 |
+
|
| 119 |
+
We use our presented simple blind-spot attack in Section 3.3 to find blind-spot images, and use Carlini & Wagner’s (C&W’s) $\ell _ { \infty }$ attack (Carlini & Wagner (2017)) to find their adversarial examples. We found that C&W’s attacks generally find adversarial examples with smaller perturbations than projected gradient descent (PGD). To avoid gradient masking, we initial our attacks using two schemes: (1) from the original image plus a random Gaussian noise with a standard deviation of 0.2; (2) from a blank gray image where all pixels are initialized as 0. A successful attack is defined as finding an perturbed example that changes the model’s classification and the $\ell _ { \infty }$ distortion is less than a given $\epsilon$ used for robust training. For MNIST, $\epsilon = 0 . 3$ ; for Fashion-MNIST, $\epsilon = 0 . 1$ ; and for CIFAR, $\epsilon = 8 / 2 5 5$ . All input images are normalized to $[ - 0 . 5 , 0 . 5 ]$ .
|
| 120 |
+
|
| 121 |
+
# 4.2 EFFECTIVENESS OF ADVERSARIAL TRAINING AND THE DISTANCE TO TRAINING SET
|
| 122 |
+
|
| 123 |
+
In this set of experiments, we build a connection between attack success rate on adversarially trained models and the distance between a test example and the whole training set. We use the metric defined in Section 3.1 to measure this distance. For MNIST and Fashion-MNIST, the outputs of the first fully connected layer (after all convolutional layers) are used as the neural feature extractor $h ( x )$ ; for CIFAR, we use the outputs of the last average pooling layer. We consider both naturally and adversarially trained networks as the neural feature extractor, with $p = 2$ and $k = 5$ . The results are shown in Figure 1, 2 and 3. For each test set, after obtaining the distance of each test point, we bin the test data points based on their distances to the training set and show them in the histogram at the bottom half of each figure (red). The top half of each figure (blue) represents the attack success rates for the test images in the corresponding bins. Some bars on the right are missing because there are too few points in the corresponding bins. We only attack correctly classified images and only calculate success rate on those images. Note that we should not compare the distances shown between the left and right columns of Figures 1, 2 and 3 because they are obtained using different embeddings, however the overall trends are very similar.
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 1: Attack success rate and distance distribution of MNIST model in Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rates, $\epsilon = 0 . 3$ . Lower: The distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-5 nearest images in training set.
|
| 127 |
+
|
| 128 |
+
As we can observe in all three figures, most successful attacks in test sets for adversarially trained networks concentrate on the right hand side of the distance distribution, and the success rates tend to grow when the distance is increasing. The trend is independent of the feature extractor being used (naturally or adversarially trained). The strong correlation between attack success rates and the distance from a test point to the training dataset supports our hypothesis that adversarial training tends to fail on test points that are far enough from the training data distribution.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 2: Attack success rate and distance distribution of Fashion MNIST model trained using Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rate, $\epsilon = 0 . 1$ . Lower: The distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-5 nearest images in training set.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 3: Attack success rate and distance distribution of CIFAR model in Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rate, $\epsilon = 8 / 2 5 5$ . Lower: The distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-5 nearest images in training set.
|
| 135 |
+
|
| 136 |
+
# 4.3 K-L DIVERGENCE BETWEEN TRAINING AND TEST SETS VS ATTACK SUCCESS RATE
|
| 137 |
+
|
| 138 |
+
To quantify the overall distance between the training and the test set, we calculate the K-L divergence between the KDE distributions of training set and test set for each class according to Eq. (3). Then, for each dataset we take the average K-L divergence across all classes, as shown in Table 1. We use both adversarially trained networks and naturally trained networks as our feature extractors $h ( x )$ . Additionally, we also calculate the average normalized distance by calculating the $\ell _ { 2 }$ distance between each test point and the training set as in Section 4.2, and taking the average over all test points. To compare between different datasets, we normalize each element of the feature representation √ $h ( x )$ to mean 0 and variance 1. We average this distance among all test points and divide it by $\sqrt { d _ { t } }$ to normalize the dimension, where $d _ { t }$ is the dimension of the feature representation $h ( \cdot )$ .
|
| 139 |
+
|
| 140 |
+
Clearly, Fashion-MNIST is the dataset with the strongest defense as measured by the attack success rates on test set, and its ${ \mathrm { K } } { \mathrm { - } } { \mathrm { L } }$ divergence is also the smallest. For CIFAR, the divergence between training and test sets is significantly larger, and adversarial training only has limited success. The hardness of training a robust model for MNIST is in between Fashion-MNIST and CIFAR. Another important observation is that the effectiveness of adversarial training does not depend on the accuracy; for Fashion-MNIST, classification is harder as the data is more complicated than MNIST, but training a robust Fashion-MNIST model is easier as the data distribution is more concentrated and adversarial training has less “blind-spots”.
|
| 141 |
+
|
| 142 |
+
# 4.4 BLIND-SPOT ATTACK ON MNIST AND FASHION MNIST
|
| 143 |
+
|
| 144 |
+
In this section we focus on applying the proposed blind-spot attack to MNIST and Fashion MNIST. As mentioned in Section 3.3, for an image $x$ from the test set, the blind-spot image $x ^ { \prime } = \alpha x + \beta$ obtained by scaling and shifting is considered as a new natural image, and we use the C&W $\ell _ { \infty }$ attack to craft an adversarial image $x _ { \mathrm { a d v } } ^ { \prime }$ for $x ^ { \prime }$ . The attack distortion is calculated as the $\ell _ { \infty }$ distance between $x ^ { \prime }$ and $x _ { \mathrm { a d v } } ^ { \prime }$ . For MNIST, $\epsilon = 0 . 3$ so we set the scaling factor to $\alpha = \{ 1 . 0 , 0 . 9 , 0 . 8 , 0 . 7 \}$ . For Fashion-MNIST, $\epsilon = 0 . 1$ so we set the scaling factor to $\alpha = \{ 1 . 0 , 0 . 9 5 , 0 . 9 \}$ . We set $\beta$ to either 0 or a small constant. The case $\alpha = 1 . 0 , \beta = 0 . 0$ represents the original test set images. We report the model’s accuracy and attack success rates for each choice of $\alpha$ and $\beta$ in Table 2 and Table 3. Because we scale the image by a factor of $\alpha$ , we also set a stricter criterion of success – the $\ell _ { \infty }$ perturbation must be less than $\alpha \epsilon$ to be counted as a successful attack. For MNIST, $\epsilon = 0 . 3$ and for Fashion-MNIST, $\epsilon = 0 . 1$ . We report both success criterion, $\epsilon$ and $\alpha \epsilon$ in Tables 2 and 3.
|
| 145 |
+
|
| 146 |
+
Table 1: Average K-L divergence and normalized $\ell _ { 2 }$ distance between training and test sets across all classes. We use both adversarially trained networks (adv.) and naturally trained networks (nat.) as our feature extractors when computing K-L divergence. Note that we only attack images that are correctly classified and report success rate on those images.
|
| 147 |
+
|
| 148 |
+
<table><tr><td>Dataset</td><td>Avg K-L div. (adv. trained)</td><td>Avg K-L div. (nat. trained)</td><td>Avg.normalized l2 Distance</td><td>Attack Success Rates (Test Set)</td><td>Test Accuracy</td></tr><tr><td>Fashion-MNIST</td><td>0.046</td><td>0.058</td><td>0.4233</td><td>6.4%</td><td>86.1%</td></tr><tr><td>MNIST</td><td>0.119</td><td>0.095</td><td>0.3993</td><td>9.7%</td><td>98.2%</td></tr><tr><td>CIFAR</td><td>0.571</td><td>0.143</td><td>0.6715</td><td>37.9%</td><td>87.0%</td></tr></table>
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 4: Blind-spot attacks on Fashion-MNIST and MNIST data with scaling and shifting on adversarially trained models (Madry et al., 2018). First row contains input images after scaling and shifting and the second row contains the found adversarial examples. “dist” represents the $\ell _ { \infty }$ distortion of adversarial perturbations. The first rows of figures (a) and (d) represent the original test set images $( \alpha = 1 . 0 , \beta = 0 . 0 )$ ; first rows of figures (b), (c), (e), and (f) illustrate the images after transformation. Adversarial examples for these transformed images have small distortions.
|
| 152 |
+
|
| 153 |
+
We first observe that for all pairs of $\alpha$ and $\beta$ the transformation does not affect the models’ test accuracy at all. The adversarially trained model classifies these slightly scaled and shifted images very well, with test accuracy equivalent to the original test set. Visual comparisons in Figure 4 show that when $\alpha$ is close to 1 and $\beta$ is close to 0, it is hard to distinguish the transformed images from the original images. On the other hand, according to Tables 2 and 3, the attack success rates for those transformed test images are significantly higher than the original test images, for both the original criterion $\epsilon$ and the stricter criterion $\alpha \epsilon$ . In Figure 4, we can see that the $\ell _ { \infty }$ adversarial perturbation
|
| 154 |
+
|
| 155 |
+
<table><tr><td rowspan=2 colspan=1>α,β</td><td rowspan=1 colspan=1>a=1.0</td><td rowspan=1 colspan=4>α=0.9</td><td rowspan=1 colspan=4>a=0.8</td><td rowspan=1 colspan=4>α=0.7</td></tr><tr><td rowspan=1 colspan=1>β=0</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.05</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.1</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.15</td></tr><tr><td rowspan=1 colspan=1>acc</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>98.</td><td rowspan=1 colspan=1>3%</td><td rowspan=1 colspan=1>98.</td><td rowspan=1 colspan=1>5%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>4%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>5%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>4%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>1%</td></tr><tr><td rowspan=1 colspan=1>th.</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.27</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.27</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.24</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.24</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.21</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.21</td></tr><tr><td rowspan=1 colspan=1>suc.rate</td><td rowspan=1 colspan=1>9.70%</td><td rowspan=1 colspan=1>75.20%</td><td rowspan=1 colspan=1>15.20%</td><td rowspan=1 colspan=1>93.65%</td><td rowspan=1 colspan=1>82.50%</td><td rowspan=1 colspan=1>94.85%</td><td rowspan=1 colspan=1>52.30%</td><td rowspan=1 colspan=1>99.55%</td><td rowspan=1 colspan=1>95.45%</td><td rowspan=1 colspan=1>98.60%</td><td rowspan=1 colspan=1>82.45%</td><td rowspan=1 colspan=1>99.95%</td><td rowspan=1 colspan=1>99.95%</td></tr></table>
|
| 156 |
+
|
| 157 |
+
Table 2: Attack success rate (suc. rate) and test accuracy (acc) of scaled and shifted MNIST. An attack is considered successful if its $\ell _ { \infty }$ distortion is less than thresholds (th.) 0.3 or $0 . 3 \alpha$ .
|
| 158 |
+
|
| 159 |
+
<table><tr><td rowspan=2 colspan=1>α,β</td><td rowspan=1 colspan=1>α=1.0</td><td rowspan=1 colspan=4>α=0.95</td><td rowspan=1 colspan=4>a=0.9</td></tr><tr><td rowspan=1 colspan=1>β=0</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.025</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.05</td></tr><tr><td rowspan=1 colspan=1>acc</td><td rowspan=1 colspan=1>86.1%</td><td rowspan=1 colspan=2>86.1%</td><td rowspan=1 colspan=2>86.4%</td><td rowspan=1 colspan=2>86.1%</td><td rowspan=1 colspan=2>86.2%</td></tr><tr><td rowspan=1 colspan=1>th.</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.095</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.095</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.09</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.09</td></tr><tr><td rowspan=1 colspan=1>suc. rate</td><td rowspan=1 colspan=1>6.40%</td><td rowspan=1 colspan=1>11.25%</td><td rowspan=1 colspan=1>9.05%</td><td rowspan=1 colspan=1>22.55%</td><td rowspan=1 colspan=1>18.55%</td><td rowspan=1 colspan=1>25.70%</td><td rowspan=1 colspan=1>19.15%</td><td rowspan=1 colspan=1>62.60%</td><td rowspan=1 colspan=1>55.95%</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Table 3: Attack success rate (suc. rate) and test accuracy (acc) of scaled and shifted Fashion-MNIST.
|
| 162 |
+
An attack is considered as successful if its $\ell _ { \infty }$ distortion is less than threshold (th.) 0.1 or $0 . 1 \alpha$ .
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 5: The distribution of the $\ell _ { 2 }$ distance between the original and scaled images in test set and the top-5 nearest images $k = 5$ ) in training set using the distance metric defined in Eq. (2).
|
| 166 |
+
|
| 167 |
+
required is much smaller than the original image after the transformation. Thus, the proposed scale and shift transformations indeed move test images into blind-spots. More figures are in Appendix.
|
| 168 |
+
|
| 169 |
+
One might think that we can generally detect blind-spot attacks by observing their distances to the training dataset, using a metric similar to Eq. (2). Thus, we plot histograms for the distances between tests points and training dataset, for both original test images and those slightly transformed ones in Figure 5. We set $\alpha = 0 . 7 , \beta = 0$ for MNIST and $\alpha = 0 . 9$ , $\beta = 0$ for Fashion-MNIST. Unfortunately, the differences in distance histograms for these blind-spot images are so tiny that we cannot reliably detect the change, yet the robustness property drastically changes on these transformed images.
|
| 170 |
+
|
| 171 |
+
# 5 CONCLUSION
|
| 172 |
+
|
| 173 |
+
In this paper, we observe that the effectiveness of adversarial training is highly correlated with the characteristics of the dataset, and data points that are far enough from the distribution of training data are prone to adversarial attacks despite adversarial training. Following this observation, we defined a new class of attacks called “blind-spot attack” and proposed a simple scale-and-shift scheme for conducting blind-spot attacks on adversarially trained MNIST and Fashion MNIST datasets with high success rates. Our findings suggest that adversarial training can be challenging due to the prevalence of blind-spots in high dimensional datasets.
|
| 174 |
+
|
| 175 |
+
# ACKNOWLEDGMENT
|
| 176 |
+
|
| 177 |
+
We thank Zeyuan Allen-Zhu, Lijie Chen, Sébastien Bubeck, Rasmus Kyng, Yin Tat Lee, Aleksander M ˛adry, Jelani Nelson, Eric Price, Ilya Razenshteyn, Aviad Rubinstein, Ludwig Schmidt and Pengchuan Zhang for fruitful discussions. We also thank Eric Wong for kindly providing us with pre-trained models to perform our experiments.
|
| 178 |
+
|
| 179 |
+
# REFERENCES
|
| 180 |
+
|
| 181 |
+
Anish Athalye and Ilya Sutskever. Synthesizing robust adversarial examples. arXiv preprint arXiv:1707.07397, 2017.
|
| 182 |
+
|
| 183 |
+
Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. International Conference on Machine Learning (ICML), 2018.
|
| 184 |
+
|
| 185 |
+
Sébastien Bubeck, Yin Tat Lee, Eric Price, and Ilya Razenshteyn. Adversarial examples from cryptographic pseudo-random generators. arXiv preprint arXiv:1811.06418, 2018a.
|
| 186 |
+
|
| 187 |
+
Sébastien Bubeck, Eric Price, and Ilya Razenshteyn. Adversarial examples from computational constraints. arXiv preprint arXiv:1805.10204, 2018b.
|
| 188 |
+
|
| 189 |
+
Jacob Buckman, Aurko Roy, Colin Raffel, and Ian Goodfellow. Thermometer encoding: One hot way to resist adversarial examples. ICLR, 2018.
|
| 190 |
+
|
| 191 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 39–57. IEEE, 2017.
|
| 192 |
+
|
| 193 |
+
Daniel Cullina, Arjun Nitin Bhagoji, and Prateek Mittal. Pac-learning in the presence of evasion adversaries. arXiv preprint arXiv:1806.01471, 2018.
|
| 194 |
+
|
| 195 |
+
Guneet S Dhillon, Kamyar Azizzadenesheli, Zachary C Lipton, Jeremy Bernstein, Jean Kossaifi, Aran Khanna, and Anima Anandkumar. Stochastic activation pruning for robust adversarial defense. arXiv preprint arXiv:1803.01442, 2018.
|
| 196 |
+
|
| 197 |
+
Krishnamurthy Dvijotham, Robert Stanforth, Sven Gowal, Timothy Mann, and Pushmeet Kohli. A dual approach to scalable verification of deep networks. UAI, 2018.
|
| 198 |
+
|
| 199 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples (2014). arXiv preprint arXiv:1412.6572.
|
| 200 |
+
|
| 201 |
+
Chuan Guo, Mayank Rana, Moustapha Cisse, and Laurens van der Maaten. Countering adversarial images using input transformations. arXiv preprint arXiv:1711.00117, 2017.
|
| 202 |
+
|
| 203 |
+
Matthias Hein and Maksym Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. In Advances in Neural Information Processing Systems (NIPS), pp. 2266–2276, 2017.
|
| 204 |
+
|
| 205 |
+
Sebastian Houben, Johannes Stallkamp, Jan Salmen, Marc Schlipsing, and Christian Igel. Detection of traffic signs in real-world images: The German Traffic Sign Detection Benchmark. In International Joint Conference on Neural Networks, number 1288, 2013.
|
| 206 |
+
|
| 207 |
+
Junlin Hu, Jiwen Lu, and Yap-Peng Tan. Discriminative deep metric learning for face verification in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1875–1882, 2014.
|
| 208 |
+
|
| 209 |
+
Junlin Hu, Jiwen Lu, and Yap-Peng Tan. Deep transfer metric learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 325–333, 2015.
|
| 210 |
+
|
| 211 |
+
Guy Katz, Clark Barrett, David L Dill, Kyle Julian, and Mykel J Kochenderfer. Reluplex: An efficient smt solver for verifying deep neural networks. In International Conference on Computer Aided Verification, pp. 97–117. Springer, 2017.
|
| 212 |
+
|
| 213 |
+
J Zico Kolter and Eric Wong. Provable defenses against adversarial examples via the convex outer adversarial polytope. ICML, 2018.
|
| 214 |
+
|
| 215 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016.
|
| 216 |
+
|
| 217 |
+
Xuanqing Liu, Minhao Cheng, Huan Zhang, and Cho-Jui Hsieh. Towards robust neural networks via random self-ensemble. ECCV, 2018.
|
| 218 |
+
|
| 219 |
+
Xingjun Ma, Bo Li, Yisen Wang, Sarah M Erfani, Sudanthi Wijewickrema, Michael E Houle, Grant Schoenebeck, Dawn Song, and James Bailey. Characterizing adversarial subspaces using local intrinsic dimensionality. arXiv preprint arXiv:1801.02613, 2018.
|
| 220 |
+
|
| 221 |
+
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
|
| 222 |
+
|
| 223 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. ICLR, arXiv preprint arXiv:1706.06083, 2018.
|
| 224 |
+
|
| 225 |
+
Saeed Mahloujifar, Dimitrios I Diochnos, and Mohammad Mahmoody. The curse of concentration in robust learning: Evasion and poisoning attacks from concentration of measure. arXiv preprint arXiv:1809.03063, 2018.
|
| 226 |
+
|
| 227 |
+
Leland McInnes and John Healy. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2018.
|
| 228 |
+
|
| 229 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In 2016 IEEE Symposium on Security and Privacy (SP), pp. 582–597. IEEE, 2016.
|
| 230 |
+
|
| 231 |
+
Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. arXiv preprint arXiv:1801.09344, 2018.
|
| 232 |
+
|
| 233 |
+
Pouya Samangouei, Maya Kabkab, and Rama Chellappa. Defense-GAN: Protecting classifiers against adversarial attacks using generative models. arXiv preprint arXiv:1805.06605, 2018.
|
| 234 |
+
|
| 235 |
+
Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. NIPS, pp. 5019–5031, 2018.
|
| 236 |
+
|
| 237 |
+
David W Scott. Multivariate density estimation: theory, practice, and visualization. John Wiley & Sons, 2015.
|
| 238 |
+
|
| 239 |
+
Gagandeep Singh, Timon Gehr, Matthew Mirman, Markus Püschel, and Martin Vechev. Fast and effective robustness certification. In Advances in Neural Information Processing Systems, pp. 10825–10836, 2018.
|
| 240 |
+
|
| 241 |
+
Aman Sinha, Hongseok Namkoong, and John Duchi. Certifying some distributional robustness with principled adversarial training. ICLR, 2018.
|
| 242 |
+
|
| 243 |
+
Yang Song, Taesup Kim, Sebastian Nowozin, Stefano Ermon, and Nate Kushman. Pixeldefend: Leveraging generative models to understand and defend against adversarial examples. arXiv preprint arXiv:1710.10766, 2017.
|
| 244 |
+
|
| 245 |
+
Yang Song, Rui Shu, Nate Kushman, and Stefano Ermon. Generative adversarial examples. arXiv preprint arXiv:1805.07894, 2018.
|
| 246 |
+
|
| 247 |
+
Dong Su, Huan Zhang, Hongge Chen, Jinfeng Yi, Pin-Yu Chen, and Yupeng Gao. Is robustness the cost of accuracy?–a comprehensive study on the robustness of 18 deep image classification models. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 631–648, 2018.
|
| 248 |
+
|
| 249 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
|
| 250 |
+
|
| 251 |
+
Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. Ensemble adversarial training: Attacks and defenses. In International Conference on Learning Representations (ICLR), 2018. https://arxiv.org/abs/1705.07204.
|
| 252 |
+
|
| 253 |
+
Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. ICLR, 2019.
|
| 254 |
+
|
| 255 |
+
Tsui-Wei Weng, Huan Zhang, Hongge Chen, Zhao Song, Cho-Jui Hsieh, Duane Boning, Inderjit S Dhillon, and Luca Daniel. Towards fast computation of certified robustness for relu networks. ICML, 2018.
|
| 256 |
+
|
| 257 |
+
Eric Wong, Frank Schmidt, Jan Hendrik Metzen, and J Zico Kolter. Scaling provable adversarial defenses. NIPS, pp. 8410–8419, 2018.
|
| 258 |
+
|
| 259 |
+
Chaowei Xiao, Bo Li, Jun-Yan Zhu, Warren He, Mingyan Liu, and Dawn Song. Generating adversarial examples with adversarial networks. arXiv preprint arXiv:1801.02610, 2018.
|
| 260 |
+
|
| 261 |
+
Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. arXiv preprint arXiv:1711.01991, 2017.
|
| 262 |
+
|
| 263 |
+
Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. arXiv preprint arXiv:1704.01155, 2017.
|
| 264 |
+
|
| 265 |
+
Huan Zhang, Tsui-Wei Weng, Pin-Yu Chen, Cho-Jui Hsieh, and Luca Daniel. Efficient neural network robustness certification with general activation functions. In Advances in Neural Information Processing Systems (NIPS), dec 2018.
|
| 266 |
+
|
| 267 |
+
Tianhang Zheng, Changyou Chen, and Kui Ren. Distributionally adversarial attack. arXiv preprint arXiv:1808.05537, 2018.
|
| 268 |
+
|
| 269 |
+
# 6 APPENDIX
|
| 270 |
+
|
| 271 |
+
# 6.1 DISTANCE DISTRIBUTIONS UNDER DIFFERENT NEAREST NEIGHBOUR PARAMETERS $k$
|
| 272 |
+
|
| 273 |
+
As discussed in Section 3.1, we use $k$ -nearest neighbour in embedding space to measure the distance between a test example and the training set. In Section 4.2 we use $k = 5$ . In this section we show that the choice of $k$ does not have much influence on our results. We use the adversarially trained model on the CIFAR dataset as an example. In Figures 6, 7 and 8 we choose $k = 1 0$ , 100, 1000, respectively. The results are similar to those we have shown in Figure 3: a strong correlation between attack success rates and the distance from a test point to the training dataset.
|
| 274 |
+
|
| 275 |
+

|
| 276 |
+
Figure 6: Attack success rates and distance distribution of the adversarially trained CIFAR model by Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rate, $\epsilon = 8 / 2 5 5$ . Lower: distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-10 $k = 1 0$ ) nearest images in training set.
|
| 277 |
+
|
| 278 |
+

|
| 279 |
+
Figure 7: Attack success rates and distance distribution of the adversarially trained CIFAR model by Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rate, $\epsilon = 8 / 2 5 5$ . Lower: distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-100 $k = 1 0 0$ ) nearest images in training set.
|
| 280 |
+
|
| 281 |
+
# 6.2 GERMAN TRAFFIC SIGN (GTS) DATASET
|
| 282 |
+
|
| 283 |
+
We also studied the German Traffic Sign (GTS) (Houben et al., 2013) dataset. For GTS, we train our own model with the same model structure and parameters as the adversarially trained CIFAR model (Madry et al., 2018). We set $\epsilon = 8 / 2 5 5$ for adversarial training with PGD, and also use the same $\epsilon$ as the threshold of success. The results are shown in Figure 9. The GTS model behaves similarly to the CIFAR model: attack success rates are much higher when the distances between the test example and the training dataset are larger.
|
| 284 |
+
|
| 285 |
+
# 6.3 MORE VISUALIZATION RESULTS
|
| 286 |
+
|
| 287 |
+
We demonstrate more MNIST and Fashion-MNIST visualizations in Figure 10.
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
Figure 8: Attack success rates and distance distribution of the adversarially trained CIFAR model by Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rate, $\epsilon = 8 / 2 5 5$ . Lower: distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-1000 $k = 1 0 0 0 ,$ ) nearest images in training set.
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
Figure 9: Attack success rate and distance distribution of GTS in Madry et al. (2018). Upper: C&W $\ell _ { \infty }$ attack success rate, $\epsilon = 8 / 2 5 5$ . Lower: distribution of the average $\ell _ { 2 }$ (embedding space) distance between the images in test set and the top-5 nearest images in training set.
|
| 294 |
+
|
| 295 |
+
# 6.4 RESULTS ON OTHER ROBUST TRAINING METHODS
|
| 296 |
+
|
| 297 |
+
In this section we demonstrate our experimental results on two other state-of-the-art certified defense methods, including convex adversarial polytope by Wong et al. (2018) and Kolter & Wong (2018), and distributional robust optimization based adversarial training by Sinha et al. (2018). Different from the adversarial training by Madry et al. (2018), these two methods can provide a formal certification on the robustness of the model and provably improve robustness on the training dataset. However, they cannot practically guarantee non-trivial robustness on test data. We did not include other certified defenses like Raghunathan et al. (2018) and Hein & Andriushchenko (2017) because they are not applicable to multi-layer networks. For all defenses, we use their official implementations and pretrained models (if available). Figure 11 shows the results on CIFAR using the defenses in Wong et al. (2018). Tables 4 and 5 show the blind-spot attack results on MNIST and FashionMNIST for robust models in Kolter & Wong (2018) and Sinha et al. (2018), respectively. Figure 12 shows the blind-spot attack examples on Madry et al. (2018), Kolter & Wong (2018) and Sinha et al. (2018).
|
| 298 |
+
|
| 299 |
+

|
| 300 |
+
Figure 10: Blind-spot attacks on Fashion-MNIST and MNIST data with scaling and shifting in Madry et al. (2018). First row contains input images after scaling and shifting and the second row contains the found adversarial examples. “dist” represents the $\ell _ { \infty }$ distortion of adversarial perturbations. The first rows of figures (a), (d), (g) and (j) represent the original test set images $( \alpha = 1 . 0 , \beta = 0 . 0 )$ ); first rows of figures (b), (c), (e), (f), (h), (i), (k) and (l) illustrate the images after transformation. Adversarial examples for these transformed images can be found with small distortions.
|
| 301 |
+
|
| 302 |
+

|
| 303 |
+
Figure 11: Attack success rates and distance distribution of the CIFAR-10 model in Wong et al. (2018). Lower: the histogram of the average $\ell _ { 2 }$ (in embedding space) distance between the images in test set and the top-5 nearest images in training set. Upper: the C&W $\ell _ { \infty }$ attack success rate with success criterion $\epsilon = 8 / 2 5 5$ .
|
| 304 |
+
|
| 305 |
+
Table 4: Blind-spot attack on MNIST and Fashion-MNIST for robust models by Kolter & Wong (2018)
|
| 306 |
+
|
| 307 |
+
<table><tr><td rowspan=5 colspan=1>MNIST</td><td rowspan=2 colspan=1>α,β</td><td rowspan=1 colspan=1>α=1.0</td><td rowspan=1 colspan=4>α=0.95</td><td rowspan=1 colspan=4>α=0.9</td></tr><tr><td rowspan=1 colspan=1>β=0</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.025</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.05</td></tr><tr><td rowspan=1 colspan=1>Accuracy</td><td rowspan=1 colspan=1>97.5%</td><td rowspan=1 colspan=1>97.</td><td rowspan=1 colspan=1>%</td><td rowspan=1 colspan=1>97</td><td rowspan=1 colspan=1>5%</td><td rowspan=1 colspan=1>97</td><td rowspan=1 colspan=1>5%</td><td rowspan=1 colspan=1>97.4%</td><td rowspan=1 colspan=1>%</td></tr><tr><td rowspan=1 colspan=1>Success criterion (lonorm)</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.095</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.095</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.09</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.09</td></tr><tr><td rowspan=1 colspan=1>Successrates</td><td rowspan=1 colspan=1>2.15%</td><td rowspan=1 colspan=1>5.55%</td><td rowspan=1 colspan=1>4.35%</td><td rowspan=1 colspan=1>28.5%</td><td rowspan=1 colspan=1>17.55%</td><td rowspan=1 colspan=1>30.1%</td><td rowspan=1 colspan=1>15.4%</td><td rowspan=1 colspan=1>86.35%</td><td rowspan=1 colspan=1>80.7%</td></tr><tr><td rowspan=5 colspan=1>Fashion-MNIST</td><td rowspan=2 colspan=1>α,β</td><td rowspan=1 colspan=1>α=1.0</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>0.95</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>0.9</td></tr><tr><td rowspan=1 colspan=1>β=0</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.025</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.05</td></tr><tr><td rowspan=1 colspan=1>Accuracy</td><td rowspan=1 colspan=1>79.1%</td><td rowspan=1 colspan=1>79.1%</td><td rowspan=1 colspan=1>%</td><td rowspan=1 colspan=1>79</td><td rowspan=1 colspan=1>4%</td><td rowspan=1 colspan=1>79</td><td rowspan=1 colspan=1>2%</td><td rowspan=1 colspan=1>79.2%</td><td rowspan=1 colspan=1>%</td></tr><tr><td rowspan=1 colspan=1>Success criterion (lo norm)</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.095</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.095</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.09</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.09</td></tr><tr><td rowspan=1 colspan=1>Successrates</td><td rowspan=1 colspan=1>6.85%</td><td rowspan=1 colspan=1>15.45%</td><td rowspan=1 colspan=1>9.3%</td><td rowspan=1 colspan=1>39.75%</td><td rowspan=1 colspan=1>29.35%</td><td rowspan=1 colspan=1>34.25%</td><td rowspan=1 colspan=1>24.65%</td><td rowspan=1 colspan=1>69.95%</td><td rowspan=1 colspan=1>65.2%</td></tr></table>
|
| 308 |
+
|
| 309 |
+
Table 5: Blind-spot attack on MNIST and Fashion-MNIST for robust models by Sinha et al. (2018). Note that we use $\ell _ { 2 }$ distortion for this model as it is the threat model under study in their work.
|
| 310 |
+
|
| 311 |
+
<table><tr><td rowspan=5 colspan=2>MNIST</td><td rowspan=2 colspan=1>α,β</td><td rowspan=1 colspan=1>α=1.0</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>.95</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>0.9</td></tr><tr><td rowspan=1 colspan=1>β=0</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.025</td><td rowspan=1 colspan=2>β=0</td><td rowspan=1 colspan=2>β=0.05</td></tr><tr><td rowspan=1 colspan=1>Accuracy</td><td rowspan=1 colspan=1>98.7%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>5%</td><td rowspan=1 colspan=1>98.6%</td><td rowspan=1 colspan=1>%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>1%</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>4%</td></tr><tr><td rowspan=1 colspan=1>Success criterion (l2 norm)</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.8</td></tr><tr><td rowspan=1 colspan=1>Successrates</td><td rowspan=1 colspan=1>12.2%</td><td rowspan=1 colspan=1>27.05%</td><td rowspan=1 colspan=1>22.95%</td><td rowspan=1 colspan=1>36.15%</td><td rowspan=1 colspan=1>30.9%</td><td rowspan=1 colspan=1>45.25%</td><td rowspan=1 colspan=1>31.55%</td><td rowspan=1 colspan=1>58.9%</td><td rowspan=1 colspan=1>45.6%</td></tr><tr><td rowspan=3 colspan=2>Fashion-MNIST</td><td rowspan=2 colspan=1>α,β</td><td rowspan=1 colspan=1>α=1.0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1.95</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0=</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>β=0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>025</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.05</td></tr><tr><td rowspan=1 colspan=1>NIST</td><td rowspan=1 colspan=1>Accuracy</td><td rowspan=1 colspan=1>88.5%</td><td rowspan=1 colspan=1>88</td><td rowspan=1 colspan=1>3%</td><td rowspan=1 colspan=1>88.</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>88</td><td rowspan=1 colspan=1>%</td><td rowspan=1 colspan=1>87</td><td rowspan=1 colspan=1>8%</td></tr><tr><td rowspan=2 colspan=2></td><td rowspan=1 colspan=1>Success criterion (l2 norm)</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1.8</td></tr><tr><td rowspan=1 colspan=1>Successrates</td><td rowspan=1 colspan=1>31.4%</td><td rowspan=1 colspan=1>46.3%</td><td rowspan=1 colspan=1>41.1%</td><td rowspan=1 colspan=1>58%</td><td rowspan=1 colspan=1>53.3%</td><td rowspan=1 colspan=1>61.2%</td><td rowspan=1 colspan=1>51.8%</td><td rowspan=1 colspan=1>69.1%</td><td rowspan=1 colspan=1>62.85%</td></tr></table>
|
| 312 |
+
|
| 313 |
+

|
| 314 |
+
Figure 12: Blind-spot attacks on Fashion-MNIST and MNIST datasets with scaling and shifting. For each group, the first row contains input images transformed with different scaling and shifting parameter $\alpha , \beta$ $\alpha = 1 . 0 , \beta = 0 . 0$ is the original image) and the second row contains the found adversarial examples. $d$ represents the distortion of adversarial perturbations. For models from Madry et al. (2018) and Kolter $\&$ Wong (2018) we use $\ell _ { \infty }$ norm and for models from Sinha et al. (2018) we use $\ell _ { 2 }$ norm. Adversarial examples for these transformed images can be found with small distortions $d$ .
|
md/train/Hyp3i2xRb/Hyp3i2xRb.md
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OVERCOMING THE VANISHING GRADIENT PROBLEM INPLAIN RECURRENT NETWORKS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Plain recurrent networks greatly suffer from the vanishing gradient problem while Gated Neural Networks (GNNs) such as Long-short Term Memory (LSTM) and Gated Recurrent Unit (GRU) deliver promising results in many sequence learning tasks through sophisticated network designs. This paper shows how we can address this problem in a plain recurrent network by analyzing the gating mechanisms in GNNs. We propose a novel network called the Recurrent Identity Network (RIN) which allows a plain recurrent network to overcome the vanishing gradient problem while training very deep models without the use of gates. We compare this model with IRNNs and LSTMs on multiple sequence modeling benchmarks. The RINs demonstrate competitive performance and converge faster in all tasks. Notably, small RIN models produce $12 \% { - } 6 7 \%$ higher accuracy on the Sequential and Permuted MNIST datasets and reach state-of-the-art performance on the bAbI question answering dataset.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Numerous methods have been proposed for mitigating the vanishing gradient problem including the use of second-order optimization methods (e.g., Hessian-free optimization (Martens & Sutskever, 2011)), specific training schedules (e.g., Greedy Layer-wise training (Schmidhuber, 1992; Hinton et al., 2006; Vincent et al., 2008)), and special weight initialization methods when training on both plain FFNs and RNNs (Glorot & Bengio, 2010; Mishkin & Matas, 2015; Le et al., 2015; Jing et al., 2016; Xie et al., 2017; Jing et al., 2017).
|
| 12 |
+
|
| 13 |
+
Gated Neural Networks (GNNs) also help to mitigate this problem by introducing “gates” to control information flow through the network over layers or sequences. Notable examples include recurrent networks such as Long-short Term Memory (LSTM) (Hochreiter & Schmidhuber, 1997), Gated Recurrent Unit (GRU) (Chung et al., 2014; Cho et al., 2014), and feedforward networks such as Highway Networks (HNs) (Srivastava et al., 2015), and Residual Networks (ResNets) (He et al., 2015). One can successfully train very deep models by employing these models, e.g., ResNets can be trained with over 1,000 layers. It has been demonstrated that removing (lesioning) or reordering (re-shuffling) random layers in deep feedforward GNNs does not noticeable affect the performance of the network (Veit et al., 2016) Noticeably, one interpretation for this effect as given by Greff et al. (2016) is that the functional blocks in HNs or ResNets engage in an Unrolled Iterative Estimate (UIE) of representations and that layers in this block of HNs or ResNets iteratively refine a single set of representations.
|
| 14 |
+
|
| 15 |
+
In this paper, we investigate if the view of Iterative Estimation (IE) can also be applied towards recurrent GNNs (Section 2.1). We present a formal analysis for GNNs by examining a dual gate design common in LSTM and GRU (Section 2.2). The analysis suggests that the use of gates in GNNs encourages the network to learn an identity mapping which can be beneficial in training deep architectures (He et al., 2016; Greff et al., 2016).
|
| 16 |
+
|
| 17 |
+
We propose a new formulation of a plain RNN, called a Recurrent Identity Network (RIN), that is encouraged to learn an identity mapping without the use of gates (Section 2). This network uses ReLU as the activation function and contains a set of non-trainable parameters. This simple yet effective method helps the plain recurrent network to overcome the vanishing gradient problem while it is still able to model long-range dependencies. This network is compared against two competing networks, the IRNN (Le et al., 2015) and LSTM, on several long sequence modeling tasks including the adding problem (Section 3.1), Sequential and Permuted MNIST classification tasks (Section 3.2), and bAbI question answering tasks (Section 3.3). RINs show faster convergence than IRNNs and LSTMs in the early stage of the training phase and reach competitive performance in all benchmarks. Note that the use of ReLU in RNNs usually leads to training instability, and therefore the network is sensitive to training hyperparameters. Our proposed RIN network demonstrates that a plain RNN does not suffer from this problem even with the use of ReLUs as shown in Section 3. We discuss further implications of this network and related work in Section 4.
|
| 18 |
+
|
| 19 |
+
# 2 METHODS
|
| 20 |
+
|
| 21 |
+
# 2.1 ITERATIVE ESTIMATION VIEW IN RNNS
|
| 22 |
+
|
| 23 |
+
Representation learning in RNNs requires that the network build a latent state, which reflects the temporal dependencies over a sequence of inputs. In this section, we explore an interpretation of this process using iterative estimation (IE), a view that is similar to the UIE view for feedforward GNNs. Formally, we characterize this viewpoint in Eq. 1, that is, the expectation of the difference between the hidden activation at step $t$ , $\mathbf { h } _ { t }$ , and the last hidden activation at step $T$ , $\mathbf { h } _ { T }$ , is zero:
|
| 24 |
+
|
| 25 |
+
$$
|
| 26 |
+
\mathbb { E } _ { \mathbf { x } _ { 1 , . . . , T } } \left[ \mathbf { h } _ { t } - \mathbf { h } _ { T } \right] = 0 .
|
| 27 |
+
$$
|
| 28 |
+
|
| 29 |
+
This formulation implies that an RNN layer maintains and updates the same set of representations over the input sequence. Given the fact that the hidden activation at every step is an estimation of the final activation, we derive Eq. 3.
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
\begin{array} { r l } & { \mathbb { E } _ { \mathbf { x } _ { 1 , \ldots , T } } \left[ \mathbf { h } _ { t } - \mathbf { h } _ { T } \right] - \mathbb { E } _ { \mathbf { x } _ { 1 , \ldots , T } } \left[ \mathbf { h } _ { t - 1 } - \mathbf { h } _ { T } \right] = 0 } \\ { \Rightarrow } & { \mathbb { E } _ { \mathbf { x } _ { 1 , \ldots , T } } \left[ \mathbf { h } _ { t } - \mathbf { h } _ { t - 1 } \right] = 0 } \end{array}
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 1: Observation of learning identity mapping in an LSTM model trained on the adding problem task (see Section 3.1). The average estimation error is computed over a batch of 128 samples of the test set. (a) and $\mathbf { ( b ) }$ show the evaluation of Eq. 1 and Eq. 3 respectively. The $\mathbf { X }$ -axis indicates the index of the step that compares with the final output $\mathbf { h } _ { T }$ or its previous step $\mathbf { h } _ { t - 1 }$ .
|
| 37 |
+
|
| 38 |
+
Fig. 1 shows an empirical observation of the IE in the adding problem (experimental details in Section 3.1). Here, we use the Average Estimation Error (AEE) measure (Greff et al., 2016) to quantify the expectation of the difference between two hidden activations. The measured AEEs in Fig. 1 are close to 0 indicating that the LSTM model fulfills the view of IE. The results also suggest that the network learns an identity mapping since the activation levels are similar on average across all recurrent updates. In the next section, we shall show that the use of gates in GNNs encourages the network to learn an identity mapping and whether this analysis can be extended to plain recurrent networks.
|
| 39 |
+
|
| 40 |
+
# 2.2 ANALYSIS OF GNNS
|
| 41 |
+
|
| 42 |
+
Popular GNNs such as LSTM, GRU; and recent variants such as the Phased-LSTM (Neil et al., 2016), and Intersection RNN (Collins et al., 2017), share the same dual gate design following:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\mathbf h _ { t } = \mathbf H _ { t } \odot \mathbf T _ { t } + \mathbf h _ { t - 1 } \odot \mathbf C _ { t }
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where $t \in [ 1 , T ]$ , $\mathbf H _ { t } = \sigma ( \mathbf x _ { t } , \mathbf h _ { t - 1 } )$ represents the hidden transformation, $\mathbf T _ { t } = \tau ( \mathbf x _ { t } , \mathbf h _ { t - 1 } )$ is the transform gate, and $\mathbf { C } _ { t } = \phi ( \mathbf { x } _ { t } , \mathbf { h } _ { t - 1 } )$ is the carry gate. $\sigma , \tau$ and $\phi$ are recurrent layers that have their trainable parameters and activation functions. $\odot$ represents element-wise product operator. Note that $\mathbf { h } _ { t }$ may not be the output activation at the recurrent step $t$ . For example in LSTM, $\mathbf { h } _ { t }$ represents the memory cell state. Typically, the elements of transform gate $\mathbf { T } _ { t , k }$ and carry gate $\mathbf { C } _ { t , k }$ are between 0 (close) and 1 (open), the value indicates the openness of the gate at the $k$ th neuron. Hence, a plain recurrent network is a subcase of Eq. 4 when $\mathbf { T } _ { t } = \mathbf { 1 }$ and $\mathbf { C } _ { t } = \mathbf { 0 }$ .
|
| 49 |
+
|
| 50 |
+
Note that conventionally, the initial hidden activation $\mathbf { h } _ { 0 }$ is 0 to represent a “void state” at the start of computation. For $\mathbf { h } _ { 0 }$ to fit into Eq. 4’s framework, we define an auxiliary state $\mathbf { h } _ { - 1 }$ as the previous state of $\mathbf { h } _ { 0 }$ , and $\mathbf { T } _ { 0 } = \mathbf { 1 }$ , $\mathbf { C } _ { 0 } = \mathbf { 0 }$ . We also define another auxiliary state ${ \bf h } _ { T + 1 } = { \bf h } _ { T }$ , $\mathbf { T } _ { T + 1 } = \mathbf { 0 }$ , and ${ \bf C } _ { T + 1 } = { \bf 1 }$ as the succeeding state of $\mathbf { h } _ { T }$ .
|
| 51 |
+
|
| 52 |
+
Based on the recursive definition in Eq. 4, we can write the final layer output $\mathbf { h } _ { T }$ as follows:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathbf { h } _ { T } = \mathbf { h } _ { 0 } \odot \prod _ { t = 1 } ^ { T } \mathbf { C } _ { t } + \sum _ { t = 1 } ^ { T } \left( \mathbf { H } _ { t } \odot \mathbf { T } _ { t } \odot \prod _ { i = t + 1 } ^ { T + 1 } \mathbf { C } _ { i } \right)
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where we use $\prod$ to represent element-wise multiplication over a series of terms.
|
| 59 |
+
|
| 60 |
+
According to Eq. 3, and supposing that Eq. 5 fulfills the Eq. 1, we can use a zero-mean residual $\epsilon _ { t }$ for describing the difference between the outputs of recurrent steps:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { c } { \mathbf { h } _ { t } - \mathbf { h } _ { t - 1 } = \pmb { \epsilon } _ { t } } \\ { \mathbf { \epsilon } _ { \mathbf { \epsilon } _ { 0 } } = \mathbf { 0 } } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
Plugging Eq. 6 into Eq. 5, we get
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
{ \bf h } _ { T } = { \bf h } _ { 0 } + \lambda
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\lambda = \sum _ { t = 1 } ^ { T } \lambda _ { t } = \sum _ { t = 1 } ^ { T } \left( \left( \sum _ { i = 1 } ^ { t } \epsilon _ { i } \right) \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } - \left( \sum _ { i = 0 } ^ { t - 1 } \epsilon _ { i } \right) \odot \prod _ { j = t } ^ { T } \mathbf { C } _ { j } \right)
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
The complete deduction of Eqs. 8–9 is presented in Appendix A. Eq. 8 performs an identity mapping when the carry gate $\mathbf { C } _ { t }$ is always open. In Eq. 9, the term $\textstyle \sum _ { i = 1 } ^ { t } \epsilon _ { i }$ represents “a level of representation that is formed between $\mathbf { h } _ { 1 }$ and $\mathbf { h } _ { t } \mathbf { \Psi } ^ { \mathsf { N } }$ . Moreover, the term $\textstyle \prod _ { j = t } ^ { T } \mathbf { C } _ { j }$ extract the “useful” part of this representation and contribute to the final representation of the recurrent layer. Here, we interpret “useful” as any quantity that helps in minimizing the cost function. Therefore, the contribution, $\lambda _ { t }$ , at each recurrent step, quantifies the representation that is learned in the step $t$ . Furthermore, it is generally believed that a GNN manages and maintains the latent state through the carry gate, such as the forget gate in LSTM. If the carry gate is closed, then it is impossible for the old state to be preserved while undergoing recurrent updates. However, if we set $\mathbf { C } _ { t } = \mathbf { 0 }$ , $t \in [ 1 , T ]$ in Eq. 9, we get:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
{ \mathbf { h } } _ { T } = { \mathbf { h } } _ { 0 } + \sum _ { t = 1 } ^ { T } \epsilon _ { t }
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
If $\mathbf { h } _ { 0 } = \mathbf { 0 }$ (void state at the start), we can turn Eq. 10 into:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
{ \mathbf h } _ { T } = { \mathbf \epsilon } _ { 1 } + \sum _ { t = 2 } ^ { T } { \boldsymbol { \epsilon } } _ { t } = { \mathbf h } _ { 1 } + \sum _ { t = 2 } ^ { T } { \boldsymbol { \epsilon } } _ { t }
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
Eq. 11 shows that the state can be preserved without the help of the carry gate. This result indicates that it is possible for a plain recurrent network to learn an identity mapping as well.
|
| 91 |
+
|
| 92 |
+
# 2.3 RECURRENT IDENTITY NETWORKS
|
| 93 |
+
|
| 94 |
+
Motivated by the previous iterative estimation interpretation of RNNs, we formulate a novel plain recurrent network variant — Recurrent Identity Network (RIN):
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\begin{array} { r l } & { \mathbf { h } _ { t } = \mathrm { R e L U } \left( \mathbf { W } \mathbf { x } _ { t } + \mathbf { U } \mathbf { h } _ { t - 1 } + \mathbf { h } _ { t - 1 } + \mathbf { b } \right) } \\ & { \quad = \mathrm { R e L U } \left( \mathbf { W } \mathbf { x } _ { t } + ( \mathbf { U } + \mathbf { I } ) \mathbf { h } _ { t - 1 } + \mathbf { b } \right) } \end{array}
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where W is the input-to-hidden weight matrix, U is the hidden-to-hidden weight matrix, and I is a non-trainable identity matrix that acts as a “surrogate memory” component. This formulation encourages the network to preserve a copy of the last state by embedding I into the hidden-tohidden weights. This “surrogate memory” component maintains the representation encoded in the past recurrent steps.
|
| 101 |
+
|
| 102 |
+
# 3 RESULTS
|
| 103 |
+
|
| 104 |
+
In this section, we compare the performances of the RIN, IRNN, and LSTM in a set of tasks that require modeling long-range dependencies.
|
| 105 |
+
|
| 106 |
+
# 3.1 THE ADDING PROBLEM
|
| 107 |
+
|
| 108 |
+
The adding problem is a standard task for examining the capability of RNNs for modeling longrange dependencies (Hochreiter & Schmidhuber, 1997). In this task, two numbers are randomly selected from a long sequence. The network has to predict the sum of these two numbers. The task becomes challenging as the length of the sequence $T$ increases because the relevant numbers can be far from each other in a long sequence. We report experimental results from three datasets that have sequence lengths of $T _ { 1 } = 2 0 0$ , $T _ { 2 } = 3 0 0$ , and $T _ { 3 } = 4 0 0$ respectively. Each dataset has 100,000 training samples and 10,000 testing samples. Each sequence of a dataset has $T _ { i }$ numbers that are randomly sampled from a uniform distribution in $[ 0 , 1 ]$ . Each sequence is accompanied by a mask that indicates the two chosen random positions.
|
| 109 |
+
|
| 110 |
+

|
| 111 |
+
Figure 2: Mean Squared Error (MSE) plots during the testing phase of the adding problem task for different sequence lengths. The errors are presented in log scale. LSTM performs the worst in all three tasks. RIN and IRNN models are comparable in (a) and (b), and (c).
|
| 112 |
+
|
| 113 |
+
We compare the performance between RINs, IRNNs, and LSTMs using the same experimental settings. Each network has one hidden layer with 100 hidden units. Note that a LSTM has four times more parameters than corresponding RIN and IRNN models. The optimizer minimizes the Mean Squared Error (MSE) between the target sum and the predicted sum. We initially used the RMSprop (Tieleman & Hinton, 2012) optimizer. However, some IRNN models failed to converge using this optimizer. Therefore, we chose the Adam optimizer (Kingma & Ba, 2014) so a fair comparison can be made between the different networks. The batch size is 32. Gradient clipping value for all models is 100. The models are trained with maximum 300 epochs until they converged. The initial learning rates are different between the datasets because we found that IRNNs are sensitive to the initial learning rate as the sequence length increases. The learning rates $\alpha _ { 2 0 0 } = 1 0 ^ { - 4 }$ , $\alpha _ { 3 0 0 } = 1 0 ^ { - 5 }$ and $\alpha _ { 4 0 0 } = \mathrm { i } 0 ^ { - 6 }$ are applied to $T _ { 1 }$ , $T _ { 2 }$ and $T _ { 3 }$ correspondingly. The input-to-hidden weights of RINs and IRNNs and hidden-to-hidden weights of RINs are initialized using a similar method to Le et al. (2015) where the weights are drawn from a Gaussian distribution $\mathcal { N } ( 0 , 1 0 ^ { - 3 } )$ . The LSTM is initialized with the settings where the input-to-hidden weights use Glorot Uniform (Glorot & Bengio, 2010) and hidden-to-hidden weights use an orthogonal matrix as suggested by Saxe et al.
|
| 114 |
+
|
| 115 |
+
(2013). Bias values for all networks are initialized to 0. No explicit regularization is employed. We do not perform an exhaustive hyperparameter search in these experiments.
|
| 116 |
+
|
| 117 |
+
The baseline MSE of the task is 0.167. This score is achieved by predicting the sum of two numbers as 1 regardless of the input sequence. Fig. 2 shows MSE plots for different test datasets. RINs and IRNNs reached the same level of performance in all experiments, and LSTMs performed the worst. Notably, LSTM fails to converge in the dataset with $T _ { 3 } = 4 0 0$ . The use of ReLU in RINs and IRNNs causes some degree of instability in the training phase. However, in most cases, RINs converge faster and are more stable than IRNNs (see training loss plots in Fig. 5 of Appendix B). Note that because IRNNs are sensitive to the initial learning rate, applying high learning rates such as $\alpha = 1 0 ^ { - 3 }$ for $T _ { 2 }$ and $T _ { 3 }$ could cause the training of the network to fail.
|
| 118 |
+
|
| 119 |
+
# 3.2 SEQUENTIAL AND PERMUTED MNIST
|
| 120 |
+
|
| 121 |
+
Sequential and Permuted MNIST are introduced by Le et al. (2015) for evaluating RNNs. Sequential MNIST presents each pixel of the MNIST handwritten image (Lecun et al., 1998) to the network sequentially (e.g., from the top left corner of the image to the bottom right corner of the image). After the network has seen all $2 8 \times 2 8 = 7 8 4$ pixels, the network produces the class of the image. This task requires the network to model a very long sequence that has 784 steps. Permuted MNIST is an even harder task than the Sequential MNIST in that a fixed random index permutation is applied to all images. This random permutation breaks the association between adjacent pixels. The network is expected to find the hidden relations between pixels so that it can correctly classify the image.
|
| 122 |
+
|
| 123 |
+
All networks are trained with the RMSprop optimizer (Tieleman & Hinton, 2012) and a batch size of 128. The networks are trained with maximum 500 epochs until they are converged. The initial learning rate is set to $\alpha = 1 0 ^ { - 6 }$ . Weight initialization follows the same setup as Section 3.1. No explicit regularization is added.
|
| 124 |
+
|
| 125 |
+
Table 1 summarizes the accuracy performance of the networks on the Sequential and Permuted MNIST datasets. For small network sizes (1–100, 1–200), RINs outperform IRNNs in their accuracy performance. For bigger networks, RINs and IRNNs achieve similar performance; however, RINs converge much faster than IRNNs in the early stage of training (see Fig. 3). LSTMs perform the worst on both tasks in terms of both convergence speed and final accuracy. Appendix C presents the full experimental results.
|
| 126 |
+
|
| 127 |
+
To investigate the limit of RINs, we adopted the concept of Deep Transition (DT) Networks (Pascanu et al., 2013) for increasing the implicit network depth. In this extended RIN model called RINDT, each recurrent step performs two hidden transitions instead of one (the formulation is given in Appendix D). The network modification increases the inherent depth by a factor of two. The results showed that the error signal could survive $7 8 4 \times 2 = 1 5 6 8$ computation steps in RIN-DTs.
|
| 128 |
+
|
| 129 |
+
In Fig. 4, we show the evidence of learning identity mapping empirically by collecting the hidden activation from all recurrent steps and evaluating Eqs. 1 and 3. The network matches the IE when AEE is close to zero. We also compute the variance of the difference between two recurrent steps. Fig. 4(a) suggests that all networks bound the variance across recurrent steps. Fig. 4(b) offers a closer perspective where it measures the AEE between two adjacent steps. The levels of activations for all networks are always kept the same on an average, which is an evidence of learning identity mapping. We also observed that the magnitude of the variance becomes significantly larger at the last 200 steps in IRNN and RIN. Repeated application of ReLU may cause this effect during recurrent update (Jastrzebski et al., 2017). Other experiments in this section exhibit similar behaviors, complete results are shown in Appendix C (Fig. 8–12). Note that this empirical analysis only demonstrates that the tested RNNs have the evidence of learning identity mapping across recurrent updates as RINs and IRNNs largely fulfill the view of IE. We do not over-explain the relationship between this analysis and the performance of the network.
|
| 130 |
+
|
| 131 |
+
Table 1: Accuracies of RINs, IRNNs and LSTM on Sequential and Permuted MNIST. The network type is represented by No. layers-No. units, e.g., 3–100 means that the network has 3 layers and each layer has 100 hidden units. The LSTM results matches with Le et al. (2015)
|
| 132 |
+
|
| 133 |
+
<table><tr><td>Network Type</td><td colspan="3">Sequential MNIST</td><td colspan="3">Permuted MNIST</td></tr><tr><td></td><td>RIN</td><td>IRNN</td><td>LSTM</td><td>RIN</td><td>IRNN</td><td>LSTM</td></tr><tr><td>1-100</td><td>91.64%</td><td>83.55%</td><td>24.10%</td><td>78.89%</td><td>62.11%</td><td>28.49%</td></tr><tr><td>1-200</td><td>94.60%</td><td>92.86%</td><td>47.13%</td><td>85.03%</td><td>73.73%</td><td>30.63%</td></tr><tr><td>2-100</td><td>93.69%</td><td>92.15%</td><td>39.50%</td><td>83.37%</td><td>76.31%</td><td>41.31%</td></tr><tr><td>2-200</td><td>94.82%</td><td>94.78%</td><td>22.27%</td><td>85.31%</td><td>83.78%</td><td>55.44%</td></tr><tr><td>3-100</td><td>94.15%</td><td>94.03%</td><td>54.98%</td><td>84.15%</td><td>78.78%</td><td>38.61%</td></tr><tr><td>3-200</td><td>95.19%</td><td>95.05%</td><td>61.20%</td><td>83.41%</td><td>84.24%</td><td>53.29%</td></tr><tr><td></td><td>RIN-DT</td><td></td><td></td><td>RIN-DT</td><td></td><td></td></tr><tr><td>1-100</td><td>95.41%</td><td></td><td></td><td>86.23%</td><td></td><td></td></tr></table>
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 3: Results for network type 1–200. (a) and (b) show the loss and accuracy curves on Sequential MNIST; (c) and (d) present the loss and accuracy curves on Permuted MNIST. RINs and RIN-DTs converge much faster than IRNNs and LSTMs in the early stage of training (first 100 epochs) and achieve a better final accuracy.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 4: Evidence of learning identity mapping in RIN, IRNN and LSTM for network type 1–200 over a batch of 128 samples. (a) evaluates Eq. 1 and $\mathbf { ( b ) }$ evaluates Eq. 3. The $\mathbf { X }$ -axis indicates the index of the step that compares with the final output $\mathbf { h } _ { T }$ or its previous step $\mathbf { h } _ { t - 1 }$ , and $_ \textrm { y }$ -axis represents the average estimation error (AEE).
|
| 140 |
+
|
| 141 |
+
# 3.3 BABI QUESTION ANSWERING TASKS
|
| 142 |
+
|
| 143 |
+
The bAbI dataset provides 20 question answering tasks that measure the understanding of language and the performance of reasoning in neural networks (Weston et al., 2015). Each task consists of 1,000 training samples and 1,000 test samples. A sample consists of three parts: a list of statements, a question and an answer (examples in Table 2). The answer to the question can be inferred from the statements that are logically organized together.
|
| 144 |
+
|
| 145 |
+
Table 2: Examples of bAbI tasks.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Statements: Mary went to the office. Then she journeyed to the garden.</td><td>Statements:</td><td>The red square is below the blue square. The red square is to the left of the pink rectangle.</td></tr><tr><td>Question: Answer:</td><td>Where is Mary? Garden.</td><td>Question: Answer:</td><td>Is the blue square below the pink rectangle? No.</td></tr></table>
|
| 148 |
+
|
| 149 |
+
We compare the performance of the RIN, IRNN, and LSTM on these tasks. All networks follow a network design where the network firstly embeds each word into a vector of 200 dimensions. The statements are then appended together to a single sequence and encoded by a recurrent layer while another recurrent layer encodes the question sequence. The outputs of these two recurrent layers are concatenated together, and this concatenated sequence is then passed to a different recurrent layer for decoding the answer. Finally, the network predicts the answer via a softmax layer. The recurrent layers in all networks have 100 hidden units. This network design roughly follows the architecture presented in Jing et al. (2017). The initial learning rates are set to $\alpha = 1 0 ^ { - 3 }$ for RINs and LSTMs and $\alpha = 1 0 ^ { - 4 }$ for IRNNs because IRNNs fail to converge with a higher learning rate on many tasks. We chose the Adam optimizer over the RMSprop optimizer because of the same reasons as in the adding problem. The batch size is 32. Each network is trained for maximum 100 epochs until the network converges. The recurrent layers in the network follow the same initialization steps as in Section 3.1.
|
| 150 |
+
|
| 151 |
+
The results in Table 3 show that RINs can reach mean performance similar to the state-of-theart performance reported in Jing et al. (2017). As discussed in Section 3.1, the use of ReLU as the activation function can lead to instability during training of IRNN for tasks that have lengthy statements (e.g.. 3-Three Supporting Facts, 5-Three Arg. Relations).
|
| 152 |
+
|
| 153 |
+
Table 3: Test accuracy $( \% )$ of 20 bAbI Question Answering Tasks.
|
| 154 |
+
|
| 155 |
+
<table><tr><td>Task</td><td>RIN</td><td>IRNN</td><td>LSTM</td><td>Jing et al. (2017)</td><td>Weston et al. (2015)</td></tr><tr><td>1: Single Supporting Fact</td><td>51.9</td><td>48.4</td><td>50.3</td><td>48.2</td><td>50</td></tr><tr><td>2: Two Supporting Facts</td><td>18.7</td><td>18.7</td><td>19</td><td>15.8</td><td>20</td></tr><tr><td>3: Three Supporting Facts</td><td>18.5</td><td>15.3</td><td>22.9</td><td>19.1</td><td>20</td></tr><tr><td>4: Two Arg.Relations</td><td>71.2</td><td>72.6</td><td>71.6</td><td>75.8</td><td>61</td></tr><tr><td>5: Three Arg. Relations</td><td>16.4</td><td>18.9</td><td>36.4</td><td>33.7</td><td>70</td></tr><tr><td>6:Yes/No Questions</td><td>50.3</td><td>50.3</td><td>52.3</td><td>49</td><td>48</td></tr><tr><td>7: Counting</td><td>48.8</td><td>48.8</td><td>48.9</td><td>48</td><td>49</td></tr><tr><td>8:Lists/Sets</td><td>33.6</td><td>33.6</td><td>33.6</td><td>33.6</td><td>45</td></tr><tr><td>9: Simple Negation</td><td>64.6</td><td>64.7</td><td>63.8</td><td>63.2</td><td>64</td></tr><tr><td>10: Indefinite Knowledge</td><td>45.1</td><td>43.7</td><td>45.1</td><td>43.9</td><td>44</td></tr><tr><td>11:Basic Coreference</td><td>71.6</td><td>67.8</td><td>78.4</td><td>68.8</td><td>72</td></tr><tr><td>12:Conjunction</td><td>70.6</td><td>71.4</td><td>75.3</td><td>73</td><td>74</td></tr><tr><td>13: Compound Coref.</td><td>94.4</td><td>94.2</td><td>94.4</td><td>93.9</td><td>94</td></tr><tr><td>14:Time Reasoning</td><td>36.7</td><td>17.6</td><td>23.2</td><td>19.7</td><td>27</td></tr><tr><td>15:Basic Deduction</td><td>54.8</td><td>54.1</td><td>26.7</td><td>54.9</td><td>21</td></tr><tr><td>16:Basic Induction</td><td>48.8</td><td>49</td><td>25.8</td><td>46.6</td><td>23</td></tr><tr><td>17: Positional Reasoning</td><td>53.9</td><td>53.4</td><td>52</td><td>60.5</td><td>51</td></tr><tr><td>18:Size Reasoning</td><td>92.6</td><td>46.9</td><td>93</td><td>91.3</td><td>52</td></tr><tr><td>19: Path Finding</td><td>10.5</td><td>10.9</td><td>9.9</td><td>10</td><td>8</td></tr><tr><td>20:Agent’s Motivations</td><td>98</td><td>98.2</td><td>97.3</td><td>97.4</td><td>91</td></tr><tr><td>Mean Performance</td><td>52.6</td><td>48.9</td><td>51.0</td><td>52.3</td><td>49.2</td></tr></table>
|
| 156 |
+
|
| 157 |
+
# 4 DISCUSSION
|
| 158 |
+
|
| 159 |
+
In this paper, we discussed the iterative representation refinement in RNNs and how this viewpoint could help in learning identity mapping. Under this observation, we demonstrated that the contribution of each recurrent step a GNN can be jointly determined by the representation that is formed up to the current step, and the openness of the carry gate in later recurrent updates. Note in Eq. 9, the element-wise multiplication of $\mathbf { C } _ { t } \mathbf { s }$ selects the encoded representation that could arrive at the output of the layer. Thus, it is possible to embed a special function in $\mathbf { C } _ { t } \mathbf { s }$ so that they are sensitive to certain pattern of interests. For example, in Phased LSTM, the time gate is inherently interested in temporal frequency selection (Neil et al., 2016).
|
| 160 |
+
|
| 161 |
+
Motivated by the analysis presented in Section 2, we propose a novel plain recurrent network variant, the Recurrent Identity Network (RIN), that can model long-range dependencies without the use of gates. Compared to the conventional formulation of plain RNNs, the formulation of RINs only adds a set of non-trainable weights to represent a “surrogate memory” component so that the learned representation can be maintained across two recurrent steps.
|
| 162 |
+
|
| 163 |
+
Experimental results in Section 3 show that RINs are competitive against other network models such as IRNNs and LSTMs. Particularly, small RINs produce $12 \% { - } 6 7 \%$ higher accuracy in the Sequential and Permuted MNIST. Furthermore, RINs demonstrated much faster convergence speed in early phase of training, which is a desirable advantage for platforms with limited computing resources. RINs work well without advanced methods of weight initializations and are relatively insensitive to hyperparameters such as learning rate, batch size, and selection of optimizer. This property can be very helpful when the time available for choosing hyperparameters is limited. Note that we do not claim that RINs outperform LSTMs in general because LSTMs may achieve comparable performance with finely-tuned hyperparameters.
|
| 164 |
+
|
| 165 |
+
The use of ReLU in RNNs might be counterintuitive at first sight because the repeated application of this activation is more likely causing gradient explosion than conventional choices of activation function, such as hyperbolic tangent (tanh) function or sigmoid function. Although the proposed IRNN (Le et al., 2015) reduces the problem by the identity initialization, in our experiments, we usually found that IRNN is more sensitive to training parameters and more unstable than RINs and LSTMs. On the contrary, feedforward models that use ReLU usually produce better results and converge faster than FFNs that use the tanh or sigmoid activation function. In this paper, we provide a promising method of using ReLU in RNNs so that the network is less sensitive to the training conditions. The experimental results also support the argument that the use of ReLU significantly speeds up the convergence.
|
| 166 |
+
|
| 167 |
+
During the development of this paper, a recent independent work (Zagoruyko & Komodakis, 2017) presented a similar network formulation with a focus on training of deep plain FFNs without skip connections. DiracNet uses the idea of ResNets where it assumes that the identity initialization can replace the role of the skip-connection in ResNets. DiracNet employed a particular kind of activation function — negative concatenated ReLU (NCReLU), and this activation function allows the layer output to approximate the layer input when the expectation of the weights are close to zero. In this paper, we showed that an RNN can be trained without the use of gates or special activation functions, which complements the findings and provides theoretical basis in Zagoruyko & Komodakis (2017).
|
| 168 |
+
|
| 169 |
+
We hope to see more empirical and theoretical insights that explains the effectiveness of the RIN by simply embedding a non-trainable identity matrix. In future, we will investigate the reasons for the faster convergence speed of the RIN during training. Furthermore, we will investigate why RIN can be trained stably with the repeated application of ReLU and why it is less sensitive to training parameters than the two other models.
|
| 170 |
+
|
| 171 |
+
# REFERENCES
|
| 172 |
+
|
| 173 |
+
Kyunghyun Cho, Bart van Merrienboer, C¸ aglar Gulc¸ehre, Fethi Bougares, Holger Schwenk, and ¨ Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. CoRR, abs/1406.1078, 2014.
|
| 174 |
+
|
| 175 |
+
Junyoung Chung, C¸ aglar Gulc¸ehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of ¨ gated recurrent neural networks on sequence modeling. CoRR, abs/1412.3555, 2014.
|
| 176 |
+
|
| 177 |
+
Jasmine Collins, Jascha Sohl-Dickstein, and David Sussillo. Capacity and trainability in recurrent neural networks. In 5th International Conference on Learning Representations, Palais des Congres Neptune, Toulon, France, 2017. \`
|
| 178 |
+
|
| 179 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Yee Whye Teh and Mike Titterington (eds.), Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pp. 249–256, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR.
|
| 180 |
+
|
| 181 |
+
Klaus Greff, Rupesh Kumar Srivastava, and Jurgen Schmidhuber. Highway and residual networks ¨ learn unrolled iterative estimation. CoRR, abs/1612.07771, 2016.
|
| 182 |
+
|
| 183 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015.
|
| 184 |
+
|
| 185 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity Mappings in Deep Residual Networks, pp. 630–645. Springer International Publishing, Cham, 2016. ISBN 978-3-319-46493- 0.
|
| 186 |
+
|
| 187 |
+
Geoffrey E. Hinton, Simon Osindero, and Yee-Whye Teh. A fast learning algorithm for deep belief nets. Neural Comput., 18(7):1527–1554, July 2006. ISSN 0899-7667.
|
| 188 |
+
|
| 189 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, November 1997. ISSN 0899-7667.
|
| 190 |
+
|
| 191 |
+
S. Jastrzebski, D. Arpit, N. Ballas, V. Verma, T. Che, and Y. Bengio. Residual Connections Encourage Iterative Inference. CoRR, abs/1710.04773, October 2017.
|
| 192 |
+
|
| 193 |
+
Li Jing, Yichen Shen, Tena Dubcek, John Peurifoy, Scott A. Skirlo, Max Tegmark, and Marin Soljacic. Tunable efficient unitary neural networks (EUNN) and their application to RNN. CoRR, abs/1612.05231, 2016.
|
| 194 |
+
|
| 195 |
+
Li Jing, Cagla Gulcehre, John Peurifoy, Yichen Shen, Max Tegmark, Marin Soljaciˇ c, and Yoshua ´ Bengio. Gated Orthogonal Recurrent Units: On Learning to Forget. CoRR, abs/1706.02761, 2017.
|
| 196 |
+
|
| 197 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2014.
|
| 198 |
+
|
| 199 |
+
Quoc V. Le, Navdeep Jaitly, and Geoffrey E. Hinton. A simple way to initialize recurrent networks of rectified linear units. CoRR, abs/1504.00941, 2015.
|
| 200 |
+
|
| 201 |
+
Yann Lecun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, Nov 1998. ISSN 0018-9219. doi: 10.1109/5.726791.
|
| 202 |
+
|
| 203 |
+
James Martens and Ilya Sutskever. Learning recurrent neural networks with hessian-free optimization. In Proceedings of the 28th International Conference on Machine Learning, ICML 2011, Bellevue, Washington, USA, June 28 - July 2, 2011, pp. 1033–1040, 2011.
|
| 204 |
+
|
| 205 |
+
Dmytro Mishkin and Jiri Matas. All you need is a good init. CoRR, abs/1511.06422, 2015.
|
| 206 |
+
|
| 207 |
+
Daniel Neil, Michael Pfeiffer, and Shih-Chii Liu. Phased lstm: Accelerating recurrent network training for long or event-based sequences. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 3882–3890. Curran Associates, Inc., 2016.
|
| 208 |
+
|
| 209 |
+
Razvan Pascanu, C¸ aglar Gulc¸ehre, Kyunghyun Cho, and Yoshua Bengio. How to construct deep ¨ recurrent neural networks. CoRR, abs/1312.6026, 2013.
|
| 210 |
+
|
| 211 |
+
Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. CoRR, abs/1312.6120, 2013.
|
| 212 |
+
|
| 213 |
+
Jurgen Schmidhuber. Learning complex, extended sequences using the principle of history com-¨ pression. Neural Computation, 4(2):234–242, March 1992. ISSN 0899-7667.
|
| 214 |
+
|
| 215 |
+
Rupesh K Srivastava, Klaus Greff, and Juergen Schmidhuber. Training very deep networks. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2377–2385. Curran Associates, Inc., 2015.
|
| 216 |
+
|
| 217 |
+
Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
|
| 218 |
+
|
| 219 |
+
Andreas Veit, Michael J. Wilber, and Serge J. Belongie. Residual networks are exponential ensembles of relatively shallow networks. CoRR, abs/1605.06431, 2016.
|
| 220 |
+
|
| 221 |
+
Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th International Conference on Machine Learning, ICML ’08, pp. 1096–1103, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-205-4.
|
| 222 |
+
|
| 223 |
+
Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. Towards ai-complete question answering: A set of prerequisite toy tasks. CoRR, abs/1502.05698, 2015.
|
| 224 |
+
|
| 225 |
+
Di Xie, Jiang Xiong, and Shiliang Pu. All you need is beyond a good init: Exploring better solution for training extremely deep convolutional neural networks with orthonormality and modulation. CoRR, abs/1703.01827, 2017.
|
| 226 |
+
|
| 227 |
+
Sergey Zagoruyko and Nikos Komodakis. DiracNets: Training Very Deep Neural Networks Without Skip-Connections. CoRR, abs/1706.00388, 2017.
|
| 228 |
+
|
| 229 |
+
# A ALGEBRA OF EQS. 8–9
|
| 230 |
+
|
| 231 |
+
Popular GNNs such as LSTM, GRU; and recent variants such as the Phased-LSTM (Neil et al., 2016), and Intersection RNN (Collins et al., 2017), share the same dual gate design described as follows:
|
| 232 |
+
|
| 233 |
+
$$
|
| 234 |
+
\mathbf h _ { t } = \mathbf H _ { t } \odot \mathbf T _ { t } + \mathbf h _ { t - 1 } \odot \mathbf C _ { t }
|
| 235 |
+
$$
|
| 236 |
+
|
| 237 |
+
where $t \in [ 1 , T ]$ , $\mathbf H _ { t } = \sigma ( \mathbf x _ { t } , \mathbf h _ { t - 1 } )$ represents the hidden transformation, $\mathbf T _ { t } = \tau ( \mathbf x _ { t } , \mathbf h _ { t - 1 } )$ is the transform gate, and $\mathbf { C } _ { t } = \phi ( \mathbf { x } _ { t } , \mathbf { h } _ { t - 1 } )$ is the carry gate. $\sigma , \tau$ and $\phi$ are recurrent layers that have their trainable parameters and activation functions. $\odot$ represents element-wise product operator. Note that $\mathbf { h } _ { t }$ may not be the output activation at the recurrent step $t$ . For example in LSTM, $\mathbf { h } _ { t }$ represents the memory cell state. Typically, the elements of transform gate $\mathbf { T } _ { t , k }$ and carry gate $\mathbf { C } _ { t , k }$ are between 0 (close) and 1 (open), the value indicates the openness of the gate at the $k$ th neuron. Hence, a plain recurrent network is a subcase of Eq. 14 when $\mathbf { T } _ { t } = \mathbf { 1 }$ and $\mathbf { C } _ { t } = \mathbf { 0 }$ .
|
| 238 |
+
|
| 239 |
+
Note that conventionally, the initial hidden activation $\mathbf { h } _ { 0 }$ is 0 to represent a “void state” at the start of computation. For $\mathbf { h } _ { 0 }$ to fit into Eq. 4’s framework, we define an auxiliary state $\mathbf { h } _ { - 1 }$ as the previous state of $\mathbf { h } _ { 0 }$ , and $\mathbf { T } _ { 0 } = \mathbf { 1 }$ , $\mathbf { C } _ { 0 } = \mathbf { 0 }$ . We also define another auxiliary state ${ \bf h } _ { T + 1 } = { \bf h } _ { T }$ , $\mathbf { T } _ { T + 1 } = \mathbf { 0 }$ , and ${ \bf C } _ { T + 1 } = { \bf 1 }$ as the succeeding state of $\mathbf { h } _ { T }$ .
|
| 240 |
+
|
| 241 |
+
Based on the recursive definition in Eq. 4, we can write the final layer output $\mathbf { h } _ { T }$ as follows:
|
| 242 |
+
|
| 243 |
+
$$
|
| 244 |
+
\mathbf { h } _ { T } = \mathbf { h } _ { 0 } \odot \prod _ { t = 1 } ^ { T } \mathbf { C } _ { t } + \sum _ { t = 1 } ^ { T } \left( \mathbf { H } _ { t } \odot \mathbf { T } _ { t } \odot \prod _ { i = t + 1 } ^ { T + 1 } \mathbf { C } _ { i } \right)
|
| 245 |
+
$$
|
| 246 |
+
|
| 247 |
+
where we use $\prod$ to represent element-wise multiplication over a series of terms.
|
| 248 |
+
|
| 249 |
+
According to Eq. 3, and supposing that Eq. 5 fulfills the Eq. 1, we can use a zero-mean residual $\epsilon _ { t }$ for describing the difference between the outputs of recurrent steps:
|
| 250 |
+
|
| 251 |
+
$$
|
| 252 |
+
\begin{array} { c } { \mathbf { h } _ { t } - \mathbf { h } _ { t - 1 } = \pmb { \epsilon } _ { t } } \\ { \mathbf { \epsilon } _ { \mathbf { \epsilon } _ { 0 } } = \mathbf { 0 } } \end{array}
|
| 253 |
+
$$
|
| 254 |
+
|
| 255 |
+
Then we can rewrite Eq. 16 as:
|
| 256 |
+
|
| 257 |
+
$$
|
| 258 |
+
\mathbf { H } _ { t } \odot \mathbf { T } _ { t } + \mathbf { h } _ { t - 1 } \odot \mathbf { C } _ { t } = \mathbf { h } _ { t - 1 } + \epsilon _ { t }
|
| 259 |
+
$$
|
| 260 |
+
|
| 261 |
+
Substituting Eq. 18 into Eq. 15:
|
| 262 |
+
|
| 263 |
+
$$
|
| 264 |
+
\begin{array} { r l } & { \mathbf { h } _ { T } = \mathbf { h } _ { 0 } \odot \displaystyle \prod _ { t = 1 } ^ { T } \mathbf { C } _ { t } + \sum _ { t = 1 } ^ { T } \left( \left( \left( 1 - \mathbf { C } _ { t } \right) \odot \mathbf { h } _ { t - 1 } + \boldsymbol { \epsilon } _ { t } \right) \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } \right) } \\ & { \mathbf { \Theta } = \mathbf { h } _ { 0 } \odot \displaystyle \prod _ { t = 1 } ^ { T } \mathbf { C } _ { t } + \sum _ { t = 1 } ^ { T } \left( \left( \left( 1 - \mathbf { C } _ { t } \right) \odot \left( \mathbf { h } _ { 0 } + \sum _ { i = 1 } ^ { t - 1 } \boldsymbol { \epsilon } _ { i } \right) + \boldsymbol { \epsilon } _ { t } \right) \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } \right) } \end{array}
|
| 265 |
+
$$
|
| 266 |
+
|
| 267 |
+
We can rearrange Eqn. 20 to
|
| 268 |
+
|
| 269 |
+
$$
|
| 270 |
+
\begin{array} { l } { { \displaystyle { \bf h } _ { T } = { \bf h } _ { 0 } \odot \left( \sum _ { t = 0 } ^ { T } ( { \bf 1 } - { \bf C } _ { t } ) \prod _ { i = t + 1 } ^ { T + 1 } { \bf C } _ { i } \right) + \lambda } \ ~ } \\ { { \displaystyle ~ = { \bf h } _ { 0 } \odot \left( { \bf C } _ { T + 1 } - \prod _ { t = 0 } ^ { T + 1 } { \bf C } _ { t } \right) + \lambda } \ ~ } \\ { { \displaystyle ~ = { \bf h } _ { 0 } + \lambda } \ ~ } \end{array}
|
| 271 |
+
$$
|
| 272 |
+
|
| 273 |
+
where
|
| 274 |
+
|
| 275 |
+
$$
|
| 276 |
+
\lambda = \sum _ { t = 1 } ^ { T } \lambda _ { t } = \sum _ { t = 1 } ^ { T } \left( \left( \left( \mathbf { 1 } - \mathbf { C } _ { t } \right) \odot \sum _ { i = 1 } ^ { t - 1 } \epsilon _ { i } + \epsilon _ { t } \right) \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } \right)
|
| 277 |
+
$$
|
| 278 |
+
|
| 279 |
+
The term $\boldsymbol { \lambda }$ in Eq. 23 can be reorganized to,
|
| 280 |
+
|
| 281 |
+
$$
|
| 282 |
+
\begin{array} { l } { { \displaystyle \lambda = \sum _ { t = 1 } ^ { T } \lambda _ { t } = \sum _ { t = 1 } ^ { T } \left( \left( \left( \mathbf { 1 } - \mathbf { C } _ { t } \right) \odot \sum _ { i = 1 } ^ { t - 1 } \epsilon _ { i } + \epsilon _ { t } \right) \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } \right) } } \\ { { \displaystyle ~ = \sum _ { t = 1 } ^ { T } \left( \left( \sum _ { i = 1 } ^ { t } \epsilon _ { i } - \mathbf { C } _ { t } \odot \sum _ { i = 0 } ^ { t - 1 } \epsilon _ { i } \right) \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } \right) } } \\ { { \displaystyle ~ = \sum _ { t = 1 } ^ { T } \left( \sum _ { i = 1 } ^ { t } \epsilon _ { i } \odot \prod _ { j = t + 1 } ^ { T + 1 } \mathbf { C } _ { j } - \sum _ { i = 0 } ^ { t - 1 } \epsilon _ { i } \odot \prod _ { j = t } ^ { T } \mathbf { C } _ { j } \right) } } \end{array}
|
| 283 |
+
$$
|
| 284 |
+
|
| 285 |
+
# B DETAILS IN THE ADDING PROBLEM EXPERIMENTS
|
| 286 |
+
|
| 287 |
+
Fig. 5 presents the MSE plots during the training phase. As we discussed in Section 3.1, the choice of ReLU can occur some degree of instability during the training. Compared to RINs, IRNNs are much more unstable in $T _ { 3 } = 4 0 0$ .
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
Figure 5: Mean Squared Error (MSE) plots for the adding problem with different sequence lengths at training phase. The figures are presented in log scale. All models are trained up to 300 epochs.
|
| 291 |
+
|
| 292 |
+
# C DETAILS IN SEQUENTIAL AND PERMUTED MNIST EXPERIMENTS
|
| 293 |
+
|
| 294 |
+
Fig. 6–7 show all training and testing curves for Sequential and Permuted MNIST experiments.
|
| 295 |
+
RINs and RIN-DTs converge much faster than IRNNs and LSTMs.
|
| 296 |
+
|
| 297 |
+

|
| 298 |
+
Figure 6: (a) and (b) show the training loss and accuracy plots for Sequential MNIST; (c) and (d) present training loss and accuracy plots for Permuted MNIST. We use blue color palette to represent RIN experiments, orange color palette to represent IRNN experiments, purple color palette to represent LSTM experiments and green color palette to represent RIN-DT experiments. RINs and RIN-DTs are much better than IRNNs and LSTMs in the early stage of training (first 200 epochs).
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
Figure 7: (a) and (b) show the test loss and accuracy plots for Sequential MNIST; (c) and (d) present test loss and accuracy plots for Permuted MNIST.
|
| 302 |
+
|
| 303 |
+

|
| 304 |
+
Fig. 8–12 show validation of the Iterative Estimation hypothesis in all network types.
|
| 305 |
+
Figure 8: Evidence of learning identity mapping in RIN, IRNN and LSTM for network type 1–100 over a batch of 128 samples. (a) evaluates Eq. 1 and (b) evaluates Eq. 3.
|
| 306 |
+
|
| 307 |
+

|
| 308 |
+
Figure 9: Evidence of learning identity mapping in RIN, IRNN and LSTM for network type 2–100 over a batch of 128 samples. (a) evaluates Eq. 1 and (b) evaluates Eq. 3.
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
Figure 10: Evidence of learning identity mapping in RIN, IRNN and LSTM for network type 2–200 over a batch of 128 samples. (a) evaluates Eq. 1 and $\mathbf { ( b ) }$ evaluates Eq. 3.
|
| 312 |
+
|
| 313 |
+

|
| 314 |
+
Figure 11: Evidence of learning identity mapping in RIN, IRNN and LSTM for network type 3–100 over a batch of 128 samples. (a) evaluates Eq. 1 and $\mathbf { ( b ) }$ evaluates Eq. 3.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 12: Evidence of learning identity mapping in RIN, IRNN and LSTM for network type 3–200 over a batch of 128 samples. (a) evaluates Eq. 1 and $\mathbf { ( b ) }$ evaluates Eq. 3.
|
| 318 |
+
|
| 319 |
+
# D RINS WITH DEEP TRANSITIONS
|
| 320 |
+
|
| 321 |
+
In Section 3.2, we tested an additional model for RINs, which takes the concept of Deep Transition Networks (DTNs) Pascanu et al. (2013). Instead of stacking the recurrent layers, DTNs add multiple nonlinear transitions in a single recurrent step. This modification massively increases the depth of the network. In our RIN-DTs, the number of transition per recurrent step is two. Because the length of the sequence for Sequential and Permuted MNIST tasks is 784, RIN-DTs have the depth of $7 8 4 \times 2 = 1 5 6 8$ . The recurrent layer is defined in Eqs. 26–27.
|
| 322 |
+
|
| 323 |
+
$$
|
| 324 |
+
\begin{array} { r l } & { \hat { \mathbf { h } } _ { t } = f ( \mathbf { W } _ { 1 } \mathbf { x } _ { t } + ( \mathbf { U } _ { 1 } + \mathbf { I } ) \mathbf { h } _ { t - 1 } + \mathbf { b } _ { 1 } ) } \\ & { \mathbf { h } _ { t } = f ( ( \mathbf { U } _ { 2 } + \mathbf { I } ) \hat { \mathbf { h } } _ { t } + \mathbf { b } _ { 2 } ) } \end{array}
|
| 325 |
+
$$
|
md/train/HyxAfnA5tm/HyxAfnA5tm.md
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEEP ONLINE LEARNING VIA META-LEARNING:CONTINUAL ADAPTATION FOR MODEL-BASED RL
|
| 2 |
+
|
| 3 |
+
Anusha Nagabandi, Chelsea Finn & Sergey Levine University of California, Berkeley {nagaban2,cbfinn,svlevine}@berkeley.edu
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Humans and animals can learn complex predictive models that allow them to accurately and reliably reason about real-world phenomena, and they can adapt such models extremely quickly in the face of unexpected changes. Deep neural network models allow us to represent very complex functions, but lack this capacity for rapid online adaptation. The goal in this paper is to develop a method for continual online learning from an incoming stream of data, using deep neural network models. We formulate an online learning procedure that uses stochastic gradient descent to update model parameters, and an expectation maximization algorithm with a Chinese restaurant process prior to develop and maintain a mixture of models to handle non-stationary task distributions. This allows for all models to be adapted as necessary, with new models instantiated for task changes and old models recalled when previously seen tasks are encountered again. Furthermore, we observe that meta-learning can be used to meta-train a model such that this direct online adaptation with SGD is effective, which is otherwise not the case for large function approximators. In this work, we apply our meta-learning for online learning (MOLe) approach to model-based reinforcement learning, where adapting the predictive model is critical for control; we demonstrate that MOLe outperforms alternative prior methods, and enables effective continuous adaptation in non-stationary task distributions such as varying terrains, motor failures, and unexpected disturbances. Videos available at: https://sites.google.com/berkeley.edu/onlineviameta
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Human and animal learning is characterized not just by a capacity to acquire complex skills, but also the ability to adapt rapidly when those skills must be carried out under new or changing conditions. For example, animals can quickly adapt to walking and running on different surfaces (Herman, 2017) and humans can easily modulate force during reaching movements in the presence of unexpected perturbations (Flanagan & Wing, 1993). Furthermore, these experiences are remembered, and can be recalled to adapt more quickly when similar disturbances occur in the future (Doyon & Benali, 2005). Since learning entirely new models on such short time-scales is impractical, we can devise algorithms that explicitly train models to adapt quickly from small amounts of data. Such online adaptation is crucial for intelligent systems operating in the real world, where changing factors and unexpected perturbations are the norm. In this paper, we propose an algorithm for fast and continuous online learning that utilizes deep neural network models to build and maintain a task distribution, allowing for the natural development of both generalization as well as task specialization.
|
| 12 |
+
|
| 13 |
+
Our working example is continuous adaptation in the model-based reinforcement learning setting, though our approach generally addresses any online learning scenario with streaming data. We assume that each “trial” consists of multiple tasks, and that the delineation between the tasks is not provided explicitly to the learner – instead, the method must adaptively decide what “tasks” even represent, when to instantiate new tasks, and when to continue updating old ones. For example, a robot running over changing terrain might need to handle uphill and downhill slopes, and might choose to maintain separate models that become specialized to each slope, adapting to each one in turn based on the currently inferred surface.
|
| 14 |
+
|
| 15 |
+
We perform adaptation simply by using online stochastic gradient descent (SGD) on the model parameters, while maintaining a mixture model over model parameters for different tasks. The mixture is updated via the Chinese restaurant process (Stimberg et al., 2012), which enables new tasks to be instantiated as needed over the course of a trial. Although online learning is perhaps one of the oldest applications of SGD (Bottou, 1998), modern parametric models such as deep neural networks are exceedingly difficult to train online with this method. They typically require mediumsized minibatches and multiple epochs to arrive at sensible solutions, which is not suitable when receiving data in an online streaming setting. One of our key observations is that meta-learning can be used to learn a prior initialization for the parameters that makes such direct online adaptation feasible, with only a handful of gradient steps. The meta-training procedure we use is based on model-agnostic meta-learning (MAML) (Finn et al., 2017), where a prior weight initialization is learned for a model so as to optimize improvement on any task from a meta-training task distribution after a small number of gradient steps.
|
| 16 |
+
|
| 17 |
+
Meta-learning with MAML has previously been extended to model-based RL (Nagabandi et al., 2018), but only for the $k$ -shot adaptation setting: The meta-learned prior model is adapted to the $k$ most recent time steps, but the adaptation is not carried forward in time (i.e., adaptation is always performed from the prior itself). This rigid batch-mode setting is restrictive in an online learning setup and is insufficient for tasks that are further outside of the training distribution. A more natural formulation is one where the model receives a continuous stream of data and must adapt online to a potentially non-stationary task distribution. This requires both fast adaptation and the ability to recall prior tasks, as well as an effective adaptation strategy to interpolate as needed between the two.
|
| 18 |
+
|
| 19 |
+
The primary contribution of this paper is a meta-learning for online learning (MOLe) algorithm that uses expectation maximization, in conjunction with a Chinese restaurant process prior on the task distribution, to learn mixtures of neural network models that are each updated with online SGD. In contrast to prior multi-task and meta-learning methods, our method’s online assignment of soft task probabilities allows for task specialization to emerge naturally, without requiring task delineations to be specified in advance. We evaluate MOLe in the context of model-based RL on a suite of challenging simulated robotic tasks including disturbances, environmental changes, and simulated motor failures. Our simulated experiments show a half-cheetah agent and a hexapedal crawler robot performing continuous model adaptation in an online setting. Our results show online instantiation of new tasks, the ability to adapt to out-of-distribution tasks, and the ability to recognize and revert back to prior tasks. Additionally, we demonstrate that MOLe outperforms a state-of-the-art prior method that does $k$ -shot model-based meta-RL, as well as natural baselines such as continuous gradient updates for adaptation and online learning without meta-training.
|
| 20 |
+
|
| 21 |
+
# 2 RELATED WORK
|
| 22 |
+
|
| 23 |
+
Online learning is one of the oldest subfields of machine learning (Bottou, 1998; Jafari et al., 2001). Prior algorithms have used online gradient updates (Duchi et al., 2011) and probabilistic filtering formulations (Murphy, 2002; Hoffman et al., 2010; Broderick et al., 2013). In principle, commonly used gradient-based learning methods, such as SGD, can easily be used as online learning algorithms (Bottou, 1998). In practice, their performance with deep neural network function approximators is limited (Sahoo et al., 2017): such high-dimensional models must be trained with batch-mode methods, minibatches, and multiple passes over the data. We aim to lift this restriction by using model-agnostic meta-learning (MAML) to explicitly pretrain a model that enables fast adaptation, which we then use for continuous online adaptation via an expectation maximization algorithm with a Chinese restaurant process (Blei et al., 2003) prior for dynamic allocation of new tasks in a non-stationary task distribution.
|
| 24 |
+
|
| 25 |
+
Online learning is related to that of continual or lifelong learning (Thrun, 1998), where the agent faces a non-stationary distribution of tasks over time. However, unlike works that focus on avoiding negative transfer, i.e. catastrophic forgetting (Kirkpatrick et al., 2017; Rebuffi et al., 2017; Zenke et al., 2017; Lopez-Paz et al., 2017; Nguyen et al., 2017), online learning focuses on the ability to rapidly learn and adapt in the presence of non-stationarity. While some continual learning works consider the problem of forward transfer, e.g. Rusu et al. (2016); Aljundi et al. (2017); Wang et al. (2017), these works and others in continual learning generally focus on small sets of tasks where fast, online learning is not realistically possible, since there are simply not enough tasks to recover structure that enables fast, few-shot learning in new tasks or environments.
|
| 26 |
+
|
| 27 |
+
Our approach builds on techniques for meta-learning or learning-to-learn (Thrun & Pratt, 1998; Schmidhuber, 1987; Bengio et al., 1992; Naik & Mammone, 1992). However, most recent metalearning work considers a setting where one task is learned at a time, often from a single batch of data (Santoro et al., 2016; Ravi & Larochelle, 2017; Munkhdalai & Yu, 2017; Wang et al., 2016; Duan et al., 2016). In our work, we specifically address non-stationary task distributions and do not assume that task boundaries are known. Concurrent work (Anonymous, 2019) has used a mixture model at the level of the prior parameters, considering non-stationarity at the meta-level, whereas we use a mixture model to model the task-specific parameters to perform online learning only during run-time. Other meta-learning works have considered non-stationarity within a task (Al-Shedivat et al., 2017) and episodes involving multiple tasks at meta-test time (Ritter et al., 2018), but they do not consider continual online adaptation with unknown task separation. Prior work has also studied meta-learning for model-based RL (Nagabandi et al., 2018). This prior method updates the model every time step, but each update is a batch-mode $k$ -shot update, using exactly $k$ prior transitions and resetting the model at each step. This allows for adaptive control, but does not enable continual online adaptation, since updates from previous steps are always discarded. In our comparisons, we find that our approach substantially outperforms this prior method. To our knowledge, our work is the first to apply meta-learning to learn streaming online updates.
|
| 28 |
+
|
| 29 |
+
# 3 PROBLEM STATEMENT
|
| 30 |
+
|
| 31 |
+
We formalize our online learning problem setting as follows: at each time step, the model receives an input $\mathbf { x } _ { t }$ and produces a prediction $\hat { \mathbf { y } } _ { t }$ . It then receives a ground truth label $\mathbf { y } _ { t }$ , which must be used to adapt the model to increase its prediction accuracy on the next input $\mathbf { x } _ { t + 1 }$ . The true labels are assumed to come from some task distribution $P ( Y _ { t } | X _ { t } , T _ { t } )$ , where $T _ { t }$ is the task at time $t$ . The tasks themselves change over time, resulting in a non-stationary task distribution, and the identity of the task $T _ { t }$ is unknown to the learner. In real-world settings, tasks might correspond to unknown parameters of the system (e.g., motor malfunction on a robot), user preferences, or other unexpected events. This problem statement covers a range of online learning problems that all require continual adaptation to streaming data and trading off between generalization and specialization.
|
| 32 |
+
|
| 33 |
+
In our experiments, we use model-based RL as our working example, where the input $\mathbf { x } _ { t }$ is a stateaction pair, and the output $\mathbf { y } _ { t }$ is the next state. We discuss this application to model-based RL in Section 6, but we keep the following derivation of our method general for the case of arbitrary online prediction problems.
|
| 34 |
+
|
| 35 |
+
# 4 ONLINE LEARNING WITH MIXTURE OF META-TRAINED NETWORKS
|
| 36 |
+
|
| 37 |
+
We discuss our meta-learning for online learning (MOLe) algorithm in two parts: online learning in this section, and meta-learning in the next. In this section, we explain our online learning method that enables effective online learning using a continuous stream of incoming data from a non-stationary task distribution. We aim to retain generalization so as to not lose past knowledge, as well as gain specialization, which is particularly important for learning new tasks that are further out-ofdistribution and require more learning. We discuss the process of obtaining a meta-learned prior in Sec. 5, but we first formulate in this section an online adaptation algorithm using SGD with expectation maximization to maintain and adapt a mixture model over task model parameters (i.e., a probabilistic task distribution).
|
| 38 |
+
|
| 39 |
+
# 4.1 METHOD OVERVIEW
|
| 40 |
+
|
| 41 |
+
Let $p _ { \theta ( T _ { t } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } )$ represent the predictive distribution of our model on input $\mathbf { x } _ { t }$ , for an unknown task $T _ { t }$ . Our goal is to estimate model parameters $\theta _ { t } ( T )$ for each task $T$ in the non-stationary task distribution: This requires inferring the distribution over tasks at each step $P ( T _ { t } | \mathbf x _ { t } , \mathbf y _ { t } )$ , using that distribution to make predictions $\hat { \mathbf y } _ { t } = p _ { \theta ( T _ { t } ) } ( \mathbf y _ { t } | \mathbf x _ { t } )$ , and also using it to update each model from $\theta _ { t } ( T )$ to $\theta _ { t + 1 } ( T )$ . In practice, the parameters $\theta ( T )$ of each model will correspond to the weights of a neural network $f _ { \theta ( T ) }$ .
|
| 42 |
+
|
| 43 |
+
Each model begins with some prior parameter vector $\theta ^ { * }$ , which we will discuss in more detail in Section 5. Since the number of tasks is also unknown, we begin with one task at time step 0, where $\theta _ { 0 } ( T ) = \{ \theta _ { 0 } ( T _ { 0 } ) \} = \{ \theta ^ { * } \}$ . From here, we continuously update all parameters in $\theta _ { t } ( T )$ and add new tasks as needed, in the attempt to model the true underlying process $P ( Y _ { t } | X _ { t } , T _ { t } )$ . Since task identities are unknown, we must also estimate $P ( T _ { t } )$ at each time step. Thus, the online learning problem consists of adapting each $\theta _ { t } ( T _ { i } )$ at each time step $t$ according to the inferred task probabilities $P ( T _ { t } = T _ { i } | \mathbf x _ { t } , \mathbf y _ { t } )$ . To do this, we adapt the expectation maximization (EM) algorithm and optimize the expected log-likelihood, given by
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\mathcal { L } = E _ { T _ { t } \sim P ( T _ { t } | \mathbf { x } _ { t } , \mathbf { y } _ { t } ) } [ \log p _ { \theta _ { t } ( T _ { t } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } , T _ { t } ) ] ,
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
where we use $\theta _ { t } ( T _ { t } )$ to denote the model parameters corresponding to task $T _ { t }$ . Finally, to handle the unknown number of tasks, we employ the Chinese restaurant process to instantiate new tasks as needed.
|
| 50 |
+
|
| 51 |
+
# 4.2 APPROXIMATE ONLINE INFERENCE
|
| 52 |
+
|
| 53 |
+
We use expectation maximization (EM) to update the model parameters. In our case, the $\mathrm { E }$ step in EM involves estimating the task distribution $P ( T _ { t } = T _ { i } | \mathbf { x } _ { t } , \mathbf { \bar { y } } _ { t } )$ at the current time step, while the M step involves updating all model parameters from $\theta _ { t } ( T )$ to obtain the new model parameters $\theta _ { t + 1 } ( T )$ . The parameters are always updated by one gradient step per time step, according to the inferred task responsibilities.
|
| 54 |
+
|
| 55 |
+
We first estimate the expectations over all task parameters $T _ { i }$ in the task distribution, where the posterior of each task probability can be written as follows:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
P ( T _ { t } = T _ { i } | \mathbf { x } _ { t } , \mathbf { y } _ { t } ) \propto p _ { \theta _ { t } ( T _ { i } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } , T _ { t } = T _ { i } ) P ( T _ { t } = T _ { i } ) .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
We then formulate the task prior $P ( T _ { t } = T _ { i } )$ using a Chinese restaurant process (CRP) to enable new tasks to be instantiated during a trial. The CRP is an instantiation of a Dirichlet process. In the CRP, at time $t$ , the probability of each task $T _ { i }$ should be given by
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
P ( T _ { t } = T _ { i } ) = \frac { n _ { T _ { i } } } { t - 1 + \alpha }
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $n _ { T _ { i } }$ is the expected number of datapoints in task $T _ { i }$ for all steps $1 , \ldots , t - 1$ , and $\alpha$ is a hyperparameter that controls the instantiation of new tasks. The prior therefore becomes
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
P ( T _ { t } = T _ { i } ) = \frac { \sum _ { t ^ { \prime } = 1 } ^ { t - 1 } P ( T _ { t ^ { \prime } } = T _ { i } ) } { t - 1 + \alpha } \quad \mathrm { a n d } \quad P ( T _ { t } = T _ { \mathrm { n e w } } ) = \frac { \alpha } { t - 1 + \alpha }
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
Combining the prior and likelihood, we derive the following posterior task probability distribution:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
P ( T _ { t } = T _ { i } | \mathbf { x } _ { t } , \mathbf { y } _ { t } ) \propto p _ { \theta _ { t } ( T _ { i } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } , T _ { t } = T _ { i } ) \left[ \sum _ { t ^ { \prime } = 1 } ^ { t - 1 } P ( T _ { t ^ { \prime } } = T _ { i } ) + \delta ( T _ { t ^ { \prime } } = T _ { \mathrm { n e w } } ) \alpha \right]
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
Having estimated the latent task probabilities, we next perform the $\mathbf { M }$ step, which improves the expected log-likelihood in Equation 1 based on the inferred task distribution. Since each task starts from the prior $\theta ^ { * }$ , the values of all parameters in $\theta _ { t } ( T )$ after one gradient update are given by
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\theta _ { t + 1 } ( T _ { i } ) = \theta ^ { * } - \beta \sum _ { t ^ { \prime } = 0 } ^ { t } P _ { t } ( T _ { t ^ { \prime } } = T _ { i } | \mathbf { x } _ { t ^ { \prime } } , \mathbf { y } _ { t ^ { \prime } } ) \nabla _ { \theta _ { t ^ { \prime } } ( T _ { i } ) } \log p _ { \theta _ { t ^ { \prime } } ( T _ { i } ) } ( \mathbf { y } _ { t ^ { \prime } } | \mathbf { x } _ { t ^ { \prime } } ) \quad \forall T _ { i }
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
If we assume that all parameters of $\theta _ { t } ( T )$ have already been updated for the previous time steps $0 , \ldots , t$ , we can approximate this update by simply updating all parameters $\theta _ { t } ( T )$ on the newest data:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\begin{array} { r l } { \theta _ { t + 1 } ( T _ { i } ) = \theta _ { t } ( T _ { i } ) - \beta P _ { t } ( T _ { t } = T _ { i } | \mathbf { x } _ { t } , \mathbf { y } _ { t } ) \nabla _ { \theta _ { t } ( T _ { i } ) } \log p _ { \theta _ { t } ( T _ { i } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } ) } & { \forall T _ { i } } \end{array}
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
This procedure is an approximation, since updates to task parameters $\theta _ { t } ( T )$ will in reality also change the corresponding task probabilities at previous time steps. However, this approximation removes the need to store previously seen data points and yields a fully online, streaming algorithm. Finally, to fully implement the EM algorithm, we must alternate the $\mathrm { E }$ and $\mathbf { M }$ steps to convergence at each time step, rolling back the previous gradient update to $\theta _ { t } ( T )$ at each iteration. In practice, we found it sufficient to perform the E and $\mathbf { M }$ steps only once per time step. While this is a crude simplification, successive time steps in the online learning scenario are likely to be correlated, making this procedure reasonable. However, it is also straightforward to perform multiple steps of EM while still remaining fully online.
|
| 92 |
+
|
| 93 |
+
We now summarize this full online learning portion of MOLe, and we also outline it in Alg. 1. At the first time step $t = 0$ , the task distribution is initialized to contain one entry: $\theta _ { 0 } ( T ) = \{ \theta _ { 0 } ( T _ { 0 } ) \} = \{ \theta ^ { * } \}$ . At every time step after that, an E step is performed to estimate the task distribution and an $\mathbf { M }$ step is performed to update the model parameters. The CRP prior also assigns, at each time step, the probability of adding a new task $T _ { \mathrm { n e w } }$ at the given time step. The parameters $\theta _ { t + 1 } \big ( T _ { \mathrm { n e w } } \big )$ of this new task are adapted from $\theta ^ { * }$ on the latest data. The prediction on the next datapoint is then made using the model parameters $\theta _ { t + 1 } ( T ^ { * } )$ corresponding to the most likely task $T ^ { * }$ .
|
| 94 |
+
|
| 95 |
+
Algorithm 1 Online Learning with Mixture of Meta
|
| 96 |
+
Trained Networks
|
| 97 |
+
Require: $\theta ^ { * }$ from meta-training Initialize $t = 0$ , $\theta _ { 0 } ( T ) = \{ \bar { \theta _ { 0 } ( T _ { 0 } ) } \} = \{ \theta ^ { * } \}$ for each time step $t$ do Calculate $p _ { \theta _ { t } ( T _ { i } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } , T _ { t } = T _ { i } ) \ \forall T _ { i }$ Calculate $P _ { t } ( T _ { i } ) = P _ { t } ( T _ { t } = T _ { i } | \mathbf { x } _ { t } , \mathbf { y } _ { t } ) \ \forall T _ { i }$ Calculate $\theta _ { t + 1 } ( T _ { i } )$ by adapting from $\theta _ { t } ( T _ { i } ) \ \forall T _ { i }$ Calculate $\theta _ { t + 1 } \big ( T _ { \mathrm { n e w } } \big )$ by adapting from $\theta ^ { * }$ if $P _ { t } ( T _ { \mathrm { n e w } } ) > P _ { t } ( T _ { i } ) \ \forall T _ { : }$ then Add $\theta _ { t + 1 } \big ( T _ { \mathrm { n e w } } \big )$ to $\theta _ { t + 1 } ( T )$ Recalculate $P _ { t } ( T _ { i } )$ using $\theta _ { t + 1 } ( T _ { i } ) \ \forall T _ { i }$ Recalculate $\theta _ { t + 1 } ( T _ { i } )$ using updated $P _ { t } ( T _ { i } ) \ \forall T _ { i }$ end if $\begin{array} { r } { T ^ { * } = \mathrm { a r g m a x } _ { T _ { i } } \ p _ { \theta _ { t + 1 } ( T _ { i } ) } ( \mathbf { y } _ { t } | \mathbf { x } _ { t } , T _ { t } = T _ { i } ) } \end{array}$ iReceive next data point $\mathbf { x } _ { t + 1 }$ end for
|
| 98 |
+
|
| 99 |
+
# 5 META-LEARNING THE PRIOR
|
| 100 |
+
|
| 101 |
+
We formulated an algorithm above for performing online adaptation using continually incoming data. For this method, we choose to meta-train the prior using the model-agnostic meta-learning (MAML) algorithm. This meta-training algorithm is an appropriate choice, because it results in a prior that is specifically intended for gradient-based fine-tuning. Before we further discuss our choice in meta-training procedure, we first give an overview of MAML and meta-learning in general.
|
| 102 |
+
|
| 103 |
+
Given a distribution of tasks, a meta-learning algorithm produces a learning procedure, which can, in some cases, quickly adapt to a new task. MAML optimizes for an initialization of a deep network that achieves good few-shot task generalization when fine-tuned using a few datapoints from that task. At train time, MAML sees small amounts of data from large numbers of tasks, where data $\mathcal { D } _ { T }$ from each task $T$ can be split into training and validation subsets ( ${ \mathcal { D } } _ { T } ^ { \mathrm { t r } }$ and $\mathcal { D } _ { T } ^ { \mathrm { v a l } }$ ), where ${ \mathcal { D } } _ { T } ^ { \mathrm { t r } }$ is of size $k$ . MAML optimizes for model parameters $\theta$ such that one or more gradients steps on ${ \mathcal { D } } _ { T } ^ { \mathrm { t r } }$ results in a minimaand the loss oss wil $L$ on orr $\mathcal { D } _ { T } ^ { \mathrm { v a l } }$ . In our case, we will set nd to negative log likelihoo ${ \mathcal D } _ { T _ { t } } ^ { \mathrm { t r } } = ( { \bf x } _ { t } , { \bf y } _ { t } )$ and t allo $\mathcal { D } _ { T _ { t } } ^ { \mathrm { v a l } } = ( \mathbf { x } _ { t + 1 } , \mathbf { y } _ { t + 1 } )$ , $L$ $\theta$
|
| 104 |
+
be successful across various meta-training tasks is thus a good network initialization from which adaptation can solve various new tasks that are related to the previously seen tasks. The MAML objective is defined as follows:
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\operatorname* { m i n } _ { \theta } \sum _ { T } L ( \theta - \eta \nabla _ { \theta } L ( \theta , \mathcal { D } _ { T } ^ { \mathrm { t r } } ) , \mathcal { D } _ { T } ^ { \mathrm { v a l } } ) = \operatorname* { m i n } _ { \theta } \sum _ { T } L ( \phi _ { T } , \mathcal { D } _ { T } ^ { \mathrm { v a l } } ) .
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
Here, $\eta$ is the inner learning rate. Once this meta-objective is optimized, the resulting $\theta ^ { * }$ acts as a prior from which fine-tuning can occur at test-time, using recent experience from ${ \mathcal { D } } _ { T _ { \mathrm { t e s t } } } ^ { \mathrm { t r } }$ as follows:
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\phi _ { T _ { \mathrm { t e s t } } } = \theta ^ { * } - \eta \nabla _ { \theta ^ { * } } L ( \theta ^ { * } , { \mathcal { D } } _ { T _ { \mathrm { t e s t } } } ^ { \mathrm { t r } } ) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
Here, $\phi _ { T _ { \mathrm { t e s t } } }$ is adapted from the meta-learned prior $\theta ^ { * }$ to be more representative for the current time.
|
| 117 |
+
|
| 118 |
+
Although Finn et al. (2017) demonstrated this fast adaptation of deep neural networks and Nagabandi et al. (2018) extended this framework to model-based meta RL, these methods address adaptation in the $k$ -shot setting, always adapting directly from the meta-learned prior and not allowing further adaptation or specialization. In this work, we have extended these capabilities by enabling more evolution of knowledge through a temporally-extended online adaptation procedure.
|
| 119 |
+
|
| 120 |
+
While our procedure for continual online learning is still initialized with this meta-training for $k$ - shot adaptation (i.e., MAML), we found that this prior was sufficient to enable effective continual online adaptation at test time. The intuitive rationale for this is that MAML trains the model to be able to change significantly using only a small number of datapoints and gradient steps. Note that this meta-trained prior can be used at test time in (a) a $k$ -shot setting, similar to how it was trained, or it can be used at test time by (b) taking substantially more gradient steps away from this prior. We show in Sec. 7 that our method outperforms both of these methods, but the mere ability to use this meta-learned prior in these ways makes the use of MAML enticing.
|
| 121 |
+
|
| 122 |
+
We note that it is quite possible to modify the MAML algorithm to optimize the model directly with respect to the weighted updates discussed in Section 4.2. This simply requires computing the task weights (the E step) on each batch during meta-training, and then constructing a computation graph where all gradient updates are multiplied by their respective weights. Standard automatic differentiation software can then compute the corresponding meta-gradient. For short trial lengths, this is not substantially more complex than standard MAML; for longer trial lengths, truncated backpropagation is an option. Although such a meta-training procedure better matches the way that the model is used during online adaptation, we found that it did not substantially improve our results. While it’s possible that the difference might be more significant if meta-training for longerterm adaptation, this observation does suggest that simply meta-training with MAML is sufficient for enabling effective continuous online adaptation in non-stationary multi-task settings. To clarify, although this modified training procedure of incorporating the EM weight updates (during metatraining) did not explicitly improve our results, we see that test-time performance did indeed improve with using more data for the standard MAML meta-training procedure (see Appendix).
|
| 123 |
+
|
| 124 |
+
# 6 APPLICATION TO MODEL-BASED RL
|
| 125 |
+
|
| 126 |
+
In our experiments, we apply MOLe to model-based reinforcement learning. RL in general aims to act in a way that maximizes the sum of future rewards. At each time step $t$ , the agent executes action $\mathbf { a } _ { t } \in A$ from state $\mathbf { s } _ { t } \in S$ , transitions to the next state $\mathbf { s } _ { t + 1 }$ according the transition probabilities (i.e., dynamics) $p ( \mathbf { s } _ { t + 1 } | \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ and receives rewards $r _ { t } = r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ . The goal at each step is to execute the action $\mathbf { a } _ { t }$ that maximizes the discounted sum of future rewards $\sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } r ( \mathbf { s } _ { t ^ { \prime } } , \mathbf { a } _ { t ^ { \prime } } )$ , where discount factor $\gamma \in [ 0 , 1 ]$ prioritizes near-term rewards. In model-based RL, in particular, the predictions from a known or learned dynamics model are used to either learn a policy, or are used directly inside a planning algorithm to select actions that maximize reward.
|
| 127 |
+
|
| 128 |
+
In our work, the underlying distribution that we aim to model is the dynamics distribution $p ( \mathbf { s } _ { t + 1 } | \mathbf { s } _ { t } , \mathbf { a } _ { t } , T _ { t } )$ , where the unknown $T _ { t }$ represents the underlying settings (e.g., state of the system, external details, environmental perturbations, etc.). The goal for MOLe is to estimate this distribution with a predictive model $p _ { \theta }$ . To instantiate MOLe in this context of model-based RL, we follow Algorithm 1 with the following specifications:
|
| 129 |
+
|
| 130 |
+
(1) We set the input $\mathbf { x } _ { t }$ to be the concatenation of $K$ previous states and actions, given by $\mathbf { x } _ { t } ~ =$ $\left[ \mathbf { s } _ { t - K } , \mathbf { a } _ { t - K } , \ldots , \mathbf { s } _ { t - 2 } , \mathbf { a } _ { t - 2 } , \mathbf { s } _ { t - 1 } , \mathbf { a } _ { t - 1 } \right]$ , and the output to be the corresponding next states $\mathbf { y } _ { t } =$ $\left[ \mathbf { s } _ { t - K + 1 } , \ldots , \mathbf { s } _ { t - 1 } , \mathbf { s } _ { t } \right]$ . This provides us with a slightly larger batch of data for each online update, as compared to using only the data from the given time step. Since individual time steps at high frequency can be very noisy, using the past $K$ transitions helps to damp out the updates.
|
| 131 |
+
|
| 132 |
+
(2) The predictive model $p _ { \theta }$ represents each of these underlying transitions as an independent Gaussian such that $\begin{array} { r } { p _ { \theta } ( \mathbf { y } _ { t } \vert \mathbf { x } _ { t } ) = \prod _ { t ^ { \prime } = t - K } ^ { t - 1 } p ( \mathbf { s } _ { t ^ { \prime } + 1 } \vert \mathbf { s } _ { t ^ { \prime } } , \mathbf { a } _ { t ^ { \prime } } ) } \end{array}$ , where each $p ( \mathbf { s } _ { t + 1 } | \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ is parameterized with a Gaussian given by mean $f _ { \theta } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ and constant variance $\sigma ^ { 2 }$ . We implement this mean dynamics function $f _ { \theta } ( s _ { t } , a _ { t } )$ as a neural network model with three hidden layers each of dimension 500, and ReLU nonlinearities.
|
| 133 |
+
|
| 134 |
+
(3) To calculate the new task parameter $\theta _ { t + 1 } \big ( T _ { \mathrm { n e w } } \big )$ , which may or may not be added to the task distribution $\theta _ { t + 1 } ( T )$ , we use a set of $K$ nearby datapoints that is separate from the set $\mathbf { x } _ { t }$ . This is done to avoid calculating the parameter using the same dataset on which it is evaluated, since $P _ { t } ( T _ { \mathrm { n e w } } )$ comes from evaluating the parameter on the data $\mathbf { x } _ { t }$ .
|
| 135 |
+
|
| 136 |
+
(4) Unlike standard online streaming tasks where the next data point $\mathbf { x } _ { t + 1 }$ is just given, the incoming data point (i.e., the next visited state) in this case is influenced by the predictive model itself. This is because, after the most likely task $T ^ { * }$ is selected from the possible tasks, the predictions from the model $p _ { \theta _ { t + 1 } ( T ^ { * } ) }$ are used by the controller to plan over a sequence of future actions $\mathbf { a } _ { 0 } , \ldots , \mathbf { a } _ { H }$ and select the actions that maximize future reward. Note that the planning procedure is based on stochastic optimization, following prior work (Nagabandi et al., 2018), and we provide more details in the appendix. Since the controller’s action choice determines the next data point, and since the controller’s choice is dependent on the estimated model parameters, it is even more crucial in this setting to appropriately adapt the model.
|
| 137 |
+
|
| 138 |
+
5) Finally, note that we attain $\theta ^ { * }$ from meta-training using model-agnostic meta-learning (MAML), as mentioned in the method above. However, in this case, MAML is performed in the loop of modelbased RL. In other words, the model parameters at a given iteration of meta-training are used by the controller to generate on-policy rollouts, the data from these rollouts is then added to the dataset for MAML, and this process repeats until the end of meta-training.
|
| 139 |
+
|
| 140 |
+
# 7 EXPERIMENTS
|
| 141 |
+
|
| 142 |
+
The questions that we aimed to study from our experiments include: Can MOLe 1) autonomously discover some task structure amid a stream of non-stationary data? 2) adapt to tasks that are further outside of the task distribution than can be handled by a $k$ -shot learning approach? 3) recognize and revert to tasks it has seen before? 4) avoid overfitting to a recent task to prevent deterioration of performance upon the next task switch? 5) outperform other methods?
|
| 143 |
+
|
| 144 |
+
To study these questions, we conduct experiments on agents in the MuJoCo physics engine (Todorov et al., 2012). The agents we used are a half-cheetah (S R21, A R6) and a hexapedal crawler (S R50, A R12). Using these agents, we design a number of challenging online learning problems that involve multiple sudden and gradual changes in the underlying task distribution, including tasks that are extrapolated from those seen previously, where online learning is criticial. Through these experiments, we aim to build problem settings that are representative of the types of disturbances and shifts that a real RL agent might encounter.
|
| 145 |
+
|
| 146 |
+
We present results and analysis of our findings in the following three sections, and videos can be found at https://sites.google.com/berkeley.edu/onlineviameta. In our experiments, we compare to several alternative methods, including two approaches that leverage metatraining and two approaches that do not:
|
| 147 |
+
|
| 148 |
+
(a) $\mathbf { k }$ -shot adaptation with meta-learning: Always adapt from the meta-trained prior $\theta ^ { * }$ , as typically done with meta-learning methods (Nagabandi et al., 2018). This method is often insufficient for adapting to tasks that are further out of distribution, and the adaptation is also not carried forward in time for future use.
|
| 149 |
+
|
| 150 |
+
(b) continued adaptation with meta-learning: Always take gradient steps from the previous time step’s parameters. This method oftens overfits to recently observed tasks, so it should indicate the importance of our method effectively identifying task structure to avoid overfitting and enable recall.
|
| 151 |
+
|
| 152 |
+
(c) model-based RL: Train a model on the same data as the methods above, using standard supervised learning, and keep this model fixed throughout the trials (i.e., no meta-learning and no adaptation).
|
| 153 |
+
|
| 154 |
+
(d) model-based RL with online gradient updates: Use the same model from model-based RL (i.e., no meta-learning), but adapt it online using gradient-descent at run time. This is representative of commonly used dynamic evaluation methods (Rei, 2015; Krause et al., 2017; 2016; Fortunato et al., 2017).
|
| 155 |
+
|
| 156 |
+
# 7.1 TERRAIN SLOPES ON HALF-CHEETAH
|
| 157 |
+
|
| 158 |
+
We start with the task of a half-cheetah (Fig. 1) agent, traversing terrains of differing slopes. The prior model is meta-trained on data from terrains with random slopes of low magnitudes, and the test trials are executed on difficult out-of-distribution tasks such as basins, steep hills, etc. As shown in Fig. 2, neither model-based RL nor model-based RL with online gradient updates perform well on these out-of-distribution tasks, even though those models were trained on the same data that the metatrained model received. The bad performance of the model-based RL approach indicates the need for model adaptation (as opposed to assuming a single model can encompass everything), while the bad performance of model-based RL with online gradient updates indicates the need for a meta-learned initialization to enable online learning with neural networks.
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
Figure 1: Half-cheetah agent, shown traversing a landscape with ‘basins’
|
| 162 |
+
|
| 163 |
+
For the three meta-learning and adaptation methods, we expect continued adaptation with metalearning to perform poorly due to continuous gradient steps causing it to overfit to recent data; that is, we expect that experience on the upward slopes to lead to deterioration of performance on downward slopes, or something similar. However, based on both our qualitative and quantitative results, we see that the meta-learning procedure seems to have initialized the agent with a parameter space in which these various “tasks” are not seen as substantially different, where online learning by SGD performs well. This suggests that the meta-learning process finds a task space where there is an easy skill transfer between slopes; thus, even when MOLe is faced with the option of switching tasks or adding new tasks to its dynamic latent task distribution, it chooses not to do so (Fig. 3). Unlike findings that we will see later, it is interesting that the discovered task space here does not correspond to human-distinguishable categorical labels. Finally, note that these tasks of changing slopes are not particularly similar to each other (and that the discovered task space is indeed useful), because the two non-meta-learning baselines do indeed fail on these test tasks despite having similar training performance on the shallow training slopes.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 2: Results on half-cheetah terrain traversal. The poorly performing model-based RL shows that a single model is not sufficient, and model-based RL with online gradient updates shows that a meta-learned initialization is critical. The three meta-learning approaches perform similarly; however, the performance of $\mathbf { k }$ -shot adaptation deteriorates when the task calls for taking multiple gradient steps away from the prior.
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Figure 3: Latent task distribution over time for two half-cheetah landscape traversal tasks, where encountered terrain slopes vary within each run. Interestingly, we find that MOLe chooses to only use a single latent task variable to describe varying terrain.
|
| 170 |
+
|
| 171 |
+
# 7.2 HALF-CHEETAH MOTOR MALFUNCTIONS
|
| 172 |
+
|
| 173 |
+
While the findings from the half-cheetah on sloped terrains illustrate that separate task parameters aren’t always necessary for what might externally seem like separate tasks, we also want to study agents that experience more drastically-changing non-stationary task distributions during their experience in the world. For this set of experiments, we train all models on data where a single actuator is selected at random to experience a malfunction during the rollout. In this case, malfunction means that the polarity or magnitude of actions applied to that actuator are altered. Fig. 4 shows the results of various methods on drastically out-of-distribution test tasks, such as altering all actuators at once. The left of Fig. 4 shows that when the task distribution during the test trials contains only a single task, such as ‘sign negative’ where all actuators are prescribed to be the opposite polarity, then continued adaptation performs well by repeatedly performing gradient updates on incoming data. However, as shown in the other tasks of Fig. 4, the performance of this continue adaptation substantially deteriorates when the agent experiences a non-stationary task distribution. Due to overspecialization on recent incoming data, such methods that continuously adapt tend to forget and lose previously existing skills. This overfitting and forgetting of past skills is also illustrated in the consistent performance deterioration shown in Fig. 4. MOLe, on the other hand, dynamically builds a probabilistic task distribution and allows adaptation to these difficult tasks, without forgetting past skills. We show a sample task setup in Fig. 5, where the agent experiences alternating periods of normal and crippled-leg operation. This plot shows the successful recognition of new tasks as well as old tasks; note that both the recognition and adaptation are all done online, without using a bank of past data to perform the adaptation, and without a human-specified set of task categories.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 4: Results on the motor malfunction trials, where different trials are shown task distributions that modulate at different frequencies (or stay constant, for the first category). Here, online learning is critical for good performance, k-shot adaptation is insufficient for such different tasks, and continued gradient steps leads to overfitting to recently seen data.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 5: Latent task variable distribution over the course of an online learning trial where the underlying motor malfunction changes every 500 timesteps. We find that MOLe is able to successfully recover the task structure, recognize when the underlying task has changed, and recall previously seen tasks.
|
| 180 |
+
|
| 181 |
+
# 7.3 CRIPPLING OF END EFFECTORS ON SIX-LEGGED CRAWLER
|
| 182 |
+
|
| 183 |
+
To further examine the effects of our continual online adaptation algorithm, we study another, more complex agent: a 6-legged crawler (Fig. 6). In these experiments, models are trained on random joints being crippled (i.e., unable to apply actuator commands). In Fig. 7, we present two illustrative test tasks: (1) the agent sees a set configuration of crippling for the duration of its testtime experience, and (2) the agent receives alternating periods of experience, between regions of normal operation and regions of having crippled legs.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 6: Six-legged crawler robot, shown with crippled legs.
|
| 187 |
+
|
| 188 |
+
The first setting is similar to data seen during training, and thus, we see that even the model-based RL and model based-RL with online gradient updates baselines do not fail. The methods that include both meta-learning and adaptation, however, do have higher performance. Furthermore, we see again that continued gradient steps in this case of a single-task setting is not detrimental. The second setting’s non-stationary task distribution (when the leg crippling is dynamic) illustrates the need for online adaptation (modelbased RL fails), the need for a good prior to adapt from (failure of model-based RL with online gradient updates), the harm of overfitting to recent experience and thus forgetting older skills (low performance of continued gradient steps), and the need for further adaptation away from the prior (limited performance of k-shot adaptation). With MOLe, this agent is able to build its own representation of “task” switches, and we see that this switch does indeed correspond to recognizing regions of leg crippling (left of Fig. 7.3). The plot of the cumulative sum of rewards (right of Fig. 7.3) of each of the three meta-learning plus adaptation methods includes this same task switch pattern every 500 steps: Here, we can clearly see that steps 500-1000 and 1500-2000 were the crippled regions. Continued gradient steps actually performs worse on the second and third times it sees normal operation, whereas MOLe is noticeably better as it sees the task more often. Note that this improvement of both skills is possible with MOLe, where development of one skill actually does not hinder the other.
|
| 189 |
+
|
| 190 |
+
Finally, we examine experiments where the crawler experiences (during each trial) walking straight, making turns, and sometimes having a crippled leg. The performance during the first 500 time steps of ”walking forward in a normal configuration” for continued gradient steps was comparable to MOLe $( + / - 1 0 \%$ difference), but its performance during the last 500 time steps of ”walking forward in a normal configuration” was $200 \%$ lower. Note this detrimental effect of performing updates without allowing for separate task specialization/adaptation.
|
| 191 |
+
|
| 192 |
+

|
| 193 |
+
Figure 7: Quantitative results on crawler. For a fixed task, adaptation is not necessary and all methods perform well. In contrast, when tasks change dynamically within the trial, only MOLe effectively learns online.
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 8: Results on crawler experiments. Left: Online recognition of latent task probabilities for alternating periods of normal/crippled experience. Right: MOLe improves from seeing the same tasks multiple times.
|
| 197 |
+
|
| 198 |
+
# 8 DISCUSSION
|
| 199 |
+
|
| 200 |
+
We presented an online learning method for neural network models that can handle non-stationary, multi-task settings within each trial. Our method adapts the model directly with SGD, where an EM algorithm uses a Chinese restaurant process prior to maintain a distribution over tasks and handle non-stationarity. Although SGD generally makes for a poor online learning algorithm in the streaming setting for large parametric models such as deep neural networks, we observe that, by (1) meta-training the model for fast adaptation with MAML and (2) employing our online algorithm for probabilistic updates at test time, we can enable effective online learning with neural networks. In our experiments, we applied this approach to model-based RL, and we demonstrated that it could be used to adapt the behavior of simulated robots faced with various new and unexpected tasks. Our results showed that our method can develop its own notion of task, continuously adapt away from the prior as necessary (to learn even tasks that require more adaptation), and recall tasks it has seen before. While we use model-based RL as our evaluation domain, our method is general and could be applied to other streaming and online learning settings. An exciting direction for future work would be to apply our method to domains such as time series modeling and active online learning.
|
| 201 |
+
|
| 202 |
+
# REFERENCES
|
| 203 |
+
|
| 204 |
+
Maruan Al-Shedivat, Trapit Bansal, Yuri Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. arXiv preprint arXiv:1710.03641, 2017.
|
| 205 |
+
|
| 206 |
+
Rahaf Aljundi, Punarjay Chakravarty, and Tinne Tuytelaars. Expert gate: Lifelong learning with a network of experts. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
|
| 207 |
+
|
| 208 |
+
Anonymous. Modulating transfer between tasks in gradient-based meta-learning. 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rkxLDyBuFX. under review.
|
| 209 |
+
|
| 210 |
+
Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Optimality in Artificial and Biological Neural Networks, 1992.
|
| 211 |
+
|
| 212 |
+
David M Blei, Andrew Y Ng, and Michael I Jordan. Latent dirichlet allocation. Journal of machine Learning research, 3(Jan):993–1022, 2003.
|
| 213 |
+
|
| 214 |
+
Zdravko I Botev, Dirk P Kroese, Reuven Y Rubinstein, and Pierre LEcuyer. The cross-entropy method for optimization. In Handbook of statistics, volume 31, pp. 35–59. Elsevier, 2013.
|
| 215 |
+
|
| 216 |
+
Leon Bottou. Online learning and stochastic approximations. ´ On-line learning in neural networks, 17(9):142, 1998.
|
| 217 |
+
|
| 218 |
+
Tamara Broderick, Nicholas Boyd, Andre Wibisono, Ashia C Wilson, and Michael I Jordan. Streaming variational bayes. In Advances in Neural Information Processing Systems, pp. 1727–1735, 2013.
|
| 219 |
+
|
| 220 |
+
Julien Doyon and Habib Benali. Reorganization and plasticity in the adult brain during learning of motor skills. Current opinion in neurobiology, 15(2):161–167, 2005.
|
| 221 |
+
|
| 222 |
+
Yan Duan, John Schulman, Xi Chen, Peter L Bartlett, Ilya Sutskever, and Pieter Abbeel. Rl2: Fast reinforcement learning via slow reinforcement learning. arXiv:1611.02779, 2016.
|
| 223 |
+
|
| 224 |
+
John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 2011.
|
| 225 |
+
|
| 226 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. International Conference on Machine Learning (ICML), 2017.
|
| 227 |
+
|
| 228 |
+
J Randall Flanagan and Alan M Wing. Modulation of grip force with load force during point-to-point arm movements. Experimental Brain Research, 95(1):131–143, 1993.
|
| 229 |
+
|
| 230 |
+
Meire Fortunato, Charles Blundell, and Oriol Vinyals. Bayesian recurrent neural networks. arXiv preprint arXiv:1704.02798, 2017.
|
| 231 |
+
|
| 232 |
+
Robert Herman. Neural control of locomotion, volume 18. Springer, 2017.
|
| 233 |
+
|
| 234 |
+
Matthew Hoffman, Francis R Bach, and David M Blei. Online learning for latent dirichlet allocation. In advances in neural information processing systems, pp. 856–864, 2010.
|
| 235 |
+
|
| 236 |
+
Amir Jafari, Amy Greenwald, David Gondek, and Gunes Ercal. On no-regret learning, fictitious play, and nash equilibrium. In ICML, volume 1, pp. 226–233, 2001.
|
| 237 |
+
|
| 238 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 2017.
|
| 239 |
+
|
| 240 |
+
Ben Krause, Liang Lu, Iain Murray, and Steve Renals. Multiplicative lstm for sequence modelling. arXiv preprint arXiv:1609.07959, 2016.
|
| 241 |
+
|
| 242 |
+
Ben Krause, Emmanuel Kahembwe, Iain Murray, and Steve Renals. Dynamic evaluation of neural sequence models. CoRR, abs/1709.07432, 2017.
|
| 243 |
+
|
| 244 |
+
David Lopez-Paz et al. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, 2017.
|
| 245 |
+
|
| 246 |
+
Tsendsuren Munkhdalai and Hong Yu. Meta networks. International Conference on Machine Learning (ICML), 2017.
|
| 247 |
+
|
| 248 |
+
K. Murphy. Dynamic Bayesian Networks: Representation, Inference and Learning. PhD thesis, Dept. Computer Science, UC Berkeley, 2002. URL https://www.cs.ubc.ca/ ˜murphyk/Thesis/thesis.html.
|
| 249 |
+
|
| 250 |
+
Anusha Nagabandi, Ignasi Clavera, Simin Liu, Ronald S Fearing, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Learning to adapt: Meta-learning for model-based control. arXiv preprint arXiv:1803.11347, 2018.
|
| 251 |
+
|
| 252 |
+
Devang K Naik and RJ Mammone. Meta-neural networks that learn by learning. In International Joint Conference on Neural Netowrks (IJCNN), 1992.
|
| 253 |
+
|
| 254 |
+
Cuong V Nguyen, Yingzhen Li, Thang D Bui, and Richard E Turner. Variational continual learning. arXiv:1710.10628, 2017.
|
| 255 |
+
|
| 256 |
+
A. Rao. A survey of numerical methods for optimal control. In Advances in the Astronautical Sciences, 2009.
|
| 257 |
+
|
| 258 |
+
Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In International Conference on Learning Representations (ICLR), 2017.
|
| 259 |
+
|
| 260 |
+
Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, and Christoph H Lampert. icarl: Incremental classifier and representation learning. In Proc. CVPR, 2017.
|
| 261 |
+
|
| 262 |
+
Marek Rei. Online representation learning in recurrent neural language models. CoRR, abs/1508.03854, 2015.
|
| 263 |
+
|
| 264 |
+
Samuel Ritter, Jane X Wang, Zeb Kurth-Nelson, Siddhant M Jayakumar, Charles Blundell, Razvan Pascanu, and Matthew Botvinick. Been there, done that: Meta-learning with episodic recall. arXiv preprint arXiv:1805.09692, 2018.
|
| 265 |
+
|
| 266 |
+
Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv:1606.04671, 2016.
|
| 267 |
+
|
| 268 |
+
Doyen Sahoo, Quang Pham, Jing Lu, and Steven CH Hoi. Online deep learning: Learning deep neural networks on the fly. arXiv preprint arXiv:1711.03705, 2017.
|
| 269 |
+
|
| 270 |
+
Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International Conference on Machine Learning (ICML), 2016.
|
| 271 |
+
|
| 272 |
+
Jurgen Schmidhuber. Evolutionary principles in self-referential learning. Diploma thesis, Institut f. Informatik, Tech. Univ. Munich, 1987.
|
| 273 |
+
|
| 274 |
+
Florian Stimberg, Andreas Ruttor, and Manfred Opper. Bayesian inference for change points in dynamical systems with reusable states-a chinese restaurant process approach. In Artificial Intelligence and Statistics, pp. 1117–1124, 2012.
|
| 275 |
+
|
| 276 |
+
Sebastian Thrun. Lifelong learning algorithms. In Learning to learn. Springer, 1998.
|
| 277 |
+
|
| 278 |
+
Sebastian Thrun and Lorien Pratt. Learning to learn. Springer Science & Business Media, 1998.
|
| 279 |
+
|
| 280 |
+
Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
|
| 281 |
+
|
| 282 |
+
Jane X Wang, Zeb Kurth-Nelson, Dhruva Tirumala, Hubert Soyer, Joel Z Leibo, Remi Munos, Charles Blundell, Dharshan Kumaran, and Matt Botvinick. Learning to reinforcement learn. arXiv:1611.05763, 2016.
|
| 283 |
+
|
| 284 |
+
Yu-Xiong Wang, Deva Ramanan, and Martial Hebert. Growing a brain: Fine-tuning by increasing model capacity. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 285 |
+
|
| 286 |
+
Grady Williams, Andrew Aldrich, and Evangelos Theodorou. Model predictive path integral control using covariance variable importance sampling. CoRR, abs/1509.01149, 2015.
|
| 287 |
+
|
| 288 |
+
Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In International Conference on Machine Learning, 2017.
|
| 289 |
+
|
| 290 |
+
# A TEST-TIME PERFORMANCE VS TRAINING DATA
|
| 291 |
+
|
| 292 |
+
We verify below that as the meta-trained models are trained with more data, their performance on test tasks does improve.
|
| 293 |
+
|
| 294 |
+

|
| 295 |
+
Figure 9: Performance on test tasks (i.e., unseen during training) of models that are meta-trained with differing amounts of data. Performance numbers here are normalized per agent, between 0 and 1.
|
| 296 |
+
|
| 297 |
+
# B HYPERPARAMETERS
|
| 298 |
+
|
| 299 |
+
In all experiments, we use a dynamics model consisting of three hidden layers, each of dimension 500, with ReLU nonlinearities. The control method that we use is random-shooting model predictive control (MPC) where 1000 candidate action sequences each of horizon length $_ { \mathrm { H = 1 0 } }$ are sampled at each time step, fed through the predictive model, and ranked by their expected reward. The first action step from the highest-scoring candidate action sequence is then executed before the entire planning process repeats again at the next time step.
|
| 300 |
+
|
| 301 |
+
Below, we list relevant training and testing parameters for the various methods used in our experiments. # Task/itr corresponds to the number of tasks sampled during each iteration of collecting data to train the model, and # TS/itr is the total number of times steps collected during that iteration (sum over all tasks).
|
| 302 |
+
|
| 303 |
+
Table 1: Hyperparameters for train-time
|
| 304 |
+
|
| 305 |
+
<table><tr><td>Iters</td><td>Epochs</td><td># Tasks/itr</td><td>#TS/itr</td><td>K</td><td>outer LR</td><td>inner LR (n)</td></tr><tr><td>12</td><td>50</td><td>16</td><td>2000-3000</td><td>16</td><td>0.001</td><td>0.01</td></tr><tr><td>12</td><td>50</td><td>16</td><td>2000-3000</td><td>16</td><td>0.001</td><td>N/A</td></tr></table>
|
| 306 |
+
|
| 307 |
+
Table 2: Hyperparameters for run-time
|
| 308 |
+
|
| 309 |
+
<table><tr><td></td><td>α(CRP)</td><td>LR (model update)</td><td>K (previous data)</td></tr><tr><td>MOLe (ours)</td><td>1</td><td>0.01</td><td>16</td></tr><tr><td>continued adaptation with meta-learning</td><td>N/A</td><td>0.01</td><td>16</td></tr><tr><td>k-shot adaptation with meta-learning</td><td>N/A</td><td>0.01</td><td>16</td></tr><tr><td>model-based RL</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td>model-based RL with online gradient updates</td><td>N/A</td><td>0.01</td><td>16</td></tr></table>
|
| 310 |
+
|
| 311 |
+
# C CONTROLLER
|
| 312 |
+
|
| 313 |
+
As mentioned in Section 6, we use the learned dynamics model in conjunction with a controller to select the next action to execute. The controller uses the learned model $f _ { \theta }$ together with a reward function $r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ that encodes the desired task. Many methods could be used to perform this action selection, including cross entropy method (CEM) (Botev et al., 2013) or model predictive path integral control (MPPI) (Williams et al., 2015), but in our experiments, we use a random-sampling shooting method Rao (2009).
|
| 314 |
+
|
| 315 |
+
At each time step $t$ , we randomly generate $N$ candidate action sequences with $H$ actions in each sequence.
|
| 316 |
+
|
| 317 |
+
$$
|
| 318 |
+
A _ { t } ^ { i } = \{ \mathbf { a } _ { t } ^ { i } , \dots , \mathbf { a } _ { t + H } ^ { i } \}
|
| 319 |
+
$$
|
| 320 |
+
|
| 321 |
+
We then use the learned dynamics model to predict the resulting states of executing these candidate action sequences.
|
| 322 |
+
|
| 323 |
+
$$
|
| 324 |
+
S ^ { i } = \{ \hat { \mathbf { s } } _ { t + 1 } ^ { i } , \dotsc , \hat { \mathbf { s } } _ { t + H + 1 } ^ { i } \} \mathrm { ~ w h e r e ~ } \hat { \mathbf { s } } _ { p + 1 } ^ { i } = f _ { \theta } ( \hat { \mathbf { s } } _ { p } ^ { i } , \mathbf { a } _ { p } ^ { i } )
|
| 325 |
+
$$
|
| 326 |
+
|
| 327 |
+
Next, we use the reward function to select the action sequence with the highest associated predicted reward.
|
| 328 |
+
|
| 329 |
+
$$
|
| 330 |
+
i ^ { * } = \operatorname * { a r g m a x } _ { i } \sum _ { t ^ { \prime } = t } ^ { t ^ { \prime } = t + H } r ( \hat { \mathbf { s } } _ { t ^ { \prime } } ^ { i } , \mathbf { a } _ { t ^ { \prime } } ^ { i } )
|
| 331 |
+
$$
|
| 332 |
+
|
| 333 |
+
Next, rather than executing the entire sequence $A _ { t } ^ { i ^ { * } }$ of selected optimal actions, we use a model predictive control (MPC) framework to execute only the first action $\mathbf { a } _ { t } ^ { i ^ { * } }$ from the current state $\mathbf { s } _ { t }$ . We then replan at the next time step; This use of MPC can compensate for model inaccuracies by preventing accumulating errors, since we replan at each time step using updated state information.
|
md/train/LT0KSFnQDWF/LT0KSFnQDWF.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/LhY8QdUGSuw/LhY8QdUGSuw.md
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ANATOMY OF CATASTROPHIC FORGETTING: HIDDEN REPRESENTATIONS AND TASK SEMANTICS
|
| 2 |
+
|
| 3 |
+
Vinay V. Ramasesh Blueshift, Alphabet Mountain View, CA
|
| 4 |
+
|
| 5 |
+
Ethan Dyer Blueshift, Alphabet Mountain View, CA
|
| 6 |
+
|
| 7 |
+
Maithra Raghu Google Brain Mountain View, CA
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Catastrophic forgetting is a recurring challenge to developing versatile deep learning models. Despite its ubiquity, there is limited understanding of its connections to neural network (hidden) representations and task semantics. In this paper, we address this important knowledge gap. Through quantitative analysis of neural representations, we find that deeper layers are disproportionately responsible for forgetting, with sequential training resulting in an erasure of earlier task representational subspaces. Methods to mitigate forgetting stabilize these deeper layers, but show diversity on precise effects, with some increasing feature reuse while others store task representations orthogonally, preventing interference. These insights also enable the development of an analytic argument and empirical picture relating forgetting to task semantic similarity, where we find that maximal forgetting occurs for task sequences with intermediate similarity.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
While the past few years have seen the development of increasingly versatile machine learning systems capable of learning complex tasks (Stokes et al., 2020; Raghu & Schmidt, 2020; Wu et al., 2019b), catastrophic forgetting remains a core capability challenge. Catastrophic forgetting is the ubiquitous phenomena where machine learning models trained on non-stationary data distributions suffer performance losses on older data instances. More specifically, if our machine learning model is trained on a sequence of tasks, accuracy on earlier tasks drops significantly. The catastrophic forgetting problem manifests in many sub-domains of machine learning including continual learning (Kirkpatrick et al., 2017), multi-task learning (Kudugunta et al., 2019), standard supervised learning through input distribution shift (Toneva et al., 2019; Snoek et al., 2019; Rabanser et al., 2019; Recht et al., 2019) and data augmentation (Gontijo-Lopes et al., 2020).
|
| 16 |
+
|
| 17 |
+
Mitigating catastrophic forgetting has been an important research focus (Goodfellow et al., 2013; Kirkpatrick et al., 2017; Lee et al., 2017; Li et al., 2019; Serra et al., 2018; Ritter et al., 2018; Rolnick \` et al., 2019), but many methods are only effective in specific settings (Kemker et al., 2018), and progress is hindered by limited understanding of catastrophic forgetting‘s fundamental properties. How does catastrophic forgetting affect the hidden representations of neural networks? Are earlier tasks forgotten equally across all parameters? Are there underlying principles common across methods to mitigate forgetting? How is catastrophic forgetting affected by (semantic) similarities between sequential tasks? This paper takes steps to answering these questions, specifically:
|
| 18 |
+
|
| 19 |
+
1. With experiments on split CIFAR-10, a novel distribution-shift CIFAR-100 variant, CelebA and ImageNet we analyze neural network layer representations, finding that higher layers are disproportionately responsible for catastrophic forgetting, the sequential training process erasing earlier task subspaces.
|
| 20 |
+
2. We investigate different methods for mitigating forgetting, finding that while all stabilize higher layer representations, some methods encourage greater feature reuse in higher layers, while others store task representations as orthogonal subspaces, preventing interference.
|
| 21 |
+
3. We study the connection between forgetting and task semantics, finding that semantic similarity between subsequent tasks consistently controls the degree of forgetting.
|
| 22 |
+
4. Informed by the representation results, we construct an analytic model that relates task similarity to representation interference and forgetting. This provides a quantitative empirical measure of
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 1: Examples of catastrophic forgetting across different architectures and datasets. We plot accuracy of Task 1 (purple) and Task 2 (green), on both the split CIFAR10 task, and the CIFAR100 distribution-shift task across multiple architectures. Catastrophic forgetting is seen as the significant drop of Task 1 accuracy when Task 2 training begins.
|
| 26 |
+
|
| 27 |
+
task similarity, and together these show that forgetting is most severe for tasks with intermediate similarity.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
Mitigation strategies Developing mitigation strategies for catastophic forgetting is an active area of research (Kemker et al., 2018). Popular approaches based on structural regularization include Elastic Weight Consolidation (Kirkpatrick et al., 2017) and Synaptic Intelligence (Zenke et al., 2017). An alternative, functional regularization approach is based on storing and replaying earlier data in a replay buffer (Schaul et al., 2015; Robins, 1995; Rolnick et al., 2019). We study how these mitigation methods affect the internal network representations to better understand their role in preventing catastrophic forgetting.
|
| 32 |
+
|
| 33 |
+
Understanding catastrophic forgetting Our work is similar in spirit to existing empirical studies aimed at better understanding the catastrophic forgetting phenomenon (Goodfellow et al., 2013; Toneva et al., 2019). We focus specifically on understanding how layerwise representations change, and on the relation between forgetting and task semantics, which have not previously been explored. This semantic aspect is related to recent work by Nguyen et al. (2019) examining the influence of task sequences on forgetting. It also builds on work showing that learning in both biological and artificial neural networks is affected by semantic properties of the training data (Saxe et al., 2019; Mandler & McDonough, 1993).
|
| 34 |
+
|
| 35 |
+
Fine-tuning and transfer learning While not studied in the context of catastrophic forgetting, layerwise learning dynamics have been investigated in settings other than continual learning. For example, Raghu et al. (2017) showed that layerwise network representations roughly converge bottomup; (from input to output). Neyshabur et al. (2020) observed similar phenomena in a transfer-learning setting with images, as have others recently in transformers for NLP (Wu et al., 2020; Merchant et al., 2020). Furthermore, the observation that early layers in networks learn general features like edge detectors, while latter layers learn more task specific features is a well-known result in computer vision (Erhan et al., 2009), and here we quantitatively study its ramifications for sequential training and catastrophic forgetting.
|
| 36 |
+
|
| 37 |
+
# 3 SETUP
|
| 38 |
+
|
| 39 |
+
Tasks: We conduct this study over many different tasks and datasets: (i) Split CIFAR-10, where the ten class dataset is split into two tasks of 5 classes each (ii) input distribution shift CIFAR-100, where each task is to distinguish between the CIFAR-100 superclasses, but input data for each task is a different subset of the constituent classes of the superclass (see Appendix A.3) (iii) CelebA attribute prediction: the two tasks have input data either men or women, and we predict either smile or mouth open (iv) ImageNet superclass prediction, similar to CIFAR100.
|
| 40 |
+
|
| 41 |
+
Models: We perform experiments with three common neural network architectures used in image classification — VGG (Simonyan & Zisserman, 2014), ResNet (He et al., 2015) and DenseNet (Huang et al., 2016). Examples of catastrophic forgetting in these models are shown in Figure 1.
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 2: Freezing lower layer representations after Task 1 training has little impact on Task 2 accuracy. We freeze the parameters of a contiguous block of layers (starting from the lowest layer) after Task 1 training, and only train the remainder on Task 2, finding that freezing the lowest layers has little impact on Task 2 accuracy.
|
| 45 |
+
|
| 46 |
+
# 4 CATASTROPHIC FORGETTING AND HIDDEN LAYER REPRESENTATIONS
|
| 47 |
+
|
| 48 |
+
We begin by investigating how catastrophic forgetting manifests in the hidden representations of the neural network. Do all parameters (and layers) forget equally? Or are specific components of the network particularly responsible for the drop in accuracy in sequential training? Through a combination of layer freezing experiments, and representational analysis, we find that higher layers (layers closest to output) are disproportionately responsible for catastrophic forgetting, with lower layers (layers closest to input) remaining representationally stable through sequential training. Further analysis of the representational subspaces of Task 1, Task 1 (post Task 2 training) and Task 2, provide insights on both feature reuse and interference.
|
| 49 |
+
|
| 50 |
+
# 4.1 FREEZING LAYER REPRESENTATIONS
|
| 51 |
+
|
| 52 |
+
To study the effect of individual layers on forgetting, we measure the effect of freezing layer representations on Task 2 accuracy (Figure 2). Specifically, we freeze a contiguous block of layers (starting from the lowest layer) after training on Task 1, and only train the remaining layers on Task 2. Across different architectures and tasks, we observe that lower layers can be reliably frozen with very little impact on Task 2 accuracy. This suggests the possibility of lower layer features being reused between both tasks, with higher layers being the main contributor to catastrophic forgetting.
|
| 53 |
+
|
| 54 |
+
# 4.2 REPRESENTATIONAL SIMILARITY THROUGH SEQUENTIAL TRAINING
|
| 55 |
+
|
| 56 |
+
The results of Figure 2 illustrate that lower layer representations on Task 1 can be reused for good performance on Task 2. To determine if this is what actually occurs during the training process, we turn to Centered Kernel Alignment (CKA) (Kornblith et al., 2019), a neural network representation similarity measure. CKA and other related algorithms (Raghu et al., 2017; Morcos et al., 2018) provide a scalar score (between 0 and 1) determining how similar a pair of (hidden) layer representations are, and have been used to study many properties of deep neural networks (Gotmare et al., 2018; Kudugunta et al., 2019; Wu et al., 2019a).
|
| 57 |
+
|
| 58 |
+
Specifically, letting $\ b X \in \mathbb { R } ^ { n \times p }$ and $Y \in \mathbb { R } ^ { n \times p }$ be (centered) layer activation matrices of (the same) $n$ datapoints and $p$ neurons, CKA computes
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\mathrm { C K A } ( \mathrm { X } , \mathrm { Y } ) = \frac { \mathrm { H S I C } ( \mathrm { X X ^ { T } } , \mathrm { Y Y ^ { T } } ) } { \sqrt { \mathrm { H S I C } ( \mathrm { X X ^ { T } } , \mathrm { X X ^ { T } } ) } \sqrt { \mathrm { H S I C } ( \mathrm { Y Y ^ { T } } , \mathrm { Y Y ^ { T } } ) } }
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
for HSIC Hilbert-Schmidt Independence Criterion (Gretton et al., 2005). We use linear-kernel CKA.
|
| 65 |
+
|
| 66 |
+
In Figure 3, we plot the results of computing CKA on Task 1 layer representations before and after Task 2 training. Across architectures and tasks, we observe that the lower layers have high representation similarity, suggesting that lower layer Task 1 features are reused in Task 2. The higher layers however show significant decreases in representation similarity, suggesting they disproportionately contribute to catastrophic forgetting. These conclusions are further supported by additional layer reset experiments in Appendix Figure 12, which shows that rewinding higher layer parameters from post-Task 2 training to their pre-Task 2 training values significantly improves Task 1 performance.
|
| 67 |
+
|
| 68 |
+
# 4.3 FEATURE REUSE AND SUBSPACE ERASURE
|
| 69 |
+
|
| 70 |
+
Further insights on how the representations of lower and higher layers evolve during sequential training is given through a subspace similarity analysis. Letting $\ b X \in \mathbb R ^ { n \times p }$ be the (centered) layer activation matrix of $n$ examples by $p$ neurons, we compute the PCA decomposition of $X$ , i.e. the
|
| 71 |
+
|
| 72 |
+

|
| 73 |
+
Figure 3: CKA analysis of layer representations before/after Task 2 training shows lower layer feature reuse and higher layer representations changing significantly on CIFAR10, CIFAR100, ImageNet and CelebA. We compute CKA of the Task 1 layer representations before and after Task 2 training. We observe that later layers change more than early layers through second task training.
|
| 74 |
+
|
| 75 |
+

|
| 76 |
+
Figure 4: Subspace similarity analysis shows feature reuse in lower layers and Task 1 subspace erasure in higher layers. For Resnet on CIFAR10 (left), VGG on CIFAR10 (middle), Resnet on CIFAR100 (right), we compute subspace similarity between: (i) (Task 1, Task 2) (purple line) (ii) (Task 1, Task 1 post-Task 2 training) (green line) (iii) (Task 2, Task 1 post-Task 2 training) (blue line). All comparisons show high similarity in lower layers, indicative of feature reuse. Most striking is the comparison between (Task 1, Task 1 post-Task 2 training) and (Task 2, Task 1 post-Task 2 training), which show that after Task 2 training, higher layer representations for Task 1 are more similar to Task 2 than to Task 1! Specifically, the Task 1 subspace in higher layers is erased through Task 2 training.
|
| 77 |
+
|
| 78 |
+
eigenvectors $( v _ { 1 } , v _ { 2 } , \ldots )$ and eigenvalues $( \lambda _ { 1 } , \lambda _ { 2 } . . . )$ of $X ^ { T } X$ . Letting $V _ { k }$ be the matrix formed from the top $k$ principal directions, $v _ { 1 } , . . . , v _ { k }$ as columns, and $U _ { k }$ the corresponding matrix for a different activation matrix $Y$ , we compute
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathrm { S u b s p a c e S i m } _ { k } ( X , Y ) = \frac { 1 } { k } | | V _ { k } ^ { T } U _ { k } | | _ { F } ^ { 2 } .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
This measures the overlap in the subspaces spanned by $( v _ { 1 } , . . . , v _ { k } )$ and $( u _ { 1 } , . . . , u _ { k } )$ . Concretely, if $X$ and $Y$ correspond to layer activation matrices for two different tasks, Subspace $s \mathrm { i m } _ { k } ( X , Y )$ measures how similarly the top $k$ representations for those tasks are stored in the network.
|
| 85 |
+
|
| 86 |
+
Figure 4 shows the result of computing SubspaceSim ${ } _ { k } ( X , Y )$ for $X , Y$ being the layer activation matrices in (i) (Task 1, Task 2) (purple line) (ii) (Task 1, Task 1 post-Task 2 training) (blue line) (iii) (Task 2, Task 1 post-Task 2 training) (blue line). Supporting the CKA analysis, lower layers have high subspace similarity between Task 1 and Task 2 (feature reuse), but higher layers have low similarity (representations change significantly during Task 2 training.) Furthermore, (Task 1, Task 1 post-Task 2 training) also shows low subspace similarity in the higher layers, indicating that the representational change in later layers is not restricted to Task 2 data, but also alters the networks representation of the initial task. Strikingly, (Task 2, Task 1 post-Task 2 training) shows high similarity in all layers, despite being different tasks.
|
| 87 |
+
|
| 88 |
+
In summary, these results illustrate that during sequential training, effective feature reuse happens in the lower layers, but in the higher layers, after Task 2 training, Task 1 representations are mapped into the same subspace as Task 2. Specifically, Task 2 training causes subspace erasure of Task 1 in the higher layers. (Additional details and results are in Appendix Section A.5.)
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 5: CKA analysis of mitigation methods demonstrates that mitigation methods stabilize the higher layer representations. We compute CKA between layer representations of Task 1 before and after Task 2 training, with varying amounts and types of mitigation. We find that across all mitigation methods, even a small amount of mitigation works to stabilize the higher layer representations. In Figure 6, we investigate whether this stabilization results in greater feature reuse or through finding independent subspaces.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 6: Subspace similarity analysis reveals differences between different mitigation methods, with replay storing Task 1 and Task 2 representations in orthogonal subspaces, while EWC and SI promote feature reuse in the higher layers. Top row: We plot subspace similarities like in Figure 4, for different mitigation methods. We observe that (Task 2, Task 1 post-Task 2 training) is much lower in replay compared to EWC/SI, as is (Task1, Task2) similarity. The bottom row plots (Task 2, Task 1 post-Task 2 training) for different amounts of mitigation. Again we see that replay has much lower (Task 2, Task 1 post-Task 2 training) similarity than no mitigation, while EWC/SI maintain the similar subspaces of Task 1 and Task 2 post Task 2 training.
|
| 95 |
+
|
| 96 |
+
# 5 FORGETTING MITIGATION METHODS AND REPRESENTATIONS
|
| 97 |
+
|
| 98 |
+
Informed by this understanding of how catastrophic forgetting manifests in the hidden layers (feature reuse in lower layers and subspace erasure in higher layers), we next study methods to mitigate forgetting. Do popularly used mitigation methods act to stabilize higher layers — given possible alternate approaches such as weight orthogonalization (Appendix C)?
|
| 99 |
+
|
| 100 |
+
We investigate these questions across different successful mitigation strategies (i) EWC (elastic weight consolidation) (Kirkpatrick et al., 2017), a regularization-based approach (ii) replay buffer (Schaul et al., 2015; Ratcliff, 1990; Rolnick et al., 2019), a rehearsal-styled approach (iii) SI (Synaptic Intelligence) (Zenke et al., 2017), another popular regularization-based approach.
|
| 101 |
+
|
| 102 |
+
In Figure 5, we plot the results of computing CKA on layer representations of Task 1 before/after training on Task 2, with different amounts of mitigation applied, and across different mitigation methods, tasks and architectures (full results in Appendix B.7.) Across all of these settings, we observe that even a small amount of mitigation results in a significant increase in similarity (stabilization) in the higher layers. However, there remains a central open question — is this increase in similarity due to feature reuse in the higher layers between Task 1 and Task 2, or does the network store Task 1 and Task 2 representations in non-interfering, orthogonal subspaces?
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 7: Subspace similarity analysis of CelebA, with and without replay mitigation. Left pane computes subspace similarities in CelebA, like in Figure 4, showing subspace erasure at top layers. Middle and right panes showt the effect of adding replay, where subspaces in lower/middle layers become more similar but higher layers become more orthogonal, like in Figure 6.
|
| 106 |
+
|
| 107 |
+
To answer this, we compute the Subspace Similarity measure introduced in Section 4.3, with results in Figure 6 (and additional experiments in Appendix Section B.5). These results reveal key differences between the mitigation methods: replay buffer results in orthogonal network subspaces for higher layer representations of Task 1 and Task 2, while EWC and SI promote feature reuse even in the higher layers. In more detail:
|
| 108 |
+
|
| 109 |
+
• Comparing the top row of Figure 6 to Figure 4 (the same plot without mitigation), we see that mitigation methods increase the subspace similarity of (Task 1, Task 1 Post-Task 2) and (Task 1, Task 2) representations in earlier/middling layers (more feature reuse).
|
| 110 |
+
• Most interestingly, comparing the different mitigation methods across top row Figure 6, we see that while EWC and SI maintain high subspace similarity of (Task 2, Task 1 Post-Task 2) even in the highest layers, replay significantly decreases this value in the highest layers. This suggests that replay performs mitigation through use of orthogonal subspaces, while EWC/SI encourage feature reuse even in the highest layers.
|
| 111 |
+
• In the bottom row we show subspace similarity of (Task 2, Task 1 Post-Task 2) for varying strengths of the different mitigation methods. We observe a clear decrease in subspace similarity in higher layers even when a little replay is used (again supporting orthogonal subspaces), while EWC/SI maintain or increase this (feature reuse even in higher layers.)
|
| 112 |
+
|
| 113 |
+
# 6 SEMANTICS
|
| 114 |
+
|
| 115 |
+
With the insights on how catastrophic forgetting relates to the hidden representations, and the effects on network internals of different mitigation methods, we turn to investigating how the semantic similarity between the sequential tasks affects forgetting. Specifically the prior results on lower layer feature reuse suggest a key question: does similarity between tasks result in less forgetting? Surprisingly, the answer is quite nuanced, depending on how precisely the different tasks are represented in the network.
|
| 116 |
+
|
| 117 |
+
# 6.1 FORGETTING, TASK SEMANTICS AND A SIMILARITY PUZZLE
|
| 118 |
+
|
| 119 |
+
Our study of the relationship between task semantic similarity and forgetting reveals a surprising puzzle. In Figure 8 and Table 1, we observe that depending on the task setup, a semantically similar task may be forgotten less or more than a less similar task. This behavior is consistent across different settings and datasets. Specifically, in Figure 8a and 8d, Task 1 and Task 2 consist of binary classifications between animals and objects from CIFAR-10, where we find that the similar categories forget less. But in Figure 8b and 8e, a four category classification between animals and objects followed by a binary classification task results in the similar categories being forgotten more. Table 1 shows an analogous result on ImageNet. This effect of similar categories being forgotten more can also be observed in the CIFAR-100 distribution shift setting, where input distribution shift to the CIFAR-100 superclasses results in more similar categories being forgotten more, e.g. input shifts to natural superclasses (Figure 8c) or artifical superclasses (Figure 8f). Further details and supporting experiments can be found in Appendix B.9.
|
| 120 |
+
|
| 121 |
+
In the subsequent sections, we resolve this puzzle through (i) the development of an analytic model that formalizes the subtle connection between task similarity and forgetting (ii) an ensuing measure of task similarity, trace overlap, empirically quantifies task similarity (iii) showing maximal forgetting happens with intermediate task similarity.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 8: Forgetting severity consistently varies along semantic divisions. (a,d) For sequential binary classification tasks models trained on either objects or animals forgets less on a second object task of the same semantic category. (b,e) Models trained initially on four way classification of two object and two animal classes see more forgetting in semantically similar classes when trained on a second two class task of either objects or animals. (c,f) Models trained on sequential six-way classification with four unaltered categories (shown) and two altered categories show increased forgetting in the unaltered categories semantically most similar to altered categories. For all panes, performance is shown for ResNet, with additional results in Appendix B.9.
|
| 125 |
+
|
| 126 |
+
Table 1: Task Semantics and forgetting in ImageNet Here a ResNet50 is first trained (task 1) to classify either 10 animals, 10 artifacts or 10 animals and artifacts (chosen randomly from ImageNet). The network is then trained (task 2) to either classify 10 different animals or 10 different artifacts. The table shows performance drop on Task 1 after Task 2 training. Similar to Figure 8, when Task 1 is either animals or artifacts (top part of table), similar tasks forget less, while when Task 1 is both animals and artifacts, similar tasks show greater forgetting (bottom part of table).
|
| 127 |
+
|
| 128 |
+
<table><tr><td>Task Description</td><td colspan="2">Performance Drop on Task 1 Animals Artifacts</td></tr><tr><td>Task1:animals Task2:animals</td><td>0.0885 ± 0.0259</td><td></td></tr><tr><td>Task1:animals Task2:artifacts</td><td>0.1832 ± 0.0484</td><td></td></tr><tr><td>Task1:artifacts Task2:artifacts</td><td></td><td>0.2884 ± 0.0187</td></tr><tr><td>Task1:artifacts Task2:animals</td><td>■</td><td>0.3720 ± 0.0288</td></tr><tr><td>Task1:animals and artifacts Task2:animals</td><td>0.1752 ± 0.0193</td><td>0.1532 ± 0.0231</td></tr><tr><td>Task1:animals and artifacts Task2:artifacts</td><td>0.2057 ± 0.0312</td><td>0.2330 ± 0.0292</td></tr></table>
|
| 129 |
+
|
| 130 |
+
# 6.2 AN ANALYTIC MODEL OF FORGETTING SEMANTICS
|
| 131 |
+
|
| 132 |
+
We first formalize a model with a single classification head (like in distribution shift CIFAR-100), $\scriptstyle \sum _ { \mu = 1 } ^ { p } \theta _ { \mu } g _ { \mu } ( w ; x )$ nding m, where $\theta$ ti-head setup in Appendix C. Ware the last layer weights and $g$ write the network output asare features. We consider $f ( x ) =$ sequentially on two tasks. For the first task, we train normally. For the second task, inspired by our empirical observation above that forgetting is driven by deeper layers, we freeze the the earlier layer features, $g _ { \mu } ( w ; x ) = g _ { \mu } ( \hat { w } ; x )$ when training on the second task (here $\hat { w }$ represent the weights after training on the first task). If we train with loss function $L ( f , y )$ and learning rate $\eta$ , the network output SGD update at timestep $t$ is
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\Delta f _ { t } ( x ) = - \eta \sum _ { x ^ { \prime } , y ^ { \prime } \in \mathcal { D } _ { \operatorname { t r a i n } } ^ { ( 2 ) } } \Theta ( x , x ^ { \prime } ) \frac { \partial L ( f ( x ^ { \prime } ) , y ^ { \prime } ) } { \partial f } .
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
Here D(2) is the second-task training data and $\begin{array} { r } { \Theta ( x , x ^ { \prime } ) = \sum _ { \mu = 1 } ^ { p } g _ { \mu } ( \hat { w } ; x ) g _ { \mu } ( \hat { w } ; x ^ { \prime } ) } \end{array}$ is the overlap (inner product) between the model last-layer representations on data point $x$ and $x ^ { \prime }$ . If the overlap $\Theta ( x , x ^ { \bar { \prime } } )$ is small, then the change in the logits is small and forgetting is minimal, specifically:
|
| 139 |
+
|
| 140 |
+
Lemma 1 Let $f _ { t }$ be the logits of a neural network trained via the frozen feature model. Let $x$ be an element of the initial task test set. Let us further denote the vector of the feature overlap applied to the second task training set as $ { \vec { \Theta } } ( x ) : = \{ \Theta ( x , x ^ { \prime } ) : x ^ { \prime } \in X _ { t r a i n } ^ { ( 2 ) } \}$ and the loss vector as $\vec { L } = \{ L ( f ( x ^ { \prime } ) , y ^ { \prime } ) : x ^ { \prime } , y ^ { \prime } \in \mathcal { D } _ { t r a i n } ^ { ( 2 ) } \}$ train. With this, the change in the original task logits is bounded as
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
| \Delta f _ { t } ( x ) | \leq \eta | | { \vec { \Theta } } ( x ) | | | { \frac { \partial { \vec { L } } } { \partial f } } | | .
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
Thus representational similarity is necessary for forgetting to occur, and in this model, sufficiently similar and sufficiently dissimilar tasks have minimal forgetting, while intermediate similar tasks have maximal forgetting.
|
| 147 |
+
|
| 148 |
+
# 6.3 CATASTROPHIC FORGETTING ACROSS VARYING TASK SIMILARITIES
|
| 149 |
+
|
| 150 |
+
The analytical result enables us to make precise a measure of task similarity, through using the feature overlap matrix $\Theta ( x ^ { \prime } , x )$ . Concretely, letting $\Theta _ { 1 1 }$ be the overlap matrix on Task 1, $\Theta _ { 2 2 }$ on Task 2, and $\Theta _ { 1 2 }$ on Task 1 and Task 2, we define:
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
\mathrm { T r a c e ~ o v e r l a p } = \frac { \mathrm { T r } \left( \Theta _ { 1 2 } \Theta _ { 1 2 } ^ { T } \right) } { \sqrt { \left( \right)} \mathrm { T r } \left( \Theta _ { 1 1 } \Theta _ { 1 1 } ^ { T } \right) \mathrm { T r } \left( \Theta _ { 2 2 } \Theta _ { 2 2 } ^ { T } \right) } .
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
Trace overlap is directly analogous to CKA, where instead of comparing the similarity of different features on the same data, we are comparing the similarity of common features on different data.
|
| 157 |
+
|
| 158 |
+
Increasing task dissimilarity can help reduce forgetting In Lemma 1, we see that very dissimilar tasks, with small overlap matrix, exhibit minimal forgetting. In Figure 9, we test this in the context of sequential binary classification. We introduce an other category to the classification problem (of images from classes not included in the training tasks), which encourages the model to represent Task 1 and Task 2 dissimilarly (lower trace overlap in Figure 9b), and reduces forgetting (Figure 9a).
|
| 159 |
+
|
| 160 |
+
Maximal forgetting at intermediate similarity To empirically study the conclusion from the model that intermediate-similar tasks have maximal forgetting, we use mixup (Zhang et al., 2017), a standard data augmentation technique, to interpolate between the two tasks. Specifically, we first train a model on binary classification (with an other category to encourage dissimilarity) and for $\lambda \in [ 0 , 1 ]$ , generate an mixup dataset D(λ)train $\mathcal { D } _ { \mathrm { t r a i n } } ^ { ( \lambda ) } = \{ ( \lambda x ^ { ( 2 ) } + ( 1 - \lambda ) x ^ { ( 1 ) } , \lambda y ^ { ( 2 ) } + ( 1 - \lambda ) y ^ { ( 1 ) } ) \}$ . We compare model behavior across a range of mixup fractions, finding that the task similarity as measured through the trace overlap between task1 and task2 varies monotonically with mixup fraction (Figure 10b), quantifying that varying the mixing parameter, $\lambda$ , tunes the degree of task similarity. Figure 10a shows that the most extreme forgetting happens for intermediate similarity (i.e. mixing fraction $\sim 0 . 1 - 0 . 2 $ ).
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 9: Adding an other category reduces forgetting and increases orthogonalization. (a) Models trained initially on classifying two objects: airplane/automobile, and subsequently on two animals: deer/dog exhibit diminished forgetting when we add an other category to task 1 training. The other category contains randomly sampled images from all classes not present in the initial or final tasks. (b,c) The presence of the other category reduces the similarity between the model’s representations of each task. Additional plots are in Appendix B.8.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 10: Task similarity affects performance. (a) We measure initial task performance for sequential binary classification as we dial the mixup fraction between 0.0, pure task 2 data, and 1.0, pure task 1 data. Maximum forgetting (minimal accuracy) occurs at an intermediate value of the mixup fraction, $\sim 0 . 1 - 0 . 2$ . (b) We measure the similarity between task 1 and task 2 as we vary the mixup fraction, supporting the intuition that interpolating mixup fraction interpolates task similarity. (c) Task 1 performance after task 2 training is plotted against task 1 versus task 2 representational similarity for animal and object classes in the sequential binary classification tasks (solid) and four-way followed by binary classification tasks (hollow) of Figures 8a and Figures 8b. In the case of sequential binary tasks both object and animal second tasks are represented extremely similarly to the initial object task and the slightly less similar, object task, forgets more. For the four way classification task, animals are represented dissimilarly to the second object task and cause less forgetting.
|
| 167 |
+
|
| 168 |
+
Semantic similarity revisited Armed with these quantitative measures, we revisit the task semantics puzzle in Figure 8 where (i) for sequential binary classification, semantically more similar categories were forgotten less, while in (ii) four class classification followed by binary classification and input distribution shift, similar classes were forgotten more. Figure 10c (solid dots) shows that in (i) the net didn’t represent objects and animals differently, and the slightly more similar task is forgotten less. But in (ii) Figure 10c (hollow dots), the model encodes animals and objects differently, minimizing forgetting on the dissimilar tasks, consistent with maximal forgetting for intermediate similarity.
|
| 169 |
+
|
| 170 |
+
# 7 CONCLUSION
|
| 171 |
+
|
| 172 |
+
In this paper, we have studied some of the fundamental properties of catastrophic forgetting, answering important open questions on how it arises and interacts with hidden representations, mitigation strategies and task semantics. By using representational analysis techniques, we demonstrated that forgetting is not evenly distributed throughout the deep learning model but concentrated at the higher layers, which change significantly and erase earlier task subspaces through sequential training. Consistent with this, we find mitigation methods all stabilize higher layer representations, but vary on whether they enforce more feature reuse, or store tasks in orthogonal subspaces. Informed by these insights, we formulate an analytic model to investigate connections between forgetting and task semantics. This gives a quantitative measure of task similarity and shows that intermediate similarity in sequential tasks leads to maximal forgetting. In summary, these results help provide a foundation for a deeper understanding of catastrophic forgetting and suggest new approaches for developing and measuring mitigation methods.
|
| 173 |
+
|
| 174 |
+
# REFERENCES
|
| 175 |
+
|
| 176 |
+
Naveen Arivazhagan, Ankur Bapna, Orhan Firat, Dmitry Lepikhin, Melvin Johnson, Maxim Krikun, Mia Xu Chen, Yuan Cao, George Foster, Colin Cherry, et al. Massively multilingual neural machine translation in the wild: Findings and challenges. arXiv preprint arXiv:1907.05019, 2019.
|
| 177 |
+
|
| 178 |
+
Dumitru Erhan, Y. Bengio, Aaron Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. Technical Report, Univeriste de Montr ´ eal ´ , 01 2009.
|
| 179 |
+
|
| 180 |
+
Dar Gilboa and Guy Gur-Ari. Wider networks learn better features, 2019.
|
| 181 |
+
|
| 182 |
+
Raphael Gontijo-Lopes, Sylvia J Smullin, Ekin D Cubuk, and Ethan Dyer. Affinity and diversity: Quantifying mechanisms of data augmentation. arXiv preprint arXiv:2002.08973, 2020.
|
| 183 |
+
|
| 184 |
+
Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013.
|
| 185 |
+
|
| 186 |
+
Akhilesh Gotmare, Nitish Shirish Keskar, Caiming Xiong, and Richard Socher. A closer look at deep learning heuristics: Learning rate restarts, warmup and distillation. arXiv preprint arXiv:1810.13243, 2018.
|
| 187 |
+
|
| 188 |
+
Arthur Gretton, Olivier Bousquet, Alex Smola, and Bernhard Scholkopf. Measuring statistical ¨ dependence with hilbert-schmidt norms. In International conference on algorithmic learning theory, pp. 63–77. Springer, 2005.
|
| 189 |
+
|
| 190 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition, 2015.
|
| 191 |
+
|
| 192 |
+
Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks, 2016.
|
| 193 |
+
|
| 194 |
+
Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and ´ generalization in neural networks. In NeurIPS, 2018.
|
| 195 |
+
|
| 196 |
+
Ronald Kemker, Marc McClure, Angelina Abitino, Tyler L Hayes, and Christopher Kanan. Measuring catastrophic forgetting in neural networks. In Thirty-second AAAI conference on artificial intelligence, 2018.
|
| 197 |
+
|
| 198 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114 (13):3521–3526, 2017.
|
| 199 |
+
|
| 200 |
+
Simon Kornblith, Mohammad Norouzi, Honglak Lee, and Geoffrey Hinton. Similarity of neural network representations revisited. arXiv preprint arXiv:1905.00414, 2019.
|
| 201 |
+
|
| 202 |
+
Sneha Reddy Kudugunta, Ankur Bapna, Isaac Caswell, Naveen Arivazhagan, and Orhan Firat. Investigating multilingual nmt representations at scale. arXiv preprint arXiv:1909.02197, 2019.
|
| 203 |
+
|
| 204 |
+
Sang-Woo Lee, Jin-Hwa Kim, Jaehyun Jun, Jung-Woo Ha, and Byoung-Tak Zhang. Overcoming catastrophic forgetting by incremental moment matching. In Advances in neural information processing systems, pp. 4652–4662, 2017.
|
| 205 |
+
|
| 206 |
+
Xilai Li, Yingbo Zhou, Tianfu Wu, Richard Socher, and Caiming Xiong. Learn to grow: A continual structure learning framework for overcoming catastrophic forgetting. arXiv preprint arXiv:1904.00310, 2019.
|
| 207 |
+
|
| 208 |
+
Jean M. Mandler and Laraine McDonough. Concept formation in infancy. Cognitive Development, 8(3):291 – 318, 1993. ISSN 0885-2014. doi: https://doi.org/10. 1016/S0885-2014(93)80003-C. URL http://www.sciencedirect.com/science/ article/pii/S088520149380003C.
|
| 209 |
+
|
| 210 |
+
Amil Merchant, Elahe Rahimtoroghi, Ellie Pavlick, and Ian Tenney. What happens to bert embeddings during fine-tuning?, 2020.
|
| 211 |
+
|
| 212 |
+
Ari Morcos, Maithra Raghu, and Samy Bengio. Insights on representational similarity in neural networks with canonical correlation. In Advances in Neural Information Processing Systems, pp. 5727–5736, 2018.
|
| 213 |
+
|
| 214 |
+
Behnam Neyshabur, Hanie Sedghi, and Chiyuan Zhang. What is being transferred in transfer learning?, 2020.
|
| 215 |
+
|
| 216 |
+
Cuong V Nguyen, Alessandro Achille, Michael Lam, Tal Hassner, Vijay Mahadevan, and Stefano Soatto. Toward understanding catastrophic forgetting in continual learning. arXiv preprint arXiv:1908.01091, 2019.
|
| 217 |
+
|
| 218 |
+
Stephan Rabanser, Stephan Gunnemann, and Zachary Lipton. Failing loudly: an empirical study of ¨ methods for detecting dataset shift. In Advances in Neural Information Processing Systems, pp. 1394–1406, 2019.
|
| 219 |
+
|
| 220 |
+
Maithra Raghu and Eric Schmidt. A survey of deep learning for scientific discovery. arXiv preprint arXiv:2003.11755, 2020.
|
| 221 |
+
|
| 222 |
+
Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. Svcca: Singular vector canonical correlation analysis for deep learning dynamics and interpretability. In Advances in Neural Information Processing Systems, pp. 6076–6085, 2017.
|
| 223 |
+
|
| 224 |
+
Roger Ratcliff. Connectionist models of recognition memory: constraints imposed by learning and forgetting functions. Psychological review, 97 2:285–308, 1990.
|
| 225 |
+
|
| 226 |
+
Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? arXiv preprint arXiv:1902.10811, 2019.
|
| 227 |
+
|
| 228 |
+
Hippolyt Ritter, Aleksandar Botev, and David Barber. Online structured laplace approximations for overcoming catastrophic forgetting. In Advances in Neural Information Processing Systems, pp. 3738–3748, 2018.
|
| 229 |
+
|
| 230 |
+
Anthony Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2): 123–146, 1995.
|
| 231 |
+
|
| 232 |
+
David Rolnick, Arun Ahuja, Jonathan Schwarz, Timothy Lillicrap, and Gregory Wayne. Experience replay for continual learning. In Advances in Neural Information Processing Systems, pp. 348–358, 2019.
|
| 233 |
+
|
| 234 |
+
Andrew M. Saxe, James L. McClelland, and Surya Ganguli. A mathematical theory of semantic development in deep neural networks. Proceedings of the National Academy of Sciences, 116 (23):11537–11546, 2019. ISSN 0027-8424. doi: 10.1073/pnas.1820226116. URL https: //www.pnas.org/content/116/23/11537.
|
| 235 |
+
|
| 236 |
+
Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
|
| 237 |
+
|
| 238 |
+
Joan Serra, Didac Suris, Marius Miron, and Alexandros Karatzoglou. Overcoming catastrophic \` forgetting with hard attention to the task. arXiv preprint arXiv:1801.01423, 2018.
|
| 239 |
+
|
| 240 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition, 2014.
|
| 241 |
+
|
| 242 |
+
Jasper Snoek, Yaniv Ovadia, Emily Fertig, Balaji Lakshminarayanan, Sebastian Nowozin, D Sculley, Joshua Dillon, Jie Ren, and Zachary Nado. Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, pp. 13969–13980, 2019.
|
| 243 |
+
|
| 244 |
+
Jonathan M Stokes, Kevin Yang, Kyle Swanson, Wengong Jin, Andres Cubillos-Ruiz, Nina M Donghia, Craig R MacNair, Shawn French, Lindsey A Carfrae, Zohar Bloom-Ackerman, et al. A deep learning approach to antibiotic discovery. Cell, 180(4):688–702, 2020.
|
| 245 |
+
|
| 246 |
+
Mariya Toneva, Alessandro Sordoni, Remi Tachet des Combes, Adam Trischler, Yoshua Bengio, and Geoffrey J. Gordon. An empirical study of example forgetting during deep neural network learning. ArXiv, abs/1812.05159, 2019.
|
| 247 |
+
|
| 248 |
+
John M. Wu, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. Similarity analysis of contextual word representation models, 2020.
|
| 249 |
+
Shijie Wu, Alexis Conneau, Haoran Li, Luke Zettlemoyer, and Veselin Stoyanov. Emerging crosslingual structure in pretrained language models. arXiv preprint arXiv:1911.01464, 2019a.
|
| 250 |
+
Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019b.
|
| 251 |
+
Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3987– 3995. JMLR. org, 2017.
|
| 252 |
+
Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
|
| 253 |
+
|
| 254 |
+
# A METHODS
|
| 255 |
+
|
| 256 |
+
# A.1 MODELS
|
| 257 |
+
|
| 258 |
+
Here we detail the model architectures used in this study. We use standard versions of the popular VGG (Simonyan & Zisserman, 2014), ResNet (He et al., 2015), and DenseNet (Huang et al., 2016) architectures. These architectures have varying structural properties (e.g., presence or absence of skip connections), meaning observed behaviors common to all of them are likely to be robust and generalizable.
|
| 259 |
+
|
| 260 |
+
VGG: The VGG model we use consists of five stages. Each stage comprises a convolutional layer, a ReLU nonlinearity, another convolutional layer, another ReLU nonlinearity, and finally a MaxPool layer. Each convolution uses a 3-by-3 kernel with unit stride and padding. The MaxPool operation uses a 2-by-2 kernel with stride 2. The number of channels by stage is 16, 32, 64, 128, 128. We do not use batch normalization in the VGG.
|
| 261 |
+
|
| 262 |
+
We test two different version of the VGG: one with just the stages described above, and another with two fully connected layers, of width 1024, after the convolutional layers.
|
| 263 |
+
|
| 264 |
+
ResNet: Our ResNet consists of a initial 3-by-3 convolutional layer with 32 channels, followed by a 2d batch norm operation. This initial pair is followed by four stages, each consisting of two residual blocks per stage. Each block consists of two conv-BN-ReLU sequences, with a shortcut layer directly routing the input to add to the final ReLU preactivations. All convolutions are 3-by-3, with unit padding. In all but the first block, the first convolutional layer downsamples, with a stride of 2; the second convolutional layer maintains stride of 1. The number of channels doubles each block, starting from a base level of 32 channels in the first block.
|
| 265 |
+
|
| 266 |
+
DenseNet: Like ResNet, our DenseNet consists of an initial 3-by-3 convolution, followed by four dense blocks. In between each pair of dense blocks is a transition block. Following the final dense block is a batch-normalization, ReLU, and average pooling operation to generate the final features. Our DenseNet is characterized by a growth rate of 12 and compression rate of 0.5. The first stage of the DenseNet features 6 blocks, with the number of blocks doubling in each subsequent stage.
|
| 267 |
+
|
| 268 |
+
# A.2 TRAINING
|
| 269 |
+
|
| 270 |
+
All networks are trained using cross-entropy loss with SGD with momentum $\beta = 0 . 9 ,$ ), using a batch size 128. We do not use learning-rate schedules here, leaving that investigation to future work. To better correspond with practical situations, however, we choose a learning rate and total number of epochs such that interpolation (of the training set) occurs. For the split CIFAR-10 task, this typically corresponds to training for 30 epochs per task with a learning rate of 0.01 (VGG), 0.03 (ResNet), and 0.03 (DenseNet). We use weight decay with strength 1e-4, and do not apply any data augmentation. For the split CIFAR-100 task, we usually train for 60 or 90 epochs per task, with other the other hyperparameters identical to the CIFAR-10 case.
|
| 271 |
+
|
| 272 |
+
For multi-head networks (used in split CIFAR-10), each head is initialized with weights drawn from a normal distribution with variance $1 / n _ { f }$ , where $n _ { f }$ is the number of features; biases are initialized to zero. We do not copy the parameters from the old head to the new when switching tasks.
|
| 273 |
+
|
| 274 |
+
For the split CIFAR-10 setup, the plots shown in the main text refer to experiments in which the initial task was classifying between the five categories airplane, automobile, bird, cat, and deer; and the second task comprising dog, frog, horse, ship, and truck. To verify that our results were not unique to the particular split of CIFAR-10 we chose, we used three other splits: airplane, bird, deer, frog, ship (task 1) and automobile, cat, dog, horse, truck (task 2); automobile, cat, dog, horse, truck (task 1) and airplane, bird, deer, frog, ship (task 2); and dog, frog, horse, ship, truck (task 1) and airplane, automobile, bird, cat, deer (task 2).
|
| 275 |
+
|
| 276 |
+
# A.3 CIFAR-100 DISTRIBUTION SHIFT TASK
|
| 277 |
+
|
| 278 |
+
Here we provide the concrete example of the CIFAR-100 distribution-shift task shown in Figure 1. This is meant to capture it the scenario where catastrophic forgetting arises through input distribution shift — the input data to the neural network undergoes a distribution shift, causing the neural network to perform poorly on earlier data distributions (Arivazhagan et al., 2019; Snoek et al., 2019; Rabanser et al., 2019). As mentioned in the main text, in this task, the model must identify, for CIFAR-100 images, which of the 20 superclasses the image belongs to. The difference in tasks comes from the difference in subclasses which make up the superclass. As an example, we take the five superclasses aquatic mammals, fruits and vegetables, household electrical devices, trees, and vehicles- $I ^ { \hat { 1 } }$ , with the corresponding task 1 subclasses (1) dolphin, (2) apple, (3) lamp, (4) maple tree, and (5) bicycle and task 2 subclasses (1) whale, (2) orange, (3) television, (4) willow, and (5) motorcycle. A key feature of this setting is that task-specific components (including multiple heads) are precluded since the model does not know the task identity either at inference or time. While we do not explore it here, this setup also allows for continuously varying the data distribution, another situation likely to occur in practice.
|
| 279 |
+
|
| 280 |
+
# A.4 REPRESENTATIONAL SIMILARITY AND CENTERED KERNEL ALIGNMENT
|
| 281 |
+
|
| 282 |
+
To understand properties of neural network hidden representations, we turn to representational similarity algorithms. A key challenge in analyzing neural network hidden representations is the lack of alignment — no natural correspondence exists between hidden neurons across different neural networks. Representational similarity algorithms propose different ways to overcome this — one of the first such algorithms, SVCCA (Raghu et al., 2017; Morcos et al., 2018), uses a Canonical Correlation Analysis (CCA) step to align neurons (enable invariance) through linear transformations.
|
| 283 |
+
|
| 284 |
+
We use centered kernel alignment (CKA), proposed by Kornblith et al. (2019), to measure the similarity between two representations of the same dataset which is invariant to orthogonal transformation and isotropic scaling (but not arbitrary linear transformations). Given a dataset of $m$ examples, we compare two representations $X$ and $Y$ of that dataset (say, from two different neural networks or from the same neural network with different parameters), with $n _ { x }$ and $n _ { y }$ features respectively; that is, $X \in \mathbb { R } ^ { m \times n _ { x } }$ and $Y \in \mathbb { R } ^ { m \times n _ { y } }$ . Then the linear-kernel CKA similarity between the two representations is given by
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
\mathrm { C K A } ( X , Y ) = { \frac { | | X ^ { T } Y | | _ { F } ^ { 2 } } { | | X ^ { T } X | | _ { F } ^ { 2 } | | Y ^ { T } Y | | _ { F } ^ { 2 } } }
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
# A.5 SUBSPACE SIMILARITY
|
| 291 |
+
|
| 292 |
+
For the subspace similarity computations we pick a fixed threshold $k$ for all layers so that the first $k$ principal components capture $\mathrm { \bar { 8 0 \% } }$ of variance in the final layer. This gives $k = 3$ for Resnet on CIFAR-10, $k = 4$ for Resnet on CIFAR-100, $k = 4$ for VGG on CIFAR-10 and $k = 7$ for VGG on CIFAR-100 and $k = 4$ for DenseNet on CIFAR-10 and $k = 5$ for DenseNet on CIFAR-100.
|
| 293 |
+
|
| 294 |
+

|
| 295 |
+
Figure 11: Subspace similarity analysis shows feature reuse in lower layers and Task 1 subspace erasure in higher layers.
|
| 296 |
+
|
| 297 |
+
# A.6 MITIGATION METHODS
|
| 298 |
+
|
| 299 |
+
# A.6.1 ELASTIC WEIGHT CONSOLIDATION
|
| 300 |
+
|
| 301 |
+
Developed by Kirkpatrick et al. in 2017, elastic weight consolidation (EWC) adds a term to the loss function of the new task to get the regularized loss function $\mathcal { L } ( \vec { \theta } )$ :
|
| 302 |
+
|
| 303 |
+
$$
|
| 304 |
+
\mathcal { L } ( \vec { \theta } ) = \mathcal { L } _ { B } ( \vec { \theta } ) + \frac { \lambda } { 2 } \sum _ { i } F _ { i } \cdot \left( \theta _ { i } - \theta _ { A , i } ^ { * } \right) ^ { 2 } .
|
| 305 |
+
$$
|
| 306 |
+
|
| 307 |
+
Here, $\vec { \theta }$ are the model parameters; $\mathcal { L } _ { B } ( \vec { \theta } )$ is the unregularized loss function of the new task; $\lambda$ is a parameter which controls the strength of the regularization; $F _ { i }$ is the diagonal of the Fisher information matrix with respect to the parameters; and $\vec { \theta } _ { A } ^ { * }$ are the model parameters after having been trained on task A. We compute the Fisher information via using the squared gradients of the log-likelihood, averaged over a subset of the trainset. We use the empirical Fisher as an approximation.
|
| 308 |
+
|
| 309 |
+
Following standard practice, in our experiments we estimate the Fisher information using a subset of the full training data; for all of our models on CIFAR-10, 200 samples proved sufficient to be reasonably confident of a converged estimate. We do not include a delay between the start of secondtask training and the application of the EWC penalty. Naturally, we do not apply the EWC penalty to the parameters of the head in the multi-head setting.
|
| 310 |
+
|
| 311 |
+
# A.6.2 SYNAPTIC INTELLIGENCE
|
| 312 |
+
|
| 313 |
+
Developed by Zenke et al. (2017), synaptic intelligence, like EWC, is a structural regularization method which adds an elastic penalty to the second task’s loss function:
|
| 314 |
+
|
| 315 |
+
$$
|
| 316 |
+
\mathcal { L } ( \vec { \theta } ) = \mathcal { L } _ { B } ( \vec { \theta } ) + \frac { \lambda } { 2 } \sum _ { i } C _ { i } \cdot \left( \theta _ { i } - \theta _ { A , i } ^ { * } \right) ^ { 2 } .
|
| 317 |
+
$$
|
| 318 |
+
|
| 319 |
+
The difference from EWC is in how the elastic penalties are calculated. In synaptic intelligence, for each parameter, a contribution to the loss is tracked via the product of the gradient of the loss and the stepwise change in the parameter value. The coefficient is then constructed such that changing the parameter by an amount equal to its change during task-1 training will incur a loss penalty equal to the change in loss from the initial value. Our implementation does not differ from the standard implementation.
|
| 320 |
+
|
| 321 |
+
# B SUPPORTING EXPERIMENTS
|
| 322 |
+
|
| 323 |
+
Here we present experiments omitted from the main text for space, which help flesh out some of the conclusions. This section is roughly organized with layerwise experiments first, followed by semantic experiments.
|
| 324 |
+
|
| 325 |
+
# B.1 LAYER RESET EXPERIMENTS
|
| 326 |
+
|
| 327 |
+
As described in the main text, we perform an additional experiment to check that deeper representations get corrupted more than shallower representations. This experiment, corresponding to Figure 12, shows that when layers are reset to their pre-forgetting value, performance improves more dramatically when deeper layers are reset first.
|
| 328 |
+
|
| 329 |
+
# B.2 TASK-SPECIFIC STAGES
|
| 330 |
+
|
| 331 |
+
Our observations that forgetting is driven primarily by the higher layers suggests that in a setting with known task identities (i.e. in the split CIFAR-10 setting described in the main text but not the CIFAR-100 distribution-shift setting), making the deeper stages of the network task-specific would likely mitigate a large portion of forgetting on the old tasks while still allowing for full performance on the new tasks. In particular, since the changes in deeper represntations are much greater than their shallower counterparts, only a few task-specific stages should be necessary to get significant performance increases on the old task. For each of the three network architectures we considered (VGG, ResNet, and DenseNet), we investigated the performance of these task-specific networks on the split CIFAR task. We intend these results to be further evidence of the role of deeper layers in forgetting, not a proposed mitigation scheme.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 12: Layer reset experiments. After training on Task 2 we reset contiguous blocks of layers to their values before training and record the resulting accuracy on Task 1 (bottom row). We see a significant increase in accuracy when resetting the highest $N$ layers (blue line) compared to resetting the $N$ lowest layers (gray line). Together, these results demonstrate that higher layers are disproportionately responsible for forgetting.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 13: Forgetting in networks with task-specific stages on CIFAR-10. Using the same settings as Figure 1 of the main text, we run networks with task-specific layers on split CIFAR-10. We make deeper layers task-specific before shallower layers. Performance increases with number of task-specific layers, denoted by the line color (see legend). In all architectures, two task-specific stages is sufficient to recover significant performance.
|
| 338 |
+
|
| 339 |
+
Results, shown in figure 13, show that for all architectures, performance dramatically rises with the number of task-specific stages. For all architectures, having the deepest two stages be task-specific recovers a significant fraction of the forgotten task performance.
|
| 340 |
+
|
| 341 |
+
# B.3 LAYER RESET AND RETRAIN EXPERIMENTS
|
| 342 |
+
|
| 343 |
+
As an additional probe of the degree to which catastrophic forgetting impacts the representations of various network layers, we perform a reset-and-retrain experiment on the split CIFAR-10 task, using the same training setup as in Figure 3 of the main text. The reset-and-retrain experiment is designed to probe the degree to which network representations get corrupted and can no longer be used by a network of the same architecture to productively classify images. To investigate this, after having trained the network on Task 2, we freeze parameters of stages 1 through $N$ to their post-task-2 values, reset the parameters of stages $N + 1$ onwards to their post-task-1 values, and then retrain those parameters on the Task 1 loss function. This is a natural, operational measure of the degree to which layer 1 through $N$ representations have been corrupted.
|
| 344 |
+
|
| 345 |
+
The results of this experiment, shown in Figure 14, tell a similar story to that of Figure ?? of the main text. In particular, we see even retraining the network with all but the last couple of layers frozen recovers nearly the pre-forgetting performance of the network.
|
| 346 |
+
|
| 347 |
+
Some of the performances in Figure 14 even outperform the pre-forgetting network performance, suggesting that network representations of intermediate layers may actually be improved by training on Task 2. Further suggestive results are shown in Figure 15, in which we retrain the full network again on Task 1 after the training on Task 2. For ResNet and, to some degree, VGG, training on the second task clearly improves performance on the first.
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
Figure 14: Layer reset and retrain experiments. Consistent with the observations in the freeze-training, layer reset, and CKA experiments, resetting and retraining only a few stages from the top is enough to recover the performance before forgetting.
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 15: Training on a different task can improve performance on the original task. Networks are trained on two five-class splits of CIFAR-10. The gray curve shows the test accuracy on task 0 during training on solely that task for 270 epochs; the teal curve shows the task-0 test accuracy when training on task 0 for 90 epochs, then on task 1 for 90 epochs, and task 0 again for 90 epochs. While we see a sharp performance drop for the duration of training on task 1, the performance is quickly recovered once we begin training on task 0, and in fact surpasses the performance of the model only exposed to task-0 data. This effect is consistent across different splits of the original dataset. Of the architectures we studied, this effect is most pronounced for ResNet, but also exists to some degree for VGG and DenseNet models.
|
| 354 |
+
|
| 355 |
+
# B.4 REPRESENTATION CHANGES IN THE CIFAR-100 DISTRIBUTION SHIFT EXPERIMENTS
|
| 356 |
+
|
| 357 |
+
Here we show the change in representations due to training on distribution-shifted CIFAR-100 for the VGG (Figure 16) and DenseNet (Figure 17) networks, to accompany the ResNet results in the main text.
|
| 358 |
+
|
| 359 |
+

|
| 360 |
+
Figure 16: Change in Densenet representations under CIFAR-100 distribution shift.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 17: Change in VGG representations under CIFAR-100 distribution shift.
|
| 364 |
+
|
| 365 |
+
B.5 ADDITIONAL EXPERIMENTS FOR SUBSPACE SIMILARITY OF MITIGATION METHODS
|
| 366 |
+
|
| 367 |
+
We include additional experiments on computing subspace similarities for different mitigation methods across different architectures. The results support the orthogonal storage of Task 1, Task 2 representations by replay, while EWC and SI enforce greater feature reuse in the higher layers.
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
Figure 18: Subspace similarity analysis reveals differences between different mitigation methods, with replay storing Task 1 and Task 2 representations in orthogonal subspaces, while EWC and SI promote feature reuse in the higher layers. Additional results, compare to Figure 6 in the main text.
|
| 371 |
+
|
| 372 |
+
# B.6 LINEAR REGRESSION ON FORGOTTEN NETWORK ACTIVATIONS
|
| 373 |
+
|
| 374 |
+
To further probe the manner in which catastrophic forgetting affects the internal representation of networks, we perform the following experiment (in the split CIFAR-10 setting). We train a (multihead) model on the first task for some time, resulting in model $M _ { 1 }$ , and then train on the second task for some time, resulting in model $M _ { 2 }$ . Due to forgetting, the model $M _ { 2 }$ of course performs significantly worse than does $M _ { 1 }$ on the first task. But, to probe how much information has been lost internally, we train a linear model to classify between the first-task categories using only the internal activations of $M _ { 2 }$ on the first-task images. We measure both the amount of performance which we can recover using this linear regression, and the weight placed by the linear model on various stages of the network.
|
| 375 |
+
|
| 376 |
+
Model performances are given in Table 2. For all three architectures, the performance of the model before forgetting is naturally the highest, with a performance drop of up to forty percent due to forgetting. Remarkably, however, training a linear model on the internal post-forgetting activations recovers a substantial fraction of the performance loss: for ResNet and VGG, the linear model on post-forgetting activations is only a percent less accurate than the model before forgetting. As a control, we also train a linear model on the activations of networks at initialization (denoted the random lift in the table). Because the number of activations is much higher than the number of pixels in a CIFAR-10 image, this control is necessary to ensure that the boost in performance we see is not simply due to performing a high-dimensional lift which renders the data linearly separable. As the table shows, however, this random lift performance is quite poor.
|
| 377 |
+
|
| 378 |
+
Table 2: Performance of linear model trained on internal activations.
|
| 379 |
+
|
| 380 |
+
<table><tr><td></td><td>DenseNet</td><td>ResNet</td><td>VGG</td></tr><tr><td>Pre-forgetting accuracy</td><td>0.869</td><td>0.7714</td><td>0.7970</td></tr><tr><td>Post-forgetting accuracy</td><td>0.4754</td><td>0.5924</td><td>0.5877</td></tr><tr><td>Linear regression on activations</td><td>0.802</td><td>0.7592</td><td>0.7896</td></tr><tr><td>Linear regression on random lift</td><td>0.447</td><td>0.4198</td><td>0.543</td></tr></table>
|
| 381 |
+
|
| 382 |
+
Figure 19 shows the weights placed by the linear model on the various internal activations of the network. We use the activations both before and after forgetting. Before forgetting, a linear model trained on the activations places most importance on the final layers, as expected; however, after forgetting, the model learns to use information stored in earlier-layer representations of the network. The reduced weighting of the final layers is consistent with the experiments we describe in the main text showing that deeper representations suffer the most from forgetting.
|
| 383 |
+
|
| 384 |
+

|
| 385 |
+
Figure 19: Weights of linear models trained on internal activations.
|
| 386 |
+
|
| 387 |
+
# B.7 CKA MEASUREMENTS ON MITIGATION METHODS
|
| 388 |
+
|
| 389 |
+
This section gives CKA similarity measurements to accompany those in the main text presented in figure 5. The main text figure showed results for ResNet; here we show corresponding results for all architectures on both split CIFAR10 and split CIFAR100 tasks, in figures 20 and 21, repsectively. These plots show that the results discussed in the main text apply broadly across architectures and datasets.
|
| 390 |
+
|
| 391 |
+
# B.8 OTHER CATEGORY IN RESNET AND DENSENET
|
| 392 |
+
|
| 393 |
+
In Figure 9 of the main text, we showed for the VGG architecture that adding an ‘other’ category (by sampling from all images in the dataset which are not in either of the main tasks) can mitigate forgetting by reducing the similarity between the model’s representations of the task 1 data versus
|
| 394 |
+
|
| 395 |
+

|
| 396 |
+
Figure 20: CKA Analysis of mitigation methods on the split CIFAR10 task
|
| 397 |
+
|
| 398 |
+

|
| 399 |
+
Figure 21: CKA Analysis of mitigation methods on the split CIFAR100 task
|
| 400 |
+
|
| 401 |
+

|
| 402 |
+
Figure 22: Adding an ‘other’ category during initial training helps performance through orthogonalization: Densenet. Model is trained initially on classifying two objects: airplane/automobile, and subsequently on two animals: deer/dog. When we add the ‘other’ category, it comprises a random sampling of images from all other classes. This reduces the similarity between the model’s representations of each tasks’ datapoints, leading to improved continual learning.
|
| 403 |
+
|
| 404 |
+

|
| 405 |
+
Figure 23: Adding an ‘other’ category during initial training helps performance through orthogonalization: Resnet. Model is trained initially on classifying two objects: airplane/automobile, and subsequently on two animals: deer/dog. When we add the ‘other’ category, it comprises a random sampling of images from all other classes. This reduces the similarity between the model’s representations of each tasks’ datapoints, leading to improved continual learning.
|
| 406 |
+
|
| 407 |
+
the task 2 data. As our analytic model suggested, increasing this dissimilarity should help forgetting.
|
| 408 |
+
Figures 22 and 23 show corresponding plots for the Resnet and Densenet architectures.
|
| 409 |
+
|
| 410 |
+
# B.9 ADDITIONAL SEMANTIC EXPERIMENTS
|
| 411 |
+
|
| 412 |
+
In this section, comprising figures 24, 25, and 26, we present additional realizations of the semantic experiments presented in Section 6, Figure 8. In particular we present results for sequential binary classification tasks, four-class classification followed by two-class classification, and the CIFAR-100 distribution shift task. We find consistent results across different choices of objects and animals and across VGG, ResNet, and DenseNet architectures. In particular, we find that when models are encouraged to distinguish objects and animals, dissimilar categories lead to less forgetting. In contrast when models are trained with only a single semantic category, there is no pressure to distinguish objects from animals and similar categories lead to less forgetting. We observe one exception to the intuitive semantic groupings of categories. For VGG in Setup 2 (Figure 25) the truck category behaves similarly to animal classes in that the performance suffers more when the second task is animal classification then when it is object classification.
|
| 413 |
+
|
| 414 |
+
# C FROZEN-FEATURE MODEL: FURTHER DETAILS
|
| 415 |
+
|
| 416 |
+
Here we consider extensions and applications of the analytic model introduced in Section 6.2. Both the single and multi-head models relate the change in predictions during training on a second task to
|
| 417 |
+
|
| 418 |
+

|
| 419 |
+
Task 1 - deer, dog, Task 2 - cat, horse or plane, car
|
| 420 |
+
Figure 24: Sequential binary classification tasks show consistent semantic structure. We train on sequential binary subsets of CIFAR-10, distinguishing between two animals or two objects. We find that less forgetting occurs when the initial task is more similar to the second task.
|
| 421 |
+
|
| 422 |
+
the overlap between features, $\begin{array} { r } { \Theta ( x , x ^ { \prime } ) = \sum _ { \mu } g _ { \mu } ( x ) g _ { \mu } ( x ^ { \prime } ) } \end{array}$ , evaluated on the initial and second task data.2
|
| 423 |
+
|
| 424 |
+
Multi-head model In the main text we focused for simplicity on an analytic model of single head forgetting. Here we construct a solvable model for the multi-head setup. We consider a model
|
| 425 |
+
|
| 426 |
+

|
| 427 |
+
Task 1 - deer, dog, ship, truck, Task 2 - cat, horse
|
| 428 |
+
Figure 25: Sequential four class and binary tasks show decreased forgetting for dissimilar tasks. We train on sequential subsets of CIFAR-10, initially distinguishing between four classes (two animals and two objects) and then distinguishing between either two animals or two objects. We find that less forgetting occurs for categories that are dissimilar to those used in the second task.
|
| 429 |
+
|
| 430 |
+
consisting of non-linear features $g ( w ; x )$ , a linear layer with weights, $\theta$ , and a read out head $\it { h ^ { ( i ) } }$
|
| 431 |
+
|
| 432 |
+
$$
|
| 433 |
+
f ^ { ( i ) } ( x ) = \sum _ { a , \mu } h _ { a } ^ { ( i ) } \theta _ { a \mu } g _ { \mu } ( w ; x ) .
|
| 434 |
+
$$
|
| 435 |
+
|
| 436 |
+
Here $\mu$ runs over the feature dimensions, while $a$ runs over the output dimensions of our additional linear layer. For the initial task we use the head $h ^ { ( 1 ) }$ , while for the second task, we swap the head and use $h ^ { ( 2 ) }$ .
|
| 437 |
+
|
| 438 |
+
Again we consider a model trained without restrictions on Task 1 using head $h ^ { ( 1 ) }$ . For Task 2, we first swap the head and then perform head only training on head $h ^ { ( 2 ) }$ . After training the head, we
|
| 439 |
+
|
| 440 |
+

|
| 441 |
+
Figure 26: Semantic structure of forgetting on the CIFAR-100 distribution-shfit task for VGG and DenseNet models
|
| 442 |
+
|
| 443 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>VGG</td><td rowspan=1 colspan=1>ResNet</td><td rowspan=1 colspan=1>DenseNet</td></tr><tr><td rowspan=1 colspan=1>No headfirst training5 epochs headfirst training</td><td rowspan=1 colspan=1>0.147 ± 0.0510.550±0.029</td><td rowspan=1 colspan=1>0.183 ± 0.0010.673 ± 0.010</td><td rowspan=1 colspan=1>0.162 ± 0.0080.700 ± 0.012</td></tr></table>
|
| 444 |
+
|
| 445 |
+
Table 3: Headfirst CKA similarity. CKA similarity between the readout layer after headfirst training and after final training on the second task.
|
| 446 |
+
|
| 447 |
+
freeze the head, $h ^ { ( 2 ) }$ , and the features $g ( w ; x ) = g ( \hat { w } ; x )$ , where $\hat { w }$ is the value of the feature weights after training on the initial task. This model is again inspired by our observation that forgetting is driven by changes in the latter network layers. The multi head model is additionally inspired by our observing that after head first training, the CKA similarity between the second task head before and after second task training is relatively high (see Table 3).
|
| 448 |
+
|
| 449 |
+
After training the second task head, we continue training the weights $\theta$ . The model output evolves as
|
| 450 |
+
|
| 451 |
+
$$
|
| 452 |
+
\Delta f _ { t } ^ { ( i ) } ( x ) = - \eta \sum _ { x ^ { \prime } , y ^ { \prime } \in \mathcal { D } _ { \mathrm { t r a i n } } ^ { ( 2 ) } } \Theta ( x , x ^ { \prime } ) \frac { \partial L ( f ^ { ( j ) } ( x ^ { \prime } ) , y ^ { \prime } ) } { \partial f } h ^ { T ( j ) } h ^ { ( i ) } .
|
| 453 |
+
$$
|
| 454 |
+
|
| 455 |
+
Again we find that if the representation overlap matrix $\begin{array} { r } { \Theta ( x , x ^ { \prime } ) = \sum _ { \mu } g _ { \mu } ( \hat { w } ; x ) g _ { \mu } ( \hat { w } ; x ^ { \prime } ) } \end{array}$ is small between the features evaluated on the initial task and second task data then the predictions do not change significantly. If this overlap is zero, then the predictions are constant. In the multi-head setup we are considering here, we see that the change in predictions is further proportional to the similarity between the model heads, $h ^ { T ( j ) } h ^ { ( i ) }$ .
|
| 456 |
+
|
| 457 |
+
Finally, we note that we have considered a final linear layer before the readout head for simplicity. One can instead include a ReLU non-linearity without changing the essential point, that the change in model output is governed by the overlap matrix, $\Theta$ .
|
| 458 |
+
|
| 459 |
+
Rotating representations in the analytic model. We can use our analytic model (Section 6.2) to investigate how forgetting depends on representation similarity. We again consider sequential binary tasks (car vs plane) followed by (cat vs horse). We then tune the overlap of our initial task and final task features by explicitly rotating the frozen features for the second task to produce new features $g ^ { \prime } ( \theta ; \hat { w } ; x )$ .
|
| 460 |
+
|
| 461 |
+
$$
|
| 462 |
+
\begin{array} { r } { g ^ { \prime } ( \theta ; \hat { w } ; x ) = R ( \theta ) g ( \hat { w } ; x ) . } \end{array}
|
| 463 |
+
$$
|
| 464 |
+
|
| 465 |
+
Here, if we have $P$ features, $R ( \theta ) \in \mathbb { R } ^ { P \times P }$ is a one-parameter family of rotation matrices designed such that $R ( 0 ) = { \bf 1 }$ and $g ^ { T } ( \hat { w } ; x ) g ^ { \prime } ( \pi / 2 ; \hat { w } ; x ^ { \prime } )$ for $x \in X _ { \mathrm { t e s t } } ^ { ( 1 ) }$ )t and x0 ∈ X (2)train is small. Explicitly, we take
|
| 466 |
+
|
| 467 |
+
$$
|
| 468 |
+
R ( \theta ) = V ^ { T } \prod _ { i = 1 } ^ { \lfloor P / 2 \rfloor } r _ { i , P - i } ( \theta ) V ,
|
| 469 |
+
$$
|
| 470 |
+
|
| 471 |
+

|
| 472 |
+
Figure 27: Rotating representations shows diminished forgetting for dissimilar tasks. Here we consider the performance of our frozen feature model on sequential binary CIFAR-10 tasks (Task 1: car vs plane, Task 2: cat vs horse). We use a model built from a two hidden-layer fully connected network with ReLU activations. We increase decrease representational similarity by explicitly rotating the second task features and find as predicted that this leads to diminished forgetting.
|
| 473 |
+
|
| 474 |
+

|
| 475 |
+
Figure 28: Stabilizing final layer weights is not necessary to stop forgetting. Here we look at the change in final layer weights during second task training for a model with severe forgetting (gray) and forgetting mitigated by rotating the second task representations (teal). We see that final layer weights become less and less similar in both cases. The setup is identical to Figure 27
|
| 476 |
+
|
| 477 |
+
where $r _ { i j } ( \theta )$ is the two dimensional rotation matrix between axes $i$ and $j$ , and $V$ is the orthogonal matrix appearing in the singular value decomposition of the feature by data matrix on the initial task, $g ( X _ { \mathrm { t e s t } } ^ { ( 1 ) } ) = U D V$ . We find that explicitly enforcing task dissimilarity via a large rotation minimizes the effect of forgetting (Figure 27).
|
| 478 |
+
|
| 479 |
+
Stopping forgetting without stabilizing weights We saw in Section 4 that both EWC and replay buffers stabilize deeper network representations. As mentioned above, this need not be the case a priori. As an illustrative example, we construct a setup where sequential training leads to no forgetting despite a significant change to final layer weights. We consider the single head model of Section 6.2 where the Task 1 and Task 2 representations are completely orthogonal, $\Theta ( x , x ^ { \prime } ) = 0$ for $x \in X _ { \mathrm { t e s t } } ^ { ( 1 ) }$ and $x ^ { \prime } \in X _ { \mathrm { t r a i n } } ^ { ( 2 ) }$ . In this case the Task 1 predictions remain constant throughout all of Task 2 training, despite significant changes to the final layer weights and predictions on the second task. In Figure 28 we present an example of this setup. The representations are again made orthogonal by explicitly rotating the second task features by the rotation matrix, $R ( \pi / 2 )$ defined in Equation equation 11.
|
| 480 |
+
|
| 481 |
+
# D ADDITIONAL EXPERIMENTS
|
| 482 |
+
|
| 483 |
+
This section presents two additional experiments which are slightly unrelated to the main thrust of the paper. We examine how the degree to which a network forgets is influenced by its width, and also how training the head independently of the rest of the network, in a multi-head setting, can mitigate forgetting.
|
| 484 |
+
|
| 485 |
+
# D.1 FORGETTING VERSUS NETWORK WIDTH
|
| 486 |
+
|
| 487 |
+

|
| 488 |
+
Figure 29: Forgetting as a function of network width. (a) VGG, (b) ResNet, and (c) DenseNet networks of varying widths were trained on two subsets of CIFAR-10 classes. We trained each of these (multi-head) networks for 30 epochs on each task with constant $\eta$ , enough to achieve perfect training accuracy. Further training details can be found in the text. From the plots, which show the percent drop in accuracy (on task 1) due to training on task 2, the effect of width on the performance drop seems to be minimal, even sweeping across roughly a factor of ten in the number of model parameters.
|
| 489 |
+
|
| 490 |
+
Inspired by recent work of Gilboa & Gur-Ari (2019) showing that wider networks can learn better features than their narrower counterparts, we sought to determine whether wider networks also exhibit less catastrophic forgetting than narrower ones. We tested forgetting versus width for VGG, DenseNet, and ResNet networks on the split CIFAR-10 task in the multi-head setting. For VGG and ResNet, the width was varied by changing the number of channels in the initial convolutional layer and scaling the rest of the network layers concurrently while maintaining the network shape; for DenseNet, the width was varied by by changing the growth rate.
|
| 491 |
+
|
| 492 |
+
Surprisingly, though we found that the performances of the networks on each task improved as they grew wider, the amount of forgetting in each network, measured by the percent drop in accuracy (on task 1) due to training on task, exhibited a minimal dependence on network width. These results are shown in Figure 29.
|
| 493 |
+
|
| 494 |
+
# D.2 HEADFIRST TRAINING
|
| 495 |
+
|
| 496 |
+
When training multi-head networks on sequences of tasks, we found that the networks suffered a smaller performance drop on the original task, i.e. forgot less, if only the new task head was trained for a few epochs prior to training the full network. In Figure 30, this effect is shown for all three network architectures on the split CIFAR-10 task. Training only the head for up to five epochs seemed to improve the original-task performance without sacrificing performance on the new task. This suggests that coadaptation between the freshly-initialized head and the rest of the model contributes to forgetting when there is no headfirst training.
|
| 497 |
+
|
| 498 |
+

|
| 499 |
+
Figure 30: Effect of training readout layer separately between task switches. (a) VGG, (b) ResNet, and (c) DenseNet models were trained on two subsets of CIFAR-10 classes: task 0 (dog, frog, horse, ship, and truck), and task 1 (airplane, automobile, bird, cat, deer). When switching tasks, we first trained only the final classification layer (known as the readout layer or head) for a specified number of epochs (here 0, 1, 2, and 5) from a random Gaussian initialization. During this period, the rest of the model parameters are held fixed; after the head-only training, the entire model is trained as usual. Across all architectures, training only the head consistently improves the forgetting performance of the model (its accuracy on task 0) while having a negligible impact on the performance on the next task (task 1).
|
| 500 |
+
|
| 501 |
+
# E FIGURES FOR ANONREVIEWER2
|
| 502 |
+
|
| 503 |
+
# F IMAGENET RESULTS FOR TASK SEMANTICS
|
| 504 |
+
|
| 505 |
+
Figures corresponding to results tables in the main text.
|
| 506 |
+
|
| 507 |
+

|
| 508 |
+
Figure 31: Stage-wise weight change between initial weights and weights after Task 1 (blue) and between weights after Task 1 and Task2 (orange) for a model trained sequentially on disjoint 5 class subsets of CIFAR10. (a) Mean $\ell _ { 2 }$ distance. (b) Cosine similarity. We see no sign of significantly more change in last layer weights, and in fact see the reverse trend in $\ell _ { 2 }$ distance.
|
| 509 |
+
|
| 510 |
+

|
| 511 |
+
Figure 32: Mean and std deviation for the residual, $p _ { i } - y _ { i }$ , for a model trained on ship v truck evaluated on cat, horse data (blue) and plane, car (orange). We see no clear separation between object and animal data. Each point represents a model trained with a different seed.
|
| 512 |
+
|
| 513 |
+

|
| 514 |
+
Task1:10Artifacts Task2:10 Animals or 10 Artifacts
|
| 515 |
+
Figure 33: ImageNet Two-task 10 class sequences in which similar tasks cause less forgetting.
|
| 516 |
+
|
| 517 |
+
(a) Initial classification between 10 artifacts
|
| 518 |
+
|
| 519 |
+

|
| 520 |
+
Task 1:10 Animals Task2:10 Animals or10 Artifacts
|
| 521 |
+
(b) Initial classification between 10 animals
|
| 522 |
+
|
| 523 |
+

|
| 524 |
+
Task 1:10 Artifacts $+ ~ 1 0$ Animals Task 2: 10 Artifacts
|
| 525 |
+
Task 1:10 Artifacts + 10 Animals Task 2:10 Animals
|
| 526 |
+
Figure 34: ImageNet Two-task 20-class followed by 10-class sequences in which similar categories are forgotten more.
|
md/train/Lpfh1Bpqfk/Lpfh1Bpqfk.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Early Convolutions Help Transformers See Better
|
| 2 |
+
|
| 3 |
+
Tete Xiao1,2 Mannat Singh1 Eric Mintun1 Trevor Darrell2 Piotr Dollár1∗ Ross Girshick1∗
|
| 4 |
+
|
| 5 |
+
1Facebook AI Research (FAIR) 2UC Berkeley
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Vision transformer (ViT) models exhibit substandard optimizability. In particular, they are sensitive to the choice of optimizer (AdamW vs. SGD), optimizer hyperparameters, and training schedule length. In comparison, modern convolutional neural networks are easier to optimize. Why is this the case? In this work, we conjecture that the issue lies with the patchify stem of ViT models, which is implemented by a stride- $p p { \times } p$ convolution $\dot { p } = 1 6$ by default) applied to the input image. This large-kernel plus large-stride convolution runs counter to typical design choices of convolutional layers in neural networks. To test whether this atypical design choice causes an issue, we analyze the optimization behavior of ViT models with their original patchify stem versus a simple counterpart where we replace the ViT stem by a small number of stacked stride-two $3 { \times } 3$ convolutions. While the vast majority of computation in the two ViT designs is identical, we find that this small change in early visual processing results in markedly different training behavior in terms of the sensitivity to optimization settings as well as the final model accuracy. Using a convolutional stem in ViT dramatically increases optimization stability and also improves peak performance (by ${ \sim } 1 { - } 2 \%$ top-1 accuracy on ImageNet-1k), while maintaining flops and runtime. The improvement can be observed across the wide spectrum of model complexities (from 1G to 36G flops) and dataset scales (from ImageNet-1k to ImageNet-21k). These findings lead us to recommend using a standard, lightweight convolutional stem for ViT models in this regime as a more robust architectural choice compared to the original ViT model design.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Vision transformer (ViT) models [13] offer an alternative design paradigm to convolutional neural networks (CNNs) [24]. ViTs replace the inductive bias towards local processing inherent in convolutions with global processing performed by multi-headed self-attention [43]. The hope is that this design has the potential to improve performance on vision tasks, akin to the trends observed in natural language processing [11]. While investigating this conjecture, researchers face another unexpected difference between ViTs and CNNs: ViT models exhibit substandard optimizability. ViTs are sensitive to the choice of optimizer [41] (AdamW [27] vs. SGD), to the selection of dataset specific learning hyperparameters [13, 41], to training schedule length, to network depth [42], etc. These issues render former training recipes and intuitions ineffective and impede research.
|
| 14 |
+
|
| 15 |
+
Convolutional neural networks, in contrast, are exceptionally easy and robust to optimize. Simple training recipes based on SGD, basic data augmentation, and standard hyperparameter values have been widely used for years [19]. Why does this difference exist between ViT and CNN models? In this paper we hypothesize that the issues lies primarily in the early visual processing performed by ViT. ViT “patchifies” the input image into $p { \times } p$ non-overlapping patches to form the transformer encoder’s input set. This patchify stem is implemented as a stride- $p p \times p$ convolution, with $p = 1 6$ as a default value. This large-kernel plus large-stride convolution runs counter to the typical design choices used in CNNs, where best-practices have converged to a small stack of stride-two $3 { \times } 3$ kernels as the network’s stem (e.g., [30, 36, 39]).
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Early convolutions help transformers see better: We hypothesize that the substandard optimizability of ViT models compared to CNNs primarily arises from the early visual processing performed by its patchify stem, which is implemented by a non-overlapping stride- $p p { \times } p$ convolution, with $p = 1 6$ by default. We minimally replace the patchify stem in ViT with a standard convolutional stem of only ${ \sim } 5 $ convolutions that has approximately the same complexity as a single transformer block. We reduce the number of transformer blocks by one (i.e., $\bar { L } - 1$ vs. $L$ ) to maintain parity in flops, parameters, and runtime. We refer to the resulting model as $\mathrm { V i T } _ { C }$ and the original ViT as $\mathrm { V i T } _ { P }$ . The vast majority of computation performed by these two models is identical, yet surprisingly we observe that $\mathrm { V i T } _ { C }$ (i) converges faster, (ii) enables, for the first time, the use of either AdamW or SGD without a significant accuracy drop, (iii) shows greater stability to learning rate and weight decay choice, and (iv) yields improvements in ImageNet top-1 error allowing $\mathrm { V i T } _ { C }$ to outperform state-of-the-art CNNs, whereas $\mathrm { V i T } _ { P }$ does not.
|
| 19 |
+
|
| 20 |
+
To test this hypothesis, we minimally change the early visual processing of ViT by replacing its patchify stem with a standard convolutional stem consisting of only ${ \sim } 5$ convolutions, see Figure 1. To compensate for the small addition in flops, we remove one transformer block to maintain parity in flops and runtime. We observe that even though the vast majority of the computation in the two ViT designs is identical, this small change in early visual processing results in markedly different training behavior in terms of the sensitivity to optimization settings as well as the final model accuracy.
|
| 21 |
+
|
| 22 |
+
In extensive experiments we show that replacing the ViT patchify stem with a more standard convolutional stem (i) allows ViT to converge faster (§5.1), (ii) enables, for the first time, the use of either AdamW or SGD without a significant drop in accuracy (§5.2), (iii) brings ViT’s stability w.r.t. learning rate and weight decay closer to that of modern CNNs (§5.3), and (iv) yields improvements in ImageNet [10] top-1 error of $\sim 1 - 2$ percentage points (§6). We consistently observe these improvements across a wide spectrum of model complexities (from 1G flops to 36G flops) and dataset scales (ImageNet-1k to ImageNet-21k).
|
| 23 |
+
|
| 24 |
+
These results show that injecting some convolutional inductive bias into ViTs can be beneficial under commonly studied settings. We did not observe evidence that the hard locality constraint in early layers hampers the representational capacity of the network, as might be feared [9]. In fact we observed the opposite, as ImageNet results improve even with larger-scale models and larger-scale data when using a convolution stem. Moreover, under carefully controlled comparisons, we find that ViTs are only able to surpass state-of-the-art CNNs when equipped with a convolutional stem (§6).
|
| 25 |
+
|
| 26 |
+
We conjecture that restricting convolutions in ViT to early visual processing may be a crucial design choice that strikes a balance between (hard) inductive biases and the representation learning ability of transformer blocks. Evidence comes by comparison to the “hybrid ViT” presented in [13], which uses 40 convolutional layers (most of a ResNet-50) and shows no improvement over the default ViT. This perspective resonates with the findings of [9], who observe that early transformer blocks prefer to learn more local attention patterns than later blocks. Finally we note that exploring the design of hybrid CNN/ViT models is not a goal of this work; rather we demonstrate that simply using a minimal convolutional stem with ViT is sufficient to dramatically change its optimization behavior.
|
| 27 |
+
|
| 28 |
+
In summary, the findings presented in this paper lead us to recommend using a standard, lightweight convolutional stem for ViT models in the analyzed dataset scale and model complexity spectrum as a more robust and higher performing architectural choice compared to the original ViT model design.
|
| 29 |
+
|
| 30 |
+
# 2 Related Work
|
| 31 |
+
|
| 32 |
+
Convolutional neural networks (CNNs). The breakthrough performance of the AlexNet [23] CNN [15, 24] on ImageNet classification [10] transformed the field of recognition, leading to the development of higher performing architectures, e.g., [19, 36, 37, 48], and scalable training methods [16, 21]. These architectures are now core components in object detection (e.g., [34]), instance segmentation (e.g., [18]), and semantic segmentation (e.g., [26]). CNNs are typically trained with stochastic gradient descent (SGD) and are widely considered to be easy to optimize.
|
| 33 |
+
|
| 34 |
+
Self-attention in vision models. Transformers [43] are revolutionizing natural language processing by enabling scalable training. Transformers use multi-headed self-attention, which performs global information processing and is strictly more general than convolution [6]. Wang et al. [46] show that (single-headed) self-attention is a form of non-local means [2] and that integrating it into a ResNet [19] improves several tasks. Ramachandran et al. [32] explore this direction further with stand-alone self-attention networks for vision. They report difficulties in designing an attention-based network stem and present a bespoke solution that avoids convolutions. In contrast, we demonstrate the benefits of a convolutional stem. Zhao et al. [53] explore a broader set of self-attention operations with hard-coded locality constraints, more similar to standard CNNs.
|
| 35 |
+
|
| 36 |
+
Vision transformer (ViT). Dosovitskiy et al. [13] apply a transformer encoder to image classification with minimal vision-specific modifications. As the counterpart of input token embeddings, they partition the input image into, e.g., $1 6 \times 1 6$ pixel, non-overlapping patches and linearly project them to the encoder’s input dimension. They report lackluster results when training on ImageNet-1k, but demonstrate state-of-the-art transfer learning when using large-scale pretraining data. ViTs are sensitive to many details of the training recipe, e.g., they benefit greatly from AdamW [27] compared to SGD and require careful learning rate and weight decay selection. ViTs are generally considered to be difficult to optimize compared to CNNs (e.g., see [13, 41, 42]). Further evidence of challenges comes from Chen et al. [4] who report ViT optimization instability in self-supervised learning (unlike with CNNs), and find that freezing the patchify stem at its random initialization improves stability.
|
| 37 |
+
|
| 38 |
+
ViT improvements. ViTs are gaining rapid interest in part because they may offer a novel direction away from CNNs. Touvron et al. [41] show that with more regularization and stronger data augmentation ViT models achieve competitive accuracy on ImageNet-1k alone (cf . [13]). Subsequently, works concurrent with our own explore numerous other ViT improvements. Dominant themes include multi-scale networks [14, 17, 25, 45, 50], increasing depth [42], and locality priors [5, 9, 17, 47, 49]. In [9], d’Ascoli et al. modify multi-head self-attention with a convolutional bias at initialization and show that this prior improves sample efficiency and ImageNet accuracy. Resonating with our work, [5, 17, 47, 49] present models with convolutional stems, but do not analyze optimizability (our focus).
|
| 39 |
+
|
| 40 |
+
Discussion. Unlike the concurrent work on locality priors in ViT, our focus is studying optimizability under minimal ViT modifications in order to derive crisp conclusions. Our perspective brings several novel observations: by adding only ${ \sim } 5 $ convolutions to the stem, ViT can be optimized well with either AdamW or SGD $_ { c f }$ . all prior works use AdamW to avoid large drops in accuracy [41]), it becomes less sensitive to the specific choice of learning rate and weight decay, and training converges faster. We also observe a consistent improvement in ImageNet top-1 accuracy across a wide spectrum of model complexities (1G flops to 36G flops) and dataset scales (ImageNet-1k to ImageNet-21k). These results suggest that a (hard) convolutional bias early in the network does not compromise representational capacity, as conjectured in [9], and is beneficial within the scope of this study.
|
| 41 |
+
|
| 42 |
+
# 3 Vision Transformer Architectures
|
| 43 |
+
|
| 44 |
+
Next, we review vision transformers [13] and describe the convolutional stems used in our work.
|
| 45 |
+
|
| 46 |
+
The vision transformer (ViT). ViT first partitions an input image into non-overlapping $p { \times } p$ patches and linearly projects each patch to a $d$ -dimensional feature vector using a learned weight matrix. A patch size of $p = 1 6$ and an image size of $2 2 4 \times 2 2 4$ are typical. The resulting patch embeddings (plus positional embeddings and a learned classification token embedding) are processed by a standard transformer encoder [43, 44] followed by a classification head. Using common network nomenclature, we refer to the portion of ViT before the transformer blocks as the network’s stem. ViT’s stem is a
|
| 47 |
+
|
| 48 |
+
<table><tr><td>model</td><td>ref model</td><td>|hidden MLP size</td><td>mult</td><td>num heads</td><td>num blocks</td><td>flops (B)</td><td>params (M)</td><td>acts (M)</td><td>time (min)</td></tr><tr><td>ViTp-1GF</td><td>~ViT-T</td><td>192</td><td>3</td><td>3</td><td>12</td><td>1.1</td><td>4.8</td><td>5.5</td><td>2.6</td></tr><tr><td>ViTp-4GF</td><td>~ViT-S</td><td>384</td><td>3</td><td>6</td><td>12</td><td>3.9</td><td>18.5</td><td>11.1</td><td>3.8</td></tr><tr><td>ViTp-18GF</td><td>=ViT-B</td><td>768</td><td>4</td><td>12</td><td>12</td><td>17.5</td><td>86.7</td><td>24.0</td><td>11.5</td></tr><tr><td>ViTp-36GF</td><td>ViT-L</td><td>1024</td><td>4</td><td>16</td><td>14</td><td>35.9</td><td>178.4</td><td>37.3</td><td>18.8</td></tr></table>
|
| 49 |
+
|
| 50 |
+
<table><tr><td>model</td><td>hidden size</td><td>MLP mult</td><td>num heads blocks</td><td>num</td><td>flops (B)</td><td>params (M)</td><td>acts (M)</td><td>time (min)</td></tr><tr><td>ViTc-1GF</td><td>192</td><td>3</td><td>3</td><td>11</td><td>1.1</td><td>4.6</td><td>5.7</td><td>2.7</td></tr><tr><td>ViTc-4GF</td><td>384</td><td>3</td><td>6</td><td>11</td><td>4.0</td><td>17.8</td><td>11.3</td><td>3.9</td></tr><tr><td>ViTc-18GF</td><td>768</td><td>4</td><td>12</td><td>11</td><td>17.7</td><td>81.6</td><td>24.1</td><td>11.4</td></tr><tr><td>ViTc-36GF</td><td>1024</td><td>4</td><td>16</td><td>13</td><td>35.0</td><td>167.8</td><td>36.7</td><td>18.6</td></tr></table>
|
| 51 |
+
|
| 52 |
+
Table 1: Model definitions: Left: Our $\mathrm { V i T } _ { P }$ models at various complexities, which use the original patchify stem and closely resemble the original ViT models [13]. To facilitate comparisons with CNNs, we modify the original ViT-Tiny, -Small, -Base, -Large models to obtain models at 1GF, 4GF, 18GF, and 36GF, respectively. The modifications are indicated in blue and include reducing the MLP multiplier from $4 \times$ to $3 \times$ for the 1GF and 4GF models, and reducing the number of transformer blocks from 24 to 14 for the 36GF model. Right: Our $\mathrm { V i T } _ { C }$ models at various complexities that use the convolutional stem. The only additional modification relative to the corresponding $\mathrm { V i T } _ { P }$ models is the removal of 1 transformer block to compensate for the increased flops of the convolutional stem. We show complexity measures for all models (flops, parameters, activations, and epoch training time on ImageNet-1k); the corresponding $\mathrm { V i T } _ { P }$ and $\mathrm { V i T } _ { C }$ models match closely on all metrics.
|
| 53 |
+
|
| 54 |
+
specific case of convolution (stride- $p$ , $p { \times } p$ kernel), but we will refer to it as the patchify stem and reserve the terminology of convolutional stem for stems with a more conventional CNN design with multiple layers of overlapping convolutions (i.e., with stride smaller than the kernel size).
|
| 55 |
+
|
| 56 |
+
$\mathbf { V i T } _ { P }$ models. Prior work proposes ViT models of various sizes, such as ViT-Tiny, ViT-Small, ViT-Base, etc. [13, 41]. To facilitate comparisons with CNNs, which are typically standardized to 1 gigaflop (GF), 2GF, 4GF, 8GF, etc., we modify the original ViT models to obtain models at about these complexities. Details are given in Table 1 (left). For easier comparison with CNNs of similar flops, and to avoid subjective size names, we refer the models by their flops, e.g., $\mathrm { V i T } _ { P }$ -4GF in place of ViT-Small. We use the $P$ subscript to indicate that these models use the original patchify stem.
|
| 57 |
+
|
| 58 |
+
Convolutional stem design. We adopt a typical minimalist convolutional stem design by stacking $3 { \times } 3$ convolutions [36], followed by a single $1 \times 1$ convolution at the end to match the $d$ -dimensional input of the transformer encoder. These stems quickly downsample a $2 2 4 \times 2 2 4$ input image using overlapping strided convolutions to $1 4 \times 1 4$ , matching the number of inputs created by the standard patchify stem. We follow a simple design pattern: all $3 { \times } 3$ convolutions either have stride 2 and double the number of output channels or stride 1 and keep the number of output channels constant. We enforce that the stem accounts for approximately the computation of one transformer block of the corresponding model so that we can easily control for flops by removing one transformer block when using the convolutional stem instead of the patchify stem. Our stem design was chosen to be purposefully simple and we emphasize that it was not designed to maximize model accuracy.
|
| 59 |
+
|
| 60 |
+
$\mathbf { V i T } _ { C }$ models. To form a ViT model with a convolutional stem, we simply replace the patchify stem with its counterpart convolutional stem and remove one transformer block to compensate for the convolutional stem’s extra flops (see Figure 1). We refer to the modified ViT with a convolutional stem as $\mathrm { V i T } _ { C }$ . Configurations for $\mathrm { V i T } _ { C }$ at various complexities are given in Table 1 (right); corresponding $\mathrm { V i T } _ { P }$ and $\mathrm { V i T } _ { C }$ models match closely on all complexity metrics including flops and runtime.
|
| 61 |
+
|
| 62 |
+
Convolutional stem details. Our convolutional stem designs use four, four, and six $3 { \times } 3$ convolutions for the 1GF, 4GF, and 18GF models, respectively. The output channels are [24, 48, 96, 192], [48, 96, 192, 384], and [64, 128, 128, 256, 256, 512], respectively. All $3 { \times } 3$ convolutions are followed by batch norm (BN) [21] and then ReLU [29], while the final $1 \times 1$ convolution is not, to be consistent with the original patchify stem. Eventually, matching stem flops to transformer block flops results in an unreasonably large stem, thus $\mathrm { V i T } _ { C }$ -36GF uses the same stem as $\mathrm { V i T } _ { C }$ -18GF.
|
| 63 |
+
|
| 64 |
+
Convolutions in ViT. Dosovitskiy et al. [13] also introduced a “hybrid ViT” architecture that blends a modified ResNet [19] (BiT-ResNet [22]) with a transformer encoder. In their hybrid model, the patchify stem is replaced by a partial BiT-ResNet-50 that terminates at the output of the conv4 stage or the output of an extended conv3 stage. These image embeddings replace the standard patchify stem embeddings. This partial BiT-ResNet-50 stem is deep, with 40 convolutional layers. In this work, we explore lightweight convolutional stems that consist of only 5 to 7 convolutions in total, instead of the 40 used by the hybrid ViT. Moreover, we emphasize that the goal of our work is not to explore the hybrid ViT design space, but rather to study the optimizability effects of simply replacing the patchify stem with a minimal convolutional stem that follows standard CNN design practices.
|
| 65 |
+
|
| 66 |
+
# 4 Measuring Optimizability
|
| 67 |
+
|
| 68 |
+
It has been noted in the literature that ViT models are challenging to optimize, e.g., they may achieve only modest performance when trained on a mid-size dataset (ImageNet-1k) [13], are sensitive to data augmentation [41] and optimizer choice [41], and may perform poorly when made deeper [42]. We empirically observed the general presence of such difficulties through the course of our experiments and informally refer to such optimization characteristics collectively as optimizability.
|
| 69 |
+
|
| 70 |
+
Models with poor optimizability can yield very different results when hyperparameters are varied, which can lead to seemingly bizarre observations, e.g., removing erasing data augmentation [54] causes a catastrophic drop in ImageNet accuracy in [41]. Quantitative metrics to measure optimizability are needed to allow for more robust comparisons. In this section, we establish the foundations of such comparisons; we extensively test various models using these optimizability measures in $\ S 5$ .
|
| 71 |
+
|
| 72 |
+
Training length stability. Prior works train ViT models for lengthy schedules, e.g., 300 to 400 epochs on ImageNet is typical (at the extreme, [17] trains models for 1000 epochs), since results at a formerly common 100-epoch schedule are substantially worse ( $2 \%$ lower top-1 accuracy, see $\begin{array} { r l } { \ S } & { { } \} } \end{array}$ . In the context of ImageNet, we define top-1 accuracy at 400 epochs as an approximate asymptotic result, i.e., training for longer will not meaningfully improve top-1 accuracy, and we compare it to the accuracy of models trained for only 50, 100, or 200 epochs. We define training length stability as the gap to asymptotic accuracy. Intuitively, it’s a measure of convergence speed. Models that converge faster offer obvious practical benefits, especially when training many model variants.
|
| 73 |
+
|
| 74 |
+
Optimizer stability. Prior works use AdamW [27] to optimize ViT models from random initialization. Results of SGD are not typically presented and we are only aware of Touvron et al. [41]’s report of a dramatic $\sim 7 \%$ drop in ImageNet top-1 accuracy. In contrast, widely used CNNs, such as ResNets, can be optimized equally well with either SGD or AdamW (see $\ S 5 . 2 )$ and SGD (always with momentum) is typically used in practice. SGD has the practical benefit of having fewer hyperparameters (e.g., tuning AdamW’s $\beta _ { 2 }$ can be important [3]) and requiring $50 \%$ less optimizer state memory, which can ease scaling. We define optimizer stability as the accuracy gap between AdamW and SGD. Like training length stability, we use optimizer stability as a proxy for the ease of optimization of a model.
|
| 75 |
+
|
| 76 |
+
Hyperparameter $( l r , w d )$ stability. Learning rate $( l r )$ and weight decay (wd) are among the most important hyperparameters governing optimization with SGD and AdamW. New models and datasets often require a search for their optimal values as the choice can dramatically affect results. It is desirable to have a model and optimizer that yield good results for a wide range of learning rate and weight decay values. We will explore this hyperparameter stability by comparing the error distribution functions (EDFs) [30] of models trained with various choices of $l r$ and $w d$ . In this setting, to create an EDF for a model we randomly sample values of $l r$ and wd and train the model accordingly. Distributional estimates, like those provided by EDFs, give a more complete view of the characteristics of models that point estimates cannot reveal [30, 31]. We will review EDFs in $\ S$ .
|
| 77 |
+
|
| 78 |
+
Peak performance. The maximum possible performance of each model is the most commonly used metric in previous literature and it is often provided without carefully controlling training details such as data augmentations, regularization methods, number of epochs, and $l r$ , wd tuning. To make more robust comparisons, we define peak performance as the result of a model at 400 epochs using its best-performing optimizer and parsimoniously tuned $l r$ and $w d$ values (details in $\ S 6$ ), while fixing justifiably good values for all other variables that have a known impact on training. Peak performance results for ViTs and CNNs under these carefully controlled training settings are presented in $\ S 6$ .
|
| 79 |
+
|
| 80 |
+
# 5 Stability Experiments
|
| 81 |
+
|
| 82 |
+
In this section we test the stability of ViT models with the original patchify $( P )$ stem vs. the convolutional $( C )$ stem defined in $\ S$ . For reference, we also train RegNetY [12, 31], a state-of-the-art CNN that is easy to optimize and serves as a reference point for good stability.
|
| 83 |
+
|
| 84 |
+
We conduct experiments using ImageNet-1k [10]’s standard training and validation sets, and report top-1 error. Following [12], for all results, we carefully control training settings and we use a minimal set of data augmentations that still yields strong results, for details see $\ S$ . In this section, unless noted, for each model we use the optimal $l r$ and $w d$ found under a 50 epoch schedule (see Appendix).
|
| 85 |
+
|
| 86 |
+

|
| 87 |
+
Figure 2: Training length stability: We train 9 models for 50 to 400 epochs on ImageNet-1k and plot the ∆top-1 error to the 400 epoch result for each. $\mathrm { V i T } _ { C }$ demonstrates faster convergence than $\mathrm { V i T } _ { P }$ across the model complexity spectrum, and helps close the gap to CNNs (represented by RegNetY).
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
Figure 3: Optimizer stability: We train each model for 50 to 400 epochs with AdamW (upward triangle $\blacktriangle$ ) and SGD (downward triangle $\blacktriangledown$ ). For the baseline $\mathrm { V i T } _ { P }$ , SGD yields significantly worse results than AdamW. In contrast, $\mathrm { V i T } _ { C }$ and $\mathrm { R e g N e t Y }$ models exhibit a much smaller gap between SGD and AdamW across all settings. Note that for long schedules, $\mathrm { V i T } _ { P }$ often fails to converge with SGD (i.e., loss goes to NaN), in such cases we copy the best results from a shorter schedule of the same model (and show the results via a dashed line).
|
| 91 |
+
|
| 92 |
+
# 5.1 Training Length Stability
|
| 93 |
+
|
| 94 |
+
We first explore how rapidly networks converge to their asymptotic error on ImageNet-1k, i.e., the highest possible accuracy achievable by training for many epochs. We approximate asymptotic error as a model’s error using a 400 epoch schedule based on observing diminishing returns from 200 to 400. We consider a grid of 24 experiments for ViT: $\{ P , C \}$ stems $\times \ \{ 1 , 4 , 1 8 \}$ GF model sizes $\times$ {50, 100, 200, 400} epochs. For reference we also train RegNetY at $\{ 1 , 4 , 1 6 \}$ GF. We use the best optimizer choice for each model (AdamW for ViT models and SGD for RegNetY models).
|
| 95 |
+
|
| 96 |
+
Results. Figure 2 shows the absolute error deltas (∆top-1) between 50, 100, and 200 epoch schedules and asymptotic performance (at 400 epochs). $\mathrm { V i T } _ { C }$ demonstrates faster convergence than $\mathrm { V i T } _ { P }$ across the model complexity spectrum, and closes much of the gap to the rate of CNN convergence. The improvement is most significant in the shortest training schedule (50 epoch), e.g., $\mathrm { V i T } _ { P }$ -1GF has a $10 \%$ error delta, while $\mathrm { V i T } _ { C }$ -1GF reduces this to about $6 \%$ . This opens the door to applications that execute a large number of short-scheduled experiments, such as neural architecture search.
|
| 97 |
+
|
| 98 |
+
# 5.2 Optimizer Stability
|
| 99 |
+
|
| 100 |
+
We next explore how well AdamW and SGD optimize ViT models with the two stem types. We consider the following grid of $4 8 \ \mathrm { V i T }$ experiments: $\{ P , C \}$ stems × {1, 4, 18} GF sizes $\times$ {50, 100, 200, 400} epochs $\times$ {AdamW, SGD} optimizers. As a reference, we also train 24 RegNetY baselines, one for each complexity regime, epoch length, and optimizer.
|
| 101 |
+
|
| 102 |
+
Results. Figure 3 shows the results. As a baseline, RegNetY models show virtually no gap when trained using either SGD or AdamW (the difference ${ \sim } 0 . 1 { - } 0 . 2 \%$ is within noise). On the other hand, $V i T _ { P }$ models suffer a dramatic drop when trained with SGD across all settings (of up to $10 \%$ for larger models and longer training schedules). With a convolutional stem, $\mathrm { V i T } _ { C }$ models exhibit much smaller error gaps between SGD and AdamW across all training schedules and model complexities, including in larger models and longer schedules, where the gap is reduced to less than $0 . 2 \%$ . In other words, both RegNetY and $\mathrm { V i T } _ { C }$ can be easily trained via either SGD or AdamW, but $\mathrm { V i T } _ { P }$ cannot.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 4: Hyperparameter stability for AdamW $_ { l r }$ and ${ \pmb w d }$ ): For each model, we train 64 instances of the model for 50 epochs each with a random1.0 $l r$ and $w d$ (in a fixed width interval around the optimal value for each model). Top: Scatterplots of the $l r$ , $w d$ , and $l r$ ·wd for three 4GF models. Vertical bars indicate optimal $l r , w d$ , and $l r \cdot w d$ values for each model. Bottom: For each model, we generate an EDF of the errors by plotting the cumulative distribution of the 0.6 $\Delta$ top-1 errors ( $\Delta$ to the optimal error for each model). A steeper EDF indicates better stability to 0.4 1GF models 4G $l r$ and odels $w d$ variation. $\mathrm { V i T } _ { C }$ significantly18GF models improves the stability over the baseline0.2 ViTC $\mathrm { V i T } _ { P }$ across the model complexity spectrum, and matches orViTC ViTC even outperforms the stability of the CNN model (RegNetY).0.0 RegNetY R
|
| 106 |
+
|
| 107 |
+

|
| 108 |
+
Figure 5: Hyperparameter stability for SGD $_ { L r }$ and ${ \pmb w d }$ ): We repeat the setup from Figure 4 using SGD instead of AdamW. The stability improvement of $\mathrm { V i T } _ { C }$ over the baseline $\mathrm { V i T } _ { P }$ is even larger than with AdamW. $E . g$ ., ${ \sim } 6 0 \%$ of $\mathrm { V i T } _ { C }$ -18GF models are within $4 \%$ $\Delta$ top-1 error of the best result, while less than $20 \%$ of $\mathrm { V i T } _ { P }$ -18GF models are (in fact most $\mathrm { V i T } _ { P }$ -18GF runs don’t converge).
|
| 109 |
+
|
| 110 |
+
# 5.3 Learning Rate and Weight Decay Stability
|
| 111 |
+
|
| 112 |
+
Next, we characterize how sensitive different model families are to changes in learning rate $( l r )$ and weight decay $( w d )$ under both AdamW and SGD optimizers. To quantify this, we make use of error distribution functions (EDFs) [30]. An EDF is computed by sorting a set of results from low-to-high error and plotting the cumulative proportion of results as error increases, see [30] for details. In particular, we generate EDFs of a model as a function of $l r$ and $w d$ . The intuition is that if a model is robust to these hyperparameter choices, the EDF will be steep (all models will perform similarly), while if the model is sensitive, the EDF will be shallow (performance will be spread out).
|
| 113 |
+
|
| 114 |
+
We test 6 ViT models $( \{ P , C \} \times \{ 1 , 4 , 1 8 \} \mathrm { G F ) }$ and 3 RegNetY models ({1, 4, 16} GF). For each model and each optimizer, we compute an EDF by randomly sampling 64 $( l r , w d )$ pairs with learning rate and weight decay sampled in a fixed width interval around their optimal values for that model and optimizer (see the Appendix for sampling details). Rather than plotting absolute error in the EDF, we plot $\Delta$ top-1 error between the best result (obtained with the optimal $l r$ and $w d$ ) and the observed result. Due to the large number of models, we train each for only 50 epochs.
|
| 115 |
+
|
| 116 |
+
Results. Figure 4 shows scatterplots and EDFs for models trained by AdamW. Figure 5 shows SGD results. In all cases we see that $\mathrm { V i T } _ { C }$ significantly improves the $l r$ and $w d$ stability over $\mathrm { V i T } _ { P }$ for both optimizers. This indicates that the $l r$ and $w d$ are easier to optimize for $\mathrm { V i T } _ { C }$ than for $\mathrm { V i T } _ { P }$ .
|
| 117 |
+
|
| 118 |
+
# 5.4 Experimental Details
|
| 119 |
+
|
| 120 |
+
In all experiments we train with a single half-period cosine learning rate decay schedule with a 5-epoch linear learning rate warm-up [16]. We use a minibatch size of 2048. Crucially, weight decay is not applied to the gain factors found in normalization layers nor to bias parameters anywhere in the model; we found that decaying these parameters can dramatically reduce top-1 accuracy for small models and short schedules. For inference, we use an exponential moving average (EMA) of the model weights (e.g., [8]). The $l r$ and $w d$ used in this section are reported in the Appendix. Other hyperparameters use defaults: SGD momentum is 0.9 and AdamW’s $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ .
|
| 121 |
+
|
| 122 |
+
Regularization and data augmentation. We use a simplified training recipe compared to recent work such as DeiT [41], which we found to be equally effective across a wide spectrum of model complexities and dataset scales. We use AutoAugment [7], mixup [52] $\langle \alpha = 0 . 8 \rangle$ ), CutMix [51] $\alpha = 1 . 0$ ), and label smoothing [38] $\epsilon = 0 . 1$ ). We prefer this setup because it is similar to common settings for CNNs (e.g., [12]) except for stronger mixup and the addition of CutMix (ViTs benefit from both, while CNNs are not harmed). We compare this recipe to the one used for DeiT models in the Appendix, and observe that our setup provides substantially faster training convergence likely because we remove repeating augmentation [1, 20], which is known to slow training [1].
|
| 123 |
+
|
| 124 |
+
# 6 Peak Performance
|
| 125 |
+
|
| 126 |
+
A model’s peak performance is the most commonly used metric in network design. It represents what is possible with the best-known-so-far settings and naturally evolves over time. Making fair comparisons between different models is desirable but fraught with difficulty. Simply citing results from prior work may be negatively biased against that work as it was unable to incorporate newer, yet applicable improvements. Here, we strive to provide a fairer comparison between state-of-the-art CNNs, $\mathrm { V i T } _ { P }$ , and $\mathrm { V i T } _ { C }$ . We identify a set of factors and then strike a pragmatic balance between which subset to optimize for each model vs. which subset share a constant value across all models.
|
| 127 |
+
|
| 128 |
+
In our comparison, all models share the same epochs (400), use of model weight EMA, and set of regularization and augmentation methods (as specified in $\ S \quad ,$ . All CNNs are trained with SGD with $l r$ of 2.54 and wd of $2 . 4 \mathrm { e } { - 5 }$ ; we found this single choice worked well across all models, as similarly observed in [12]. For all ViT models we found AdamW with a $l r / w d$ of $1 . 0 \mathrm { { e - } 3 / 0 . 2 4 }$ was effective, except for the 36GF models. For these larger models we tested a few settings and found a $l r / w d$ of $6 . 0 \mathrm { { e } - 4 / 0 . 2 8 }$ to be more effective for both $\mathrm { V i T } _ { P ^ { - 3 6 } } \mathrm { G F }$ and $\mathrm { V i T } _ { C }$ -36GF models. For training and inference, ViTs use $2 2 4 \times 2 2 4$ resolution (we do not fine-tune at higher resolutions), while the CNNs use (often larger) optimized resolutions specified in [12, 39]. Given this protocol, we compare $\mathrm { V i T } _ { P }$ , $\mathrm { V i T } _ { C }$ , and CNNs across a spectrum of model complexities (1GF to 36GF) and dataset scales (directly training on ImageNet-1k vs. pretraining on ImageNet-21k and then fine-tuning on ImageNet-1k).
|
| 129 |
+
|
| 130 |
+
Results. Figure 6 shows a progression of results. Each plot shows ImageNet-1k val top-1 error vs. ImageNet-1k epoch training time.1 The left plot compares several state-of-the-art CNNs. RegNetY and RegNetZ [12] achieve similar results across the training speed spectrum and outperform EfficientNets [39]. Surprisingly, ResNets [19] are highly competitive at fast runtimes, showing that under a fairer comparison these years-old models perform substantially better than often reported (cf . [39]).
|
| 131 |
+
|
| 132 |
+
The middle plot compares two representative CNNs (ResNet and RegNetY) to ViTs, still using only ImageNet-1k training. The baseline $\mathrm { V i T } _ { P }$ underperforms RegNetY across the entire model complexity spectrum. To our surprise, $V i T _ { P }$ also underperforms ResNets in this regime. $\mathrm { V i T } _ { C }$ is more competitive and outperforms CNNs in the middle-complexity range.
|
| 133 |
+
|
| 134 |
+
The right plot compares the same models but with ImageNet-21k pretraining (details in Appendix). In this setting ViT models demonstrates a greater capacity to benefit from the larger-scale data: now $\mathrm { V i T } _ { C }$ strictly outperforms both $\mathrm { V i T } _ { P }$ and RegNetY. Interestingly, the original $V i T _ { P }$ does not outperform a state-of-the-art CNN even when trained on this much larger dataset. Numerical results are presented in Table 2 for reference to exact values. This table also highlights that flop counts are not significantly correlated with runtime, but that activations are (see Appendix for more details), as also observed by [12]. $E . g .$ ., EfficientNets are slow relative to their flops while ViTs are fast.
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
Figure 6: Peak performance (epoch training time vs. ImageNet-1k val top-1 error): Results of a fair, controlled comparison of $\mathrm { V i T } _ { P }$ , $\mathrm { V i T } _ { C }$ , and CNNs. Each curve corresponds to a model complexity sweep resulting in a training speed spectrum (minutes per ImageNet-1k epoch). Left: State-of-the-art CNNs. Equipped with a modern training recipe, ResNets are highly competitive in the faster regime, while RegNetY and Z perform similarly, and better than EfficientNets. Middle: Selected CNNs compared to ViTs. With access to only ImageNet-1k training data, RegNetY and ResNet outperform $\mathrm { V i T } _ { P }$ across the board. $\mathrm { V i T } _ { C }$ is more competitive with CNNs. Right: Pretraining on ImageNet-21k improves the ViT models more than the CNNs, making $\mathrm { V i T } _ { P }$ competitive. Here, the proposed $\mathrm { V i T } _ { C }$ outperforms all other models across the full training speed spectrum.
|
| 138 |
+
Table 2: Peak performance (grouped by model family): Model complexity and validation top-1 error at 100, 200, and 400 epoch schedules on ImageNet-1k, and the top-1 error after pretraining on ImageNet-21k (IN 21k) and fine-tuning on ImageNet-1k. This table serves as reference for the results shown in Figure 6. Blue numbers: best model trainable under 20 minutes per ImageNet-1k epoch. Batch sizes and training times are reported normalized to 8 32GB Volta GPUs (see Appendix). Additional results on the ImageNet-V2 [33] test set are presented in the Appendix.
|
| 139 |
+
|
| 140 |
+
<table><tr><td rowspan="2">model</td><td colspan="2">flops params acts</td><td colspan="2"></td><td rowspan="2">time batch|</td><td colspan="2">epochs</td><td rowspan="2"></td><td rowspan="2">IN 21k</td><td rowspan="2">model (B)</td><td colspan="3">flops params</td><td rowspan="2">time batch|</td><td rowspan="2">size</td><td colspan="2">epochs</td><td rowspan="2">IN</td><td rowspan="2">200400 21k</td></tr><tr><td>(B)</td><td>(M)</td><td>(M) (min)</td><td>size</td><td>100</td><td>200400</td><td></td><td>(M)</td><td>(min)</td><td>100</td></tr><tr><td>ResNet-50</td><td>4.1</td><td>25.6</td><td>11.3</td><td>3.4</td><td>2048</td><td>22.5</td><td>21.2</td><td>20.7</td><td>21.6</td><td>EffNet-B2</td><td>1.0</td><td>9.1</td><td>(M) 13.8</td><td>5.9</td><td>2048</td><td></td><td>21.4 20.5</td><td>19.9</td><td>-</td></tr><tr><td>ResNet-101</td><td>7.8</td><td>44.5</td><td>16.4</td><td>5.5</td><td>2048</td><td>20.3</td><td>19.1</td><td>18.5</td><td>19.2</td><td>EffNet-B4</td><td>4.4</td><td>19.3</td><td>49.5</td><td>19.4</td><td>512</td><td>18.5</td><td>17.8</td><td>17.5</td><td></td></tr><tr><td>ResNet-152</td><td>11.5</td><td>60.2</td><td>22.8</td><td>7.7</td><td>2048</td><td>19.5</td><td>18.417.7</td><td></td><td>18.2</td><td>EffNet-B5</td><td>10.3</td><td>30.4</td><td>98.9 41.7</td><td></td><td>256</td><td>17.3</td><td>317.0</td><td>17.0</td><td></td></tr><tr><td>ResNet-200</td><td>15.0</td><td>64.7</td><td>32.3</td><td>10.7</td><td>1024</td><td>19.5</td><td>18.3</td><td>17.6</td><td>17.7</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RegNetY-1GF</td><td>1.0</td><td>9.6</td><td>6.2</td><td>3.1</td><td>2048</td><td>23.2</td><td>22.2</td><td>21.5</td><td>-</td><td>ViTp-1GF</td><td>1.1</td><td>4.8</td><td>5.5</td><td>2.6</td><td>2048</td><td>33.2</td><td>29.7</td><td>27.7</td><td></td></tr><tr><td>RegNetY-4GF</td><td>4.1</td><td>22.4</td><td>14.5</td><td>7.6</td><td>2048</td><td>19.4</td><td>18.3</td><td>17.9</td><td>18.4</td><td>ViTp-4GF</td><td>3.9</td><td>18.51</td><td>11.1</td><td></td><td>3.82048</td><td></td><td>23.3 20.8</td><td>19.6</td><td>20.6</td></tr><tr><td>RegNetY-16GF</td><td>15.5</td><td>72.3</td><td>30.7</td><td>17.9</td><td>1024</td><td>17.1</td><td>16.4</td><td>16.3</td><td>15.6</td><td>ViTp-18GF</td><td>17.5</td><td>86.6</td><td>24.0</td><td>11.5</td><td>1024</td><td></td><td>19.918.4</td><td>17.9</td><td>16.4</td></tr><tr><td>RegNetY-32GF</td><td>31.1</td><td>128.6</td><td>46.2</td><td>35.1</td><td>512</td><td>16.2</td><td>15.9</td><td>15.9</td><td>15.0</td><td>ViTp-36GF</td><td>35.9</td><td>178.4</td><td>37.3</td><td>18.8</td><td>512</td><td>19.9</td><td>18.8</td><td>18.2</td><td>15.1</td></tr><tr><td>RegNetZ-1GF</td><td>1.0</td><td>11.0</td><td>8.8</td><td>4.2</td><td>2048</td><td></td><td>20.8 20.2</td><td>19.6</td><td>-</td><td>ViTc-1GF</td><td>1.1</td><td>4.6</td><td>5.7</td><td>2.7</td><td>2048</td><td></td><td>28.626.1</td><td>24.7</td><td>-</td></tr><tr><td>RegNetZ-4GF</td><td>4.0</td><td>28.1</td><td>24.3</td><td>12.9</td><td>1024</td><td></td><td>17.4 16.9</td><td>16.6</td><td></td><td>ViTc-4GF</td><td>4.0</td><td>17.8</td><td>11.3</td><td>3.9</td><td>)2048</td><td></td><td>20.919.2</td><td>18.6</td><td>18.8</td></tr><tr><td>RegNetZ-16GF</td><td>16.0</td><td>95.3</td><td>51.3</td><td>32.0</td><td>512</td><td></td><td>16.0 15.9</td><td>15.9</td><td></td><td>ViTc-18GF</td><td>17.7</td><td>81.624.1</td><td></td><td>11.4</td><td>1024</td><td></td><td>18.4 17.5</td><td>17.0</td><td>15.1</td></tr><tr><td>RegNetZ-32GF</td><td>32.0</td><td>175.1</td><td></td><td>79.6 55.3</td><td>256</td><td></td><td>16.3 16.2</td><td>16.1</td><td></td><td>ViTc-36GF</td><td>35.0</td><td>167.8 36.7</td><td></td><td>18.6</td><td>512</td><td></td><td>18.3 17.6</td><td>16.8</td><td>14.2</td></tr></table>
|
| 141 |
+
|
| 142 |
+
These results verify that $\mathrm { V i T } _ { C }$ ’s convolutional stem improves not only optimization stability, as seen in the previous section, but also peak performance. Moreover, this benefit can be seen across the model complexity and dataset scale spectrum. Perhaps surprisingly, given the recent excitement over ViT, we find that $\mathrm { V i T } _ { P }$ struggles to compete with state-of-the-art CNNs. We only observe improvements over CNNs when using both large-scale pretraining data and the proposed convolutional stem.
|
| 143 |
+
|
| 144 |
+
# 7 Conclusion
|
| 145 |
+
|
| 146 |
+
In this work we demonstrated that the optimization challenges of ViT models are linked to the largestride, large-kernel convolution in ViT’s patchify stem. The seemingly trivial change of replacing this patchify stem with a simple convolutional stem leads to a remarkable change in optimization behavior. With the convolutional stem, ViT (termed $\mathrm { V i T } _ { C }$ ) converges faster than the original ViT (termed $\mathrm { V i T } _ { P }$ ) (§5.1), trains well with either AdamW or SGD (§5.2), improves learning rate and weight decay stability (§5.3), and improves ImageNet top-1 error by ${ \sim } 1 { - } 2 \%$ (§6). These results are consistent across a wide spectrum of model complexities (1GF to 36GF) and dataset scales (ImageNet-1k to ImageNet-21k). Our results indicate that injecting a small dose of convolutional inductive bias into the early stages of ViTs can be hugely beneficial. Looking forward, we are interested in the theoretical foundation of why such a minimal architectural modification can have such large (positive) impact on optimizability. We are also interested in studying larger models. Our preliminary explorations into 72GF models reveal that the convolutional stem still improves top-1 error, however we also find that a new form of instability arises that causes training error to randomly spike, especially for $\mathrm { V i T } _ { C }$ .
|
| 147 |
+
|
| 148 |
+
Acknowledgements. We thank Hervé Jegou, Hugo Touvron, and Kaiming He for valuable feedback.
|
md/train/OQ08SN70M1V/OQ08SN70M1V.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BETTER FINE-TUNING BY REDUCING REPRESENTATIONAL COLLAPSE
|
| 2 |
+
|
| 3 |
+
Armen Aghajanyan, Akshat Shrivastava, Anchit Gupta & Naman Goyal
|
| 4 |
+
Facebook
|
| 5 |
+
{armenag,akshats,anchit,naman}@fb.com
|
| 6 |
+
|
| 7 |
+
Luke Zettlemoyer & Sonal Gupta Facebook {lsz, sonalgupta}@fb.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Although widely adopted, existing approaches for fine-tuning pre-trained language models have been shown to be unstable across hyper-parameter settings, motivating recent work on trust region methods. This paper presents a simplified and efficient method rooted in trust region theory that replaces previously used adversarial objectives with parametric noise (sampling from either a normal or uniform distribution), thereby discouraging representation change during fine-tuning when possible without hurting performance. We also introduce a new analysis to motivate the use of trust region methods more generally, by studying representational collapse; the degradation of generalizable representations from pre-trained models as they are fine-tuned for a specific end task. Extensive experiments show that our fine-tuning method matches or exceeds the performance of previous trust region methods on a range of understanding and generation tasks (including DailyMail/CNN, Gigaword, Reddit TIFU, and the GLUE benchmark), while also being much faster. We also show that it is less prone to representation collapse; the pre-trained models maintain more generalizable representations every time they are fine-tuned.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Pre-trained language models (Radford et al., 2019; Devlin et al., 2018; Liu et al., 2019; Lewis et al., 2019; 2020) have been shown to capture a wide array of semantic, syntactic, and world knowledge (Clark et al., 2019), and provide the defacto initialization for modeling most existing NLP tasks. However, fine-tuning them for each task is a highly unstable process, with many hyperparameter settings producing failed fine-tuning runs, unstable results (considerable variation between random seeds), over-fitting, and other unwanted consequences (Zhang et al., 2020; Dodge et al., 2020).
|
| 16 |
+
|
| 17 |
+
Recently, trust region or adversarial based approaches, including SMART (Jiang et al., 2019) and FreeLB (Zhu et al., 2019), have been shown to increase the stability and accuracy of fine-tuning by adding additional constraints limiting how much the fine-tuning changes the initial parameters. However, these methods are significantly more computationally and memory intensive than the more commonly adopted simple-gradient-based approaches.
|
| 18 |
+
|
| 19 |
+
This paper presents a lightweight fine-tuning strategy that matches or improves performance relative to SMART and FreeLB while needing just a fraction of the computational and memory overhead and no additional backward passes. Our approach is motivated by trust region theory while also reducing to simply regularizing the model relative to parametric noise applied to the original pre-trained representations. We show uniformly better performance, setting a new state of the art for RoBERTa fine-tuning on GLUE and reaching state of the art on XNLI using no novel pre-training approaches (Liu et al., 2019; Wang et al., 2018; Conneau et al., 2018). Furthermore, the low overhead of our family of fine-tuning methods allows our method to be applied to generation tasks where we consistently outperform standard fine-tuning, setting state of the art on summarization tasks.
|
| 20 |
+
|
| 21 |
+
We also introduce a new analysis to motivate the use of trust-region-style methods more generally, by defining a new notion of representational collapse and introducing a new methodology for measuring it during fine-tuning. Representational collapse is the degradation of generalizable representations of pre-trained models during the fine-tuning stage. We empirically show that standard fine-tuning degrades generalizable representations through a series of probing experiments on GLUE tasks. Furthermore, we attribute this phenomenon to using standard gradient descent algorithms for the fine-tuning stage. We also find that (1) recently proposed fine-tuning methods rooted in trust region, i.e., SMART, can alleviate representation collapse, and (2) our methods alleviate representational collapse to an even greater degree, manifesting in better performance across almost all datasets and models.
|
| 22 |
+
|
| 23 |
+
Our contributions in this paper are the following.
|
| 24 |
+
|
| 25 |
+
• We propose a novel approach to fine-tuning rooted in trust-region theory, which we show directly alleviates representational collapse at a fraction of the cost of other recently proposed fine-tuning methods.
|
| 26 |
+
Through extensive experimentation, we show that our method outperforms standard finetuning methodology following recently proposed best practices from Zhang et al. (2020). We improve various SOTA models from sentence prediction to summarization, from monolingual to cross-lingual. We further define and explore the phenomena of representational collapse in fine-tuning and directly correlate it with generalization in tasks of interest.
|
| 27 |
+
|
| 28 |
+
# 2 LEARNING ROBUST REPRESENTATIONS THROUGH REGULARIZED FINE-TUNING
|
| 29 |
+
|
| 30 |
+
We are interested in deriving methods for fine-tuning representations that provide guarantees on the movement of representations, in the sense that they do not forget the original pre-trained representations when they are fine-tuned for new tasks (see Section 4 for more details). We introduce a new fine-tuning method rooted in an approximation to trust region, which provides guarantees for stochastic gradient descent algorithms by bounding some divergence between model at update $t$ and $t + 1$ (Pascanu & Bengio, 2013; Schulman et al., 2015b; Jiang et al., 2019).
|
| 31 |
+
|
| 32 |
+
Let $f : \mathbb { R } ^ { m \times n } \mathbb { R } ^ { p }$ be a function which returns some pre-trained representation parameterized by $\theta _ { f }$ from $m$ tokens embedded into a fixed vector of size $n$ . Let the learned classification head $g : \dot { \mathbb { R } ^ { p } } \to \mathbb { R } ^ { q }$ be a function which takes an input from $f$ and outputs a valid probability distribution parameterized by $\theta _ { g }$ in $q$ dimensions and let $X$ be our dataset. In the case of generation, we can assume the classification head is simply an identity function or softmax depending on the loss function. Let $\mathcal { L } ( \boldsymbol { \theta } )$ denote a loss function given by $\theta = [ \theta _ { f } , \theta _ { g } ]$ .
|
| 33 |
+
|
| 34 |
+
We are interested in minimizing $\mathcal { L }$ with respect to $\theta$ such that each update step is constrained by movement in the representational density space $p ( f )$ . More formally given an arbitrary $\epsilon$
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\begin{array} { r } { \underset { \Delta \theta } { \arg \operatorname* { m i n } } \ : \mathcal { L } ( \theta + \Delta \theta ) \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad s . t . \ : K L ( p ( f ( \cdot \ : ; \theta _ { f } ) ) | | p ( f ( \cdot \ : ; \theta _ { f } + \Delta \theta _ { f } ) ) ) = \epsilon } \end{array}
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
This constrained optimization problem is equivalent to doing natural gradient descent directly over the representations (Pascanu & Bengio, 2013). Unfortunately, we do not have direct access to the density of representations; therefore, it is not trivial to directly bound this quantity. Instead, we propose to do natural gradient over $g \cdot f$ with an additional constraint that $g$ is at most 1-Lipschitz (which naturally constrains change of representations, see Section A.1 in the Appendix). Traditional computation of natural gradient is computationally prohibitive due to the need for inverting the Hessian. An alternative formulation of natural gradient can be stated through mirror descent, using Bregmann divergences (Raskutti & Mukherjee, 2015; Jiang et al., 2019).
|
| 41 |
+
|
| 42 |
+
This method primarily serves as a robust regularizer by preventing large updates in the model’s probability space. This family of methods is classically known as trust-region methods (Pascanu & Bengio, 2013; Schulman et al., 2015a).
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\mathcal { L } _ { S M A R T } ( \theta , f , g ) = \mathcal { L } ( \theta ) + \lambda \mathbb { E } _ { x \sim X } \left[ \operatorname* { s u p } _ { { x ^ { \sim } : | x ^ { \sim } - x | \le \epsilon } } K L _ { S } ( g \cdot f ( x ) \parallel g \cdot f ( x ^ { \sim } ) ) \right]
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
However, the supremum is computationally intractable. An approximation is possible by doing gradient ascent steps, similar to finding adversarial examples. This was first proposed by SMART with a symmetrical $K L _ { S } ( X , Y ) = K L ( X | | Y ) + K L ( Y | | X )$ term (Jiang et al., 2019).
|
| 49 |
+
|
| 50 |
+
We propose an even simpler approximation which does not require extra backward computations and empirically works as well as or better than SMART. We altogether remove the adversarial nature from SMART and instead optimize for a smoothness parameterized by $K L _ { S }$ . Furthermore, we optionally also add a constraint on the smoothness of $g$ by making it at most 1-Lipschitz, the intuition being if we can bound the volume of change in $g$ we can more effectively bound $f$ .
|
| 51 |
+
|
| 52 |
+
R3F Method
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\begin{array} { r l } & { \mathcal { L } _ { R 3 } ( f , g , \theta ) = \mathcal { L } ( \theta ) + \lambda \mathbb { E } _ { x \sim X } \left[ K L _ { S } ( g \cdot f ( x ) \parallel g \cdot f ( x + z ) ) \right] } \\ & { \quad \quad \quad \quad s . t . \quad z \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I ) \mathrm { o r } z \sim \mathcal { U } ( - \sigma , \sigma ) } \\ & { \quad \quad \quad s . t . \quad L i p \{ g \} \leq 1 } \end{array}
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $K L _ { S }$ is the symmetric KL divergence and $z$ is a sample from a parametric distribution. In our work we test against two distributions, normal and uniform centered around 0. We denote this as the Robust Representations through Regularized Finetuning (R3F) method.
|
| 59 |
+
|
| 60 |
+
Additionally we propose an extension to R3F (R4F; Robust Representations through Regularized and Reparameterized Finetuning, which reparameterizes $g$ to be at most 1-Lipschitz via Spectral Normalization (Miyato et al., 2018). By constraining $g$ to be at most 1-Lipschitz, we can more directly bound the change in representation (Appendix Section A.1). Specifically we scale all the weight matrices of $g$ by the inverse of their largest singular values ${ W _ { S N } } : = W / { \overset { \cdot } { \sigma } } ( W )$ . Given that spectral radius $\sigma ( W _ { S N } ) = 1$ we can bound $L i p \{ g \} \le 1$ . In the case of generation, $g$ does not have any weights therefore we can only apply the R3F method.
|
| 61 |
+
|
| 62 |
+
# 2.1 RELATIONSHIP TO SMART AND FREELB
|
| 63 |
+
|
| 64 |
+
Our method is most closely related to the SMART algorithm, which utilizes an auxiliary smoothness inducing regularization term, which directly optimizes the Bregmann divergence mentioned above in Equation 2 (Jiang et al., 2019).
|
| 65 |
+
|
| 66 |
+
SMART solves the supremum by using an adversarial methodology to ascent to the largest KL divergence with an $\epsilon { \mathrm { - } } \mathbf { b } \mathbf { a } \mathbf { l } \mathbf { l }$ . We instead propose to remove the ascent step completely, optionally fixing the smoothness of the classification head $g$ . This completely removes SMART’s adversarial nature and is more akin to optimizing the smoothness of $g \cdot f$ directly. Another recently proposed adversarial method for fine-tuning, FreeLB optimizes a direct adversarial loss $\begin{array} { r } { \mathcal { L } _ { F r e e L B } ( \boldsymbol { \theta } ) \stackrel { - } { = } \operatorname* { s u p } _ { \Delta \boldsymbol { \theta } : | \Delta \boldsymbol { \theta } | \leq \epsilon } \mathcal { L } ( \boldsymbol { \theta } + } \end{array}$ $\Delta \theta _ { , }$ ) through iterative gradient ascent steps. This is similar to SMART in the sense that both are adversarial and require gradient ascent steps. Unfortunately, the need for extra forward-backward passes can be prohibitively expensive when fine-tuning large pre-trained models (Zhu et al., 2019).
|
| 67 |
+
|
| 68 |
+
Table 1: Computational cost of recently proposed fine-tuning algorithms. We show Forward Passes (FP), Backward Passes (BP) as well as computation cost as a factor of forward passes (xFP). $S$ is the number of gradient ascent steps, with a minimum of $S \geq 1$
|
| 69 |
+
|
| 70 |
+
<table><tr><td></td><td>FP</td><td>BP</td><td>xFP</td></tr><tr><td>FreeLB</td><td>1+S</td><td>1+S</td><td>3+3S</td></tr><tr><td>SMART</td><td>1+S</td><td>1+S</td><td>3+3S</td></tr><tr><td>R3F/R4F</td><td>2</td><td>1</td><td>4</td></tr><tr><td>Standard</td><td>1</td><td>1</td><td>3</td></tr></table>
|
| 71 |
+
|
| 72 |
+
Our method is significantly more computationally effi
|
| 73 |
+
cient than adversarial based fine-tuning methods, as seen in Table 1. We show that this efficiency does not hurt performance; we can match or exceed FreeLB and SMART on a large number of tasks. In addition, the relatively low costs of our methods allow us to improve over fine-tuning on an array of generation tasks.
|
| 74 |
+
|
| 75 |
+
# 3 EXPERIMENTS
|
| 76 |
+
|
| 77 |
+
We will first measure performance by fine-tuning on a range of tasks and languages. The next sections report why methods rooted in trust region, including ours, outperform standard fine-tuning. We aimed for fair comparisons throughout all of our experiments by using fixed budget hyperparameters searches across all methods. Furthermore, for computationally tractable tasks, we report median/max numbers as well as show distributions across a large number of runs.
|
| 78 |
+
|
| 79 |
+
# 3.1 SENTENCE PREDICTION
|
| 80 |
+
|
| 81 |
+
# GLUE
|
| 82 |
+
|
| 83 |
+
We will first test R3F and R4F on sentence classification tasks from the GLUE benchmark (Wang et al., 2018). We select the same subset of GLUE tasks that have been reported by prior work in this space (Jiang et al., 2019): MNLI (Williams et al., 2018), QQP (Iyer et al., 2017), RTE (Bentivogli et al., 2009), QNLI (Rajpurkar et al., 2016), MRPC (Dolan & Brockett, 2005), CoLA (Warstadt et al., 2018), SST-2 (Socher et al., 2013).1
|
| 84 |
+
|
| 85 |
+
Consistent with prior work (Jiang et al., 2019; Zhu et al., 2019), we focus on improving the performance of RoBERTa-Large based models in the single-task setting (Liu et al., 2019). We report the performance of all models on the GLUE development set.
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
Figure 1: Empirical evidence towards the computational benefits of our method we present training wall time analysis on the SST-2 dataset. Each method includes a violin plot for 10 random runs. We define wall-time as the training time in seconds to best checkpoint.
|
| 89 |
+
|
| 90 |
+
We fine-tune each of the GLUE tasks with four methods: Standard (STD), the traditional finetuning scheme as done by RoBERTa (Liu et al., 2019); Standard $^ { + + }$ $\mathrm { S T D + + }$ ), a variant of standard fine-tuning that incorporates recently proposed best practices for fine-tuning, specifically longer fine-tuning and using bias correction in Adam (Zhang et al., 2020); and our proposed methods R3F and R4F. We compare against the numbers reported by SMART, FreeLB, and RoBERTa on the validation set. For each method, we applied a hyper-parameter search with equivalent fixed budgets per method. Fine-tuning each task has task-specific hyperparameters described in the Appendix (Section A.2). After finding the best hyperparameters, we replicated experiments with optimal parameters across ten different random seeds. Our numbers reported are the maximum of 10 seeds to be comparable with other benchmarks in Table 2.
|
| 91 |
+
|
| 92 |
+
In addition to showing the best performance, we also show the distribution of various methods across ten seeds to demonstrate the stability properties of individual methods in Figure 2.
|
| 93 |
+
|
| 94 |
+
R3F and R4F unanimously improve over Standard and Standard $^ { + + }$ fine-tuning. Furthermore, our methods match or exceed adversarial methods such as SMART/FreeLB at a fraction of the computational cost when comparing median runs. We show computational cost in Figure 1 for a single task, but the relative behavior of wall times is consistent across all other GLUE tasks. We note that we could not find a discernable difference in the experimental setting, which would make the selection between R3F vs. R4F trivial.
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Figure 2: We show the results of our method against Standard $^ { + + }$ fine-tuning and SMART across 3 tasks. Across 10 random seeds both max and median of our runs were higher using our method than both SMART and Standard $^ { + + }$ .
|
| 98 |
+
|
| 99 |
+
<table><tr><td>MNLI Acc-m/mm</td><td>QQP Acc/F1</td><td>RTE Acc</td><td>QNLI Acc</td><td>MRPC Acc</td><td>CoLA Mcc</td><td>SST-2 Acc</td></tr><tr><td>90.2/-</td><td>91.9/-</td><td>86.6</td><td>92.1</td><td>84.4</td><td>66.2</td><td>96.4</td></tr><tr><td>90.8/-</td><td>92.1/-</td><td>87.4</td><td>92.5</td><td>89.1</td><td>68.4</td><td>96.9</td></tr><tr><td>-/- 90.85/91.10</td><td>-- 91.7/88.2</td><td>- 89.5</td><td>- 94.8</td><td>- 83.9</td><td>1 69.4</td><td>- 96.6</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>91.10/91.10</td><td>92.1/88.4</td><td>88.4</td><td>95.1</td><td>91.2</td><td>70.6</td><td>96.2</td></tr><tr><td>90.0/90.6</td><td>91.8/88.2</td><td>88.3</td><td>94.8</td><td>90.1</td><td>70.1</td><td>96.8</td></tr></table>
|
| 100 |
+
|
| 101 |
+
Table 2: We present our best results on the GLUE development set for various fine-tuning methods applied to the RoBERTa Large model. On the left side table, we present our best numbers and numbers published in other papers. On the right side, we present median numbers from 10 runs for the mentioned methods.
|
| 102 |
+
|
| 103 |
+
<table><tr><td></td><td>MNLI Acc-m/mm</td><td>QQP Acc/F1</td><td>RTE Acc</td><td>QNLI Acc</td><td>MRPC Acc</td><td>CoLA Mcc</td><td>SST-2 Acc</td></tr><tr><td>STD</td><td>90.2/-</td><td>92.2/-</td><td>86.6</td><td>94.7</td><td>89.1</td><td>68.0</td><td>96.4</td></tr><tr><td>STD++</td><td>91.0/-</td><td>92.2/-</td><td>87.4</td><td>94.8</td><td>91.1</td><td>69.4</td><td>96.9</td></tr><tr><td>FreeLB</td><td>90.6/-</td><td>92.6/-</td><td>88.1</td><td>95.0</td><td>-</td><td>71.1</td><td>96.7</td></tr><tr><td>SMART</td><td>91.1/91.3</td><td>92.4/89.8</td><td>92.0</td><td>95.6</td><td>89.2</td><td>70.6</td><td>96.9</td></tr><tr><td>R3F</td><td>91.1/91.3</td><td>92.4/89.9</td><td>88.5</td><td>95.3</td><td>91.6</td><td>71.2</td><td>97.0</td></tr><tr><td>R4F</td><td>90.1/90.8</td><td>92.5/89.9</td><td>88.8</td><td>95.1</td><td>90.9</td><td>70.6</td><td>97.1</td></tr></table>
|
| 104 |
+
|
| 105 |
+
# XNLI
|
| 106 |
+
|
| 107 |
+
We hypothesize that staying closer to the original representations is especially crucial for crosslingual tasks, especially in the zero-shot fashion where drifting away from pre-trained representations for a single language might manifest in loss of cross-lingual capabilities. In particular, we take a look at the popular XNLI benchmark, containing 15 languages (Conneau et al., 2018). We compare our method against the standard trained XLM-R model in the zero-shot setting (Conneau et al., 2019).
|
| 108 |
+
|
| 109 |
+
<table><tr><td>Model</td><td>en</td><td>fr</td><td>es</td><td>de</td><td>el</td><td>bg</td><td>ru</td><td>tr</td><td>ar</td><td>vi</td><td>th</td><td>zh</td><td>hi</td><td>sw</td><td>ur</td><td>Avg</td></tr><tr><td>XLM-R Base</td><td></td><td>85.879.7</td><td>80.7</td><td>78.7</td><td>77.5</td><td>79.6</td><td>78.1</td><td>74.2</td><td>73.8 76.5</td><td></td><td>74.6</td><td>76.7</td><td>72.4</td><td>66.5</td><td>68.3</td><td>76.2</td></tr><tr><td>XLM-R Large</td><td>89.1</td><td>84.1</td><td>85.1</td><td>83.9</td><td>82.9</td><td>84.0</td><td>81.2</td><td>79.6</td><td>79.8</td><td>80.8</td><td>78.1</td><td>80.2</td><td>76.9</td><td>73.9</td><td>73.8</td><td>80.9</td></tr><tr><td>+R3F</td><td></td><td>89.484.2</td><td>85.1</td><td>83.7</td><td>83.6</td><td>84.6</td><td>82.3</td><td>80.7</td><td>80.6</td><td>81.1</td><td>79.4</td><td>80.1</td><td>77.3</td><td>72.6</td><td>74.2</td><td>81.2</td></tr><tr><td>+R4F</td><td></td><td>89.684.7</td><td>85.2</td><td>84.2</td><td>83.6 84.6</td><td></td><td>82.5</td><td>80.3</td><td>80.5</td><td>80.9</td><td>79.2</td><td>80.6</td><td>78.2</td><td>72.7</td><td>73.9</td><td>81.4</td></tr><tr><td>InfoXLM</td><td></td><td>89.7 84.5</td><td>85.5</td><td>84.1</td><td>83.4 84.2 81.3</td><td></td><td></td><td>80.9</td><td>80.4 80.878.9</td><td></td><td></td><td>80.9</td><td>77.9</td><td>74.8</td><td>73.7</td><td>81.4</td></tr></table>
|
| 110 |
+
|
| 111 |
+
Table 3: To remain consistent with prior experiments, we report an average of 5 runs of zero-shots results on the XNLI test set for our method applied to XLM-R Large. Various versions of our method win over the majority of languages. The bottom row shows the current SOTA on XNLI, which requires the pre-training of a novel model.
|
| 112 |
+
|
| 113 |
+
We present our result in Table 3. R3F and R4F dominate standard pre-training on 14 out of the 15 languages in the XNLI task. R4F improves over the best known XLM-R XNLI results reaching SOTA with an average language score of 81.4 across five runs. The current state of the art, INFOXLM required a novel pre-training method to reach the same numbers (Chi et al., 2020).
|
| 114 |
+
|
| 115 |
+
Table 4: Our results on various summarization data-sets. We report Rouge-1, Rouge-2 and Rouge-L per element in table. Following PEGASUS, we bold the best number and numbers within 0.15 of the best.
|
| 116 |
+
|
| 117 |
+
<table><tr><td></td><td>CNN/DailyMail</td><td>Gigaword</td><td>Reddit TIFU (Long)</td></tr><tr><td>Random Transformer</td><td>38.27/15.03/35.48</td><td>35.70/16.75/32.83</td><td>15.89/1.94/12.22</td></tr><tr><td>BART</td><td>44.16/21.28/40.90</td><td>39.29/20.09/35.65</td><td>24.19/8.12/21.31</td></tr><tr><td>PEGASUS</td><td>44.17/21.47/41.11</td><td>39.12/19.86/36.24</td><td>26.63/9.01/21.60</td></tr><tr><td>ERNIE-GEN</td><td>44.02/21.17/41.26</td><td>39.25/20.25/36.53</td><td>1</td></tr><tr><td>ProphetNet (Old SOTA)</td><td>44.20/21.17/41.30</td><td>39.51/20.42/36.69</td><td>1</td></tr><tr><td>BART+R3F (New SOTA)</td><td>44.38/21.53/41.17</td><td>40.45/20.69/36.56</td><td>30.31/10.98/24.74</td></tr></table>
|
| 118 |
+
|
| 119 |
+
# 3.2 SUMMARIZATION
|
| 120 |
+
|
| 121 |
+
While prior work in non-standard finetuning methods tends to focus on sentence prediction and GLUE tasks (Jiang et al., 2019; Zhu et al., 2019; Zhang et al., 2020), we look to improve abstractive summarization, due to its additional complexity and computational cost, specifically we look at three datasets: CNN/Dailymail (Hermann et al., 2015), Gigaword (Napoles et al., 2012) and Reddit TIFU (Kim et al., 2018).
|
| 122 |
+
|
| 123 |
+
Like most other NLP tasks, summarization recently has been dominated by the fine-tuning of large pre-trained models. For example, PEGASUS explicitly defines a pre-training objective to facilitate the learning of representations tailored to summarization tasks manifesting in state-of-the-art performance on various summarization benchmarks (Zhang et al., 2019). ProphetNet (Yan et al., 2020) improved over these numbers by introducing their own novel self-supervised task as did ERNIEGEN (Xiao et al., 2020).
|
| 124 |
+
|
| 125 |
+
Independent of the pre-training task, standard fine-tuning on downstream tasks follows a simple formula of using a label smoothing loss while directly fine-tuning the whole model without adding any new parameters. We propose the addition of the R3F term directly to the label smoothing loss. We note that R4F cannot be applied directly to generation tasks due to its reparameterization nature.
|
| 126 |
+
|
| 127 |
+
We present our results in Table 4. Our method (R3F) outperforms standard fine-tuning across the board for three tasks across all of the ROUGE metric variants. Notably, we improve Gigaword and Reddit TIFU ROUGE-1 scores by a point and four points, respectively.
|
| 128 |
+
|
| 129 |
+
# 4 REPRESENTATIONAL COLLAPSE
|
| 130 |
+
|
| 131 |
+
Catastrophic forgetting, proposed initially as catastrophic interference, is a phenomenon that occurs during sequential training where new updates interfere catastrophically with previous updates manifesting in forgetting of particular examples for a fixed task (McCloskey & Cohen, 1989). Catastrophic forgetting has been historically associated with continuous learning, and recent work (Mosbach et al., 2020) showed that catastrophic forgetting concerning the original MLM objective is not detrimental for end task training. Instead, the issue lies in optimization. Inspired by this work, we explore the related problem of representational collapse, the degradation of generalizable representations of pre-trained models during the fine-tuning stage. This definition is independent of a specific fine-tuning task but is rather over the internal representations generalizability over a large union of tasks. Another view of this phenomenon is that fine-tuning collapses the wide range of information available in the representations into a smaller set needed only for the immediate task and particular training set.
|
| 132 |
+
|
| 133 |
+
Measuring such degradations is non-trivial. Simple metrics such as the distance between pre-trained representations and fine-tuned representations are not sufficient (e.g., adding a constant to the pretrained representations will not change representation power, but will change distances). One approach would be to estimate mutual information of representations across tasks before and after finetuning, but the estimation of mutual information is notoriously hard, especially in high-dimensions (Tschannen et al., 2019). We instead propose a series of probing experiments meant to provide us with empirical evidence of the existence of representation collapse on the GLUE benchmark (Wang et al., 2018).
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 3: Results from our probing experiments comparing our proposed algorithms R3F, R4F to standard fine-tuning. Variants of our method consistently outperform past work.
|
| 137 |
+
|
| 138 |
+
# 4.1 PROBING EXPERIMENTS
|
| 139 |
+
|
| 140 |
+
# PROBING GENERALIZATION OF FINE-TUNED REPRESENTATIONS
|
| 141 |
+
|
| 142 |
+
To measure the generalization properties of various fine-tuning methodologies, we follow probing methodology by first freezing the representations from the model trained on one task and then finetuning a linear layer on top of the model for another task. Doing this form of probing can directly measure the quality of representations learned by various fine-tuning methods and how much they collapse when fine-tuned on a sequence of tasks.
|
| 143 |
+
|
| 144 |
+
In particular, we fine-tune a RoBERTa model on SST-2 and train a linear layer for six other GLUE tasks, respectively. Our results are shown in Figure 3. Appendix A.2 presents the hyperparameters. Across all tasks, one of the two variants of our method performed best across various fine-tuning methods.
|
| 145 |
+
|
| 146 |
+
Conversely, standard fine-tuning produced representations that were worse than other finetuning methods across the board, hinting at the sub-optimality of standard fine-tuning. Furthermore, R3F/R4F consistently outperforms the adversarial fine-tuning method SMART.
|
| 147 |
+
|
| 148 |
+
# PROBING REPRESENTATION DEGRADATION
|
| 149 |
+
|
| 150 |
+
To show the effect of representation collapse, we propose an experiment to measure how the fine-tuning process degrades representations by sequentially training on a series of GLUE tasks. We arbitrarily select 3 GLUE tasks (QNLI, QQP, and RTE) and a source task (SST-2). We begin by training a model on our source task and then train on QNLI, QQP, and RTE in a sequential order using the best checkpoint from
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 4: We show the results of the chained probing experiments. We do not show the distributional properties of the runs because there was minimal variance in the results.
|
| 154 |
+
|
| 155 |
+
the prior iteration. At each point in the chain, we probe the source task and measure performance. We compare standard SGD with the best trust-region fine-tuning approach (R4F). Our results are depicted in Figure 4.
|
| 156 |
+
|
| 157 |
+
As we can see with the standard fine-tuning process, our model diverges from the source task resulting in lower performance probes; however, with our method, the probes change much less with sequential probing resulting in better probing and end performance.
|
| 158 |
+
|
| 159 |
+
# PROBING REPRESENTATION RETENTION
|
| 160 |
+
|
| 161 |
+
To further understand representational collapse’s impact, we extend our probing experiments to train a cyclic chain of tasks. We showed that traditional fine-tuning degrades representations during the fine-tuning process in our prior experiments, meaning standard fine-tuning learns poorer representation compared to alternative fine-tuning methods. The dual to looking at degradation is to look at the retainment of learned representations. To do this, we take a look at cyclic sequential probing. Sequential probing involves training a model on task A, probing B, then training model fine-tuned on B and probing task C, and so forth. We then create a cyclic chain $\begin{array} { r } { A \to B \to C \to A \to B \to C } \end{array}$ {zCycle 1 {zCycle 2
|
| 162 |
+
|
| 163 |
+
from where we compare tasks via their probe performance at each cycle.
|
| 164 |
+
|
| 165 |
+
We expect probing performance to increase at every cycle; since every cycle, the task we are probing on will undergo a full fine-tuning. What we are interested in is the level of retention in representations after the fine-tuning. Specifically, we hypothesize that our method, specifically R4F, will retain representations significantly better than the Standard $^ { + + }$ fine-tuning method.
|
| 166 |
+
|
| 167 |
+
In our experiments we consider the following sequence of GLUE tasks: ${ \mathrm { S S T } } { \mathrm { - } } 2 \to { \mathrm { Q N L I } } \to { \mathrm { Q Q P } } \to$ RTE. We defer hyperparameter values to Appendix (Section A.2).
|
| 168 |
+
|
| 169 |
+

|
| 170 |
+
Figure 5: We present the results of cyclical sequential probing for 3 cycles.
|
| 171 |
+
|
| 172 |
+
Looking at Figure 5, we see that R4F retains the quality of representations significantly better than standard fine-tuning methods.
|
| 173 |
+
|
| 174 |
+
# 5 CONCLUSION
|
| 175 |
+
|
| 176 |
+
We propose a family of new fine-tuning approaches for pre-trained representations based on trustregion theory: R3F and R4F. Our methods are more computationally efficient and outperform prior work in fine-tuning via adversarial learning (Jiang et al., 2019; Zhu et al., 2019). We show that this is due to a new phenomenon during fine-tuning: representational collapse, where representations learned during fine-tuning degrade, leading to worse generalization. Our analysis shows that standard fine-tuning is sub-optimal when it comes to learning generalizable representations, and instead, our methods retain representation generalizability and improve end task performance.
|
| 177 |
+
|
| 178 |
+
With our method, we improve upon monolingual and multilingual sentence prediction tasks as well as generation tasks compared to standard and adversarial fine-tuning methods. Notably, we set state of the art on DailyMail/CNN, Gigaword, Reddit TIFU, improve the best-known results on finetuning RoBERTa on GLUE, and reach state of the art on zero-shot XNLI without the need for any new pre-training method.
|
| 179 |
+
|
| 180 |
+
We note there are many flavors of RXF that can occur with various noise distributions or perturbation strategies. We believe a larger, more general framework exists which connects trust region methods and fine-tuning in general. We leave this area of exploration for future work.
|
| 181 |
+
|
| 182 |
+
REFERENCES
|
| 183 |
+
Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. The fifth pascal recognizing textual entailment challenge. In TAC, 2009.
|
| 184 |
+
Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. Semeval-2017 task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. arXiv preprint arXiv:1708.00055, 2017.
|
| 185 |
+
Zewen Chi, Li Dong, Furu Wei, Nan Yang, Saksham Singhal, Wenhui Wang, Xia Song, Xian-Ling Mao, Heyan Huang, and Ming Zhou. Infoxlm: An information-theoretic framework for crosslingual language model pre-training, 2020.
|
| 186 |
+
Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D Manning. What does bert look at? an analysis of bert’s attention. arXiv preprint arXiv:1906.04341, 2019.
|
| 187 |
+
Alexis Conneau, Guillaume Lample, Ruty Rinott, Adina Williams, Samuel R Bowman, Holger Schwenk, and Veselin Stoyanov. Xnli: Evaluating cross-lingual sentence representations. arXiv preprint arXiv:1809.05053, 2018.
|
| 188 |
+
Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzman, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Un- ´ supervised cross-lingual representation learning at scale. arXiv preprint arXiv:1911.02116, 2019.
|
| 189 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 190 |
+
Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305, 2020.
|
| 191 |
+
William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 192 |
+
Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Advances in neural information processing systems, pp. 1693–1701, 2015.
|
| 193 |
+
Shankar Iyer, Nikhil Dandekar, and Kornel Csernai. First quora dataset release: Question pairs, 2017. URL https://data.quora.com/ First-Quora-Dataset-Release-Question-Pairs.
|
| 194 |
+
Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. Smart: Robust and efficient fine-tuning for pre-trained natural language models through principled regularized optimization. arXiv preprint arXiv:1911.03437, 2019.
|
| 195 |
+
Byeongchang Kim, Hyunwoo Kim, and Gunhee Kim. Abstractive summarization of reddit posts with multi-level memory networks. arXiv preprint arXiv:1811.00783, 2018.
|
| 196 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
|
| 197 |
+
Mike Lewis, Marjan Ghazvininejad, Gargi Ghosh, Armen Aghajanyan, Sida Wang, and Luke Zettlemoyer. Pre-training via paraphrasing, 2020.
|
| 198 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 199 |
+
|
| 200 |
+
Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pp. 109–165. Elsevier, 1989.
|
| 201 |
+
|
| 202 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
|
| 203 |
+
|
| 204 |
+
Marius Mosbach, Maksym Andriushchenko, and Dietrich Klakow. On the stability of fine-tuning bert: Misconceptions, explanations, and strong baselines. arXiv preprint arXiv:2006.04884, 2020.
|
| 205 |
+
|
| 206 |
+
Courtney Napoles, Matthew R Gormley, and Benjamin Van Durme. Annotated gigaword. In Proceedings of the Joint Workshop on Automatic Knowledge Base Construction and Web-scale Knowledge Extraction (AKBC-WEKEX), pp. 95–100, 2012.
|
| 207 |
+
|
| 208 |
+
Razvan Pascanu and Yoshua Bengio. Revisiting natural gradient for deep networks. arXiv preprint arXiv:1301.3584, 2013.
|
| 209 |
+
|
| 210 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8):9, 2019.
|
| 211 |
+
|
| 212 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
|
| 213 |
+
|
| 214 |
+
Garvesh Raskutti and Sayan Mukherjee. The information geometry of mirror descent. IEEE Transactions on Information Theory, 61(3):1451–1457, 2015.
|
| 215 |
+
|
| 216 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pp. 1889–1897, 2015a.
|
| 217 |
+
|
| 218 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pp. 1889–1897, 2015b.
|
| 219 |
+
|
| 220 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
|
| 221 |
+
|
| 222 |
+
Michael Tschannen, Josip Djolonga, Paul K Rubenstein, Sylvain Gelly, and Mario Lucic. On mutual information maximization for representation learning. arXiv preprint arXiv:1907.13625, 2019.
|
| 223 |
+
|
| 224 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 353–355, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-5446. URL https://www.aclweb.org/anthology/ W18-5446.
|
| 225 |
+
|
| 226 |
+
Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471, 2018.
|
| 227 |
+
|
| 228 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1112–1122. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/N18-1101.
|
| 229 |
+
|
| 230 |
+
Dongling Xiao, Han Zhang, Yukun Li, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-gen: An enhanced multi-flow pre-training and fine-tuning framework for natural language generation. arXiv preprint arXiv:2001.11314, 2020.
|
| 231 |
+
|
| 232 |
+
Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang, and Ming Zhou. Prophetnet: Predicting future n-gram for sequence-to-sequence pre-training. arXiv preprint arXiv:2001.04063, 2020.
|
| 233 |
+
|
| 234 |
+
Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter J Liu. Pegasus: Pre-training with extracted gap-sentences for abstractive summarization. arXiv preprint arXiv:1912.08777, 2019.
|
| 235 |
+
|
| 236 |
+
Tianyi Zhang, Felix Wu, Arzoo Katiyar, Kilian Q Weinberger, and Yoav Artzi. Revisiting fewsample bert fine-tuning. arXiv preprint arXiv:2006.05987, 2020.
|
| 237 |
+
|
| 238 |
+
Chen Zhu, Yu Cheng, Zhe Gan, Siqi Sun, Tom Goldstein, and Jingjing Liu. Freelb: Enhanced adversarial training for natural language understanding. In International Conference on Learning Representations, 2019.
|
| 239 |
+
|
| 240 |
+
# A APPENDIX
|
| 241 |
+
|
| 242 |
+
# A.1 CONTROLLING CHANGE OF REPRESENTATION VIA CHANGE OF VARIABLE
|
| 243 |
+
|
| 244 |
+
Let us say we have random variables in some type of markovian chain $x , y , z ; y = f ( x ; \theta _ { f } ) , z =$ $g ( y ; \theta _ { g } )$
|
| 245 |
+
|
| 246 |
+
The change of variable formulation for probability densities is
|
| 247 |
+
|
| 248 |
+
$$
|
| 249 |
+
p ( f ( x ; \theta _ { f } ) ) = p ( g ( f ( x ; \theta _ { f } ) ) ) \left| \operatorname* { d e t } { \frac { d g ( f ( x ; \theta _ { f } ) ) } { d f ( x ; \theta _ { f } ) } } \right|
|
| 250 |
+
$$
|
| 251 |
+
|
| 252 |
+
Direct application of change of variable gives us
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
\begin{array} { r l } & { K L ( p ( f ( x ; \theta _ { f } ) ) | | p ( f ( x ; \theta _ { f } + \Delta \theta _ { f } ) ) ) = } \\ & { \qquad \sum p ( f ( x ; \theta _ { f } ) ) \log \frac { p ( f ( x ; \theta _ { f } ) ) } { p ( f ( x ; \theta _ { f } + \Delta \theta _ { f } ) ) } = } \\ & { \sum p ( g ( f ( x ; \theta _ { f } ) ) ) \left| \operatorname* { d e t } \frac { d g ( f ( x ; \theta _ { f } ) ) } { d f ( x ; \theta _ { f } ) } \right| ! } \\ & { \qquad \log p ( g ( f ( x ; \theta _ { f } ) ) ) + \log \left| \operatorname* { d e t } \frac { d g ( f ( x ; \theta _ { f } ) ) } { d f ( x ; \theta _ { f } ) } \right| } \\ & { \qquad - \log p ( g ( f ( x ; \Delta \theta _ { f } ) ) ) - \log \left| \operatorname* { d e t } \frac { d g ( f ( x ; \Delta \theta _ { f } ) ) } { d f ( x ; \Delta \theta _ { f } ) } \right| } \\ & { \qquad \quad ! } \end{array}
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
Let us make some more assumptions. Let $g ( y ) = W y$ where the spectral norm of $W , \rho ( W ) = 1$ . We can then trivially bound det $W \leq 1$ . Then we have
|
| 259 |
+
|
| 260 |
+
$$
|
| 261 |
+
\begin{array} { r l } & { = \sum p ( g ( f ( x ; \theta _ { f } ) ) ) \left| \operatorname* { d e t } \frac { d g ( f ( x ; \theta _ { f } ) ) } { d f ( x ; \theta _ { f } ) } \right| \left[ \log p ( g ( f ( x ; \theta _ { f } ) ) ) - \log p ( g ( f ( x ; \Delta \theta _ { f } ) ) ) \right] } \\ & { = \sum p ( g ( f ( x ; \theta _ { f } ) ) ) \left| \operatorname* { d e t } \frac { d g ( f ( x ; \theta _ { f } ) ) } { d f ( x ; \theta _ { f } ) } \right| \log \frac { p ( g ( f ( x ; \theta _ { f } ) ) ) } { p ( g ( f ( x ; \Delta \theta _ { f } ) ) ) } } \\ & { \leq \sum p ( g ( f ( x ; \theta _ { f } ) ) ) \log \frac { p ( g ( f ( x ; \theta _ { f } ) ) ) } { p ( g ( f ( x ; \Delta \theta _ { f } ) ) ) } } \\ & { = K L ( p ( g ( f ( x ; \theta _ { f } ) ) ) | | p ( g ( f ( x ; \Delta \theta _ { f } ) ) ) } \end{array}
|
| 262 |
+
$$
|
| 263 |
+
|
| 264 |
+
We also see that tightness is controlled by $| \operatorname* { d e t } W |$ , which is bounded by the singular value giving us intuition to the importance of using spectral normalization.
|
| 265 |
+
|
| 266 |
+
# A.2 EXPERIMENT HYPER-PARAMETERS
|
| 267 |
+
|
| 268 |
+
For our GLUE related experiments, both full fine-tuning and probing, the following parameters are used. For probing experiments, the difference is our RoBERTa encoder is frozen, and the encoder dropout is removed.
|
| 269 |
+
|
| 270 |
+
Table 5: Task specific hyper parameters for GLUE experiments
|
| 271 |
+
|
| 272 |
+
<table><tr><td>Hyper Parameter</td><td>MNLI</td><td>QNLI</td><td>QQP</td><td>SST-2</td><td>RTE</td><td>MRPC</td><td>CoLA</td></tr><tr><td>Learning Rate</td><td>5e-6</td><td>5e-6</td><td>5e-6</td><td>5e-6</td><td>1e-5</td><td>1e-5</td><td>1e-5</td></tr><tr><td>Max Updates</td><td>123873</td><td>33112</td><td>113272</td><td>20935</td><td>3120</td><td>2296</td><td>5336</td></tr><tr><td>Max Sentences</td><td>8</td><td>8</td><td>32</td><td>32</td><td>8</td><td>16</td><td>16</td></tr></table>
|
| 273 |
+
|
| 274 |
+
Table 6: Hyper parameters for R3F and R4F experiments on GLUE
|
| 275 |
+
|
| 276 |
+
<table><tr><td>Hyper parameter</td><td>Value</td></tr><tr><td>Optimizer</td><td>Adam</td></tr><tr><td>Adam-betas</td><td>(0.9, 0.98)</td></tr><tr><td>Adam-eps</td><td>1e-6</td></tr><tr><td>LR Scheduler</td><td>polynomial decay</td></tr><tr><td>Dropout</td><td>0.1</td></tr><tr><td>Weight Decay</td><td>0.01</td></tr><tr><td>Warmup Updates</td><td>0.06 * max updates</td></tr></table>
|
| 277 |
+
|
| 278 |
+
<table><tr><td>Hyper parameter</td><td>Value</td></tr><tr><td>入</td><td>[0.1, 0.5, 1.0, 5.0]</td></tr><tr><td>Noise Types</td><td>[u,M]</td></tr><tr><td>0</td><td>le-5</td></tr></table>
|
| 279 |
+
|
| 280 |
+
Table 7: Task specific hyper parameters for Summarization experiments.
|
| 281 |
+
|
| 282 |
+
<table><tr><td>Hyper Parameter</td><td>CNN/Dailymail</td><td>Gigaword</td><td>Reddit TIFU</td></tr><tr><td>Max Tokens</td><td>1024</td><td>2048</td><td>2048</td></tr><tr><td>Total updates</td><td>80000</td><td>200000</td><td>200000</td></tr><tr><td>Warmup Updates</td><td>1000</td><td>5000</td><td>5000</td></tr></table>
|
| 283 |
+
|
| 284 |
+
<table><tr><td>Hyper parameter</td><td>Value</td></tr><tr><td>入</td><td>[0.001, 0.01, 0.1]</td></tr><tr><td>Noise Types</td><td>[u,M]</td></tr><tr><td>0</td><td>le-5</td></tr><tr><td>Dropout</td><td>0.1</td></tr><tr><td>Weight Decay</td><td>0.01</td></tr><tr><td>Clip Norm</td><td>0.1</td></tr></table>
|
| 285 |
+
|
| 286 |
+
Table 8: Hyper parameters for R3F and R4F experiments on Summarization experiments.
|
| 287 |
+
|
| 288 |
+
<table><tr><td>Hyper parameter</td><td>Value</td></tr><tr><td>Optimizer</td><td>Adam</td></tr><tr><td>Adam-betas</td><td>(0.9, 0.98)</td></tr><tr><td>Adam-eps</td><td>1e-8</td></tr><tr><td>LR Scheduler</td><td>polynomial decay</td></tr><tr><td>Learning Rate</td><td>3e-05</td></tr></table>
|
| 289 |
+
|
| 290 |
+
<table><tr><td>Hyper parameter</td><td>Value</td></tr><tr><td>入 Noise Types</td><td>[0.5, 1, 3, 5] [u,M]</td></tr><tr><td>0</td><td>1e-5</td></tr><tr><td>Total Updates Max Positions</td><td>450000 512</td></tr><tr><td>Max Tokens</td><td>4400</td></tr><tr><td>Max Sentences</td><td>8</td></tr></table>
|
| 291 |
+
|
| 292 |
+
<table><tr><td>Hyper parameter</td><td>Value</td></tr><tr><td>Optimizer</td><td>Adam</td></tr><tr><td>Adam-betas</td><td>(0.9, 0.98)</td></tr><tr><td>Adam-eps</td><td>1e-8</td></tr><tr><td>LR Scheduler</td><td>polynomial decay</td></tr><tr><td>Learning Rate</td><td>3e-05</td></tr><tr><td>Dropout</td><td>0.1</td></tr><tr><td>Weight Decay</td><td>0.01</td></tr></table>
|
| 293 |
+
|
| 294 |
+
Table 9: Hyper parameters for R3F and R4F experiments on XNLI.
|
md/train/PS3IMnScugk/PS3IMnScugk.md
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING TO RECOMBINE AND RESAMPLE DATA FOR COMPOSITIONAL GENERALIZATION
|
| 2 |
+
|
| 3 |
+
Ekin Akyürek MIT CSAIL akyurek@mit.edu
|
| 4 |
+
|
| 5 |
+
Afra Feyza Akyürek Boston University akyurek@bu.edu
|
| 6 |
+
|
| 7 |
+
Jacob Andreas MIT CSAIL jda@mit.edu
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Flexible neural sequence models outperform grammar- and automaton-based counterparts on a variety of tasks. However, neural models perform poorly in settings requiring compositional generalization beyond the training data—particularly to rare or unseen subsequences. Past work has found symbolic scaffolding (e.g. grammars or automata) essential in these settings. We describe R&R, a learned data augmentation scheme that enables a large category of compositional generalizations without appeal to latent symbolic structure. R&R has two components: recombination of original training examples via a prototype-based generative model and resampling of generated examples to encourage extrapolation. Training an ordinary neural sequence model on a dataset augmented with recombined and resampled examples significantly improves generalization in two language processing problems—instruction following (SCAN) and morphological analysis (SIGMORPHON 2018)—where R&R enables learning of new constructions and tenses from as few as eight initial examples.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
How can we build machine learning models with the ability to learn new concepts in context from little data? Human language learners acquire new word meanings from a single exposure (Carey & Bartlett, 1978), and immediately incorporate words and their meanings productively and compositionally into larger linguistic and conceptual systems (Berko, 1958; Piantadosi & Aslin, 2016). Despite the remarkable success of neural network models on many learning problems in recent years—including one-shot learning of classifiers and policies (Santoro et al., 2016; Wang et al., 2016)—this kind of few-shot learning of composable concepts remains beyond the reach of standard neural models in both diagnostic and naturalistic settings (Lake & Baroni, 2018; Bahdanau et al., 2019a).
|
| 16 |
+
|
| 17 |
+
Consider the few-shot morphology learning problem shown in Fig. 1, in which a learner must predict various linguistic features (e.g. 3rd person, SinGular, PRESent tense) from word forms, with only a small number of examples of the PAST tense in the training set. Neural sequenceto-sequence models (e.g. Bahdanau et al., 2015) trained on this kind of imbalanced data fail to predict past-tense tags on held-out inputs of any kind (Section 5). Previous attempts to address this and related shortcomings in neural models have focused on explicitly encouraging rule-like behavior by e.g. modeling data with symbolic grammars (Jia & Liang, 2016; Xiao et al., 2016; Cai et al., 2017) or applying rule-based data augmentation (Andreas, 2020). These procedures involve highly task-specific models or generative assumptions, preventing them from generalizing effectively to less structured problems that combine rule-like and exceptional behavior. More fundamentally, they fail to answer the question of whether explicit rules are necessary for compositional inductive bias, and whether it is possible to obtain “rule-like” inductive bias without appeal to an underlying symbolic generative process.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: We first train a generative model to reconstruct training pairs $( x \triangleright y )$ by constructing them from other training pairs (a). We then perform data augmentation by sampling from this model, preferentially generating samples in which $_ y$ contains rare tokens or substructures (b). Dashed boxes show prediction targets. Conditional models trained on the augmented dataset accurately predict outputs $_ y$ from new inputs $_ x$ requiring compositional generalization (c).
|
| 21 |
+
|
| 22 |
+
This paper describes a procedure for improving few-shot compositional generalization in neural sequence models without symbolic scaffolding. Our key insight is that even fixed, imbalanced training datasets provide a rich source of supervision for few-shot learning of concepts and composition rules. In particular, we propose a new class of prototype-based neural sequence models (c.f. Gu et al., 2018) that can be directly trained to perform the kinds of generalization exhibited in Fig. 1 by explicitly recombining fragments of training examples to reconstruct other examples. Even when these prototype-based models are not effective as general-purpose predictors, we can resample their outputs to select high-quality synthetic examples of rare phenomena. Ordinary neural sequence models may then be trained on datasets augmented with these synthetic examples, distilling the learned regularities into more flexible predictors. This procedure, which we abbreviate R&R, promotes efficient generalization in both challenging synthetic sequence modeling tasks (Lake & Baroni, 2018) and morphological analysis in multiple natural languages (Cotterell et al., 2018).
|
| 23 |
+
|
| 24 |
+
By directly optimizing for the kinds of generalization that symbolic representations are supposed to support, we can bypass the need for symbolic representations themselves: R&R gives performance comparable to or better than state-of-the-art neuro-symbolic approaches on tests of compositional generalization. Our results suggest that some failures of systematicity in neural models can be explained by simpler structural constraints on data distributions and corrected with weaker inductive bias than previously described.1
|
| 25 |
+
|
| 26 |
+
# 2 BACKGROUND AND RELATED WORK
|
| 27 |
+
|
| 28 |
+
Compositional generalization Systematic compositionality—the capacity to identify rule-like regularities from limited data and generalize these rules to novel situations—is an essential feature of human reasoning (Fodor et al., 1988). While details vary, a common feature of existing attempts to formalize systematicity in sequence modeling problems (e.g. Gordon et al., 2020) is the intuition that learners should make accurate predictions in situations featuring novel combinations of previously observed input or output subsequences. For example, learners should generalize from actions seen in isolation to more complex commands involving those actions (Lake et al., 2019), and from relations of the form $\boldsymbol { \Gamma } ( \mathsf { a } , \mathsf { b } )$ to ${ \sf r } ( { \sf b } , \sf a )$ (Keysers et al., 2020; Bahdanau et al., 2019b). In machine learning, previous studies have found that standard neural architectures fail to generalize systematically even when they achieve high in-distribution accuracy in a variety of settings (Lake & Baroni, 2018; Bastings et al., 2018; Johnson et al., 2017).
|
| 29 |
+
|
| 30 |
+
Data augmentation and resampling Learning to predict sequential outputs with rare or novel subsequences is related to the widely studied problem of class imbalance in classification problems. There, undersampling of the majority class or oversampling of the minority class has been found to improve the quality of predictions for rare phenomena (Japkowicz et al., 2000). This can be combined with targeted data augmentation with synthetic examples of the minority class (Chawla et al., 2002). Generically, given a training dataset $\mathcal { D }$ , learning with class resampling and data augmentation involves defining an augmentation distribution $\tilde { p ( \boldsymbol { x } , \boldsymbol { y } \mid \boldsymbol { D } ) }$ and sample weighting function $u ( x , y )$ and maximizing a training objective of the form:
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\begin{array} { r } { \mathcal { L } ( \theta ) = \underbrace { \frac { 1 } { | \mathcal { D } | } \sum _ { x \in \mathcal { D } } \log p _ { \theta } ( y \mid x ) } _ { \mathrm { O r i g i n a l t r a i n i n g d a t a } } + \underbrace { { \mathbb { E } } _ { ( x , y ) \sim \tilde { p } } u ( x , y ) \log p _ { \theta } ( y \mid x ) } _ { \mathrm { A u g m e n t e d d a t a } } . } \end{array}
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
In addition to task-specific model architectures (Andreas et al., 2016; Russin et al., 2019), recent years have seen a renewed interest in data augmentation as a flexible and model-agnostic tool for encouraging controlled generalization (Ratner et al., 2017). Existing proposals for sequence models are mainly rule-based—in sequence modeling problems, specifying a synchronous context-free grammar (Jia & Liang, 2016) or string rewriting system (Andreas, 2020) to generate new examples. Rule-based data augmentation schemes that recombine multiple training examples have been proposed for image classification (Inoue, 2018) and machine translation (Fadaee et al., 2017). While rulebased data augmentation is highly effective in structured problems featuring crisp correspondences between inputs and outputs, the effectiveness of such approaches involving more complicated, context-dependent relationships between inputs and outputs has not been well-studied.
|
| 37 |
+
|
| 38 |
+
Learned data augmentation What might compositional data augmentation look like without rules as a source of inductive bias? As Fig. 1 suggests, an ideal data augmentation procedure $\tilde { p }$ in Eq. 1) should automatically identify valid ways of transforming and combining examples, without pre-committing to a fixed set of transformations.2 A promising starting point is provided by prototype-based models, a number of which (Gu et al., 2018; Guu et al., 2018; Khandelwal et al., 2020) have been recently proposed for sequence modeling. Such models generate data according to:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
d \sim p _ { \mathrm { r e w r i t e } } ( \cdot \mid d ^ { \prime } ; \theta ) \quad \mathrm { w h e r e } \quad d ^ { \prime } \sim \mathrm { U n i f } ( \mathcal { D } ) ;
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
for a dataset $\mathcal { D }$ and a learned sequence rewriting model $p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ; \theta )$ . (To avoid confusion, we will use the symbol $d$ to denote a datum. Because a data augmentation procedure must produce complete input–output examples, each $d$ is an $( x , y )$ pair for the conditional tasks evaluated in this paper.) While recent variants implement $p _ { \mathrm { r e w r i t e } }$ with neural networks, these models are closely related to classical kernel density estimators (Rosenblatt, 1956). But additionally—building on the motivation in Section 1—they may be viewed as one-shot learners trained to generate new data $d$ from a single example.
|
| 45 |
+
|
| 46 |
+
Existing work uses prototype-based models as replacements for standard sequence models. We will show here that they are even better suited to use as data augmentation procedures: they can produce high-precision examples in the neighborhood of existing training data, then be used to bootstrap simpler predictors that extrapolate more effectively. But our experiments will also show that existing prototype-based models give mixed results on challenging generalizations of the kind depicted in Fig. 1 when used for either direct prediction or data augmentation—performing well in some settings but barely above baseline in others.
|
| 47 |
+
|
| 48 |
+
Accordingly, R&R is built on two model components that transform prototype-based language models into an effective learned data augmentation scheme. Section 3 describes an implementation of prewrite that encourages greater sample diversity and well-formedness via a multi-prototype copying mechanism (a two-shot learner). Section 4 describes heuristics for sampling prototypes $d ^ { \prime }$ and model outputs $d$ to focus data augmentation on the most informative examples. Section 5 investigates the empirical performance of both components of the approach, finding that they together provide they a simple but surprisingly effective tool for enabling compositional generalization.
|
| 49 |
+
|
| 50 |
+
# 3 PROTOTYPE-BASED SEQUENCE MODELS FOR DATA RECOMBINATION
|
| 51 |
+
|
| 52 |
+
We begin with a brief review of existing prototype-based sequence models. Our presentation mostly follows the retrieve-and-edit approach of Guu et al. (2018), but versions of the approach in this paper could also be built on retrieval-based models implemented with memory networks (Miller et al., 2016; Gu et al., 2018) or transformers (Khandelwal et al., 2020; Guu et al., 2020). The generative process described in Eq. 2 implies a marginal sequence probability:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
p ( d ) = { \frac { 1 } { | { \mathcal { D } } | } } \sum _ { d ^ { \prime } \in { \mathcal { D } } } p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ; \theta )
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
Maximizing this quantity over the training set with respect to $\theta$ will encourage $p _ { \mathrm { r e w r i t e } }$ to act as a model of valid data transformations: To be assigned high probability, every training example must be explained by at least one other example and a parametric rewriting operation. (The trivial solution where $p _ { \theta }$ is the identity function, with $p _ { \theta } ( d \mid d ^ { \prime } = d ) = 1$ , can be ruled out manually in the design of $p _ { \theta }$ .) When $\mathcal { D }$ is large, the sum in Eq. 3 is too large to enumerate exhaustively when computing the marginal likelihood. Instead, we can optimize a lower bound by restricting the sum to a neighborhood $\bar { \mathcal { N } } ( d ) \subset \mathcal { D }$ of training examples around each $d$ :
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
p ( d ) \geq { \frac { 1 } { | { \mathcal { D } } | } } \sum _ { d ^ { \prime } \in { \mathcal { N } } ( d ) } p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ; \theta ) ~ .
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
The choice of $\mathcal { N }$ is discussed in more detail in Section 4. Now observe that:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\begin{array} { l } { \displaystyle \log p ( { d } ) \geq \log \left( | \mathcal { N } ( d ) | \sum _ { d ^ { \prime } \in \mathcal { N } ( d ) } \frac { 1 } { | \mathcal { N } ( d ) | } p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ; \theta ) \right) - \log | \mathcal { D } | } \\ { \geq \displaystyle \frac { 1 } { | \mathcal { N } ( d ) | } \sum _ { d ^ { \prime } \in \mathcal { N } ( d ) } \log p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ; \theta ) + \log \left( \frac { | \mathcal { N } ( d ) | } { | \mathcal { D } | } \right) } \end{array}
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where the second step uses Jensen’s inequality. If all $| \mathcal { N } ( d ) |$ are the same size, maximizing this lower bound on log-likelihood is equivalent to simply maximizing
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\sum _ { d ^ { \prime } \in \mathcal { N } ( d ) } \log p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ; \theta )
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
over $\mathcal { D }$ —this is the ordinary conditional likelihood for a string transducer (Ristad & Yianilos, 1998) or sequence-to-sequence model (Sutskever et al., 2014) with examples $d , d ^ { \prime } \in \mathcal { N } ( d )$ . 3
|
| 77 |
+
|
| 78 |
+
We have motivated prototype-based models by arguing that $p _ { \mathrm { r e w r i t e } }$ learns a model of transformations licensed by the training data. However, when generalization involves complex compositions, we will show that neither a basic RNN implementation of $p _ { \mathrm { r e w r i t e } }$ or a single prototype is enough; we must provide the learned rewriting model with a larger inventory of parts and encourage reuse of those parts as faithfully as possible. This motivates the two improvements on the prototype-based modeling framework described in the remainder of this section: generalization to multiple prototypes (Section 3.1) and a new rewriting model (Section 3.2).
|
| 79 |
+
|
| 80 |
+
# 3.1 $n$ -PROTOTYPE MODELS
|
| 81 |
+
|
| 82 |
+
To improve compositionality in prototype-based models, we equip them with the ability to condition on multiple examples simultaneously. We extend the basic prototype-based language model to $n$ prototypes, which we now refer to as a recombination model $p _ { \mathrm { r e c o m b } }$ :
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
d \sim p _ { \mathrm { r e c o m b } } ( \cdot \mid d _ { 1 : n } ^ { \prime } ; \theta ) \quad \mathrm { w h e r e } \quad d _ { 1 : n } ^ { \prime } \stackrel { \scriptscriptstyle \mathrm { d e f } } { = } ( d _ { 1 } ^ { \prime } , d _ { 2 } ^ { \prime } , \ldots , d _ { n } ^ { \prime } ) \sim p _ { \Omega } ( \cdot )
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
A multi-protype model may be viewed as a meta-learner (Thrun & Pratt, 1998; Santoro et al., 2016): it maps from a small number of examples (the prototypes) to a distribution over new datapoints consistent with those examples. By choosing the neighborhood and implementation of $p _ { \mathrm { r e c o m b } }$ appropriately, we can train this meta-learner to specialize in one-shot concept learning (by reusing a fragment exhibited in a single prototype) or compositional generalization (by assembling fragments of prototypes into a novel configuration). To enable this behavior, we define a set of compatible prototypes $\Omega \subset { \mathcal { D } } ^ { n }$ (Section 4) and let $p _ { \Omega } \ { \stackrel { \mathrm { d e f } } { = } } \ \operatorname { U n i f } ( \Omega )$ . We update Eq. 6 to feature a corresponding multi-prototype neighborhood $\mathcal { N } : \mathcal { D } \Omega$ . The only terms that have changed are the conditioning variable and the constant term, and it is again sufficient to choose $\theta$ to optimize $\begin{array} { r } { \sum _ { d _ { 1 : n } ^ { \prime } \in \mathcal { N } ( d ) } \log p _ { \mathrm { r e c o m b } } ( d \mid d _ { 1 : n } ^ { \prime } ) } \end{array}$ over $\mathcal { D }$ , implementing $p _ { \mathrm { r e c o m b } }$ as described next.
|
| 89 |
+
|
| 90 |
+
# 3.2 RECOMBINATION NETWORKS
|
| 91 |
+
|
| 92 |
+
Past work has found that latent-variable neural sequence models often ignore the latent variable and attempt to directly model sequence marginals (Bowman et al., 2016). When an ordinary sequence-tosequence model with attention is used to implement $p _ { \mathrm { r e c o m b } }$ , even in the one-prototype case, generated
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } ) = \mathbb { E } _ { z \sim p ( z ) } [ p _ { \mathrm { r e w r i t e } } ( d \mid d ^ { \prime } , z ; \theta ) ]
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 2: (a) RNN encoders produce contextual embeddings for prototype tokens. (b) In the decoder, a gated copy mechanism reuses prototypes and generated output tokens via an attention mechanism (dashed lines).
|
| 100 |
+
|
| 101 |
+
sentences often have little overlap with their prototypes (Weston et al., 2018). We describe a specific model architecture for $p _ { \mathrm { r e c o m b } }$ that does not function as a generic noise model, and in which outputs are primarily generated via explicit reuse of fragments of multiple prototypes, by facilitating copying from independent streams containing prototypes and previously generated input tokens.
|
| 102 |
+
|
| 103 |
+
We take $p _ { \mathrm { r e c o m b } } ( d \mid d _ { 1 : n } ^ { \prime } ; \theta )$ to be a neural (multi-)sequence-to-sequence model (c.f. Sutskever et al., 2014) which decomposes probability autoregressively: $\begin{array} { r } { p _ { \mathrm { r e c o m b } } ( d \mid \mathcal { \bar { d } } _ { 1 : n } ^ { \prime } ; \theta ) = \prod _ { t } p ( d ^ { t } \mid d ^ { < t } , d _ { 1 : n } ^ { \prime } ; \theta ) } \end{array}$ . As shown in Fig. 2, three LSTM encoders—two for the prototypes and one for the input prefix— compute sequences of token representations $h _ { \mathrm { p r o t o } }$ and $h _ { \mathrm { o u t } }$ respectively. Given the current decoder hidden state $\setminus h _ { o u t } ^ { t }$ , the model first attends to both prototype and output tokens:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\begin{array} { r l } { \alpha _ { \mathrm { o u t } } ^ { i } \propto \exp ( { h _ { \mathrm { o u t } } ^ { t } W _ { o } h _ { \mathrm { o u t } } ^ { i } } ) } & { { i < t } } \\ { \alpha _ { \mathrm { p r o t o } } ^ { k j } \propto \exp ( { h _ { \mathrm { o u t } } ^ { t } W _ { p } h _ { \mathrm { p r o t o } } ^ { k j } } ) } & { { k \le n , j \le | d _ { k } ^ { \prime } | } } \end{array}
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
To enable copying from each sequence, we project attention weights $\alpha _ { \mathrm { o u t } }$ and $\alpha _ { \mathrm { p r o t o } } ^ { k }$ onto the output vocabulary to produce a sparse vector of probabilities:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { r l } & { p _ { \mathrm { c o p y , o u t } } ^ { t } ( d ^ { t } = w ) = \sum _ { i < t } \mathbb { 1 } [ d _ { i } = w ] \cdot \alpha _ { \mathrm { o u t } } ^ { i } } \\ & { p _ { \mathrm { c o p y , p r o t o - k } } ^ { t } ( d ^ { t } = w ) = \sum _ { j \le | d _ { k } ^ { \prime } | } \mathbb { 1 } [ d _ { k , j } ^ { \prime } = w ] \cdot \alpha _ { \mathrm { p r o t o } } ^ { k j } } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
Unlike rule-based data recombination procedures, however, $p _ { \mathrm { r e c o m b } }$ is not required to copy from the prototypes, and can predict output tokens directly using values retrieved by the attention mechanism:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\begin{array} { r l } & { \begin{array} { r l } { h _ { \mathrm { p r e } } ^ { t } = \left[ h _ { \mathrm { o u t } } ^ { t } , \quad \sum _ { i } \alpha _ { \mathrm { o u t } } ^ { i } h _ { \mathrm { o u t } } ^ { i } , } & { \sum _ { k , j } \alpha _ { \mathrm { p r o t o } } ^ { k j } h _ { \mathrm { p r o t o } } ^ { k j } \right] } \end{array} } \\ & { \begin{array} { r l } { p _ { \mathrm { w r i t e } } ^ { t } \propto \exp ( W _ { \mathrm { w r i t e } } h _ { \mathrm { p r e } } ^ { t } ) } & { } \end{array} } \end{array}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
To produce a final distribution over output tokens at time $t$ , we combine predictions from each stream:
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\begin{array} { r } { \beta _ { \mathrm { g a t e } } = \mathrm { s o f t m a x } ( W _ { g a t e } h _ { o u t } ^ { t } ) \qquad } \\ { p ( d ^ { t } = w \mid d ^ { < t } , d _ { 1 : n } ^ { t } ; \theta ) = \beta _ { \mathrm { g a t e } } \cdot [ p _ { \mathrm { w r i t e } } ^ { t } ( w ) , p _ { \mathrm { c o p y , o u t } } ^ { t } ( w ) , p _ { \mathrm { c o p y , p r o u o - } 1 } ^ { t } ( w ) , . . . , p _ { \mathrm { c o p y , p r o u o - n } } ^ { t } ( w ) ] } \end{array}
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
This copy mechanism is similar to the one proposed by Merity et al. (2017) and See et al. (2017). We compare 1- and 2-prototype models to an ordinary sequence model and baselines in Section 5.
|
| 128 |
+
|
| 129 |
+
# 4 SAMPLING SCHEMES
|
| 130 |
+
|
| 131 |
+
The models above provide generic procedures for generating well-formed combinations of training data, but do nothing to ensure that the generated samples are of a kind useful for compositional generalization. While the training objective in Eq. 7 encourages the learned $p ( d )$ to lie close to the training data, an effective data augmentation procedure should intuitively provide novel examples of rare phenomena. To generate augmented training data, we combine the generative models of Section 3 with a simple sampling procedure that upweights useful examples.
|
| 132 |
+
|
| 133 |
+
# 4.1 RESAMPLING AUGMENTED DATA
|
| 134 |
+
|
| 135 |
+
In classification problems with imbalanced classes, a common strategy for improving accuracy on the rare class is to resample so that the rare class is better represented in training data (Japkowicz
|
| 136 |
+
|
| 137 |
+
et al., 2000). When constructing an augmented dataset using the models described above, we apply a simple rejection sampling scheme. In Eq. 1, we set:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
u ( d ) = \mathbb { 1 } [ \operatorname* { m i n } _ { t } p ( d ^ { t } ) < \epsilon ] .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
Here $p ( d ^ { t } )$ is the marginal probability that the token $d ^ { t }$ appears in any example and $\epsilon$ is a hyperparameter. The final model is then trained using Eq. 1, retaining those augmented samples for which $u ( d ) = 1$ . For extremely imbalanced problems, like the ones considered in Section 5, this weighting scheme effectively functions as a rare tag constraint: only examples containing rare words or tags are used to augment the original training data.
|
| 144 |
+
|
| 145 |
+
# 4.2 NEIGHBORHOODS AND PROTOTYPE PRIORS
|
| 146 |
+
|
| 147 |
+
How can we ensure that the data augmentation procedure generates any samples with positive weight in Eq. 18? The prototype-based models described in Section 3 offer an additional means of control over the generated data. Aside from the implementation of $p _ { \mathrm { r e c o m b } }$ , the main factors governing the behavior of the model are the choice of neighborhood function ${ \mathcal { N } } ( d )$ and, for $n \geq 2$ , the set of prior compatible prototypes $\Omega$ . Defining these so that rare tags also preferentially appear in prototypes helps ensure that the generated samples contribute to generalization. Let $d _ { 1 }$ and $d _ { 2 }$ be prototypes. As a notational convenience, given two sequences $d _ { 1 }$ , $d _ { 2 }$ , let $d _ { 1 } \backslash d _ { 2 }$ the set of tokens in $d _ { 1 }$ but not $d _ { 2 }$ , and $d _ { 1 } \Delta d _ { 2 }$ denote the set of tokens not common to $d _ { 1 }$ and $d _ { 2 }$ .
|
| 148 |
+
|
| 149 |
+
1-prototype neighborhoods Guu et al. (2018) define a one-prototype $\mathcal { N }$ based on a Jaccard distance threshold (Jaccard, 1901). For experiments with one-prototype models we employ a similar strategy, choosing an initial neighborhood of candidates such that
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
{ \mathcal { N } } ( d ) \ { \stackrel { \scriptscriptstyle { \mathrm { d e f } } } { = } } \ \left\{ d _ { 1 } \in { \mathcal { D } } : ( { \boldsymbol { \alpha } } \cdot | d \Delta d _ { 1 } | + { \boldsymbol { \beta } } \cdot \operatorname { l e v } ( d , d _ { 1 } ) ) < \delta \right\}
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
where lev is string edit distance (Levenshtein, 1966) and $\alpha , \beta$ and $\delta$ are hyperparameters (discussed in Appendix B).
|
| 156 |
+
|
| 157 |
+
2-prototype neighborhoods The $n \geq 2$ prototype case requires a more complex neighborhood function—intuitively, for an input $d$ , we want each $( d _ { 1 } , d _ { 2 } , \ldots )$ in the neighborhood to collectively contain enough information to reconstruct $d$ . Future work might treat the neighborhood function itself as latent, allowing the model to identify groups of prototypes that make $d$ probable; here, as in existing one-prototype models, we provide heuristic implementations for the $n = 2$ case.
|
| 158 |
+
|
| 159 |
+
Long–short recombination: For each $( d _ { 1 } , d _ { 2 } ) \in \mathcal { N } ( d )$ , $d _ { 1 }$ is chosen to be similar to $d$ , and $d _ { 2 }$ is chosen to be similar to the difference between $d$ and $d _ { 1 }$ . (The neighborhood is so named because one of the prototypes will generally have fewer tokens than the other one.)
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
{ \mathcal { N } } ( d ) ~ { \stackrel { \mathrm { d e f } } { = } } ~ \left\{ ( d _ { 1 } , d _ { 2 } ) \in \Omega : { \mathrm { ~ l e v } } \left( d , d _ { 1 } \right) < \delta , { \mathrm { l e v } } \left( [ d \backslash d _ { 1 } ] , d _ { 2 } \right) < \delta , | d \backslash d _ { 1 } | > 0 , | d \backslash d _ { 1 } \backslash d _ { 2 } | = 0 \right\}
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
Here $[ d \backslash d _ { 1 } ]$ is the sequence obtained by removing all tokens in $d _ { 1 }$ from $d$ . Recall that we have defined $p _ { \Omega } ( d _ { 1 : n } ) \ { \stackrel { \mathrm { d e f } } { = } } \ \mathrm { U n i f } ( \Omega )$ for a set $\Omega$ of “compatible” prototypes. For experiments using long–short combination, all prototypes are treated as compatible; that is, $\Omega = \mathcal { D } \times \mathcal { D }$ .
|
| 166 |
+
|
| 167 |
+
Long–long recombination: ${ \mathcal { N } } ( d )$ contains pairs of prototypes that are individually similar to $d$ and collectively contain all the tokens needed to reconstruct $d$ :
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
{ \mathcal { N } } ( d ) \ { \stackrel { \mathrm { d e f } } { = } } \ \{ ( d _ { 1 } , d _ { 2 } ) \in \Omega : \ { \mathrm { l e v } } \left( d , d _ { 1 } \right) < \delta , { \mathrm { l e v } } \left( d , d _ { 2 } \right) < \delta , | d \Delta d _ { 1 } | = 1 , | d \backslash d _ { 1 } \backslash d _ { 2 } | = 0 \}
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
For experiments using long–long recombination, we take $\Omega = \{ ( d _ { 1 } , d _ { 2 } ) \in \mathcal { D } \times \mathcal { D } : | d _ { 1 } \Delta d _ { 2 } | = 1 \}$
|
| 174 |
+
|
| 175 |
+
# 5 DATASETS & EXPERIMENTS
|
| 176 |
+
|
| 177 |
+
We evaluate R&R on two tests of compositional generalization: the SCAN instruction following task (Lake & Baroni, 2018) and a few-shot morphology learning task derived from the SIGMORPHON 2018 dataset (Kirov et al., 2018; Cotterell et al., 2018). Our experiments are designed to explore the effectiveness of learned data recombination procedures in controlled and natural settings. Both tasks involve conditional sequence prediction: while preceding sections have discussed augmentation
|
| 178 |
+
|
| 179 |
+
Table 1: Results on the SCAN dataset. (a) Comparison of R&R with previous work. Connecting lines indicate that model components are inherited from the parent (e.g. the row labeled recomb-2 also includes resampling). Data augmentation with recomb- $^ { 2 + }$ resampling performs slightly worse than GECA on the jump and around right splits; data augmentation with recomb- $l +$ resampling or an ordinary RNN does not generalize robustly to either split. All differences except between GECA and recomb- $^ { 2 + }$ resampling in jump are significant (paired $t$ -test, $p \ll 0 . 0 0 1$ ). (Dashes indicate that all samples were rejected by resampling when decoding with temperature $T = 1 .$ ) (b) Ablation experiments on the jump split. Introducing the latent variable used in previous work (Guu et al., 2018) does not change performance; removing the copy mechanism results in a complete failure of generalization. While it is possible to perform conditional inference of $p ( y \mid x )$ given the generative model in Eq. 3 (direct inference), this gives significantly worse results than data augmentation (see Sec. 5.3).
|
| 180 |
+
|
| 181 |
+
<table><tr><td colspan="3">(a)</td></tr><tr><td></td><td>around right</td><td> jump</td></tr><tr><td>baseline</td><td>0.00 ±0.00</td><td>0.00 ±0.00</td></tr><tr><td>GECA (published)</td><td>0.82 ±0.11</td><td>0.87 ±0.05</td></tr><tr><td>GECA (ours)</td><td>0.98 ±0.02</td><td>1.00 ±0.001</td></tr><tr><td>learned aug. (basic)</td><td>0.00 ±0.00</td><td>0.00 ±0.00</td></tr><tr><td>L resampling</td><td>-</td><td>-</td></tr><tr><td>├ recomb-1</td><td>0.17 ±0.07</td><td>-</td></tr><tr><td>Lrecomb-2</td><td>0.75 ±0.14</td><td>0.87 ±0.08</td></tr><tr><td>recomb-2 (no resampling)</td><td>0.82 ±0.08</td><td>0.88 ±0.07</td></tr></table>
|
| 182 |
+
|
| 183 |
+
<table><tr><td colspan="2"> jump</td></tr><tr><td>recomb-2 (no resampling)</td><td>0.88 ±0.07</td></tr><tr><td>+ VAE</td><td>0.88 ±0.07</td></tr><tr><td>+resampling</td><td>0.87 ±0.08</td></tr><tr><td>- copying direct inference</td><td>0.00 ±0.00</td></tr><tr><td></td><td>0.57 ±0.05</td></tr></table>
|
| 184 |
+
|
| 185 |
+
procedures that produce data points $d = ( x , y )$ , learners are evaluated on their ability to predict an output $y$ from an input $x$ : actions $y$ given instructions $x$ , or morphological analyses $y$ given words $x$
|
| 186 |
+
|
| 187 |
+
For each task, we compare a baseline with no data augmentation, the rule-based GECA data augmentation procedure (Andreas, 2020), and a sequence of ablated versions of R&R that measure the importance of resampling and recombination. The basic Learned Aug model trains an RNN to generate $( x , y )$ pairs, then trains a conditional model on the original data and samples from the generative model. Resampling filters these samples as described in Section 4. Recomb-n models replace the RNN with a prototype-based model as described in Section 3. Additional experiments (Table 1b) compare data augmentation to prediction of $y$ via direct inference (Appendix E) in the prototype-based model and several other model variants.
|
| 188 |
+
|
| 189 |
+
# 5.1 SCAN
|
| 190 |
+
|
| 191 |
+
SCAN (Lake & Baroni, 2018) is a synthetic dataset featuring simple English commands paired with sequences of actions. Our experiments aim to show that R&R performs well at one-shot concept learning and zero-shot generalization on controlled tasks where rule-based models succeed. We experiment with two splits of the dataset, jump and around right. In the jump split, which tests one-shot learning, the word jump appears in a single command in the training set but in more complex commands in the test set (e.g. look and jump twice). The around right split (Loula et al., 2018) tests zero-shot generalization by presenting learners with constructions like walk around left and walk right in the training set, but walk around right only in the test set.
|
| 192 |
+
|
| 193 |
+
Despite the apparent simplicity of the task, ordinary neural sequence-to-sequence models completely fail to make correct predictions on SCAN test set (Table 1). As such it has been a major focus of research on compositional generalization in sequence-to-sequence models, and a number of heuristic procedures and specialized model architectures and training procedures have been developed to solve it (Russin et al., 2019; Gordon et al., 2020; Lake, 2019; Andreas, 2020). Here we show that the generic prototype recombination procedure described above does so as well. We use long–short recombination for the jump split and long–long recombination for the around right split. We use a recombination network to generate 400 samples $d = ( x , y )$ and then train an ordinary LSTM with attention (Bahdanau et al., 2019b) on the original and augmented data to predict $y$ from $x$ . Training hyperparameters are provided in Appendix D.
|
| 194 |
+
|
| 195 |
+
Table 1 shows the results of training these models on the SCAN dataset.4 2-prototype recombination is essential for successful generalization on both splits. Additional ablations (Table 1b) show that the continuous latent variable used by Guu et al. (2018) does not affect performance, but that the copy mechanism described in Section 3.2 and the use of the recomb-2 model for data augmentation rather than direct inference are necessary for accurate prediction.
|
| 196 |
+
|
| 197 |
+
Table 2: $F _ { 1 }$ score for morphological analysis on rare $\mathrm { ( F U T + P S T ) }$ ) and frequent (OTHER) word forms. R&R variants with 1- and 2-prototype recombination (shaded in grey) consistently match or outperform both a no-augmentation baseline and GECA; recomb- $^ { l + }$ resampling is best overall. Bold numbers are not significantly different from the best result in each column under a paired t-test $\mathit { p } < 0 . 0 5$ after Bonferroni correction; nothing is bold if all differences are insignificant). The NOVEL portion of the table shows model accuracy on examples whose exact tag set never appeared in the training data. (There were no such words in the test set for the Spanish OTHER.) Differences between GECA and the best R&R variant (recomb- $^ { l + }$ resampling) are larger than in the full evaluation set. ∗The Spanish past tense was used as a development set.
|
| 198 |
+
|
| 199 |
+
<table><tr><td></td><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>baseline Lresampling</td><td></td><td>0.66 ±0.01</td><td>0.88 ±0.01</td><td>0.75 ±0.02</td><td>0.90 ±0.01</td><td>0.69 ±0.04</td><td>0.85 ±0.03</td></tr><tr><td></td><td></td><td>0.65 ±0.01</td><td>0.88 ±0.01</td><td>0.77 ±0.01</td><td>0.90 ±0.02</td><td>0.69 ±0.04</td><td>0.84 ±0.04</td></tr><tr><td>GECA</td><td></td><td>0.66 ±0.01</td><td>0.88 ±0.01</td><td>0.76 ±0.02</td><td>0.90±0.02</td><td>0.69 ±0.02</td><td>0.87 ±0.01</td></tr><tr><td>Lresampling A</td><td></td><td>0.72 ±0.02</td><td>0.88 ±0.01</td><td>0.81 ±0.02</td><td>0.89 ±0.01</td><td>0.75 ±0.03</td><td>0.85 ±0.02</td></tr><tr><td></td><td>learned aug. (basic)</td><td>0.66 ±0.02</td><td>0.88 ±0.01</td><td>0.77 ±0.02</td><td>0.90 ±0.01</td><td>0.70 ±0.02</td><td>0.87 ±0.01</td></tr><tr><td>L resampling</td><td></td><td>0.70 ±0.02</td><td>0.86 ±0.01</td><td>0.84 ±0.01</td><td>0.90 ±0.01</td><td>0.73 ±0.04</td><td>0.85 ±0.03</td></tr><tr><td></td><td>├recomb-1</td><td>0.72 ±0.02</td><td>0.87 ±0.01</td><td>0.85 ±0.01</td><td>0.90 ±0.02</td><td>0.77 ±0.02</td><td>0.87 ±0.02</td></tr><tr><td></td><td>recomb-2</td><td>0.71 ±0.01</td><td>0.87 ±0.02</td><td>0.82 ±0.02</td><td>0.90 ±0.01</td><td>0.75 ±0.03</td><td>0.86 ±0.03</td></tr><tr><td></td><td> GECA + recomb-1 + resamp.</td><td>0.74 ±0.02</td><td>0.86 ±0.01</td><td>0.85 ±0.02</td><td>0.89 ±0.01</td><td>0.79 ±0.02</td><td>0.84 ±0.01</td></tr><tr><td>THAON</td><td>baseline</td><td>0.63 ±0.03</td><td></td><td>0.72 ±0.02</td><td>0.42 ±0.12</td><td>0.68 ±0.04</td><td>0.66 ±0.15</td></tr><tr><td></td><td>GECA + resampling</td><td>0.67 ±0.03</td><td></td><td>0.79 ±0.02</td><td>0.26 ±0.20</td><td>0.73 ±0.04</td><td>0.71 ±0.10</td></tr><tr><td></td><td> recomb-1 + resampling</td><td>0.69 ±0.02</td><td></td><td>0.83 ±0.02</td><td>0.42 ±0.12</td><td>0.75 ±0.03</td><td>0.82 ±0.04</td></tr><tr><td></td><td> GECA + recomb-1 + resamp.</td><td>0.69 ±0.02</td><td></td><td>0.83 ±0.02</td><td>0.35 ±0.11</td><td>0.77 ±0.03</td><td>0.71 ±0.07</td></tr></table>
|
| 200 |
+
|
| 201 |
+
# 5.2 SIGMORPHON 2018
|
| 202 |
+
|
| 203 |
+
The SIGMORPHON 2018 dataset consists of words paired with morphological analyses (lemmas, or base forms, and tags for linguistic features like tense and case, as depicted in Fig. 1). We use the data to construct a morphological analysis task (Akyürek et al., 2019) (predicting analyses from surface forms) to test models’ few-shot learning of new morphological paradigms. In three languages of varying morphological complexity (Spanish, Swahili, and Turkish) we construct splits of the data featuring a training set of 1000 examples and three test sets of 100 examples. One test set consists exclusively of words in the past tense, one in the future tense and one with other word forms (present tense verbs, nouns and adjectives). The training set contains exactly eight past-tense and eight future-tense examples; all the rest are other word forms. Experiments evaluate R&R’s ability to efficiently learn noisy morphological rules, long viewed a key challenge for connectionist approaches to language learning (Rumelhart & McClelland, 1986). As approaches may be sensitive to the choice of the eight examples from which the model must generalize, we construct five different splits per language and use the Spanish past-tense data as a development set. As above, we use long–long recombination with similarity criteria applied to $y$ only. We augment the training data with 180 samples from $p _ { \mathrm { r e c o m b } }$ and again train an ordinary LSTM with attention for final predictions. Details are provided in Appendix B.
|
| 204 |
+
|
| 205 |
+
Table 2 shows aggregate results across languages. We report the model’s $F _ { 1 }$ score for predicting morphological analyses of words in the few-shot training condition (past and future) and the standard training condition (other word forms). Here, learned data augmentation with both one- and twoprototype models consistently matches or outperforms GECA. The improvement is sometimes dramatic: for few-shot prediction in Swahili, recomb-1 augmentation reduces the error rate by $40 \%$ relative to the baseline and $21 \%$ relative to GECA. An additional baseline $^ +$ resampling experiment upweights the existing rare samples rather than synthesizing new ones; results demonstrate that recombination, and not simply reweighting, is important for generalization. Table 2 also includes a finer-grained analysis of novel word forms: words in the evaluation set whose exact morphological analysis never appeared in the training set. R&R again significantly outperforms both the baseline and GECA-based data augmentation in the few-shot FUT+PAST condition and the ordinary OTHER condition, underscoring the effectiveness of this approach for “in-distribution” compositional generalization. Finally, the gains provided by learned augmentation and GECA appear to be at least partially orthogonal: combining the GECA $^ +$ resampling and recomb- $\cdot l +$ resampling models gives further improvements in Spanish and Turkish.
|
| 206 |
+
|
| 207 |
+
# 5.3 ANALYSIS
|
| 208 |
+
|
| 209 |
+
Why is R&R effective? Samples from the best learned data augmentation models for SCAN and SIGMORPHON may be found in the Appendix G.3 . We programaticaly analyzed 400 samples from recomb-2 models in SCAN and found that $40 \%$ of novel samples are exactly correct in the around right split and $74 \%$ in the jump split. A manual analysis of 50 Turkish samples indicated that only $14 \%$ of the novel samples were exactly correct. The augmentation procedure has a high error rate! However, our analysis found that malformed samples either (1) feature malformed $x s$ that will never appear in a test set (a phenomenon also observed by Andreas (2020) for outputs of GECA), or (2) are mostly correct at the token level (inducing predictions with a high $F _ { 1 }$ score). Data augmentation thus contributes a mixture of irrelevant examples, label noise—which may exert a positive regularizing effect (Bishop, 1995)—and well-formed examples, a small number of which are sufficient to induce generalization (Bastings et al., 2018). Without resampling, SIGMORPHON models generate almost no examples of rare tags.
|
| 210 |
+
|
| 211 |
+
Why does R&R outperform direct inference? A partial explanation is provided by the preceding analysis, which notes that the accuracy of the data augmentation procedure as a generative model is comparatively low. Additionally, the data augmentation procedure selects only the highest-confidence samples from the model, so the quality of predicted ys conditioned on random $x \mathbf { s }$ will in general be even lower. A conditional model trained on augmented data is able to compensate for errors in augmentation or direct inference (Table 12 in the Appendix).
|
| 212 |
+
|
| 213 |
+
Why is Resampling without Recombination effective? One surprising feature of Table 2 is performance of the learned aug (basic) $^ +$ resampling model. While less effective than the recombinationbased models, augmentation with samples from an ordinary RNN trained on $( x , y )$ pairs improves performance for some test splits. One possible explanation is that resampling effectively acts as a posterior constraint on the final model’s predictive distribution, guiding it toward solutions in which rare tags are more probable than observed in the original training data. Future work might model this constraint explicitly, e.g. via posterior regularization (as in Li & Rush, 2020).
|
| 214 |
+
|
| 215 |
+
# 6 CONCLUSIONS
|
| 216 |
+
|
| 217 |
+
We have described a method for improving compositional generalization in sequence-to-sequence models via data augmentation with learned prototype recombination models. These are the first results we are aware of demonstrating that generative models of data are effective as data augmentation schemes in sequence-to-sequence learning problems, even when the generative models are themselves unreliable as base predictors. Our experiments demonstrate that it is possible to achieve compositional generalization on-par with complex symbolic models in clean, highly structured domains, and outperform them in natural ones, with basic neural modeling tools and without symbolic representations.
|
| 218 |
+
|
| 219 |
+
# ACKNOWLEDGMENTS
|
| 220 |
+
|
| 221 |
+
We thank Eric Chu for feedback on early drafts of this paper. This work was supported by a hardware donation from NVIDIA under the NVAIL grant program. The authors acknowledge the MIT SuperCloud and Lincoln Laboratory Supercomputing Center (Reuther et al., 2018) for providing HPC resources that have contributed to the research results reported within this paper.
|
| 222 |
+
|
| 223 |
+
# REFERENCES
|
| 224 |
+
|
| 225 |
+
Ekin Akyürek, Erenay Dayanık, and Deniz Yuret. Morphological analysis using a sequence decoder. Transactions of the Association for Computational Linguistics, 7:567–579, 2019.
|
| 226 |
+
|
| 227 |
+
Jacob Andreas. Good-enough compositional data augmentation. In Procedings of the Annual Meeting of the Association for Computational Linguistics, 2020.
|
| 228 |
+
|
| 229 |
+
Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 39–48, 2016.
|
| 230 |
+
|
| 231 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, 2015.
|
| 232 |
+
|
| 233 |
+
Dzmitry Bahdanau, Harm de Vries, Timothy J O’Donnell, Shikhar Murty, Philippe Beaudoin, Yoshua Bengio, and Aaron Courville. Closure: Assessing systematic generalization of clevr models. arXiv preprint arXiv:1912.05783, 2019a.
|
| 234 |
+
|
| 235 |
+
Dzmitry Bahdanau, Shikhar Murty, Michael Noukhovitch, Thien Huu Nguyen, Harm de Vries, and Aaron Courville. Systematic generalization: What is required and can it be learned? In International Conference on Learning Representations, 2019b.
|
| 236 |
+
|
| 237 |
+
Jasmijn Bastings, Marco Baroni, Jason Weston, Kyunghyun Cho, and Douwe Kiela. Jump to better conclusions: SCAN both left and right. In Proceedings of the EMNLP BlackboxNLP Workshop, pp. 47–55, Brussels, Belgium, 2018.
|
| 238 |
+
|
| 239 |
+
Jean Berko. The child’s learning of english morphology. Word, 14(2-3):150–177, 1958.
|
| 240 |
+
|
| 241 |
+
Jeff Bezanson, Alan Edelman, Stefan Karpinski, and Viral B Shah. Julia: A fresh approach to numerical computing. SIAM review, 59(1):65–98, 2017. URL https://doi.org/10.1137/ 141000671.
|
| 242 |
+
|
| 243 |
+
Chris M Bishop. Training with noise is equivalent to tikhonov regularization. Neural computation, 7 (1):108–116, 1995.
|
| 244 |
+
|
| 245 |
+
Samuel Bowman, Luke Vilnis, Oriol Vinyals, Andrew Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, pp. 10–21, 2016.
|
| 246 |
+
|
| 247 |
+
Jonathon Cai, Richard Shin, and Dawn Song. Making neural programming architectures generalize via recursion. In International Conference on Learning Representations, ICLR 2017, 2017.
|
| 248 |
+
|
| 249 |
+
Susan Carey and Elsa Bartlett. Acquiring a single new word. Papers and Reports on Child Language Development, 2, 1978.
|
| 250 |
+
|
| 251 |
+
Nitesh V Chawla, Kevin W Bowyer, Lawrence O Hall, and W Philip Kegelmeyer. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16:321–357, 2002.
|
| 252 |
+
|
| 253 |
+
Alexander Clark and Rémi Eyraud. Polynomial identification in the limit of substitutable context-free languages. Journal of Machine Learning Research, 8(Aug):1725–1745, 2007.
|
| 254 |
+
|
| 255 |
+
Ryan Cotterell, Christo Kirov, John Sylak-Glassman, Géraldine Walther, Ekaterina Vylomova, Arya D. McCarthy, Katharina Kann, Sabrina J. Mielke, Garrett Nicolai, Miikka Silfverberg, David Yarowsky, Jason Eisner, and Mans Hulden. The CoNLL–SIGMORPHON 2018 shared task: Universal morphological reinflection. In Proceedings of the CoNLL–SIGMORPHON 2018 Shared Task: Universal Morphological Reinflection, pp. 1–27, 2018.
|
| 256 |
+
|
| 257 |
+
Marzieh Fadaee, Arianna Bisazza, and Christof Monz. Data augmentation for low-resource neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 567–573, 2017.
|
| 258 |
+
|
| 259 |
+
Jerry A Fodor, Zenon W Pylyshyn, et al. Connectionism and cognitive architecture: A critical analysis. Cognition, 28(1-2):3–71, 1988.
|
| 260 |
+
|
| 261 |
+
Felix A Gers and E Schmidhuber. Lstm recurrent networks learn simple context-free and contextsensitive languages. IEEE Transactions on Neural Networks, 12(6):1333–1340, 2001.
|
| 262 |
+
|
| 263 |
+
Jonathan Gordon, David Lopez-Paz, Marco Baroni, and Diane Bouchacourt. Permutation equivariant models for compositional generalization in language. In International Conference on Learning Representations, 2020.
|
| 264 |
+
|
| 265 |
+
Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O.K. Li. Incorporating copying mechanism in sequence-to-sequence learning. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 1631–1640, 2016.
|
| 266 |
+
|
| 267 |
+
Jiatao Gu, Yong Wang, Kyunghyun Cho, and Victor OK Li. Search engine guided neural machine translation. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
|
| 268 |
+
|
| 269 |
+
Kelvin Guu, Tatsunori B. Hashimoto, Yonatan Oren, and Percy Liang. Generating sentences by editing prototypes. Transactions of the Association for Computational Linguistics, 6:437–450, 2018.
|
| 270 |
+
|
| 271 |
+
Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020.
|
| 272 |
+
|
| 273 |
+
Tatsunori B Hashimoto, Kelvin Guu, Yonatan Oren, and Percy S Liang. A retrieve-and-edit framework for predicting structured outputs. In Advances in Neural Information Processing Systems, pp. 10052–10062, 2018.
|
| 274 |
+
|
| 275 |
+
Hiroshi Inoue. Data augmentation by pairing samples for images classification. In International Conference on Learning Representations, 2018.
|
| 276 |
+
|
| 277 |
+
Paul Jaccard. Comparative study of the distribution of flora in a portion of the Alps and Jura. Bull Soc Vaudoise Sci Nat, 37:547–579, 1901.
|
| 278 |
+
|
| 279 |
+
Nathalie Japkowicz et al. Learning from imbalanced data sets: a comparison of various strategies. In AAAI workshop on learning from imbalanced data sets, volume 68, pp. 10–15, 2000.
|
| 280 |
+
|
| 281 |
+
Robin Jia and Percy Liang. Data recombination for neural semantic parsing. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 12–22, 2016.
|
| 282 |
+
|
| 283 |
+
Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2901–2910, 2017.
|
| 284 |
+
|
| 285 |
+
Daniel Keysers, Nathanael Schärli, Nathan Scales, Hylke Buisman, Daniel Furrer, Sergii Kashubin, Nikola Momchev, Danila Sinopalnikov, Lukasz Stafiniak, Tibor Tihon, Dmitry Tsarkov, Xiao Wang, Marc van Zee, and Olivier Bousquet. Measuring compositional generalization: A comprehensive method on realistic data. In International Conference on Learning Representations, 2020.
|
| 286 |
+
|
| 287 |
+
Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. In International Conference on Learning Representations, 2020.
|
| 288 |
+
|
| 289 |
+
Christo Kirov, Ryan Cotterell, John Sylak-Glassman, Géraldine Walther, Ekaterina Vylomova, Patrick Xia, Manaal Faruqui, Sabrina J. Mielke, Arya McCarthy, Sandra Kübler, David Yarowsky, Jason Eisner, and Mans Hulden. UniMorph 2.0: Universal Morphology. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). European Language Resources Association (ELRA), 2018.
|
| 290 |
+
|
| 291 |
+
B. Lake, Tal Linzen, and M. Baroni. Human few-shot learning of compositional instructions. In CogSci, 2019.
|
| 292 |
+
|
| 293 |
+
Brenden Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2873–2882, 2018.
|
| 294 |
+
|
| 295 |
+
Brenden M Lake. Compositional generalization through meta sequence-to-sequence learning. In Advances in Neural Information Processing Systems, pp. 9788–9798, 2019.
|
| 296 |
+
|
| 297 |
+
Vladimir I Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. In Soviet physics doklady, volume 10, pp. 707–710, 1966.
|
| 298 |
+
|
| 299 |
+
Xiang Lisa Li and Alexander M Rush. Posterior control of blackbox generation. arXiv preprint arXiv:2005.04560, 2020.
|
| 300 |
+
|
| 301 |
+
João Loula, Marco Baroni, and Brenden Lake. Rearranging the familiar: Testing compositional generalization in recurrent networks. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 108–114, 2018.
|
| 302 |
+
|
| 303 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In International Conference on Learning Representations, ICLR 2017, 2017.
|
| 304 |
+
|
| 305 |
+
Alexander Miller, Adam Fisch, Jesse Dodge, Amir-Hossein Karimi, Antoine Bordes, and Jason Weston. Key-value memory networks for directly reading documents. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1400–1409, 2016.
|
| 306 |
+
|
| 307 |
+
Steven Piantadosi and Richard Aslin. Compositional reasoning in early childhood. PloS one, 11(9), 2016.
|
| 308 |
+
|
| 309 |
+
Alexander J Ratner, Henry Ehrenberg, Zeshan Hussain, Jared Dunnmon, and Christopher Ré. Learning to compose domain-specific transformations for data augmentation. In Advances in neural information processing systems, pp. 3236–3246, 2017.
|
| 310 |
+
|
| 311 |
+
Albert Reuther, Jeremy Kepner, Chansup Byun, Siddharth Samsi, William Arcand, David Bestor, Bill Bergeron, Vijay Gadepally, Michael Houle, Matthew Hubbell, et al. Interactive supercomputing on 40,000 cores for machine learning and data analysis. In 2018 IEEE High Performance extreme Computing Conference (HPEC), pp. 1–6. IEEE, 2018.
|
| 312 |
+
|
| 313 |
+
Eric Sven Ristad and Peter N Yianilos. Learning string-edit distance. IEEE Transactions on Pattern Analysis and Machine Intelligence, 20(5):522–532, 1998.
|
| 314 |
+
|
| 315 |
+
Murray Rosenblatt. Remarks on some nonparametric estimates of a density function. The Annals of Mathematical Statistics, pp. 832–837, 1956.
|
| 316 |
+
|
| 317 |
+
David E. Rumelhart and James L. McClelland. On learning the past tenses of english verbs. Mechanisms of language aquisition, pp. 195–248, 1986.
|
| 318 |
+
|
| 319 |
+
Jake Russin, Jason Jo, Randall C O’Reilly, and Yoshua Bengio. Compositional generalization in a deep seq2seq model by separating syntax and semantics. arXiv preprint arXiv:1904.09708, 2019.
|
| 320 |
+
|
| 321 |
+
Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International conference on machine learning, pp. 1842–1850, 2016.
|
| 322 |
+
|
| 323 |
+
Abigail See, Peter J. Liu, and Christopher D. Manning. Get to the point: Summarization with pointer-generator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 1073–1083, 2017.
|
| 324 |
+
|
| 325 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
|
| 326 |
+
|
| 327 |
+
Sebastian Thrun and Lorien Pratt. Learning to learn: Introduction and overview. In Learning to learn, pp. 3–17. Springer, 1998.
|
| 328 |
+
|
| 329 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30, 2017.
|
| 330 |
+
|
| 331 |
+
Jane X. Wang, Zeb Kurth-Nelson, Hubert Soyer, Joel Z. Leibo, Dhruva Tirumala, Rémi Munos, Charles Blundell, Dharshan Kumaran, and Matt M. Botvinick. Learning to reinforcement learn. In CogSci, 2016.
|
| 332 |
+
|
| 333 |
+
Gail Weiss, Yoav Goldberg, and Eran Yahav. On the practical computational power of finite precision RNNs for language recognition. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pp. 740–745, 2018.
|
| 334 |
+
|
| 335 |
+
Jason Weston, Emily Dinan, and Alexander Miller. Retrieve and refine: Improved sequence generation models for dialogue. In Proceedings of the 2018 EMNLP Workshop SCAI: The 2nd International Workshop on Search-Oriented Conversational AI, pp. 87–92, 2018.
|
| 336 |
+
|
| 337 |
+
Chunyang Xiao, Marc Dymetman, and Claire Gardent. Sequence-based structured prediction for semantic parsing. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 1341–1350, 2016.
|
| 338 |
+
|
| 339 |
+
Deniz Yuret. Knet: beginning deep learning with 100 lines of julia. In Machine Learning Systems Workshop at NIPS, volume 2016, pp. 5, 2016.
|
| 340 |
+
|
| 341 |
+
# A MODEL ARCHITECTURE
|
| 342 |
+
|
| 343 |
+
A.1 PROTOTYPE ENCODER
|
| 344 |
+
|
| 345 |
+
We use a single layer BiLSTM network to encode $h _ { \mathrm { p r o t o } } ^ { k j }$ as follows:
|
| 346 |
+
|
| 347 |
+
$$
|
| 348 |
+
h _ { \mathrm { p r o t o } } ^ { k } = \mathrm { p r o j } ( \mathrm { B i L S T M } \left( W _ { e } d _ { k } ^ { \prime } \right) )
|
| 349 |
+
$$
|
| 350 |
+
|
| 351 |
+
Morphology The hidden and embedding sizes are 1024. No dropout is applied. We project bidirectional embeddings to the hidden size with a linear projection. We concatenate the backward and the forward hidden states.
|
| 352 |
+
|
| 353 |
+
SCAN We choose the hidden size as 512, and embedding size as 64. We apply 0.5 dropout to the input. We project hidden vectors in the attention mechanism.
|
| 354 |
+
|
| 355 |
+
# A.2 DECODER
|
| 356 |
+
|
| 357 |
+
The decoder is implemented by a single layer. In addition to the hidden state and memory cell, we also carry out a feed vector through time:
|
| 358 |
+
|
| 359 |
+
$$
|
| 360 |
+
\begin{array} { l l l } { { } } & { { \displaystyle h _ { \mathrm { p r e } } ^ { t } = \left[ h _ { \mathrm { o u t } } ^ { t } , ~ \sum _ { i } \alpha _ { \mathrm { o u t } } ^ { i } h _ { \mathrm { o u t } } ^ { i } , ~ \sum _ { j \leq | d _ { 1 } | } \alpha _ { \mathrm { p r o t o } } ^ { 1 j } h _ { \mathrm { p r o t o } } ^ { 1 j } , ~ \cdots ~ , ~ \sum _ { j \leq | d _ { n } | } \alpha _ { \mathrm { p r o t o } } ^ { n j } h _ { \mathrm { p r o t o } } ^ { n j } ~ \right] } } \\ { { } } & { { \mathrm { f e e d } ^ { t } = \mathrm { L i n e a r } _ { \mathrm { f e e d } } ( h _ { \mathrm { p r e } } ^ { t } ) } } \end{array}
|
| 361 |
+
$$
|
| 362 |
+
|
| 363 |
+
The input to the LSTM decoder at time step $t$ is the concatenation of the previous token’s representation, previous feed vector, and a latent $z$ vector (in the VAE model).
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\mathrm { i n p u t } ^ { t } = [ W _ { d } d ^ { t - 1 } , f e e d ^ { t - 1 } , z ]
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
Morphology We use a single-layer LSTM network with a hidden size of 1024, and an embedding size of 1024. We initialize the decoder hidden states with the final hidden states of the BiLSTM encoder. feed is the same size as the hidden state. No dropout is applied in the decoder. Output calculations are provided in the original paper in equation Eq. 16. The query vector for the attentions is identically the hidden state:
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
{ \sf q u e r y } ^ { t } = h _ { \mathrm { o u t } } ^ { t }
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
Further details of the attention are provided in Appendix A.3.
|
| 376 |
+
|
| 377 |
+
SCAN The decoder is implemented by a single layer LSTM network with hidden size of 512, and embedding size of 64. The embedding parameters are shared with the encoder. Here the size of the feed vector is equal to embedding size, 64.
|
| 378 |
+
|
| 379 |
+
We have no self-attention for this decoder in the feed vector. There is an attention projection with dimension is 128. The details of the attention mechanism given in Appendix A.3. Finally, we use transpose of the embedding matrix to project feed to the output space.
|
| 380 |
+
|
| 381 |
+
$$
|
| 382 |
+
\mathrm { o u t p u t } ^ { t } = W _ { e } ^ { \top } \mathrm { f e e d } ^ { t }
|
| 383 |
+
$$
|
| 384 |
+
|
| 385 |
+
outputt contains unnormalized scores before the final softmax layer. We apply 0.7 dropout to $h _ { o u t } ^ { t }$ during both training and test. The copy mechanism will be further described in Appendix A.3.
|
| 386 |
+
|
| 387 |
+
The input to the LSTM decoder is the same as Eq. 25 except the decoder embedding matrix, $W _ { d }$ , shares parameters with encoder embedding matrix $W _ { e }$ . We applied 0.5 dropout to the embeddings $d _ { t - 1 }$ .
|
| 388 |
+
|
| 389 |
+
The query vector for the attention is calculated by:
|
| 390 |
+
|
| 391 |
+
$$
|
| 392 |
+
{ \displaystyle \mathrm { q u e r y } ^ { t } } = [ h _ { \mathrm { o u t } } ^ { t } , \mathrm { i n p u t } ^ { t } ]
|
| 393 |
+
$$
|
| 394 |
+
|
| 395 |
+
# A.3 ATTENTION AND COPYING
|
| 396 |
+
|
| 397 |
+
We use the attention mechanism described in Vaswani et al. (2017) with slight modifications.
|
| 398 |
+
|
| 399 |
+
Morphology We use a linear transformation for key while retaining an embedding size of 1024, and leave query and value transformations as the identity. We do not normalize by the square root of the attention dimension. The query vector is described in the decoder Appendix A.2. The copy mechanism for the morphology task is explained in the paper in detail.
|
| 400 |
+
|
| 401 |
+
SCAN We use the nonlinear tanh transformation for key, query and value. That the attention scores are calculated separately for each prototype using different parameters as well as the normalization i.e. obtaining $\alpha$ ’s is performed separately for each prototype.
|
| 402 |
+
|
| 403 |
+
The copy mechanism for this task is slightly different and follows Gu et al. (2016) We normalize prototype attention scores and output scores jointly. Let $\bar { \alpha } _ { i }$ represent attention weights for each prototype sequence before normalization. Then, we concatenate them to the output vector in Eq. 27.
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
\mathrm { f i n a l } ^ { t } = [ \mathrm { o u t p u t } ^ { t } , \bar { \alpha } _ { 1 } , . . . , \bar { \alpha } _ { n } ]
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
We obtain a probability vector via a final softmax layer:
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
{ \mathrm { p r o b } } ^ { t } = \operatorname { s o f t m a x } ( f i n a l ^ { t } )
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
That size of this probability vector is vocabulary size plus the total length all prototypes. We then project this into the output space by:
|
| 416 |
+
|
| 417 |
+
$$
|
| 418 |
+
p ^ { t } ( w ) = \mathtt { p r o b } ^ { t } ( \mathtt { i n d i c e s } ( w ) )
|
| 419 |
+
$$
|
| 420 |
+
|
| 421 |
+
where indices finds all corresponding scores in probt for token $w$ where there might be more than one element for a given $w$ . This is because one score can come from the outputt region, and others from the prototype regions of $p r o b ^ { t }$ . During training we applied 0.5 dropout to the indices from outputt. Thus, the model is encouraged to copy more.
|
| 422 |
+
|
| 423 |
+
# B NEIGHBORHOODS AND SAMPLING
|
| 424 |
+
|
| 425 |
+
In the Eq. 20 and Eq. 21 we expressed the generic form of neighborhood sets. Here we provide the implementation details.
|
| 426 |
+
|
| 427 |
+
SCAN In the jump split, we use long-short recombination with $\delta = 0 . 5$ . In around right we use long-long recombination with $\delta = 0 . 5$ , and construct $\Omega$ so that the first and second prototypes to differ by a single token. We randomly pick $k < 1 0 \times 3$ (10 different first prototypes, and 3 different second prototypes for each of them) prototype pairs that satisfy these conditions. For the recomb- $^ { l }$ experiment, we use the same neighborhood setup except but consider only the $k < 1 0$ first prototypes.
|
| 428 |
+
|
| 429 |
+
Sampling In the jump split, we used beam search with beam size 4 in the decoder. We calculate the mean and standard deviation over the lengths of both among the first $d _ { 1 } ^ { \prime }$ and the second $d _ { 2 } ^ { \prime }$ prototypes in the train set. Then, during the sampling, we expect the first and second prototypes whose length is shorter than their respective mean plus standard deviation. This decision is based on the fact that the part of the $\Omega$ that the model is exposed to is determined by the empirical distribution, $\hat { \Omega }$ , that arises from training neighborhoods. When sampling, we try to pick prototypes from a distribution that are close to properties of that empirical distribution. In around right, we use temperature sampling with $T = 0 . 4$ . If a model cannot sample the expected number of both novel and unique samples within a reasonable time, we increase temperature $T$ .
|
| 430 |
+
|
| 431 |
+
Morphology We use long-long recombination, as explained in the paper, with slight modifications which leverage the structure of the task. We set $\Omega$ as:
|
| 432 |
+
|
| 433 |
+
$$
|
| 434 |
+
\begin{array} { r } { \Omega = \{ ( d _ { 1 } , d _ { 2 } ) | d _ { \mathrm { 1 t a g s } } ^ { \prime } \neq d _ { 2 t a g s } ^ { \prime } , ( d _ { \mathrm { t a g s } } \backslash d _ { \mathrm { 1 t a g s } } ^ { \prime } \backslash d _ { \mathrm { 2 t a g s } } ^ { \prime } ) = 0 \} } \end{array}
|
| 435 |
+
$$
|
| 436 |
+
|
| 437 |
+
For the recomb-1 model ${ \mathcal { N } } ( d )$ utilizes tag similarity, lemma similarity and is constructed using a score function:
|
| 438 |
+
|
| 439 |
+
$$
|
| 440 |
+
\mathrm { s c o r e } _ { 1 } ( d , d _ { 1 } ^ { \prime } ) = \left( | d _ { \mathrm { t a g s } } \Delta d _ { \mathrm { 1 t a g s } } ^ { \prime } | , \mathrm { j a c c a r d } ( d _ { \mathrm { l e m m a } } , d _ { \mathrm { 1 l e m m a } } ^ { \prime } ) \right)
|
| 441 |
+
$$
|
| 442 |
+
|
| 443 |
+
Given $d$ , we sort training examples by using $s c o r e _ { 1 }$ as the comparison key and pick the four smallest neighbors (using a lexicographic sort) to form ${ \mathcal { N } } ( d )$ .
|
| 444 |
+
|
| 445 |
+
For the recomb-2 model, ${ \mathcal { N } } ( d )$ uses the same score function for the first prototype as in the recomb-1 case. The second prototype is selected using:
|
| 446 |
+
|
| 447 |
+
$$
|
| 448 |
+
\mathrm { s c o r e } _ { 2 } ( d , d _ { 1 } ^ { \prime } , d _ { 2 } ^ { \prime } ) = \left( d _ { \mathrm { t a g s } } \neq d _ { \mathrm { 2 t a g s } } ^ { \prime } , | d _ { \mathrm { 1 t a g s } } ^ { \prime } \Delta d _ { \mathrm { 2 t a g s } } ^ { \prime } | \right)
|
| 449 |
+
$$
|
| 450 |
+
|
| 451 |
+
Given $x$ , and a scored first prototype, we do one more sort over training examples by using ${ \mathrm { s c o r e } } _ { 2 }$ as the comparison key. Then we pick first four neighbors for ${ \mathcal { N } } ( d )$ .
|
| 452 |
+
|
| 453 |
+
Sampling We use a mix strategy of temperature sampling with $T = 0 . 5$ and greedy sampling in which we use the former for $d _ { \mathrm { i n p u t } }$ and the latter for $d _ { \mathrm { o u t p u t } }$ . We sample 180 unique and novel examples.
|
| 454 |
+
|
| 455 |
+
# C GENERATIVE MODEL TRAINING
|
| 456 |
+
|
| 457 |
+
Morphology All of the hyper parameters mentioned here are optimized by a grid search on the Spanish validation set. We train our models for 25 epochs5. We use Adam optimizer with learning rate 0.0001. The generative model is trained on morphological reinflection order $( d _ { \mathrm { l e m m a } } d _ { \mathrm { t a g s } } \triangleright d _ { \mathrm { i n f l e c t i o n } } )$ from left to right, then the samples from the model are reordered for morphological analysis task $( d _ { \mathrm { i n f l e c t i o n } } \triangleright d _ { \mathrm { l e m m a } } d _ { \mathrm { t a g s } } )$ .
|
| 458 |
+
|
| 459 |
+
SCAN We use different number of epochs for jump and around right splits where all models are trained for 8 epochs in the former and 3 epochs in the latter. We use Adam optimizer with learning rate 0.002, and gradient norm clip with 1.0.
|
| 460 |
+
|
| 461 |
+
# D SEQ2SEQ BASELINE MODEL
|
| 462 |
+
|
| 463 |
+
After generating novel samples, we either concatenate them to the training data (in morphology), or sample training batches from a mixture of the original training data and the augmented data. Our conditional model is the same as the generative model used in morphology experiments, described in detail in the paper body, replacing $d _ { \mathrm { p r o t o } }$ with $x$ , and $d$ with $y$ .
|
| 464 |
+
|
| 465 |
+
Every conditional model’s size is the same as the corresponding generative model which was used for augmentation. This is to ensure that the conditional model and the generative model have the same capacity. We train conditional models for 150 epochs for SCAN and we used augmentation ratios of $p _ { \mathrm { a u g } } = 0 . 0 1$ and $p _ { \mathrm { a u g } } = 0 . 2$ in jump and around right, respectively. For morphology, we train the conditional models for 100 epochs, and we use all generated examples for augmentation.
|
| 466 |
+
|
| 467 |
+
# E DIRECT INFERENCE
|
| 468 |
+
|
| 469 |
+
To adapt the prototype-based model for conditional prediction, we condition the neighborhood function on the input $x$ rather than the full datum $d$ , as in Hashimoto et al. (2018). Candidate $y \mathrm { s }$ are then sampled from the generative model given the observed $x$ while marginalizing over retrieved prototypes. Finally, we re-rank these candidates via Eq. 7 and output the highest-scoring candidate.
|
| 470 |
+
|
| 471 |
+
# F VAE MODEL
|
| 472 |
+
|
| 473 |
+
Prior $p ( z )$ : We use the same prior as Guu et al. (2018) given in Eq. 31. In this prior, $z$ is defined by a norm and direction vector. The norm is sampled from the uniform distribution between zero and a maximum possible norm $\mu _ { \mathrm { m a x } } ~ = ~ 1 0 . 0$ , and the direction is sampled uniformly from the unit hypersphere. This sampling procedure corresponds to a von Mises–Fisher distribution with concentration parameter zero.
|
| 474 |
+
|
| 475 |
+
$$
|
| 476 |
+
z = z _ { \mathrm { n o r m } } \cdot z _ { \mathrm { d i r } } \quad w h e r e \quad z _ { \mathrm { n o r m } } \sim U ( 0 , \mu _ { \mathrm { m a x } } ) , \quad z _ { \mathrm { d i r } } \sim \mathrm { v m F } ( \vec { u } , 0 )
|
| 477 |
+
$$
|
| 478 |
+
|
| 479 |
+
For SCAN, the size of $z$ is 32, and for morphology the size of $z$ is 2.
|
| 480 |
+
|
| 481 |
+
Proposal Network $\boldsymbol { q } ( \boldsymbol { z } | \boldsymbol { d } , d _ { 1 : n } )$ : Similarly to the prior, the posterior network decomposes $z$ into its norm and direction vectors. The norm vector is sampled from a uniform distribution at $( | \mu | , \operatorname* { m i n } ( | \mu | +$ $\epsilon , \mu _ { \mathrm { m a x } } )$ ), and the direction is sampled from the von Mises–Fisher distribution $\operatorname { v m F } ( \mu , \kappa )$ where $\kappa = 2 5 , \epsilon = 1 . 0$ .
|
| 482 |
+
|
| 483 |
+
$$
|
| 484 |
+
\begin{array} { r l } & { h _ { \mathrm { f i n a l } } = \bigl ( \overline { { h } } _ { \mathrm { p r o t o } } \bigr ) _ { \mathrm { s t a r t } } + \bigl ( \overline { { h } } _ { \mathrm { p r o t o } } \bigr ) _ { e n d } } \\ & { \qquad \mu = \mathrm { t a n h } \bigl ( W _ { z } \left[ h _ { d \mathrm { f i n a l } } , h _ { q \mathrm { f i n a l } } \right] \bigr ) } \\ & { z _ { \mathrm { n o r m } } \sim U ( | \mu | , m i n ( | \mu | + \epsilon , \mu _ { \mathrm { m a x } } ) \bigr ) } \\ & { \qquad z _ { \mathrm { d i r } } \sim v m F ( \mu , \kappa ) } \\ & { \qquad z = z _ { \mathrm { n o r m } } \cdot z _ { \mathrm { d i r } } } \end{array}
|
| 485 |
+
$$
|
| 486 |
+
|
| 487 |
+
# G ADDITIONAL RESULTS
|
| 488 |
+
|
| 489 |
+
# G.1 MORPHOLOGY RESULTS
|
| 490 |
+
|
| 491 |
+
In the paper, Table 2 shows morphology results for (non-VAE) models with 8 hints (past- and futuretense examples in the training set). Here, we provide additional results for different hint set sizes and model variants.
|
| 492 |
+
|
| 493 |
+
# G.1.1 HINTS=4
|
| 494 |
+
|
| 495 |
+
Table 3: Exact Match Accuracy
|
| 496 |
+
|
| 497 |
+
<table><tr><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>baseline</td><td>0.078 ±0.029</td><td>0.63 ±0.09</td><td>0.107 ±0.034</td><td>0.532 ±0.029</td><td>0.067 ±0.020</td><td>0.57 ±0.04</td></tr><tr><td>geca</td><td>0.072 ±0.019</td><td>0.63 ±0.05</td><td>0.039 ±0.011</td><td>0.496 ±0.027</td><td>0.052 ±0.014</td><td>0.54 ±0.08</td></tr><tr><td>geca + resampling</td><td>0.16 ±0.04</td><td>0.65 ±0.05</td><td>0.27 ±0.08</td><td>0.52 ±0.04</td><td>0.12 ±0.04</td><td>0.554 ±0.029</td></tr><tr><td>learned aug</td><td>0.063 ±0.012</td><td>0.65 ±0.04</td><td>0.066 ±0.034</td><td>0.52 ±0.04</td><td>0.074 ±0.021</td><td>0.57 ±0.04</td></tr><tr><td>learned aug + resampling</td><td>0.098 ±0.021</td><td>0.65 ±0.05</td><td>0.29 ±0.06</td><td>0.480 ±0.035</td><td>0.092 ±0.029</td><td>0.54 ±0.06</td></tr><tr><td>recomb-1</td><td>0.063 ±0.017</td><td>0.674 ±0.021</td><td>0.061 ±0.017</td><td>0.520 ±0.028</td><td>0.055 ±0.021</td><td>0.554 ±0.030</td></tr><tr><td>recomb-1 + resampling</td><td>0.13 ±0.04</td><td>0.64 ±0.04</td><td>0.29 ±0.04</td><td>0.48 ±0.04</td><td>0.15 ±0.04</td><td>0.52 ±0.06</td></tr><tr><td>recomb-2</td><td>0.061 ±0.010</td><td>0.656 ±0.030</td><td>0.08 ±0.06</td><td>0.524 ±0.026</td><td>0.073 ±0.019</td><td>0.58 ±0.05</td></tr><tr><td>recomb-2+resampling</td><td>0.108 ±0.021</td><td>0.64 ±0.05</td><td>0.18 ±0.04</td><td>0.542 ±0.035</td><td>0.067 ±0.026</td><td>0.55 ±0.06</td></tr></table>
|
| 498 |
+
|
| 499 |
+
Table 4: F1 Accuracy
|
| 500 |
+
|
| 501 |
+
<table><tr><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>baseline</td><td>0.609 ±0.025</td><td>0.873 ±0.034</td><td>0.746 ±0.013</td><td>0.897 ±0.005</td><td>0.561 ±0.032</td><td>0.867 ±0.015</td></tr><tr><td>geca</td><td>0.606 ±0.019</td><td>0.871 ±0.017</td><td>0.722 ±0.018</td><td>0.884 ±0.007</td><td>0.565 ±0.034</td><td>0.856 ±0.028</td></tr><tr><td>geca + resampling</td><td>0.675 ±0.017</td><td>0.870 ±0.022</td><td>0.802 ±0.023</td><td>0.892 ±0.010</td><td>0.65 ±0.05</td><td>0.850 ±0.019</td></tr><tr><td>learned aug</td><td>0.597 ±0.021</td><td>0.871 ±0.024</td><td>0.737 ±0.010</td><td>0.897 ±0.011</td><td>0.58 ±0.04</td><td>0.853 ±0.026</td></tr><tr><td>learned aug +resampling</td><td>0.646 ±0.007</td><td>0.872 ±0.028</td><td>0.826 ±0.013</td><td>0.887 ±0.010</td><td>0.637 ±0.032</td><td>0.835 ±0.034</td></tr><tr><td>recomb-1</td><td>0.596 ±0.020</td><td>0.884 ±0.010</td><td>0.727 ±0.012</td><td>0.893 ±0.010</td><td>0.557 ±0.032</td><td>0.868 ±0.010</td></tr><tr><td>recomb-1 + resampling</td><td>0.663 ±0.029</td><td>0.874 ±0.014</td><td>0.812 ±0.017</td><td>0.886 ±0.011</td><td>0.67 ±0.04</td><td>0.84 ±0.04</td></tr><tr><td>recomb-2</td><td>0.598 ±0.019</td><td>0.874 ±0.007</td><td>0.730 ±0.023</td><td>0.894 ±0.008</td><td>0.581 ±0.035</td><td>0.865 ±0.024</td></tr><tr><td>recomb-2 + resampling</td><td>0.658 ±0.012</td><td>0.872 ±0.015</td><td>0.778 ±0.011</td><td>0.897 ±0.007</td><td>0.609 ±0.032</td><td>0.850 ±0.029</td></tr></table>
|
| 502 |
+
|
| 503 |
+
# G.1.2 HINTS=8
|
| 504 |
+
|
| 505 |
+
Main 8-prototype $F _ { 1 }$ results are provided in the body of the paper. Here we provide exact match results and an extra set of comparisons to the VAE model.
|
| 506 |
+
|
| 507 |
+
Table 5: Exact Match Accuracy
|
| 508 |
+
|
| 509 |
+
<table><tr><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>baseline</td><td>0.151 ±0.017</td><td>0.65 ±0.04</td><td>0.15 ±0.04</td><td>0.554 ±0.034</td><td>0.23 ±0.06</td><td>0.55 ±0.04</td></tr><tr><td>geca</td><td>0.136 ±0.030</td><td>0.638 ±0.026</td><td>0.15 ±0.05</td><td>0.55 ±0.06</td><td>0.21 ±0.05</td><td>0.550 ±0.032</td></tr><tr><td>geca +resampling</td><td>0.249 ±0.034</td><td>0.64 ±0.04</td><td>0.25 ±0.05</td><td>0.532 ±0.033</td><td>0.27 ±0.07</td><td>0.524 ±0.026</td></tr><tr><td>learned aug</td><td>0.163 ±0.030</td><td>0.652 ±0.033</td><td>0.18 ±0.05</td><td>0.560 ±0.026</td><td>0.23 ±0.04</td><td>0.548 ±0.019</td></tr><tr><td>learned aug + resampling</td><td>0.181 ±0.026</td><td>0.590 ±0.032</td><td>0.34 ±0.06</td><td>0.552 ±0.029</td><td>0.24 ±0.04</td><td>0.53 ±0.05</td></tr><tr><td>recomb-1</td><td>0.155 ±0.018</td><td>0.628 ±0.020</td><td>0.161 ±0.017</td><td>0.560 ±0.025</td><td>0.22 ±0.04</td><td>0.538 ±0.025</td></tr><tr><td>recomb-1 +resampling</td><td>0.218 ±0.032</td><td>0.616 ±0.034</td><td>0.35 ±0.04</td><td>0.53 ±0.04</td><td>0.30 ±0.04</td><td>0.52 ±0.04</td></tr><tr><td>recomb-2</td><td>0.131 ±0.028</td><td>0.634 ±0.027</td><td>0.19 ±0.11</td><td>0.56 ±0.04</td><td>0.24 ±0.05</td><td>0.528 ±0.032</td></tr><tr><td>recomb-2 +resampling</td><td>0.203 ±0.035</td><td>0.63 ±0.05</td><td>0.27 ±0.07</td><td>0.552 ±0.031</td><td>0.25 ±0.05</td><td>0.54 ±0.06</td></tr></table>
|
| 510 |
+
|
| 511 |
+
Table 6: $F _ { 1 }$ Accuracy (VAE model)
|
| 512 |
+
|
| 513 |
+
<table><tr><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>learned aug + resampling +vae</td><td>0.689 ±0.018</td><td>0.859 ±0.010</td><td>0.845 ±0.014</td><td>0.896 ±0.011</td><td>0.730 ±0.032</td><td>0.850 ±0.015</td></tr><tr><td>recomb-1 + resampling +vae</td><td>0.717 ±0.014</td><td>0.870 ±0.007</td><td>0.843 ±0.014</td><td>0.898 ±0.010</td><td>0.736 ±0.030</td><td>0.859 ±0.031</td></tr><tr><td>recomb-2 + resampling +vae</td><td>0.710 ±0.008</td><td>0.865 ±0.012</td><td>0.824 ±0.015</td><td>0.896 ±0.011</td><td>0.751 ±0.027</td><td>0.848 ±0.027</td></tr></table>
|
| 514 |
+
|
| 515 |
+
# G.1.3 HINTS=16
|
| 516 |
+
|
| 517 |
+
Table 7: Exact Match Accuracy
|
| 518 |
+
|
| 519 |
+
<table><tr><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>baseline</td><td>0.27 ±0.05</td><td>0.65 ±0.04</td><td>0.28 ±0.06</td><td>0.544 ±0.029</td><td>0.40 ±0.04</td><td>0.614 ±0.032</td></tr><tr><td>geca</td><td>0.26 ±0.06</td><td>0.65 ±0.06</td><td>0.26 ±0.05</td><td>0.530 ±0.028</td><td>0.37 ±0.05</td><td>0.570 ±0.035</td></tr><tr><td>geca +resampling</td><td>0.34 ±0.05</td><td>0.63 ±0.04</td><td>0.32 ±0.07</td><td>0.506 ±0.034</td><td>0.42 ±0.05</td><td>0.590 ±0.035</td></tr><tr><td>learned aug</td><td>0.25 ±0.04</td><td>0.65 ±0.04</td><td>0.32 ±0.06</td><td>0.538 ±0.028</td><td>0.39 ±0.04</td><td>0.58 ±0.05</td></tr><tr><td>learned aug +resampling</td><td>0.230 ±0.035</td><td>0.61 ±0.04</td><td>0.42 ±0.06</td><td>0.54 ±0.04</td><td>0.42 ±0.05</td><td>0.578 ±0.027</td></tr><tr><td>recomb-1</td><td>0.27 ±0.05</td><td>0.63 ±0.06</td><td>0.32 ±0.05</td><td>0.55 ±0.04</td><td>0.35 ±0.06</td><td>0.60 ±0.05</td></tr><tr><td>recomb-1 +resampling</td><td>0.28 ±0.04</td><td>0.61 ±0.07</td><td>0.418 ±0.035</td><td>0.548 ±0.023</td><td>0.35 ±0.06</td><td>0.56 ±0.04</td></tr><tr><td>recomb-2</td><td>0.22 ±0.06</td><td>0.62 ±0.07</td><td>0.28 ±0.04</td><td>0.56 ±0.04</td><td>0.40 ±0.06</td><td>0.596 ±0.024</td></tr><tr><td>recomb-2 +resampling</td><td>0.262 ±0.025</td><td>0.61 ±0.07</td><td>0.405 ±0.028</td><td>0.53 ±0.04</td><td>0.43 ±0.06</td><td>0.61 ±0.04</td></tr></table>
|
| 520 |
+
|
| 521 |
+
Table 8: F1 Accuracy
|
| 522 |
+
|
| 523 |
+
<table><tr><td></td><td colspan="2">Spanish</td><td colspan="2">Swahili</td><td colspan="2">Turkish</td></tr><tr><td></td><td>FUT+PST*</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td><td>FUT+PST</td><td>OTHER</td></tr><tr><td>baseline</td><td>0.733 ±0.014</td><td>0.881 ±0.012</td><td>0.811 ±0.018</td><td>0.893 ±0.011</td><td>0.750 ±0.026</td><td>0.875 ±0.021</td></tr><tr><td>geca</td><td>0.736 ±0.019</td><td>0.884 ±0.018</td><td>0.800 ±0.024</td><td>0.889 ±0.012</td><td>0.74 ±0.04</td><td>0.863 ±0.019</td></tr><tr><td>geca + resampling</td><td>0.782 ±0.024</td><td>0.867 ±0.012</td><td>0.830 ±0.021</td><td>0.885 ±0.013</td><td>0.794 ±0.032</td><td>0.865 ±0.018</td></tr><tr><td>learned aug</td><td>0.738 ±0.020</td><td>0.877 ±0.008</td><td>0.816 ±0.024</td><td>0.893 ±0.012</td><td>0.752 ±0.024</td><td>0.868 ±0.020</td></tr><tr><td>learned aug + resampling</td><td>0.745 ±0.019</td><td>0.870 ±0.012</td><td>0.866 ±0.016</td><td>0.894 ±0.013</td><td>0.787 ±0.031</td><td>0.863 ±0.021</td></tr><tr><td>recomb-1</td><td>0.738 ±0.021</td><td>0.877 ±0.019</td><td>0.820 ±0.018</td><td>0.896 ±0.014</td><td>0.735 ±0.033</td><td>0.874 ±0.026</td></tr><tr><td>recomb-1 + resampling</td><td>0.770 ±0.020</td><td>0.867 ±0.023</td><td>0.872 ±0.005</td><td>0.892 ±0.010</td><td>0.778 ±0.024</td><td>0.861 ±0.022</td></tr><tr><td>recomb-2</td><td>0.716 ±0.019</td><td>0.876 ±0.022</td><td>0.815 ±0.017</td><td>0.897 ±0.016</td><td>0.752 ±0.034</td><td>0.873 ±0.017</td></tr><tr><td>recomb-2+resampling</td><td>0.765 ±0.023</td><td>0.868 ±0.021</td><td>0.856 ±0.015</td><td>0.888 ±0.016</td><td>0.808 ±0.018</td><td>0.868 ±0.027</td></tr></table>
|
| 524 |
+
|
| 525 |
+
# G.2 SIGNIFICANCE TESTS
|
| 526 |
+
|
| 527 |
+
Tables 9, 10 and 11 sho the $p$ -values for pairwise differences between the baseline and prototype-based models
|
| 528 |
+
|
| 529 |
+
Table 9: Turkish language $p$ -values for paired $t$ -test in $\mathrm { P S T + F U T }$ tenses for the average $F _ { 1 }$ (micro) scores over several runs without Bonferronni correction.
|
| 530 |
+
|
| 531 |
+
<table><tr><td></td><td>baseline</td><td>geca</td><td>learned aug</td><td>recomb-1</td><td>recomb-2</td><td>geca + resampling</td><td></td><td>learned aug + resamplingrecomb-1 + resamplingrecomb-2 + resampling</td><td></td></tr><tr><td>baseline</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>geca</td><td>0.259314</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>learned aug</td><td>0.352506</td><td>0.802058</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>recomb-1</td><td>0.707534</td><td>0.129244</td><td>0.187597</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>recomb-2</td><td>0.233578</td><td>0.0230554</td><td>0.0331794</td><td>0.363375</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>geca + resampling</td><td>1.0125e-16</td><td>3.7044e-12</td><td>4.07678e-15</td><td>6.04788e-17</td><td>1.71167e-19</td><td></td><td></td><td></td><td></td></tr><tr><td>leamed aug + resampling</td><td>8.00807e-10</td><td>1.37553e-07</td><td>6.51548e-08</td><td>6.35314e-11</td><td>3.76501e-13</td><td>0.0167999</td><td></td><td></td><td></td></tr><tr><td>recomb-1 + resampling</td><td>3.85877e-26</td><td>1.60117e-20</td><td>2.76421e-22</td><td>6.41228e-26</td><td>2.07776e-26</td><td>0.0109365</td><td>1.948e-06</td><td></td><td></td></tr><tr><td>recomb-2 + resampling</td><td>2.56689e-15</td><td>3.4083e-13</td><td>2.08177e-14</td><td>2.92113e-18</td><td>1.79928e-19</td><td>0.981886</td><td>0.0190462</td><td>0.0101878</td><td></td></tr></table>
|
| 532 |
+
|
| 533 |
+
Table 10: Spanish language $p$ -values for paired $t$ -test in PST+FUT tenses for the average $F _ { 1 }$ (micro) scores over several runs without Bonferronni correction.
|
| 534 |
+
|
| 535 |
+
<table><tr><td></td><td>baseline</td><td>geca</td><td>learned aug</td><td>recomb-1</td><td>recomb-2</td><td></td><td>geca + resamplinglearned aug + resamplingrecomb-1 + resamplingrecomb-2 + resampling</td><td></td><td></td></tr><tr><td>baseline</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>geca</td><td>0.394748</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>learned aug</td><td>0.761129</td><td>0.635337</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>recomb-1</td><td>0.428606</td><td>0.974851</td><td>0.620601</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>recomb-2</td><td>0.199768</td><td>0.601998</td><td>0.317494</td><td>0.625078</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>geca + resampling</td><td>2.27478e-25</td><td>6.11513e-29</td><td>3.30904e-24</td><td>1.38242e-24</td><td>2.19894e-27</td><td></td><td></td><td></td><td></td></tr><tr><td>learned aug + resampling</td><td>1.09224e-10</td><td>9.34816e-13</td><td>1.40474e-11</td><td>4.70624e-13</td><td>4.78418e-14</td><td>0.000137083</td><td></td><td></td><td></td></tr><tr><td>recomb-1 + resampling</td><td>4.00039e-27</td><td>8.88347e-30</td><td>4.06546e-25</td><td>1.2159e-28</td><td>7.2465e-29</td><td>0.495734</td><td>1.35727e-05</td><td></td><td></td></tr><tr><td>recomb-2 + resampling</td><td>1.17709e-17</td><td>1.29429e-21</td><td>4.07864e-18</td><td>1.12332e-19</td><td>1.66638e-21</td><td>0.313143</td><td>0.00925477</td><td>0.103819</td><td></td></tr></table>
|
| 536 |
+
|
| 537 |
+
Table 11: Swahili language $p$ -values for paired $t$ -test in $\mathrm { P S T + F U T }$ tenses for the average $F _ { 1 }$ (micro) scores over several runs without Bonferronni correction.
|
| 538 |
+
|
| 539 |
+
<table><tr><td></td><td>baseline</td><td>geca</td><td>learned aug</td><td>recomb-1</td><td>recomb-2</td><td></td><td>geca + resamplinglearned aug + resamplingrecomb-1 + resamplingrecomb-2 + resampling</td><td></td><td></td></tr><tr><td>baseline</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>geca</td><td>0.606002</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>learned aug</td><td>0.000857131</td><td>0.00384601</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>recomb-1</td><td>6.27581e-05</td><td>0.00101351</td><td>0.769589</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>recomb-2</td><td>1.75947e-05</td><td>0.000207507</td><td>0.263242</td><td>0.402064</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>geca + resampling</td><td>2.58696e-21</td><td>8.85433e-19</td><td>4.57259e-11</td><td>1.33673e-11</td><td>1.87968e-08</td><td></td><td></td><td></td><td></td></tr><tr><td>learned aug + resampling</td><td>7.09377e-53</td><td>1.46895e-47</td><td>2.3846e-38</td><td>6.32242e-38</td><td>2.09274e-30</td><td>3.26321e-10</td><td></td><td></td><td></td></tr><tr><td>recomb-1 + resampling</td><td>1.66361e-58</td><td>1.28557e-54</td><td>9.46035e-44</td><td>2.05703e-45</td><td>9.46848e-37</td><td>1.60241e-17</td><td>0.0749463</td><td></td><td></td></tr><tr><td>recomb-2 +resampling</td><td>2.16531e-31</td><td>3.52334e-25</td><td>7.80047e-20</td><td>1.08762e-19</td><td>1.26218e-15</td><td>0.0756646</td><td>1.52594e-06</td><td>2.51776e-11</td><td></td></tr></table>
|
| 540 |
+
|
| 541 |
+
# G.3 GENERATED SAMPLES
|
| 542 |
+
|
| 543 |
+
All samples are randomly selected unless otherwise indicated.
|
| 544 |
+
|
| 545 |
+
# G.3.1 SCAN
|
| 546 |
+
|
| 547 |
+
In Table 12, we present three test samples from the SCAN task along with the predictions by direct inference and the conditional model trained on the augmented data with recomb-2. Note that the augmentation procedure was able to create novel samples whose input $( x )$ happens to be in the test set (Examples 1 and 3) while $y$ may or may not be correct (Example 1).
|
| 548 |
+
|
| 549 |
+
<table><tr><td></td><td>Example 1 (jump)</td><td>Example 2 (jump)</td><td>Example 3 (around right)</td></tr><tr><td>Input (𝑥= )</td><td>walk twice after jump twice</td><td>run right after jump twice</td><td> jump left and jump around right</td></tr><tr><td>True label (y) in augmented dataset</td><td>JUMP JUMP WALK WALK JUMP JUMP JUMP WALK</td><td>JUMP JUMP RTURN RUN (not generated)</td><td>TURN LEFT JUMP'TURN RIGHT JUMP TURN RIGHT JUMP TURN RIGHT JUMP TURN RIGHT JUMP TURN LEFT JUMP TURN RIGHT JUMP TURN RIGHT JUMP TURN RIGHT JUMP TURN RIGHT JUMP</td></tr><tr><td>Predicted @</td><td></td><td></td><td></td></tr><tr><td>├ direct inference Lrecomb-2</td><td>JUMP JUMP JUMP WALK JUMP JUMP WALK WALK</td><td>LOOK LOOK RTURN JUMP JUMP JUMP RTURN RUN</td><td>TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP</td></tr></table>
|
| 550 |
+
|
| 551 |
+
Table 12: Comparison of generative and unconditional model predictions with and without data augmentation. The conditional model trained on augmented data (final row) is able to compensate for errors in data augmentation (Example 1) and generalize to examples never generated by the data augmentation procedure (Example 2), and often times if a sample is correctly created by the augmentation procedure, the conditional model also gets it right (Example 3).
|
| 552 |
+
|
| 553 |
+
Below are a set of samples from the learned aug (basic) model for SCAN dataset’s jump and around right splits, in order:
|
| 554 |
+
|
| 555 |
+
IN: run opposite and walk opposite right twice OUT: RUN TURN RIGHT TURN RIGHT RUN TURN RIGHT TURN RIGHT WALK
|
| 556 |
+
IN: look around right thrice after run around thrice thrice OUT: TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT LOOK
|
| 557 |
+
IN: look opposite right twice and walk around twice OUT: TURN RIGHT TURN RIGHT LOOK TURN RIGHT TURN RIGHT LOOK TURN RIGHT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK
|
| 558 |
+
IN: run opposite and thrice OUT: RUN TURN LEFT RUN RUN
|
| 559 |
+
|
| 560 |
+
IN: walk opposite right thrice turn turn right thrice OUT: TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT TURN RIGHT WALK IN: jump opposite right twice jump look around left OUT: TURN RIGHT TURN RIGHT JUMP TURN LEFT TURN LEFT JUMP TURN LEFT TURN LEFT LOOK TURN LEFT TURN LEFT LOOK
|
| 561 |
+
|
| 562 |
+
IN: walk around left thrice after jump left left OUT: TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK
|
| 563 |
+
|
| 564 |
+
IN: run opposite right twice walk run left thrice OUT: TURN RIGHT TURN RIGHT RUN TURN RIGHT TURN RIGHT WALK TURN LEFT TURN LEFT RUN TURN LEFT TURN LEFT RUN
|
| 565 |
+
|
| 566 |
+
Below are a set of samples from the recomb-1 model for SCAN dataset’s around right split. Note that there were no samples with rare tags generated by the model for the jump split:
|
| 567 |
+
|
| 568 |
+
IN: run around right after walk around left OUT: TURN LEFT WALK TURN LEFT WALK TURN LEFT RUN TURN LEFT RUN TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK TURN LEFT WALK
|
| 569 |
+
IN: look around right after jump around left OUT: TURN LEFT LOOK TURN LEFT JUMP TURN LEFT LOOK TURN LEFT LOOK TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP
|
| 570 |
+
IN: look around right and jump around left OUT: TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT LOOK TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP
|
| 571 |
+
IN: walk around right and turn right twice OUT: TURN RIGHT WALK TURN RIGHT WALK TURN RIGHT WALK TURN RIGHT WALK TURN RIGHT TURN RIGHT
|
| 572 |
+
|
| 573 |
+
Below are 4 samples from the recomb-2 model for each of SCAN dataset’s jump and around right splits, respectively:
|
| 574 |
+
|
| 575 |
+
IN: jump opposite left thrice after jump opposite left thrice OUT: TURN LEFT TURN LEFT JUMP TURN LEFT TURN LEFT JUMP TURN LEFT TURN LEFT JUMP TURN LEFT TURN LEFT WALK TURN LEFT TURN LEFT WALK TURN LEFT TURN LEFT WALK
|
| 576 |
+
IN: jump left thrice and jump left thrice OUT: TURN LEFT LOOK TURN LEFT LOOK TURN LEFT LOOK TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP IN: jump opposite right and turn around left OUT: TURN RIGHT TURN RIGHT JUMP
|
| 577 |
+
TURN LEFT TURN LEFT TURN LEFT TURN LEFT
|
| 578 |
+
IN: turn around left and jump around left OUT: TURN LEFT TURN LEFT TURN LEFT TURN LEFT TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP TURN LEFT JUMP IN: look right twice after run around right OUT: TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT LOOK TURN RIGHT LOOK
|
| 579 |
+
IN: turn right twice after look around right OUT: TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT LOOK TURN RIGHT TURN RIGHT
|
| 580 |
+
IN: look twice and run around right OUT: LOOK LOOK TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN TURN RIGHT RUN
|
| 581 |
+
IN: walk opposite right twice and jump around right OUT: TURN RIGHT TURN RIGHT WALK TURN RIGHT TURN RIGHT WALK TURN RIGHT JUMP TURN RIGHT JUMP TURN RIGHT JUMP TURN RIGHT JUMP
|
| 582 |
+
|
| 583 |
+
# G.3.2 MORPHOLOGY
|
| 584 |
+
|
| 585 |
+
Below are a set of samples from the learned aug (basic) model in SIGMORPHON format.
|
| 586 |
+
|
| 587 |
+
şahmiçe şahmiçende N;LOC;SG;PSS2S
|
| 588 |
+
karadan havaya füze karadan havaya füzel N;DAT;PL;PSS3P
|
| 589 |
+
ernek erneklerine N;DAT;PL;PSS3P
|
| 590 |
+
kiler kilerime N;DAT;SG;PSS1S
|
| 591 |
+
mahlep mahlebimizi N;ACC;SG;PSS1P
|
| 592 |
+
süzmek süzerler V;IND;3;PL;PRS;POS;DECL
|
| 593 |
+
âlap âlaps N;LGSPEC1;3S;SG;PRS
|
| 594 |
+
jöle jöleleri N;ACC;PL
|
| 595 |
+
|
| 596 |
+
envejecerse envejeciéndose V.CVB;PRS colaxar colaxa V;IND;PRS;3;SG pergedrer no pergedremos V;NEG;IMP;1;PL mantear no mantees V;NEG;IMP;2;SG flaguear no flagueen V;NEG;IMP;3;PL malacostar malacostaría V;COND;3;SG
|
| 597 |
+
|
| 598 |
+
desinstar desinse V;POS;IMP;3;SG concretizar no concretices V;NEG;IMP;2;SG
|
| 599 |
+
|
| 600 |
+
Below are a set of samples from the learned aug (basic) $^ +$ resampling model.
|
| 601 |
+
|
| 602 |
+
şaşırmak şaşırmıyor musun? V;IND;2;PL;PST;PROG;POS;INTR ayılmak ayılmaya V;IND;1;SG;PST;DECL pleşmek pleşmiyor muyuz? V;IND;1;PL;PST;PROG;NEG;INTR imciyetmek imciyetmezdeğiz V;IND;1;PL;FUT;NEG;DECL kuvaşmak kuvaşmayacağız V;IND;1;PL;FUT;NEG;DECL yermek yermeyeceğiz V;IND;1;PL;FUT;NEG;DECL yarıtmak yarıtmayacağız V;IND;1;PL;FUT;NEG;DECL kelimek kelimeyeceğiz V;IND;1;PL;FUT;NEG;DECL
|
| 603 |
+
|
| 604 |
+
trasescar trasescáis V;IND;PST;2;PL;IPFV tronar tronar V;IND;FUT;1;SG terzcalminar terzcalminan V;IND;PST;3;PL;IPFV esubronizar esubronizamos V;IND;PST;1;PL;IPFV urdir urdiremos V;IND;FUT;1;PL conder conderemos V;IND;FUT;1;PL florear florearían V;IND;PST;3;PL;LGSPEC1;SG sabrordar sabrordamos V;IND;PST;1;PL;IPFV
|
| 605 |
+
|
| 606 |
+
Below are a set of samples from the recomb- $l +$ resampling model (the best performing model in Table 2). Here we additionally annotate samples with error categories.
|
| 607 |
+
|
| 608 |
+
kovulmak kovulmaz mısınız V;IND;2;PL;FUT;NEG;INTR (Inflection and tags don’t match.) düşünmek düşündüler V;IND;3;PL;PST;POS;DECL (Correct and novel.) sütmek sütmez miyiz? V;IND;2;SG;FUT;NEG;INTR (Inflection and tags don’t match.) bakmak bakmayacak mıyım? V;IND;1;PL;FUT;NEG;INTR (Inflection and tags don’t match) döndürmek döndürecek misiniz? V;IND;2;PL;FUT;POS;INTR (Correct and novel.) türkçeleştirtmek türkçeleştirtiyor m V;IND;2;PL;PST;PROG;NEG;INTR (Wrong inflection, novel tag.) çalmak çalmayız V;IND;2;PL;FUT;POS;DECL (Inflection and tags don’t match.) üsürmek üsürmezsin V;IND;2;SG;PST;NEG;DECL (Inflection and tags don’t match.)
|
| 609 |
+
|
| 610 |
+
duplicar duplicaráis V;IND;FUT;2;PL (Correct and novel)
|
| 611 |
+
efundar efundan V;SBJV;FUT;3;PL (Inflection and tags don’t match)
|
| 612 |
+
deshumanizar deshumanicas V;SBJV;PST;2;SG (Inplausible inflection.)
|
| 613 |
+
emular emulares V;SBJV;FUT;2;SG (Correct and also in train set.)
|
| 614 |
+
languidecer languidecíamos V;IND;PST;1;SG;IPFV (Inflection and tags don’t match)
|
| 615 |
+
nominar nominamos V;SBJV;FUT;1;PL (Novel tags, incorrect inflection.)
|
| 616 |
+
finciar finciare V;SBJV;FUT;1;SG (Correct and novel.)
|
| 617 |
+
abastar abasto V;IND;PST;1;SG (Inflection and tags don’t match)
|
| 618 |
+
|
| 619 |
+
# G.4 ATTENTION HEATMAP
|
| 620 |
+
|
| 621 |
+
Here we provide a visualization copy and attention mechanism in recomb-2 model for SCAN experiments.
|
| 622 |
+
|
| 623 |
+

|
| 624 |
+
Figure 3: Generation of a sample. We plot normalized output scores on the left, and attention weights to the different prototypes on the right. The prototypes are on the y axes. The model is recomb-2 model trained on SCAN jump split.
|
| 625 |
+
|
| 626 |
+
# H COMPUTE
|
| 627 |
+
|
| 628 |
+
We use a single 32GB NVIDIA V100 Volta GPU for each experiment. For every experiment, the whole pipeline which consists of training of the generative model, sampling and training of the conditional model takes less than an hour.
|
md/train/QkljT4mrfs/QkljT4mrfs.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Partial success in closing the gap between human and machine vision
|
| 2 |
+
|
| 3 |
+
Robert Geirhos1-2§ Kantharaju Narayanappa1 Benjamin Mitzkus1
|
| 4 |
+
|
| 5 |
+
Tizian Thieringer1 Matthias Bethge1∗ Felix A. Wichmann1∗ Wieland Brendel1∗
|
| 6 |
+
|
| 7 |
+
1University of Tübingen 2International Max Planck Research School for Intelligent Systems ∗Joint senior authors §To whom correspondence should be addressed: robert.geirhos@uni-tuebingen.de
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
A few years ago, the first CNN surpassed human performance on ImageNet. However, it soon became clear that machines lack robustness on more challenging test cases, a major obstacle towards deploying machines “in the wild” and towards obtaining better computational models of human visual perception. Here we ask: Are we making progress in closing the gap between human and machine vision? To answer this question, we tested human observers on a broad range of out-ofdistribution (OOD) datasets, recording 85,120 psychophysical trials across 90 participants. We then investigated a range of promising machine learning developments that crucially deviate from standard supervised CNNs along three axes: objective function (self-supervised, adversarially trained, CLIP language-image training), architecture (e.g. vision transformers), and dataset size (ranging from 1M to 1B).
|
| 12 |
+
|
| 13 |
+
Our findings are threefold. (1.) The longstanding distortion robustness gap between humans and CNNs is closing, with the best models now exceeding human feedforward performance on most of the investigated OOD datasets. (2.) There is still a substantial image-level consistency gap, meaning that humans make different errors than models. In contrast, most models systematically agree in their categorisation errors, even substantially different ones like contrastive self-supervised vs. standard supervised models. (3.) In many cases, human-to-model consistency improves when training dataset size is increased by one to three orders of magnitude. Our results give reason for cautious optimism: While there is still much room for improvement, the behavioural difference between human and machine vision is narrowing. In order to measure future progress, 17 OOD datasets with image-level human behavioural data and evaluation code are provided as a toolbox and benchmark at https://github.com/bethgelab/model-vs-human/.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Looking back at the last decade, deep learning has made tremendous leaps of progress by any standard. What started in 2012 with AlexNet [1] as the surprise winner of the ImageNet Large-Scale Visual Recognition Challenge quickly became the birth of a new AI “summer”, a summer lasting much longer than just a season. With it, just like with any summer, came great expectations: the hope that the deep learning revolution will see widespread applications in industry, that it will propel breakthroughs in the sciences, and that it will ultimately close the gap between human and machine perception. We have now reached the point where deep learning has indeed become a significant driver of progress in industry [e.g. 2, 3], and where many disciplines are employing deep learning for scientific discoveries [4–9]—but are we making progress in closing the gap between human and machine vision?
|
| 18 |
+
|
| 19 |
+
IID vs. OOD benchmarking. For a long time, the gap between human and machine vision was mainly approximated by comparing benchmark accuracies on IID (independent and identically distributed) test data: as long as models are far from reaching human-level performance on challenging datasets like ImageNet, this approach is adequate [10]. Currently, models are routinely matching and in many cases even outperforming humans on IID data. At the same time, it is becoming increasingly clear that models systematically exploit shortcuts shared between training and test data [11–14]. Therefore we are witnessing a major shift towards measuring model performance on out-of-distribution (OOD) data rather than IID data alone, which aims at testing models on more challenging test cases where there is still a ground truth category, but certain image statistics differ from the training distribution. Many OOD generalisation tests have been proposed: ImageNet-C [15] for corrupted imaes, ImageNet-Sketch [16] for sketches, Stylized-ImageNet [17] for image style changes, [18] for unfamiliar object poses, and many more [19–29]. While it is great to have many viable and valuable options to measure generalisation, most of these datasets unfortunately lack human comparison data. This is less than ideal, since we can no longer assume that humans reach near-ceiling accuracies on these challenging test cases as they do on standard noise-free IID object recognition datasets. In order to address this issue, we carefully tested human observers in the Wichmannlab’s vision laboratory on a broad range of OOD datasets, providing some 85K psychophysical trials across 90 participants. Crucially, we showed exactly the same images to multiple observers, which means that we are able to compare human and machine vision on the fine-grained level of individual images [30–32]). The focus of our datasets is measuring distortion robustness: we tested 17 variations that include changes to image style, texture, and various forms of synthetic additive noise.
|
| 20 |
+
|
| 21 |
+
Contributions & outlook. The resulting 17 OOD datasets with large-scale human comparion data enable us to investigate recent exciting machine learning developments that crucially deviate from “vanilla” CNNs along three axes: objective function (supervised vs. self-supervised, adversarially trained, and CLIP’s joint language-image training), architecture (convolutional vs. vision transformer) and training dataset size (ranging from 1M to 1B images). Taken together, these are some of the most promising directions our field has developed to date—but this field would not be machine learning if new breakthroughs weren’t within reach in the next few weeks, months and years. Therefore, we open-sourced modelvshuman, a Python toolbox that enables testing both PyTorch and TensorFlow models on our comprehensive benchmark suite of OOD generalisation data in order to measure future progress. Even today, our results give cause for (cautious) optimism. After a method overview (Section 2), we are able to report that the human-machine distortion robustness gap is closing: the best models now match or in many cases even exceed human feedforward performance on most of the investigated OOD datasets (Section 3). While there is still a substantial image-level consistency gap between humans and machines, this gap is narrowing on some—but not all—datasets when the size of the training dataset is increased (Section 4).
|
| 22 |
+
|
| 23 |
+
# 2 Methods: datasets, psychophysical experiments, models, metrics, toolbox
|
| 24 |
+
|
| 25 |
+
OOD datasets with consistency-grade human data. We collected human data for 17 generalisation datasets (visualized in Figures 7 and 8 in the Appendix, which also state the number of subjects and trials per experiment) on a carefully calibrated screen in a dedicated psychophysical laboratory (a total of 85,120 trials across 90 observers). Five datasets each correspond to a single manipulation (sketches, edge-filtered images, silhouettes, images with a texture-shape cue conflict, and stylized images where the original image texture is replaced by the style of a painting); the remaining twelve datasets correspond to parametric image degradations (e.g. different levels of noise or blur). Those OOD datasets have in common that they are designed to test ImageNet-trained models. OOD images were obtained from different sources: sketches from ImageNet-Sketch [16], stylized images from
|
| 26 |
+
|
| 27 |
+
Stylized-ImageNet [17], edge-filtered images, silhouettes and cue conflict images from $[ 1 7 ] ^ { 1 }$ , and the remaining twelve parametric datasets were adapted from [33]. For these parametric datasets, [33] collected human accuracies but unfortunately, they showed different images to different observers implying that we cannot use their human data to assess image-level consistency between humans and machines. Thus we collected psychophysical data for those images ourselves by showing exactly the same images to multiple observers for each of those twelve datasets. Additionally, we cropped the images from [33] to $2 2 4 \times 2 2 4$ pixels to allow for a fair comparison to ImageNet models (all models included in our comparison receive $2 2 4 \times 2 2 4$ input images; [33] showed $2 5 6 \times 2 5 6$ images to human observers in many cases).
|
| 28 |
+
|
| 29 |
+
Psychophysical experiments. 90 observers were tested in a darkened chamber. Stimuli were presented at the center of a $2 2 '$ monitor with $1 9 2 0 \times 1 2 0 0$ pixels resolution (refresh rate: $1 2 0 \mathrm { H z } ,$ ). Viewing distance was $1 0 7 \mathrm { c m }$ and target images subtended $3 \times 3$ degrees of visual angle. Human observers were presented with an image and asked to select the correct category out of 16 basic categories (such as chair, dog, airplane, etc.). Stimuli were balanced w.r.t. classes and presented in random order. For ImageNet-trained models, in order to obtain a choice from the same 16 categories, the 1,000 class decision vector was mapped to those 16 classes using the WordNet hierarchy [34]. In Appendix I, we explain why this mapping is optimal. We closely followed the experimental protocol defined by [33], who presented images for $2 0 0 ~ \mathrm { { m s } }$ followed by a $1 / f$ backward mask to limit the influence of recurrent processing (otherwise comparing to feedforward models would be difficult). Further experimental details are provided in Appendix C.
|
| 30 |
+
|
| 31 |
+
Why not use crowdsourcing instead? Our approach of investigating few observers in a highquality laboratory setting performing many trials is known as the so-called “small-N design”, the bread-and-butter approach in high-quality psychophysics—see, e.g., the review “Small is beautiful: In defense of the small-N design” [35]. This is in contrast to the “crowdsourcing approach” (many observers in a noisy setting performing fewer trials each). The highly controlled conditions of the Wichmannlab’s psychophysical laboratory come with many advantages over crowdsourced data collection: precise timing control (down to the millisecond), carefully calibrated monitors (especially important for e.g. low-contrast stimuli), controlled viewing distance (important for foveal presentation), full visual acuity (we performed an acuity test with every observer prior to the experiment), observer attention (e.g. no multitasking or children running around during an experiment, which may happen in a crowdsourcing study), just to name a few [36]. Jointly, these factors contribute to high data quality.
|
| 32 |
+
|
| 33 |
+
Models. In order to disentangle the influence of objective function, architecture and training dataset size, we tested a total of 52 models: 24 standard ImageNet-trained CNNs [37], 8 selfsupervised models [38–43], $^ 2 6$ Big Transfer models [45], 5 adversarially trained models [46], 5 vision transformers [47, 48], two semi-weakly supervised models [49] as well as Noisy Student [50] and CLIP [51]. Technical details for all models are provided in the Appendix.
|
| 34 |
+
|
| 35 |
+
Metrics. In addition to $o o D$ accuracy (averaged across conditions and datasets), the following three metrics quantify how closely machines are aligned with the decision behaviour of humans.
|
| 36 |
+
|
| 37 |
+
Accuracy difference $A ( m )$ is a simple aggregate measure that compares the accuracy of a machine $m$ to the accuracy of human observers in different out-of-distribution tests,
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
A ( m ) : \mathbb { R } \to [ 0 , 1 ] , m \mapsto { \frac { 1 } { | D | } } \sum _ { d \in D } { \frac { 1 } { | H _ { d } | } } \sum _ { h \in H _ { d } } { \frac { 1 } { | C _ { d } | } } \sum _ { c \in C _ { d } } ( \operatorname { a c c } _ { d , c } ( h ) - \operatorname { a c c } _ { d , c } ( m ) ) ^ { 2 }
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\operatorname { a c c } _ { d , c } ( \cdot )$ is the accuracy of the model or the human on dataset $d \in D$ and condition $c \in C _ { d }$ (e.g. a particular noise level), and $h \in H _ { D }$ denotes a human observer tested on dataset $d$ . Analogously, one can compute the average accuracy difference between a human observer $h _ { 1 }$ and all other human observers by substituting $h _ { 1 }$ for $m$ and $h \in H _ { D } \setminus \{ h _ { 1 } \}$ for $h \in H _ { D }$ (which can also be applied for the two metrics defined below).
|
| 44 |
+
|
| 45 |
+
Aggregated metrics like $A ( m )$ ignore individual image-level decisions. Two models with vastly different image-level decision behaviour might still end up with the same accuracies on each dataset and condition. Hence, we include two additional metrics in our benchmark that are sensitive to decisions on individual images.
|
| 46 |
+
|
| 47 |
+
Observed consistency $O ( m )$ [32] measures the fraction of samples for which humans and a model $m$ get the same sample either both right or both wrong. More precisely, let $b _ { h , m } ( s )$ be one if both a human observer $h$ and $m$ decide either correctly or incorrectly on a given sample $s$ , and zero otherwise. We calculate the average observed consistency as
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
O ( m ) : \mathbb { R } \to [ 0 , 1 ] , m \mapsto \frac { 1 } { | D | } \sum _ { d \in D } \frac { 1 } { | H _ { d } | } \sum _ { h \in H _ { d } } \frac { 1 } { | C _ { d } | } \sum _ { c \in C _ { d } } \frac { 1 } { | S _ { d , c } | } \sum _ { s \in S _ { d , c } } b _ { h , m } ( s )
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $s \in S _ { d , c }$ denotes a sample $s$ (in our case, an image) of condition $c$ from dataset $d$ . Note that this measure can only be zero if the accuracy of $h$ and $m$ are exactly the same in each dataset and condition.
|
| 54 |
+
|
| 55 |
+
Error consistency $E ( m )$ [32] tracks whether there is above-chance consistency. This is an important distinction, since e.g. two decision makers with $9 5 \%$ accuracy each will have at least $90 \%$ observed consistency, even if their $5 \%$ errors occur on non-overlapping subsets of the test data (intuitively, they both get most images correct and thus observed overlap is high). To this end, error consistency (a.k.a. Cohen’s kappa, cf. [52]) indicates whether the observed consistency is larger than what could have been expected given two independent binomial decision makers with matched accuracy, which we denote as $\hat { o } _ { h , m }$ . This can easily be computed analytically [e.g. 32, equation 1]. Then, the average error consistency is given by
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
E ( m ) : \mathbb { R } \to [ - 1 , 1 ] , m \mapsto \frac { 1 } { | D | } \sum _ { d \in D } \frac { 1 } { | H _ { d } | } \sum _ { h \in H _ { d } } \frac { 1 } { | C _ { d } | } \sum _ { c \in C _ { d } } \frac { \big ( \frac { 1 } { | S _ { d , c } | } \sum _ { s \in S _ { d , c } } b _ { h , m } ( s ) \big ) - \hat { o } _ { h , m } ( S _ { d , c } ) } { 1 - \hat { o } _ { h , m } ( S _ { d , c } ) }
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
Benchmark $\pmb { \& }$ toolbox. $A ( m ) , O ( m )$ and $E ( m )$ each quantify a certain aspect of the humanmachine gap. We use the mean rank order across these metrics to determine an overall model ranking (Table 2 in the Appendix). However, we would like to emphasise that the primary purpose of this benchmark is to generate insights, not winners. Since insights are best gained from detailed plots and analyses, we open-source modelvshuman, a Python project to benchmark models against human data.3 The current model zoo already includes $5 0 +$ models, and an option to add new ones (both PyTorch and TensorFlow). Evaluating a model produces a $1 5 +$ page report on model behaviour. All plots in this paper can be generated for future models—to track whether they narrow the gap towards human vision, or to determine whether an algorithmic modification to a baseline model (e.g., an architectural improvement) changes model behaviour.
|
| 62 |
+
|
| 63 |
+
# 3 Robustness across models: the OOD distortion robustness gap between human and machine vision is closing
|
| 64 |
+
|
| 65 |
+
We are interested in measuring whether we are making progress in closing the gap between human and machine vision. For a long time, CNNs were unable to match human robustness in terms of generalisation beyond the training distribution—a large OOD distortion robustness gap [14, 33, 53– 55]. Having tested human observers on 17 OOD datasets, we are now able to compare the latest developments in machine vision to human perception. Our core results are shown in Figure 1: the OOD distortion robustness gap between human and machine vision is closing (1a, 1b), especially for models trained on large-scale datasets. On the individual image level, a human-machine consistency gap remains (especially 1d), which will be discussed later.
|
| 66 |
+
|
| 67 |
+
Self-supervised models “If intelligence is a cake, the bulk of the cake is unsupervised learning, the icing on the cake is supervised learning and the cherry on the cake is reinforcement learning”,
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 1: Core results, aggregated over 17 out-of-distribution (OOD) datasets: The OOD robustness gap between human and machine vision is closing (top), but an image-level consistency gap remains (bottom). Results compare humans, standard supervised CNNs, self-supervised models, adversarially trained models, vision transformers, noisy student, BiT, SWSL and CLIP. For convenience, $\downarrow$ marks models that are trained on large-scale datasets. Metrics defined in Section 2. Best viewed on screen.
|
| 71 |
+
|
| 72 |
+
Yann LeCun said in 2016 [56]. A few years later, the entire cake is finally on the table—the representations learned via self-supervised learning4 now compete with supervised methods on ImageNet [43] and outperform supervised pre-training for object detection [41]. But how do recent self-supervised models differ from their supervised counterparts in terms of their behaviour? Do they bring machine vision closer to human vision? Humans, too, rapidly learn to recognise new objects without requiring hundreds of labels per instance; additionally a number of studies reported increased similarities between self-supervised models and human perception [57–61]. Figure 2 compares the generalisation behaviour of eight self-supervised models in orange (PIRL, MoCo, MoCoV2, InfoMin, InsDis, SimCLR-x1, SimCLR-x2, SimCLR-x4)—with 24 standard supervised models (grey). We find only marginal differences between self-supervised and supervised models: Across distortion types, self-supervised networks are well within the range of their poorly generalising supervised counterparts. However, there is one exception: the three SimCLR variants show strong generalisation improvements on uniform noise, low contrast, and high-pass images, where they are the three topperforming self-supervised networks—quite remarkable given that SimCLR models were trained on a different set of augmentations (random crop with flip and resize, colour distortion, and Gaussian blur). Curious by the outstanding performance of SimCLR, we asked whether the self-supervised objective function or the choice of training data augmentations was the defining factor. When comparing self-supervised SimCLR models with augmentation-matched baseline models trained in the standard supervised fashion (Figure 15 in the Appendix), we find that the augmentation scheme (rather than the self-supervised objective) indeed made the crucial difference: supervised baselines show just the same generalisation behaviour, a finding that fits well with [62], who observed that the influence of training data augmentations is stronger than the role of architecture or training objective. In conclusion, our analyses indicate that the “cake” of contrastive self-supervised learning currently (and disappointingly) tastes much like the “icing”.
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 2: The OOD distortion robustness gap between human and machine vision is closing. Robustness towards parametric distortions for humans, standard supervised CNNs, self-supervised models, adversarially trained models, vision transformers, noisy student, BiT, SWSL, CLIP. Symbols indicate architecture type ( $\bigcirc$ convolutional, $\bigtriangledown$ vision transformer, $\diamondsuit$ human); best viewed on screen.
|
| 76 |
+
|
| 77 |
+
Adversarially trained models The vulnerability of CNNs to adversarial input perturbations is, arguably, one of the most striking shortcomings of this model class compared to robust human perception. A successful method to increase adversarial robustness is adversarial training [e.g. 63, 64]. The resulting models were found to transfer better, have meaningful gradients [65], and enable interpolating between two input images [66]: “robust optimization can actually be viewed as inducing a human prior over the features that models are able to learn” [67, p. 10]. Therefore, we include five models with a ResNet-50 architecture and different accuracy-robustness tradeoffs, adversarially trained on ImageNet with Microsoft-scale resources by [46] to test whether models with “perceptually-aligned representations” also show human-aligned OOD generalisation behaviour—as we would hope. This is not the case: the stronger the model is trained adversarially (darker shades of blue in Figure 2), the more susceptible it becomes to (random) image degradations. Most strikingly, a simple rotation by 90 degrees leads to a $50 \%$ drop in classification accuracy. Adversarial robustness seems to come at the cost of increased vulnerability to large-scale perturbations.5 On the other hand, there is a silver lining: when testing whether models are biased towards texture or shape by testing them on cue conflict images (Figure 3), in accordance with [69, 70] we observe a perfect relationship between shape bias and the degree of adversarial training, a big step in the direction of human shape bias (and a stronger shape bias than nearly all other models).
|
| 78 |
+
|
| 79 |
+
Vision transformers In computer vision, convolutional networks have become by far the dominating model class over the last decade. Vision transformers [47] break with the long tradition of using convolutions and are rapidly gaining traction [71]. We find that the best vision transformer (ViT-L trained on 14M images) even exceeds human OOD accuracy (Figure 1a shows the average across 17 datasets). There appears to be an additive effect of architecture and data: vision transformers trained on 1M images (light green) are already better than standard convolutional models; training on 14M images (dark green) gives another performance boost. In line with [72, 73], we observe a higher shape bias compared to most standard CNNs.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 3: Shape vs. texture biases of different models. While human shape bias is not yet matched, several approaches improve over vanilla CNNs. Box plots show category-dependent distribution of shape / texture biases (shape bias: high values, texture bias: low values).
|
| 83 |
+
|
| 84 |
+
Standard models trained on more data: BiT-M, SWSL, Noisy Student Interestingly, the biggest effect on OOD robustness we find simply comes from training on larger datasets, not from advanced architectures. When standard models are combined with large-scale training (14M images for BiT-M, 300M for Noisy Student and a remarkable 940M for SWSL), OOD accuracies reach levels not known from standard ImageNet-trained models; these models even outperform a more powerful architecture (vision transformer ViT-S) trained on less data (1M) as shown in Figure 1a. Simply training on (substantially) more data substantially narrows the gap to human OOD accuracies (1b), a finding that we quantified in Appendix H by means of a regression model. (The regression model also revealed a significant interaction between dataset size and objective function, as well as a significant main effect for transformers over CNNs.) Noisy Student in particular outperforms humans by a large margin overall (Figure 1a)—the beginning of a new human-machine gap, this time in favour of machines?
|
| 85 |
+
|
| 86 |
+
CLIP CLIP is special: trained on 400M images6 (more data) with joint language-image supervision (novel objective) and a vision transformer backbone (non-standard architecture), it scores close to humans across all of our metrics presented in Figure 1; most strikingly in terms of error consistency (which will be discussed in the next section). We tested a number of hypotheses to disentangle why CLIP appears “special”. H1: because CLIP is trained on a lot of data? Presumably no: Noisy Student—a model trained on a comparably large dataset of 300M images—performs very well on OOD accuracy, but poorly on error consistency. A caveat in this comparison is the quality of the labels: while Noisy Student uses pseudolabeling, CLIP receives web-based labels for all images. H2: because CLIP receives higher-quality labels? About $6 \%$ of ImageNet labels are plainly wrong [74]. Could it be the case that CLIP simply performs better since it doesn’t suffer from this issue? In order to test this, we used CLIP to generate new labels for all 1.3M ImageNet images: (a) hard labels, i.e. the top-1 class predicted by CLIP; and (b) soft labels, i.e. using CLIP’s full posterior distribution as a target. We then trained ResNet-50 from scratch on CLIP hard and soft labels (for details see Appendix E). However, this does not show any robustness improvements over a vanilla ImageNet-trained ResNet-50, thus different/better labels are not a likely root cause. H3: because CLIP has a special image+text loss? Yes and no: CLIP training on ResNet-50 leads to astonishingly poor OOD results, so training a standard model with CLIP loss alone is insufficient. However, while neither architecture nor loss alone sufficiently explain why CLIP is special, we find a clear interaction between architecture and loss (described in more detail in the Appendix along with the other “CLIP ablation” experiments mentioned above).
|
| 87 |
+
|
| 88 |
+
# 4 Consistency between models: data-rich models narrow the substantial image-level consistency gap between human and machine vision
|
| 89 |
+
|
| 90 |
+
In the previous section we have seen that while self-supervised and adversarially trained models lack OOD distortion robustness, models based on vision transformers and/or trained on large-scale datasets now match or exceed human feedforward performance on most datasets. Behaviourally, a natural follow-up question is to ask not just how many, but which errors models make—i.e., do they make errors on the same individual images as humans on OOD data (an important characteristic of a “human-like” model, cf. [32, 75])? This is quantified via error consistency (defined in Section 2); which additionally allows us to compare models with each other, asking e.g. which model classes make similar errors. In Figure 4, we compare all models with each other and with humans, asking whether they make errors on the same images. On this particular dataset (sketch images), we can see one big model cluster. Irrespective of whether one takes a standard supervised model, a selfsupervised model, an adversarially trained model or a vision transformer, all those models make highly systematic errors (which extends the results of [32, 76] who found similarities between standard vanilla CNNs). Humans, on the other hand, show a very different pattern of errors. Interestingly, the boundary between humans and some data-rich models at the bottom of the figure—especially CLIP (400M images) and SWSL (940M)—is blurry: some (but not all) data-rich models much more closely mirror the patterns of errors that humans make, and we identified the first models to achieve higher error consistency with humans than with other (standard) models. Are these promising results shared across datasets, beyond the sketch images? In Figures 1c and 1d, aggregated results over 17 datasets are presented. Here, we can see that data-rich models approach human-to-human observed consistency, but not error consistency. Taken in isolation, observed consistency is not a good measure of image-level consistency since it does not take consistency by chance into account; error consistency tracks whether there is consistency beyond chance; here we see that there is still a substantial image-level consistency gap between human and machine vision. However, several models improve over vanilla CNNs, especially BiT-M (trained on 14M images) and CLIP (400M images). This progress is non-trivial; at the same time, there is ample room for future improvement.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 4: Data-rich models narrow the substantial image-level consistency gap between humans and machines. Error consistency analysis on a single dataset (sketch images; for other datasets see Appendix, Figures 9, 11, 12, 13, 14) shows that most models cluster (dark red $=$ highly consistent errors) irrespective of their architecture and objective function; humans cluster differently (high human-to-human consistency, low human-to-model consistency); but some data-rich models including CLIP and SWSL blur the boundary, making more human-like errors than standard models.
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 5: Partial failure, partial success: Error consistency with humans aggregated over multiple datasets. Left: 12 datasets where model accuracies exceed human accuracies; here, there is still a substantial image-level consistency gap to humans. Right: 5 datasets (sketch, silhouette, edge, cue conflict, low-pass) where humans are more robust. Here, OOD accuracy is a near-perfect predictor of image-level consistency; especially data-rich models (e.g. CLIP, SWSL, BiT) narrow the consistency gap to humans. Symbols indicate architecture type $\bigcirc$ convolutional, $\bigtriangledown$ vision transformer, $\diamondsuit$ human).
|
| 97 |
+
|
| 98 |
+
How do the findings from Figure 4 (showing nearly human-level error consistency for sketch images) and from Figure 1d (showing a substantial consistency gap when aggregating over 17 datasets) fit together? Upon closer inspection, we discovered that there are two distinct cases. On 12 datasets (stylized, colour/greyscale, contrast, high-pass, phase-scrambling, power-equalisation, false colour, rotation, eidolonI, -II and -III as well as uniform noise), the human-machine gap is large; here, more robust models do not show improved error consistency (as can be see in Figure 5a). On the other hand, for five datasets (sketch, silhouette, edge, cue conflict, low-pass filtering), there is a completely different result pattern: Here, OOD accuracy is a near-perfect predictor of error consistency, which means that improved generalisation robustness leads to more human-like errors (Figure 5b). Furthermore, training on large-scale datasets leads to considerable improvements along both axes for standard CNNs. Within models trained on larger datasets, CLIP scores best; but models with a standard architecture (SWSL: based on ResNet-50 and ResNeXt-101) closely follow suit.
|
| 99 |
+
|
| 100 |
+
It remains an open question why the training dataset appears to have the most important impact on a model’s decision boundary as measured by error consistency (as opposed to other aspects of a model’s inductive bias). Datasets contain various shortcut opportunities [14], and if two different models are trained on similar data, they might converge to a similar solution simply by exploiting the same shortcuts—which would also fit well to the finding that adversarial examples typically transfer very well between different models [77, 78]. Making models more flexible (such as transformers, a generalisation of CNNs) wouldn’t change much in this regard, since flexible models can still exploit the same shortcuts. Two predictions immediately follow from this hypothesis: (1.) error consistency between two identical models trained on very different datasets, such as ImageNet vs. Stylized-ImageNet, is much lower than error consistency between very different models (ResNet-50 vs. VGG-16) trained on the same dataset. (2.) error consistency between ResNet-50 and a highly flexible model (e.g., a vision transformer) is much higher than error consistency between ResNet-50 and a highly constrained model like BagNet-9 [79]. We provide evidence for both predictions in Appendix B, which makes the shortcut hypothesis of model similarity a potential starting point for future analyses. Looking forward, it may be worth exploring the links between shortcut learning and image difficulty, such as understanding whether many “trivially easy” images in common datasets like ImageNet causes models to expoit the same characteristics irrespective of their architecture [80].
|
| 101 |
+
|
| 102 |
+
# 5 Discussion
|
| 103 |
+
|
| 104 |
+
Summary We set out to answer the question: Are we making progress in closing the gap between human and machine vision? In order to quantify progress, we performed large-scale psychophysical experiments on 17 out-of-distribution distortion datasets (open-sourced along with evaluation code as a benchmark to track future progress). We then investigated models that push the boundaries of traditional deep learning (different objective functions, architectures, and dataset sizes ranging from 1M to 1B), asking how they perform relative to human visual perception. We found that the OOD distortion robustness gap between human and machine vision is closing, as the best models now match or exceed human accuracies. At the same time, an image-level consistency gap remains; however, this gap that is at least in some cases narrowing for models trained on large-scale datasets.
|
| 105 |
+
|
| 106 |
+
Limitations Model robustness is studied from many different viewpoints, including adversarial robustness [77], theoretical robustness guarantees [e.g. 81], or label noise robustness [e.g. 82]. The focus of our study is robustness towards non-adversarial out-of-distribution data, which is particularly well-suited for comparisons with humans. Since we aimed at a maximally fair comparison between feedforward models and human perception, presentation times for human observers were limited to $2 0 0 \mathrm { { m s } }$ in order to limit the influence of recurrent processing. Therefore, human ceiling performance might be higher still (given more time); investigating this would mean going beyond “core object recognition”, which happens within less than $2 0 0 ~ \mathrm { { m s } }$ during a single fixation [83]. Furthermore, human and machine vision can be compared in many different ways. This includes comparing against neural data [84, 85], contrasting Gestalt effects [e.g. 86], object similarity judgments [87], or mid-level properties [61] and is of course not limited to studying object recognition. By no means do we mean to imply that our behavioural comparison is the only feasible option—on the contrary, we believe it will be all the more exciting to investigate whether our behavioural findings have implications for other means of comparison!
|
| 107 |
+
|
| 108 |
+
Discussion We have to admit that we view our results concerning the benefits of increasing dataset size by one-to-three orders of magnitude with mixed feelings. On the one hand, “simply” training standard models on (a lot) more data certainly has an intellectually disappointing element—particularly given many rich ideas in the cognitive science and neuroscience literature on which architectural changes might be required to bring machine vision closer to human vision [88–93]. Additionally, large-scale training comes with infrastructure demands that are hard to meet for many academic researchers. On the other hand, we find it truly exciting to see that machine models are closing not just the OOD distortion robustness gap to humans, but that also, at least for some datasets, those models are actually making more human-like decisions on an individual image level; image-level response consistency is a much stricter behavioural requirement than just e.g. matching overall accuracies. Taken together, our results give reason to celebrate partial success in closing the gap between human and machine vision. In those cases where there is still ample room for improvement, our psychophysical benchmark datasets and toolbox may prove useful in quantifying future progress.
|
| 109 |
+
|
| 110 |
+
# Acknowledgments and disclosure of funding
|
| 111 |
+
|
| 112 |
+
We thank Andreas Geiger, Simon Kornblith, Kristof Meding, Claudio Michaelis and Ludwig Schmidt for helpful discussions regarding different aspects of this work; Lukas Huber, Maximus Mutschler, David-Elias Künstle for feedback on the manuscript; Ken Kahn for pointing out typos; Santiago Cadena for sharing a PyTorch implementation of SimCLR; Katherine Hermann and her collaborators for providing supervised SimCLR baselines; Uli Wannek and Silke Gramer for infrastructure/administrative support; the many authors who made their models publicly available; and our anonymous reviewers for many valuable suggestions.
|
| 113 |
+
|
| 114 |
+
Furthermore, we are grateful to the International Max Planck Research School for Intelligent Systems (IMPRSIS) for supporting R.G.; the Collaborative Research Center (Projektnummer 276693517—SFB 1233: Robust Vision) for supporting M.B. and F.A.W. This work was supported by the German Federal Ministry of Education and Research (BMBF): Tübingen AI Center, FKZ: 01IS18039A (W.B. and M.B.). F.A.W. is a member of the Machine Learning Cluster of Excellence, EXC number 2064/1—Project number 390727645. M.B. and W.B. acknowledge funding from the MICrONS program of the Intelligence Advanced Research Projects Activity (IARPA) via Department of Interior/Interior Business Center (DoI/IBC) contract number D16PC00003. W.B. acknowledges financial support via the Emmy Noether Research Group on The Role of Strong Response Consistency for Robust and Explainable Machine Vision funded by the German Research Foundation (DFG) under grant no. BR 6382/1-1.
|
| 115 |
+
|
| 116 |
+
# Author contributions
|
| 117 |
+
|
| 118 |
+
Project idea: R.G. and W.B.; project lead: R.G.; coding toolbox and model evaluation pipeline: R.G., K.N. and B.M. based on a prototype by R.G.; training models: K.N. with input from R.G., W.B. and M.B.; data visualisation: R.G., B.M. and K.N. with input from M.B., F.A.W. and W.B.; psychophysical data collection: T.T. (12 datasets) and B.M. (2 datasets) under the guidance of R.G. and F.A.W.; curating stimuli: R.G.; interpreting analyses and findings: R.G., M.B., F.A.W. and W.B.; guidance, feedback, infrastructure & funding acquisition: M.B., F.A.W. and W.B.; paper writing: R.G. with help from F.A.W. and W.B. and input from all other authors.
|
| 119 |
+
|
| 120 |
+
# References
|
| 121 |
+
|
| 122 |
+
[1] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, pages 1097–1105, 2012.
|
| 123 |
+
[2] Jinjiang Wang, Yulin Ma, Laibin Zhang, Robert X Gao, and Dazhong Wu. Deep learning for smart manufacturing: Methods and applications. Journal of Manufacturing Systems, 48:144–156, 2018.
|
| 124 |
+
[3] Javier Villalba-Diez, Daniel Schmidt, Roman Gevers, Joaquín Ordieres-Meré, Martin Buchwitz, and Wanja Wellbrock. Deep learning for industrial computer vision quality control in the printing industry 4.0. Sensors, 19(18):3987, 2019.
|
| 125 |
+
[4] Christof Angermueller, Tanel Pärnamaa, Leopold Parts, and Oliver Stegle. Deep learning for computational biology. Molecular Systems Biology, 12(7):878, 2016.
|
| 126 |
+
[5] Adam H Marblestone, Greg Wayne, and Konrad P Kording. Toward an integration of deep learning and neuroscience. Frontiers in Computational Neuroscience, 10:94, 2016.
|
| 127 |
+
[6] Garrett B Goh, Nathan O Hodas, and Abhinav Vishnu. Deep learning for computational chemistry. Journal of Computational Chemistry, 38(16):1291–1307, 2017.
|
| 128 |
+
[7] Travers Ching, Daniel S Himmelstein, Brett K Beaulieu-Jones, Alexandr A Kalinin, Brian T Do, Gregory P Way, Enrico Ferrero, Paul-Michael Agapow, Michael Zietz, Michael M Hoffman, et al. Opportunities and obstacles for deep learning in biology and medicine. Journal of The Royal Society Interface, 15(141): 20170387, 2018.
|
| 129 |
+
[8] Dan Guest, Kyle Cranmer, and Daniel Whiteson. Deep learning and its application to LHC physics. Annual Review of Nuclear and Particle Science, 68:161–181, 2018.
|
| 130 |
+
[9] Andrew W Senior, Richard Evans, John Jumper, James Kirkpatrick, Laurent Sifre, Tim Green, Chongli Qin, Augustin Žídek, Alexander WR Nelson, Alex Bridgland, et al. Improved protein structure prediction using potentials from deep learning. Nature, 577(7792):706–710, 2020.
|
| 131 |
+
[10] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
|
| 132 |
+
[11] Jason Jo and Yoshua Bengio. Measuring the tendency of cnns to learn surface statistical regularities. arXiv preprint arXiv:1711.11561, 2017.
|
| 133 |
+
[12] Sara Beery, Grant Van Horn, and Pietro Perona. Recognition in terra incognita. In Proceedings of the European Conference on Computer Vision, pages 456–473, 2018.
|
| 134 |
+
[13] Timothy Niven and Hung-Yu Kao. Probing neural network comprehension of natural language arguments. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4658–4664, 2019.
|
| 135 |
+
[14] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2:665–673, 2020.
|
| 136 |
+
[15] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019.
|
| 137 |
+
[16] Haohan Wang, Songwei Ge, Eric P Xing, and Zachary C Lipton. Learning robust global representations by penalizing local predictive power. arXiv preprint arXiv:1905.13549, 2019.
|
| 138 |
+
[17] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019.
|
| 139 |
+
[18] Michael A Alcorn, Qi Li, Zhitao Gong, Chengfei Wang, Long Mai, Wei-Shinn Ku, and Anh Nguyen. Strike (with) a pose: Neural networks are easily fooled by strange poses of familiar objects. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
|
| 140 |
+
[19] Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
|
| 141 |
+
[20] Andrei Barbu, David Mayo, Julian Alverio, William Luo, Christopher Wang, Dan Gutfreund, Josh Tenenbaum, and Boris Katz. ObjectNet: a large-scale bias-controlled dataset for pushing the limits of object recognition models. In Advances in Neural Information Processing Systems, pages 9448–9458, 2019.
|
| 142 |
+
[21] Claudio Michaelis, Benjamin Mitzkus, Robert Geirhos, Evgenia Rusak, Oliver Bringmann, Alexander S Ecker, Matthias Bethge, and Wieland Brendel. Benchmarking robustness in object detection: Autonomous driving when winter is coming. arXiv:1907.07484, 2019.
|
| 143 |
+
[22] Rohan Taori, Achal Dave, Vaishaal Shankar, Nicholas Carlini, Benjamin Recht, and Ludwig Schmidt. Measuring robustness to natural distribution shifts in image classification. In Advances in Neural Information Processing Systems, 2020.
|
| 144 |
+
[23] Josip Djolonga, Jessica Yung, Michael Tschannen, Rob Romijnders, Lucas Beyer, Alexander Kolesnikov, Joan Puigcerver, Matthias Minderer, Alexander D’Amour, Dan Moldovan, et al. On robustness and transferability of convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 16458–16468, 2021.
|
| 145 |
+
[24] Isaac Dunn, Hadrien Pouget, Daniel Kroening, and Tom Melham. Exposing previously undetectable faults in deep neural networks. arXiv preprint arXiv:2106.00576, 2021.
|
| 146 |
+
[25] Yue He, Zheyan Shen, and Peng Cui. Towards non-iid image classification: A dataset and baselines. Pattern Recognition, 110:107383, 2021.
|
| 147 |
+
[26] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 8340–8349, 2021.
|
| 148 |
+
[27] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 15262–15271, 2021.
|
| 149 |
+
[28] Spandan Madan, Tomotake Sasaki, Tzu-Mao Li, Xavier Boix, and Hanspeter Pfister. Small in-distribution changes in 3D perspective and lighting fool both CNNs and transformers. arXiv preprint arXiv:2106.16198, 2021.
|
| 150 |
+
[29] Vaishaal Shankar, Achal Dave, Rebecca Roelofs, Deva Ramanan, Benjamin Recht, and Ludwig Schmidt. Do image classifiers generalize across time? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 9661–9669, 2021.
|
| 151 |
+
[30] David M. Green. Consistency of auditory detection judgments. Psychological Review, 71(5):392–407, 1964.
|
| 152 |
+
[31] Kristof Meding, Dominik Janzing, Bernhard Schölkopf, and Felix A. Wichmann. Perceiving the arrow of time in autoregressive motion. Advances in Neural Information Processing Systems (NeurIPS), 32: 2303–2314, 2019.
|
| 153 |
+
[32] Robert Geirhos, Kristof Meding, and Felix A Wichmann. Beyond accuracy: quantifying trial-by-trial behaviour of CNNs and humans by measuring error consistency. Advances in Neural Information Processing Systems, 33, 2020.
|
| 154 |
+
[33] Robert Geirhos, Carlos RM Temme, Jonas Rauber, Heiko H Schütt, Matthias Bethge, and Felix A Wichmann. Generalisation in humans and deep neural networks. In Advances in Neural Information Processing Systems, 2018.
|
| 155 |
+
[34] George A Miller. WordNet: a lexical database for English. Communications of the ACM, 38(11):39–41, 1995.
|
| 156 |
+
[35] Philip L Smith and Daniel R Little. Small is beautiful: In defense of the small-N design. Psychonomic Bulletin & Review, 25(6):2083–2101, 2018.
|
| 157 |
+
[36] Siavash Haghiri, Patricia Rubisch, Robert Geirhos, Felix Wichmann, and Ulrike von Luxburg. Comparisonbased framework for psychophysics: lab versus crowdsourcing. arXiv preprint arXiv:1905.07234, 2019.
|
| 158 |
+
[37] Sébastien Marcel and Yann Rodriguez. Torchvision the machine-vision package of torch. In Proceedings of the 18th ACM International Conference on Multimedia, pages 1485–1488, 2010.
|
| 159 |
+
[38] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018.
|
| 160 |
+
[39] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020.
|
| 161 |
+
[40] Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020.
|
| 162 |
+
[41] Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6707–6717, 2020.
|
| 163 |
+
[42] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. arXiv preprint arXiv:2005.10243, 2020.
|
| 164 |
+
[43] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020.
|
| 165 |
+
[44] Robert Geirhos, Kantharaju Narayanappa, Benjamin Mitzkus, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. On the surprising similarities between supervised and self-supervised models. arXiv preprint arXiv:2010.08377, 2020.
|
| 166 |
+
[45] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (BiT): General visual representation learning. arXiv preprint arXiv:1912.11370, 6 (2):8, 2019.
|
| 167 |
+
[46] Hadi Salman, Andrew Ilyas, Logan Engstrom, Ashish Kapoor, and Aleksander Madry. Do adversarially robust ImageNet models transfer better? arXiv preprint arXiv:2007.08489, 2020.
|
| 168 |
+
[47] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
|
| 169 |
+
[48] Ross Wightman. PyTorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
|
| 170 |
+
[49] I Zeki Yalniz, Hervé Jégou, Kan Chen, Manohar Paluri, and Dhruv Mahajan. Billion-scale semi-supervised learning for image classification. arXiv preprint arXiv:1905.00546, 2019.
|
| 171 |
+
[50] Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V Le. Self-training with noisy student improves ImageNet classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 10687–10698, 2020.
|
| 172 |
+
[51] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021.
|
| 173 |
+
[52] Jacob Cohen. A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20(1):37–46, 1960.
|
| 174 |
+
[53] Samuel Dodge and Lina Karam. A study and comparison of human and deep learning recognition performance under visual distortions. In 26th International Conference on Computer Communication and Networks, pages 1–7. IEEE, 2017.
|
| 175 |
+
[54] Felix A Wichmann, David HJ Janssen, Robert Geirhos, Guillermo Aguilar, Heiko H Schütt, Marianne Maertens, and Matthias Bethge. Methods and measurements to compare men against machines. Electronic Imaging, Human Vision and Electronic Imaging, 2017(14):36–45, 2017.
|
| 176 |
+
[55] Thomas Serre. Deep learning: the good, the bad, and the ugly. Annual Review of Vision Science, 5:399–426, 2019.
|
| 177 |
+
[56] Yann LeCun. Predictive learning, 2016. URL https://www.youtube.com/watch?v=Ount2Y4qxQo.
|
| 178 |
+
[57] William Lotter, Gabriel Kreiman, and David Cox. A neural network trained for prediction mimics diverse features of biological neurons and perception. Nature Machine Intelligence, 2(4):210–219, 2020.
|
| 179 |
+
[58] A Emin Orhan, Vaibhav V Gupta, and Brenden M Lake. Self-supervised learning through the eyes of a child. arXiv preprint arXiv:2007.16189, 2020.
|
| 180 |
+
[59] Talia Konkle and George A Alvarez. Instance-level contrastive learning yields human brain-like representation without category-supervision. bioRxiv, 2020.
|
| 181 |
+
[60] Chengxu Zhuang, Siming Yan, Aran Nayebi, Martin Schrimpf, Michael Frank, James DiCarlo, and Daniel Yamins. Unsupervised neural network models of the ventral visual stream. bioRxiv, 2020.
|
| 182 |
+
[61] Katherine R Storrs, Barton L Anderson, and Roland W Fleming. Unsupervised learning predicts human perception and misperception of gloss. Nature Human Behaviour, pages 1–16, 2021.
|
| 183 |
+
[62] Katherine Hermann, Ting Chen, and Simon Kornblith. The origins and prevalence of texture bias in convolutional neural networks. Advances in Neural Information Processing Systems, 33, 2020.
|
| 184 |
+
[63] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 185 |
+
[64] Ruitong Huang, Bing Xu, Dale Schuurmans, and Csaba Szepesvári. Learning with a strong adversary. arXiv preprint arXiv:1511.03034, 2015.
|
| 186 |
+
[65] Simran Kaur, Jeremy Cohen, and Zachary C Lipton. Are perceptually-aligned gradients a general property of robust classifiers? arXiv preprint arXiv:1910.08640, 2019.
|
| 187 |
+
[66] Shibani Santurkar, Dimitris Tsipras, Brandon Tran, Andrew Ilyas, Logan Engstrom, and Aleksander Madry. Image synthesis with a single (robust) classifier. arXiv:1906.09453, 2019.
|
| 188 |
+
[67] Logan Engstrom, Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Brandon Tran, and Aleksander Madry. Adversarial robustness as a prior for learned representations. arXiv preprint arXiv:1906.00945, 2019.
|
| 189 |
+
[68] Florian Tramèr, Jens Behrmann, Nicholas Carlini, Nicolas Papernot, and Jörn-Henrik Jacobsen. Fundamental tradeoffs between invariance and sensitivity to adversarial perturbations. In International Conference on Machine Learning, pages 9561–9571. PMLR, 2020.
|
| 190 |
+
[69] Tianyuan Zhang and Zhanxing Zhu. Interpreting adversarially trained convolutional neural networks. In International Conference on Machine Learning, pages 7502–7511. PMLR, 2019.
|
| 191 |
+
[70] Peijie Chen, Chirag Agarwal, and Anh Nguyen. The shape and simplicity biases of adversarially robust ImageNet-trained CNNs. arXiv preprint arXiv:2006.09373, 2020.
|
| 192 |
+
[71] Kai Han, Yunhe Wang, Hanting Chen, Xinghao Chen, Jianyuan Guo, Zhenhua Liu, Yehui Tang, An Xiao, Chunjing Xu, Yixing Xu, et al. A survey on visual transformer. arXiv preprint arXiv:2012.12556, 2020.
|
| 193 |
+
[72] Muzammal Naseer, Kanchana Ranasinghe, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang. Intriguing properties of vision transformers. arXiv preprint arXiv:2105.10497, 2021.
|
| 194 |
+
[73] Shikhar Tuli, Ishita Dasgupta, Erin Grant, and Thomas L Griffiths. Are convolutional neural networks or transformers more like human vision? arXiv preprint arXiv:2105.07197, 2021.
|
| 195 |
+
[74] Curtis G Northcutt, Anish Athalye, and Jonas Mueller. Pervasive label errors in test sets destabilize machine learning benchmarks. arXiv preprint arXiv:2103.14749, 2021.
|
| 196 |
+
[75] Rishi Rajalingham, Elias B Issa, Pouya Bashivan, Kohitij Kar, Kailyn Schmidt, and James J DiCarlo. Large-scale, high-resolution comparison of the core visual object recognition behavior of humans, monkeys, and state-of-the-art deep artificial neural networks. Journal of Neuroscience, 38(33):7255–7269, 2018.
|
| 197 |
+
[76] Horia Mania, John Miller, Ludwig Schmidt, Moritz Hardt, and Benjamin Recht. Model similarity mitigates test set overuse. Advances in Neural Information Processing Systems, 2019.
|
| 198 |
+
[77] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv:1312.6199, 2013.
|
| 199 |
+
[78] Florian Tramèr, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. The space of transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017.
|
| 200 |
+
[79] Wieland Brendel and Matthias Bethge. Approximating CNNs with bag-of-local-features models works surprisingly well on ImageNet. In International Conference on Learning Representations, 2019.
|
| 201 |
+
[80] Kristof Meding, Luca M Schulze Buschoff, Robert Geirhos, and Felix A Wichmann. Trivial or impossible–dichotomous data difficulty masks model differences (on ImageNet and beyond). arXiv preprint arXiv:2110.05922, 2021.
|
| 202 |
+
[81] Matthias Hein and Maksym Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. arXiv preprint arXiv:1705.08475, 2017.
|
| 203 |
+
[82] Arash Vahdat. Toward robustness against label noise in training deep discriminative neural networks. arXiv preprint arXiv:1706.00038, 2017.
|
| 204 |
+
[83] James J DiCarlo, Davide Zoccolan, and Nicole C Rust. How does the brain solve visual object recognition? Neuron, 73(3):415–434, 2012.
|
| 205 |
+
[84] Daniel LK Yamins, Ha Hong, Charles F Cadieu, Ethan A Solomon, Darren Seibert, and James J DiCarlo. Performance-optimized hierarchical models predict neural responses in higher visual cortex. Proceedings of the National Academy of Sciences, 111(23):8619–8624, 2014.
|
| 206 |
+
[85] Jonas Kubilius, Martin Schrimpf, Kohitij Kar, Rishi Rajalingham, Ha Hong, Najib Majaj, Elias Issa, Pouya Bashivan, Jonathan Prescott-Roy, Kailyn Schmidt, et al. Brain-like object recognition with high-performing shallow recurrent ANNs. Advances in Neural Information Processing Systems, 32:12805–12816, 2019.
|
| 207 |
+
[86] Been Kim, Emily Reif, Martin Wattenberg, Samy Bengio, and Michael C Mozer. Neural networks trained on natural scenes exhibit Gestalt closure. Computational Brain & Behavior, pages 1–13, 2021.
|
| 208 |
+
[87] Martin N Hebart, Charles Y Zheng, Francisco Pereira, and Chris I Baker. Revealing the multidimensional mental representations of natural objects underlying human similarity judgements. Nature Human Behaviour, 4(11):1173–1185, 2020.
|
| 209 |
+
[88] Nikolaus Kriegeskorte. Deep neural networks: a new framework for modeling biological vision and brain information processing. Annual Review of Vision Science, 1:417–446, 2015.
|
| 210 |
+
[89] Brenden M Lake, Tomer D Ullman, Joshua B Tenenbaum, and Samuel J Gershman. Building machines that learn and think like people. Behavioral and Brain Sciences, 40, 2017.
|
| 211 |
+
[90] Amirhossein Tavanaei, Masoud Ghodrati, Saeed Reza Kheradpisheh, Timothée Masquelier, and Anthony Maida. Deep learning in spiking neural networks. Neural Networks, 111:47–63, 2019.
|
| 212 |
+
[91] Fabian H Sinz, Xaq Pitkow, Jacob Reimer, Matthias Bethge, and Andreas S Tolias. Engineering a less artificial intelligence. Neuron, 103(6):967–979, 2019.
|
| 213 |
+
[92] Joel Dapello, Tiago Marques, Martin Schrimpf, Franziska Geiger, David D Cox, and James J DiCarlo. Simulating a primary visual cortex at the front of CNNs improves robustness to image perturbations. bioRxiv, 2020.
|
| 214 |
+
[93] Benjamin D Evans, Gaurav Malhotra, and Jeffrey S Bowers. Biological convolutions improve dnn robustness to noise and generalisation. bioRxiv, 2021.
|
| 215 |
+
[94] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pages 8026–8037, 2019.
|
| 216 |
+
[95] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv:1807.03748, 2018.
|
| 217 |
+
[96] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: a large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255, 2009.
|
| 218 |
+
[97] Evgenia Rusak, Steffen Schneider, Peter Gehler, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. Adapting ImageNet-scale models to complex distribution shifts with self-learning. arXiv preprint arXiv:2104.12928, 2021.
|
| 219 |
+
[98] Eleanor Rosch. Principles of categorization. In E. Margolis and S. Laurence, editors, Concepts: core readings, pages 189–206. 1999.
|
md/train/RJ7XFI15Q8f/RJ7XFI15Q8f.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Achieving Forgetting Prevention and Knowledge Transfer in Continual Learning
|
| 2 |
+
|
| 3 |
+
Zixuan $\mathbf { K } \mathbf { e } ^ { 1 }$ , Bing Liu1, Nianzu $\mathbf { M } \mathbf { a } ^ { 1 }$ , $\mathbf { H } \mathbf { u } \mathbf { X } \mathbf { u } ^ { 2 }$ and Lei $\mathbf { S h u ^ { 3 * } }$
|
| 4 |
+
|
| 5 |
+
1Department of Computer Science, University of Illinois at Chicago 2Facebook AI Research 3Amazon AWS AI 1{zke4,liub,nma4}@uic.edu 2huxu@fb.com 3shulindt@gmail.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Continual learning (CL) learns a sequence of tasks incrementally with the goal of achieving two main objectives: overcoming catastrophic forgetting (CF) and encouraging knowledge transfer (KT) across tasks. However, most existing techniques focus only on overcoming CF and have no mechanism to encourage KT, and thus do not do well in KT. Although several papers have tried to deal with both CF and KT, our experiments show that they suffer from serious CF when the tasks do not have much shared knowledge. Another observation is that most current CL methods do not use pre-trained models, but it has been shown that such models can significantly improve the end task performance. For example, in natural language processing, fine-tuning a BERT-like pre-trained language model is one of the most effective approaches. However, for CL, this approach suffers from serious CF. An interesting question is how to make the best use of pre-trained models for CL. This paper proposes a novel model called CTR to solve these problems. Our experimental results demonstrate the effectiveness of CTR.2
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
This paper studies continual learning (CL) of a sequence of natural language processing (NLP) tasks in the task continual learning (Task-CL) setting. It aims to (i) prevent catastrophic forgetting (CF), and (ii) transfer knowledge across tasks. (ii) is particularly important because many tasks in NLP share similar knowledge that can be leveraged to achieve better accuracy. CF means that in learning a new task, the existing network parameters learned for the previous tasks may be modified, which degrades the performance of previous tasks [40]. In the Task-CL setting, the task id is provided for each test case in testing so that the specific model for the task in the network can be applied to classify the test case. Another popular CL setting is class continual learning, which does not provide the task id during testing but it is for solving a different type of problems.
|
| 14 |
+
|
| 15 |
+
Most existing CL papers focus on dealing with CF [21, 5]. There are also some papers that perform knowledge transfer. To achieve both objectives is highly challenging. To overcome CF in the Task-CL setting, we don’t want the training of the new task to update the model parameters learned for previous tasks to achieve model separation. But to transfer knowledge across tasks, we want the new task to leverage the knowledge learned from previous tasks for learning a better model (forward transfer) and also want the new task to enhance the performance of similar previous tasks (backward transfer).
|
| 16 |
+
|
| 17 |
+
This means it is necessary to update previous model parameters. This is a dilemma. Although several papers have tried to deal with both [22, 37], they were only tested using sentiment analysis tasks with strong shared knowledge. When tested with tasks that don’t have much shared knowledge, they suffer from severe CF (see Sec. 5.4). Those existing papers that focus on dealing with CF do not do well with knowledge transfer as they have no explicit mechanism to facilitate the transfer.
|
| 18 |
+
|
| 19 |
+
Another observation about the current CL research is that most techniques do not use pre-trained models. But such pre-trained models or feature extractors can significantly improve the CL performance [18, 24]. An important question is how to make the best use of pre-trained models in CL. This paper studies the problem as well using NLP tasks, but we believe that the developed ideas are also applicable to computer vision tasks because most pre-trained models are based on the transformer architecture [60]. We will see that the naive or the conventional way of directly adding the CL module on top of a pre-trained model is not the best choice (see Sec. 5.4).
|
| 20 |
+
|
| 21 |
+
In NLP, fine-tuning a BERT [8] like pre-trained language model has been regarded as one of the most effective techniques in applications [65, 57]. However, fine-tuning works poorly for continual learning. This is because the fine-tuned BERT for a task captures highly task-specific information [41], which is difficult to be used by other tasks. When fine-tuning for a new task, it has to update the already fine-tuned parameters for previous tasks, which causes serious CF (see Sec. 5.4).
|
| 22 |
+
|
| 23 |
+
This paper proposes a novel neural architecture to achieve both CF prevention and knowledge transfer, which also deals with the CF problem with BERT fine-tuning. The proposed system is called CTR (Capsules and Transfer Routing for continual learning). CTR inserts a continual learning plug-in (CL-plugin) module in two locations in BERT. With the pair of CL-plugin modules added to BERT, we no longer need to fine-tune BERT for each task, which causes CF in BERT, and yet we can achieve the power of BERT fine-tuning. CTR has some similarity to Adapter-BERT [16], which adds adapters in BERT for parameter efficient transfer learning such that different end tasks can have their separate adapters (which are very small in size) to adapt BERT for individual end tasks and to transfer the knowledge from BERT to the end tasks. Then, there is no need to employ a separate BERT and fine-tuning it for each task, which is extremely parameter inefficient if many tasks need to be learned. An adapter is a simple 2-layer fully-connected network for adapting BERT to a specific end task. A CL-plugin is very different from an adapter. We do not use a pair of CL-plugin modules to adapt BERT for each task. Instead, CTR learns all tasks using only one pair of CL-plugin modules inserted into BERT. A CL-plugin is a full CL network that can leverage a pre-trained model and deal with both CF and knowledge transfer. Specifically, it uses a capsule [15] to represent each task and a proposed transfer routing algorithm to identify and transfer knowledge across tasks to achieve improved accuracy. It further learns and uses task masks to protect task-specific knowledge to avoid forgetting. Empirical evaluations show that CTR outperforms strong baselines. Ablation experiments have also been conducted to study where to insert the CL-plugin module in BERT in order to achieve the best performance (see Sec. 5.4).
|
| 24 |
+
|
| 25 |
+
# 2 Related Work
|
| 26 |
+
|
| 27 |
+
Catastrophic Forgetting: Existing work in CL mainly focused on overcoming CF using the following approaches. (1) Regularization-based approaches, such as those in [27, 30, 51, 69], add a regularization in the loss to consolidate weights for previous tasks when learning a new task. (2) Replay-based approaches, such as those in [45, 36, 4, 63], retain some training data of old tasks and use them in learning a new task. The methods in [54, 20, 47, 14] learn data generators and generate old task data for learning a new task. (3) Parameter isolation-based approaches, such as those in [52, 21, 39, 10], allocate model parameters dedicated to different tasks and mask them out when learning a new task. (4) Gradient projection-based approaches [68] ensure the gradient updates occur only in the orthogonal direction to the input of old tasks and thus will not affect old tasks. Some recent papers used pre-trained models [18, 23, 24] and learn one class per task [18]. Tackling CF only deals with model deterioration. These methods perform worse than learning each task separately. An empirical study of the cause of CF and the impact of task similarity on CF was done in [44].
|
| 28 |
+
|
| 29 |
+
Some NLP applications have also dealt with CF. For example, CL models have been proposed for sentiment analysis [23, 24, 37, 43], dialogue slot filling [53], language modeling [58, 7], language learning [31], sentence embedding [33], machine translation [25], cross-lingual modeling [35], and question answering [12]. A dialogue CL dataset is also reported in [38].
|
| 30 |
+
|
| 31 |
+
Knowledge Transfer: Ideally, learning from a sequence of tasks should also allow multiple tasks to support each other via knowledge transfer. CAT [21] (a Task-CL system) works on a mixed sequence of similar and dissimilar tasks and can transfer knowledge among similar tasks detected automatically. Progressive Network [48] does forward transfer but it is for class continual learning (Class-CL).
|
| 32 |
+
|
| 33 |
+
Knowledge transfer in this paper is closely related to lifelong learning (LL), which aims to improve the new/last task learning without handling CF [56, 49, 5]. In the NLP area, NELL [3] performs LL information extraction, and several other papers worked on lifelong document sentiment classification (DSC) and aspect sentiment classification (ASC). [6] and [61] proposed two Naive Bayesian methods to help improve the new task learning. [64] proposed a LL approach based on voting. [55] used LL for aspect extraction. [43] and [62] used neural networks for DSC and ASC, respectively. Several papers also studied lifelong topic modeling [5, 13]. However, all these works do not deal with CF.
|
| 34 |
+
|
| 35 |
+
SRK [37] and KAN [22] try to deal with both CF and knowledge transfer in continual sentiment classification. However, they have two critical weaknesses: (i) Their RNN architectures cannot use plug-in or adapter modules to tune BERT, which significantly limits their power. (ii) Since they were mainly designed for knowledge transfer, they suffer from serious CF (see Sec. 5.4). B-CL [24] uses the adapter idea [16] to adapt BERT for sentiment analysis tasks, which are similar to each other. However, since its mechanism of dynamic routing for knowledge transfer is very week, its knowledge transfer ability is markedly poorer than CTR (see Sec. 5.4). CLASSIC [23] is another recent work on continual learning for knowledge transfer, but its CL setting is domain continual learning. Its knowledge transfer method is based on contrastive learning.
|
| 36 |
+
|
| 37 |
+
AdapterFusion [42] used adapters proposed in [16]. It proposes a two-stage method to learn a set of tasks. In the first stage, it learns one adapter for each task independently using the task’s training data. In the second stage, it uses the training data again to learn a good composition of the learned adapters in the first stage to produce the final model for all tasks. AdapterFusion basically tries to improve multi-task learning. It is not for continual learning and thus has no CF. As explained in Sec. 1, the CL-plugin concept in CTR is different from that of adapters for adapting BERT for each task. CL-plugins are continual learning systems that make use of a pre-trained model.
|
| 38 |
+
|
| 39 |
+
# 3 CTR Architecture
|
| 40 |
+
|
| 41 |
+
This section describes the general architecture of CTR. The details about its key component CLplugin is presented in the next section. Due to its good performance, BERT [8] and its transformer [60] architecture are used as the base in our model CTR. Since BERT fine-tuning is prone to CF (Sec. 1), we propose the CL plug-in idea, which is inspired by Adapter-BERT [16]. CL-plugin is a full continual learning module designed to interact with a pre-trained model, in our case, BERT.
|
| 42 |
+
|
| 43 |
+
Inserting CL-plugins in BERT. A commonly used method of leveraging a pre-trained model is to add the end task module on top of the pre-trained model. However, as explained in Sec. 1, fine-tuning the pre-trained model can cause serious CF for CL. The CL system PCL [18], which uses this approach, has the pre-trained model frozen to avoid forgetting. But as we will see in Sec. 5.4, this is not the best choice. CTR inserts the proposed CL-plugin in two locations in BERT, i.e., in each transformer layer of BERT. We will also see in Sec. 5.4 that inserting only one CL-plugin in one location is sub-optimal. Figure 1 gives the CTR architecture and we can see the two CL-plugins are added into BERT. In learning, only the two CL-plugins and the classification heads are trained. The components of the original pre-trained BERT are fixed.
|
| 44 |
+
|
| 45 |
+
Continual learning plug-in (CL-plugin). CL-plugin employs a capsule network (CapsNet) [15, 50] like architecture. In the classic neural network, a neuron outputs a scalar, real-valued activation as a feature detector. CapsNets replaces that with a vector-output capsule to preserve additional information. A simple CapsNet consists of two capsule layers. The first layer stores low-level feature maps, and the second layer generates the classification probability with each capsule corresponding to one class. CapsNet uses a dynamic routing algorithm to make each lower-level capsule to send its output to a similar (or “agreed”, computed by dot product) higher-level capsule. This property can already be used to group similar tasks and their shareable features to produce a CL system (see the ablation study in Sec. 5.4). One of the key ideas of CL-plugin (see Figure 2(A)) is a transfer capsule layer with a new transfer routing algorithm to explicitly identify transferable features/knowledge from previous tasks to transfer to the new task. Additionally, transfer routing avoids the need for hyper-parameter tuning on the number of iterations of dynamic routing [50] to update the agreements.
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 1: Architecture of BERT (left) and the proposed system CTR (right), which inserts two CL-plugins in BERT. Each CL-plugin module (far right) has two sub-modules and a skip connection: knowledge sharing sub-module (KSM) and task-specific sub-module (TSM).
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 2: (A) CL-plugin Architecture. (B) Illustration of task masking. Cells/neurons in brown, green and red are respectively used by tasks 0, 1 and 2. Neurons with two colors are used by two tasks
|
| 52 |
+
|
| 53 |
+
# 4 Continual Learning Plug-in (CL-plugin)
|
| 54 |
+
|
| 55 |
+
The architecture of our continual learning plug-in (CL-plugin) is shown in Figure 2(A). CL-plugin takes two inputs: (1) hidden states $h ^ { ( t ) }$ from the feed-forward layer inside a transformer layer and (2) task $\textrm Ḋ \textrm Ḋ \textrm Ḋ \textrm Ḋ t Ḍ Ḍ Ḍ$ , which is required by task continual learning (Task-CL). The outputs are hidden states with features suitable for the $t$ -th task for classification. Inside CL-plugin, there are two modules: (1) knowledge sharing module (KSM) for identifying and transferring the shareable knowledge from similar previous tasks to the new task $t$ , and (2) task specific module (TSM) for learning task specific neurons and their masks (which can protect the neurons from being updated by future tasks to deal with CF). Since TSM is differentiable, the whole system CTR can be trained end-to-end.
|
| 56 |
+
|
| 57 |
+
# 4.1 Knowledge Sharing Module (KSM)
|
| 58 |
+
|
| 59 |
+
KSM achieves knowledge transfer among similar tasks via a task capsule layer (TK-Layer), a transfer capsule layer (TR-Layer), and a transfer routing mechanism.
|
| 60 |
+
|
| 61 |
+
# 4.1.1 Task Capsule Layer (TK-Layer)
|
| 62 |
+
|
| 63 |
+
Each capsule in the TK-Layer represents a task, and it prepares the low-level features derived from each task (Figure 2(A)). As such, a capsule is added to the TK-Layer for each new task. This incremental growth is efficient and easy because these capsules are discrete and do not share parameters. Also, each capsule is simply a 2-layer fully connected network with a small number of parameters. Let $h ^ { ( t ) } \in \mathbb { R } ^ { d _ { t } \times d _ { e } }$ be the input of CL-plugin, where $d _ { t }$ is the number of tokens, $d _ { e }$ the number of dimensions, and $t$ is the current task. In the TK-Layer, we have one capsule for each task. Assume we have learned $t$ tasks so far. The capsule for the $i$ -th $( i \leq t )$ ) task is
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
p _ { i } ^ { ( t ) } = f _ { i } ( h ^ { ( t ) } ) ,
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where $f _ { i } ( \cdot ) = \mathbf { M } \mathbf { L } \mathbf { P } _ { i } ( \cdot )$ denotes a 2-layer fully-connected network.
|
| 70 |
+
|
| 71 |
+
# 4.1.2 Transfer Routing and Transfer Capsule Layer
|
| 72 |
+
|
| 73 |
+
Each capsule in the transfer capsule layer (TR-Layer) represents the transferable representation extracted from TK-Layer. As shown in Figure 2(A), transfer routing between the lower-level capsules in TK-Layer and high-level capsules in TR-Layer has three components: pre-route vector generator $( P V G )$ , similarity estimator $( S E )$ and task router $( T R )$ . Given the task capsules in the TK-Layer, we first transform the feature through a trainable weight matrix. We call the output of this transformation the pre-route vector. Each SE estimates the similarity between a previous task and the current task using the pre-route vector, resulting in a similarity score for each higher-level capsule. Additionally, each SE is augmented by a TR module, a differentiable task router acting as a gate. This router estimates a binary signal that decides whether to connect or disconnect the current route between the two consecutive capsule layers (i.e. TK-Layer and TR-Layer in CL-plugin). The binary signal estimated by TR can be seen as a differentiable binary attention. Conceptually, each SE and TR pair together learns the connectivity between capsules in a stochastic and differentiable manner, which can be seen as a task similarity-based connectivity search mechanism. This transfer routing identifies the shared features/knowledge from multiple task capsules and helps knowledge transfer across similar tasks. Next, we discuss the pre-route vector generator, similarity estimator and task router.
|
| 74 |
+
|
| 75 |
+
Pre-route Vector Generator (PVG). We first turns each transfer capsule $p _ { i } ^ { ( t ) }$ into a pre-route vector,
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
u _ { j | i } ^ { ( t ) } = W _ { i j } p _ { i } ^ { ( t ) } ,
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $W _ { i j } \in \mathbb { R } ^ { d _ { s } \times d _ { k } }$ is the weight matrix, $d _ { s }$ and $d _ { k }$ are the dimensions of task capsule $i$ (also representing a task) and transfer capsule $j$ , and $t$ is the current task. The number of transfer capsules $n _ { j }$ is a hyperparameter detailed in Sec. 5.
|
| 82 |
+
|
| 83 |
+
Similarity Estimator (SE). Since tasks $i$ and $t$ are different, it is crucial to determine what in task $i$ ’s representation is transferable. Inspired by [67], we use a convolution layer and activation units to compare task $i$ with task $t$ to determine the transferable proportion from the previous task $i$ . In SE, we compute the task similarity as follows:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { r } { \boldsymbol q _ { j | t } ^ { ( t ) } = \mathbf { M a x P o o l } ( \mathbf { R e l u } ( \boldsymbol u _ { j | t } ^ { ( t ) } * W _ { q } + b _ { q } ) ) , } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
a _ { j | i } ^ { ( t ) } = \mathbf { M a x P o o l } ( \operatorname { R e l u } ( u _ { j | i } ^ { ( t ) } * W _ { a } + f _ { a } ( q _ { j | t } ^ { ( t ) } ) + b _ { a } ) ) ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $b _ { a } , b _ { q } \in \mathbb { R }$ are the bias, $W _ { a } , W _ { q } \in \mathbb { R } ^ { d _ { e } \times d _ { w } }$ are convolutions filters and $d _ { w }$ is the windows size. We extract important features from the current task representation u(t)j|t via the convolution network in Eq. (3). The MaxPool helps remove the insignificant features to generate a fixed-size vector with the size equal to the number of filters $n _ { w }$ . Similarly, we extract important features from the previous task i’s representation u(t)j|i . Using the important features for the current and previous tasks, we compute a similarity score between them in Eq. (4) with ReLU activation. Note $f _ { a }$ is a 1-layer fully-connected network to match the dimensions. As a result, $a _ { j | i } ^ { ( t ) }$ indicates how similar the representation of the $i$ -th task is to the current task t. For those tasks with a very low a(t)j|i , t heir representations are less similar to the current task and thus has little transferable knowledge.
|
| 94 |
+
|
| 95 |
+
Task Router (TR). TR controls which previous task representation should flow to the next layer with the goal of letting only the transferable information to flow. Given the similarity $a _ { j | i } ^ { ( t ) }$ , TR estimates a binary decision signal $\delta _ { j \vert t } ^ { ( t ) } \in \{ 0$ :disconnect, 1:connect}. We first apply a convolution layer with 2 output channels and $1 \times 1$ kernel size to generate un-normalized decision value. To estimate the binary decision, we need to generate a decision chosen from the set of two mutually exclusive and exhaustive events (disconnect and connect). In our work, we adopt the Gumbel-Softmax [19] to help make the TR gate differentiable.
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\delta _ { j | i } ^ { ( t ) } = \mathrm { G u m b e l \_ s o f t m a x } ( a _ { j | i } ^ { ( t ) } * W _ { \delta } + b _ { \delta } ) .
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
Given the similarity aj |t , binary decision δ(t )t and the pre-route vector u(t)j|t, we compute the transferable representation ${ v _ { j \mid i } ^ { \mathrm { t r a n } ( t ) } }$ and final output $v _ { j } ^ { ( t ) }$ as follows:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
v _ { j | i } ^ { \mathrm { t r a n } ( t ) } = a _ { j | i } ^ { ( t ) } \otimes u _ { j | i } ^ { ( t ) } , ~ v _ { j } ^ { ( t ) } = \sum _ { i = 1 \atop \delta _ { i j } ^ { ( t ) } = 1 } ^ { n + 1 } v _ { j | i } ^ { \mathrm { t r a n } ( t ) } .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
This makes sure only task capsules for tasks that are salient or similar to the new task are used, and the others task capsules are ignored (and thus protected) to learn more general shareable knowledge. As many NLP applications have similar tasks, such learning of task-sharing features can be very important. Note that in backpropagation, only the similar tasks with connected gate $( \delta _ { i j } ^ { ( t ) } = 1 )$ are
|
| 108 |
+
|
| 109 |
+
# 4.2 Task Specific Module (TSM)
|
| 110 |
+
|
| 111 |
+
We now discuss how to preserve task-specific knowledge of previous tasks to prevent forgetting (CF). To achieve this, we use task masks (Figure 2(B)). Specifically, we first detect the neurons used by each old task and then block off or mask out all the used neurons when learning a new task.
|
| 112 |
+
|
| 113 |
+
The task-specific module consists of differentiable layers (a 2-layer fully-connected network is used). Each layer’s output is further applied with a task mask to indicate which neurons should be protected for that task to overcome CF and forbids gradient updates for those neurons during backpropagation for a new task. Those tasks with overlapping masks indicate some parameter sharing. Due to KSM, the features flowing into those overlapping neurons enable the related old tasks to also improve in learning the new task. Here we borrow the hard attention idea in [52] and leverage the task ID embedding to train the task mask. Further details can be found in Supplementary.
|
| 114 |
+
|
| 115 |
+
Illustration. The task masking process is illustrated in Figure 2(B), which shows the learning process of three tasks. Before training, those solid cells with a 0 are the neurons that have been used by some previous tasks and should be protected (masked). Those empty cells are free neurons (not used). After training, those solid cells with a 1 are neurons that are important for the current task, which will be used as masks in the future. Those solid cells with a 0 are masked as they are important for previous tasks. Those non-solid cells with a 0 are neurons that are not used so far.
|
| 116 |
+
|
| 117 |
+
Let us walk through the learning process of the three tasks. After training task 0, we obtain its useful neurons indicated by the 1 entries. Before training task 1, those useful neurons for task 0 are first masked (those previous 1’s entries are turned to 0’s). After training task 1, two neurons with 1 are used by the task. When task 2 arrives, all used neurons by tasks 0 and 1 are masked before training, i.e., their entries are set to 0. After training task 2, we see that tasks 2 and 1 have a shared neuron (the cell with two colors, red and green), which is used by both of tasks.
|
| 118 |
+
|
| 119 |
+
# 5 Experiments
|
| 120 |
+
|
| 121 |
+
We evaluate CTR using three applications. We follow the continual learning (CL) evaluation method given in [29]. CTR first learns a sequence of tasks. After a task is trained, the training data of the task is no longer accessible. After all tasks are learned, their task models are tested using their respective test sets. In training each task, we use its validation set to decide when to stop training.
|
| 122 |
+
|
| 123 |
+
# 5.1 Three Applications and Their Datasets
|
| 124 |
+
|
| 125 |
+
The first two applications (and datasets) are used to show the knowledge transferability of CTR because their tasks are similar and have shared knowledge. Catastrophic forgetting (CF) is not a major concern for them. The third application (and dataset) is mainly used to test CTR’s ability to overcome CF as its tasks are very different and have little shared knowledge to transfer.
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Data source</td><td colspan="3">Liu3domain</td><td colspan="5">HL5domain</td><td colspan="10">Ding9domain</td></tr><tr><td>Task/</td><td>paede</td><td>Poener</td><td>Ccoindetr</td><td>NO990T90</td><td>NN14am00</td><td>Ceieea</td><td>Conoees</td><td>AAx2dA</td><td>Capoong0</td><td>Craonen</td><td>radera</td><td>Thah</td><td></td><td>srss</td><td>JITIIT5</td><td>NO994P00</td><td>UOJION</td><td>Jreererer</td><td>doider</td></tr><tr><td>Train</td><td>352</td><td>245</td><td>283</td><td>271</td><td>162</td><td>677</td><td>228</td><td>343</td><td>118</td><td>175</td><td>191</td><td>212</td><td>153</td><td>176</td><td>484</td><td>362</td><td>194</td><td>3452</td><td>2163</td></tr><tr><td>Val.</td><td>44</td><td>31</td><td>35</td><td>34</td><td>20</td><td>85</td><td>29</td><td>43</td><td>15</td><td>22</td><td>24</td><td>26</td><td>19</td><td>22</td><td>61</td><td>45</td><td>24</td><td>150</td><td>150</td></tr><tr><td>Test</td><td>44</td><td>31</td><td>36</td><td>34</td><td>21</td><td>85</td><td>29</td><td>43</td><td>15</td><td>22</td><td>24</td><td>27</td><td>20</td><td>23</td><td>61</td><td>46</td><td>25</td><td>1120</td><td>638</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 1: Statistics of datasets for ASC. The datasets statistics for DSC and 20News have been described in the text. More detailed data statistics are given in Supplementary.
|
| 130 |
+
|
| 131 |
+
1. Document Sentiment Classification (DSC). This application is to classify each full product review into one of the two opinion classes (positive and negative). The training data of each task consists of reviews of a particular type of product. We adopt the text classification formulation in [8], where a [CLS] token is used to predict the opinion polarity.
|
| 132 |
+
|
| 133 |
+
We employ a set of 10 DSC datasets (reviews of 10 products) to produce sequences of tasks. The products are Sports, Toys, Tools, Video, Pet, Musical, Movies, Garden, Offices, and Kindle [22]. Two experiments are conducted: (1) using small data in each task: 100 positive and 100 negative training reviews per task; (2) using the full data in each task: 2500 positive and 2500 negative training reviews per task [22]. (1) is more useful in practice because labeling a large number of examples is very costly. The same validation reviews (250 positive and 250 negative) and the same test reviews (250 positive and 250 negative) are used in both experiments.
|
| 134 |
+
|
| 135 |
+
2. Aspect Sentiment Classification (ASC). It classifies a review sentence on the aspect-level sentiment (one of positive, negative, and neutral). For example, the sentence “The picture is great but the sound is lousy” about a TV expresses a positive opinion about the aspect “picture” and a negative opinion about the aspect “sound.” We adopt the ASC formulation in [65], where the aspect term and sentence are concatenated via [SEP] in BERT. The opinion is predicted on top of the [CLS] token.
|
| 136 |
+
|
| 137 |
+
We employ a set of 19 ASC datasets (review sentences of 19 products) to produce sequences of tasks. Each dataset represents a task. The datasets are from 4 sources: (1) HL5Domains [17] with reviews of 5 products; (2) Liu3Domains [32] with reviews of 3 products; (3) Ding9Domains [9] with reviews of 9 products; and (4) SemEval14 with reviews of 2 products - SemEval 2014 Task 4 for laptop and restaurant. For (1), (2) and (3), we use about $10 \%$ of the original data as the validate data, another about $10 \%$ of the original data as the testing data. For (4), we use 150 examples from the training set for validation. To be consistent with existing research [59], sentences with conflict opinions about a single aspect are not used. Statistics of the 19 datasets are given in Table 1.
|
| 138 |
+
|
| 139 |
+
3. Text classification using 20News data. This dataset [28] has 20 classes and each class has about 1000 documents. The data split for train/validation/test is 1600/200/200. We created 10 tasks, 2 classes per task. Since this is topic-based text classification data, the classes are very different and have little shared knowledge. As mentioned above, this application (and dataset) is mainly used to show CTR’s ability to overcome forgetting.
|
| 140 |
+
|
| 141 |
+
# 5.2 Baselines
|
| 142 |
+
|
| 143 |
+
We setup 38 baselines, including both standalone and continual learning methods.
|
| 144 |
+
|
| 145 |
+
Multitask learning (MTL: Results of multitask learning is considered the upper-bound of those of continual learning. Here MTL fine-tunes BERT.
|
| 146 |
+
|
| 147 |
+
Standalone (SDL) Baselines: The SDL setting builds a model for each task independently using a separate network. It clearly has no knowledge transfer or forgetting. We have 4 baselines under SDL, BERT, BERT (Frozen), Adapter-BERT and W2V (word2vec embeddings). For BERT, we use trainable BERT, i.e., fine-tuning. BERT (Frozen) uses frozen BERT with a trainable CNN text classification network [26] on top of it.; Adapter-BERT adapts the BERT as in [16], where only the adapter blocks are trainable; W2V uses embeddings trained on the Amazon review data in [66] using FastText [11]. For ASC, we adopt the ASC classification network in [67], which takes aspect term and review sentence as input. For DSC and 20News, we adopt the classification network in [8].
|
| 148 |
+
|
| 149 |
+
Continual Learning (CL) Baselines. CL setting includes 4 baselines with no forgetting handling (NFH) (corresponding to the 4 standalone baselines), and 25 baselines from 9 state-of-the art task continual learning (Task-CL) methods that deal with forgetting (CF). NFH baselines learn the tasks one by one with no awareness of forgetting/transfer.
|
| 150 |
+
|
| 151 |
+
The 12 state-of-the-art CL systems are: KAN [22] and SRK [37] are Task-CL methods for document sentiment classification. The rest were designed initially for image classification. Therefore, we replace their original MLP or CNN image classification network with CNN for text classification [26]. HAT [52] is one of the best Task-CL methods with almost no forgetting. CAT [21] is similar to HAT but can work with a mixed sequence. UCL [1] is a recent Task-CL method. EWC [27] is a popular regularization-based class continual learning (Class-CL) method, which was adapted for Task-CL by only training on the corresponding head of the specific task ID during training and only considering the corresponding head’s prediction during testing. OWM [68] is also a Class-CL method, which we also adapt to Task-CL. L2 [27] is a classic regularization based Class-CL method, which we adapt to Task-CL. A-GEM [4] is an efficient version of the replay Task-CL method GEM [36], which penalizes the previous task loss from being increased. $\mathbf { D E R + + }$ [2] is a recent replay method using distillation to regularize the new task training and it can function as a Task-CL method. B-CL [24] is similar to CTR but uses dynamic routing for knowledge transfer and it performs markedly worse than CTR. LAMOL [58] is a pseudo-replay method based on GPT-2.
|
| 152 |
+
|
| 153 |
+
From the 10 systems, we created 10 baselines using W2V embeddings with the aspect term added before the sentence so that the Task-CL methods can take both aspect and the review sentence for ASC; 7 baselines using Adapter-BERT (SRK, KAN and CAT’s architectures cannot work with adapters); and 10 baselines using BERT (Frozen) (which replaces W2V embeddings). The BERT formulation in Sec. 3 naturally takes both aspect and review sentence in the ASC case.
|
| 154 |
+
|
| 155 |
+
# 5.3 Hyper-parameters
|
| 156 |
+
|
| 157 |
+
Unless otherwise stated, the same hyper-parameters are used in experiments for ASC, DSC and 20News datasets. For the knowledge sharing module (KSM), we employ 2 layers of fully connected network with dimensions 768 in the TK-Layer. We employ 3 transfer capsules. We experimented with 2 to 15 capsules and selected 3 based on the validation data accuracy. For the task specific module (TSM), we use 2000 dimensions as the final and the hidden layers of the TSM. The task ID embeddings have 2000 dimensions. A fully connected layer with softmax output is used as the classification heads in the last layer of the BERT, together with the categorical cross-entropy loss. dropout of 0.5 between fully connected layers. The training of BERT, Adapter-BERT and CTR follows that of [65]. We adopt BERTBASE (uncased). The maximum input length is set to 128 which is long enough for both ASC and DSC. We use Adam optimizer and set the learning rate to 3e-5. We use 10 epochs for SemEval datasets and 30 epochs for the other datasets in the ASC application. For DSC, we use 20 epochs. For 20News, we use 10 epochs. These are selected based on the validation results. The batch size is set to 32 for all cases. For all the other CL baselines, we use the code provided by their authors and adapt them for text classification. We also adopt their original parameters, including learning rate, early stopping, and batch size.
|
| 158 |
+
|
| 159 |
+
# 5.4 Evaluation Results and Analysis
|
| 160 |
+
|
| 161 |
+
Since the order of the tasks in a sequence may impact the final results, we randomly sampled 5 task sequences and averaged their results. We compute both accuracy and Macro-F1, where Macro-F1 is the primary metric as the imbalanced classes (in ASC) introduce biases on accuracy. Table 2 gives the average results of all the 19 tasks (or datasets) for ASC and 10 tasks (or datasets) for DSC and 20News over the 5 random task sequences.
|
| 162 |
+
|
| 163 |
+
Overall Performance. Table 2 shows that CTR clearly outperforms all baselines.
|
| 164 |
+
|
| 165 |
+
(1). For the standalone (SDL) baselines, BERT (with fine-tuning) and Adapter-BERT perform similarly. W2V and BERT (Frozen) are poorer, which is understandable.
|
| 166 |
+
|
| 167 |
+
(2). Comparing SDL (standalone learning) and NFH (continual learning with no forgetting handling), we see NFH is much better than SDL for W2V and BERT (Frozen). This indicates ASC and DSC tasks have similarities and thus shared knowledge. Catastrophic forgetting (CF) is not a major issue for W2V and BERT (Frozen). However, for 20News, NFH variants have serious CF. NFH with BERT (fine-tuning) is much worse than SDL and Adapter-BERT, which we explained in Introduction.
|
| 168 |
+
|
| 169 |
+
<table><tr><td rowspan="2">Scenarios</td><td rowspan="2">Category</td><td rowspan="2">Model</td><td colspan="2">ASC</td><td colspan="2">DSC (small)</td><td colspan="2">DSC (full)</td><td colspan="2">20News</td><td colspan="2">20News (FR)</td></tr><tr><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td></tr><tr><td rowspan="2">Non-continual Learning (SDL)</td><td>BERT BERT BERT (Frozen)</td><td>MTL SDL SDL</td><td>91.91 85.84 78.14</td><td>88.11 76.35 58.13</td><td>85.05 78.04 73.88</td><td>84.03 74.17</td><td>89.77 87.84</td><td>89.28 86.80</td><td>96.77 96.49</td><td>96.77 96.48</td><td></td><td></td></tr><tr><td>Adapter-BERT W2V BERT</td><td>SDL SDL NFH</td><td>85.96 77.01 49.60</td><td>78.07 51.89 43.08</td><td>76.31 62.06 73.87</td><td>67.97 71.04 53.80 69.44</td><td>85.34 88.30 69.57 73.08</td><td>80.17 87.31 65.51 71.81</td><td>96.49 96.20 94.72 52.50</td><td>96.48 96.19 94.72 39.22</td><td>24.29</td><td>30.52</td></tr><tr><td rowspan="10">Continual Learning (CL)</td><td>BERT (Frozen) Adapter-BERT W2V</td><td>NFH NFH NFH L2</td><td>85.51 54.03 82.69</td><td>76.64 44.81 73.56</td><td>83.12 63.76 65.16</td><td>79.23 53.95 57.48</td><td>61.88 64.94 70.40</td><td>45.79 63.40 68.03</td><td>83.28 68.29</td><td>81.81 61.70</td><td>8.76 30.59 4.30</td><td>9.73 3.79 4.47</td></tr><tr><td rowspan="5">BERT (frozen)</td><td rowspan="5">A-GEM DER++ KAN</td><td rowspan="5">56.04 86.06 84.27 85.49</td><td rowspan="5">38.40 78.44 75.08</td><td rowspan="5">59.17 59.33 72.29</td><td rowspan="5">48.39 45.94</td><td rowspan="5">69.80 70.67 86.70</td><td rowspan="5">62.63 61.77 85.46</td><td rowspan="5">90.74 72.14 93.31</td><td rowspan="5">90.59</td><td rowspan="5">24.57 4.09</td><td rowspan="5">32.05 4.48</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>65.39</td></tr><tr><td>92.95</td></tr><tr><td>66.28</td></tr><tr><td colspan="10"></td><td>49.67</td><td>10.54</td><td>12.16</td></tr><tr><td rowspan="6"></td><td rowspan="6"></td><td>SRK EWC</td><td>84.76 86.37</td><td>77.38 78.52 74.52</td><td>77.27 78.58 82.38</td><td>72.34 76.03</td><td>82.32 83.99</td><td>81.23</td><td>73.07 69.97 77.89</td><td></td><td>15.52 12.06</td><td>18.87 13.97 3.03</td></tr><tr><td>UCL</td><td>83.89</td><td></td><td>78.41</td><td>72.77 74.76</td><td>82.66 65.76 69.48</td><td>79.64 80.26 94.65</td><td>78.60</td><td>3.50</td><td>0.48</td></tr><tr><td></td><td></td><td>74.82</td><td>74.13</td><td></td><td></td><td></td><td>94.63</td><td>0.48</td><td></td></tr><tr><td>OWM HAT</td><td>87.02</td><td>79.31</td><td>80.12 58.07</td><td>42.63</td><td>86.30</td><td>85.36</td><td>84.54</td><td>82.73</td><td>13.80</td></tr><tr><td>CAT</td><td>86.74 83.68</td><td>78.16</td><td>79.48</td><td>72.78</td><td></td><td></td><td></td><td></td><td>15.81 2.89</td></tr><tr><td></td><td>63.97</td><td>68.64 52.43</td><td>67.41</td><td>56.22</td><td>87.29 87.34</td><td>86.14 86.51</td><td>93.51 95.17</td><td>92.93 95.16</td><td>2.26 0.80</td></tr><tr><td rowspan="4"></td><td rowspan="4">Adapter-BERT</td><td>L2</td><td></td><td>67.26</td><td>62.76</td><td>73.03</td><td>71.50</td><td>69.56</td><td>65.50</td><td>23.12</td><td>0.81 27.39</td></tr><tr><td>A-GEM</td><td>45.88 47.63</td><td>28.21 62.89</td><td>55.96</td><td>71.22</td><td>69.94</td><td>60.29</td><td>50.40</td><td>40.22</td><td>51.20</td></tr><tr><td>DER++ EWC</td><td>56.30</td><td>35.54 49.58</td><td>70.52 63.56</td><td>59.67</td><td>57.82</td><td>58.95</td><td>49.58</td><td>36.39</td><td>45.30</td></tr><tr><td>UCL OWM</td><td>64.46 72.99</td><td>58.23 36.64 48.30</td><td>51.03 32.07</td><td>62.69 57.06</td><td>61.51 55.86</td><td>61.86 51.75</td><td>53.94 36.06</td><td>37.79 4.70</td><td>46.58 6.60</td></tr><tr><td rowspan="4">W2V</td><td rowspan="4">HAT L2 KAN</td><td>86.14 60.36</td><td>66.51</td><td>73.97 80.83</td><td>71.96 78.41</td><td>85.46</td><td>84.57</td><td>71.10</td><td>66.25 95.21</td><td>27.38 0.33</td><td>32.76 0.34</td></tr><tr><td>81.33</td><td>78.52 39.13 63.35</td><td>54.34</td><td>43.19</td><td>88.00 57.71</td><td>87.26 48.00</td><td>95.22 59.54</td><td>54.40</td><td>7.83</td><td>11.89</td></tr><tr><td>A-GEM DER++</td><td>69.93</td><td>69.80</td><td>60.07</td><td>77.67</td><td>70.75</td><td>90.72</td><td>90.60</td><td>3.94</td><td>4.08</td></tr><tr><td>SRK</td><td>83.27 40.01</td><td>77.51 57.13 64.47</td><td>73.13 43.75</td><td>74.79</td><td>66.68</td><td>89.28</td><td>89.19</td><td>4.32</td><td>4.42</td></tr><tr><td rowspan="6"></td><td rowspan="5">HAT CAT</td><td rowspan="5">EWC UCL OWM</td><td>72.06 71.01 84.16</td><td></td><td>55.93</td><td>69.35</td><td>64.78</td><td>57.92</td><td>51.65</td><td>20.98</td><td>27.02 8.81</td></tr><tr><td></td><td>39.63</td><td></td><td>69.65</td><td>65.25</td><td>61.07</td><td>58.47</td><td>7.26</td><td></td></tr><tr><td></td><td>72.29</td><td>64.82</td><td>57.20 70.00</td><td>65.11</td><td>91.86</td><td>91.80</td><td>2.64</td><td>2.71 4.70</td></tr><tr><td>84.41 82.70</td><td>75.99</td><td>56.23</td><td>41.34</td><td>70.56</td><td>67.01</td><td>90.61</td><td>90.46</td><td>4.53</td></tr><tr><td></td><td>71.18</td><td>53.40</td><td>38.44</td><td>67.15</td><td>65.42</td><td>71.97</td><td>68.75</td><td>24.00</td></tr><tr><td colspan="2">B-CL LAMOL</td><td>80.83 76.28 88.29 88.91</td><td>63.63 54.65</td><td>62.57 55.19</td><td>50.83 35.28</td><td>69.75 79.58</td><td>65.44 75.99</td><td>67.73 70.38</td><td>64.43 68.04</td><td>26.04 24.37</td><td>27.56 29.70 26.95</td></tr><tr><td colspan="2"></td><td></td><td>81.40</td><td>82.01</td><td>80.63</td><td>79.76</td><td>76.51</td><td>95.07</td><td>95.04</td><td></td><td></td><td>0.59</td></tr><tr><td colspan="2">CTR(forward) CTR</td><td>87.89 89.47</td><td>80.59 80.25</td><td>89.12 83.75</td><td>86.58 82.55</td><td></td><td>92.11 89.86</td><td>91.72 89.16 95.63</td><td>66.13</td><td>45.74 95.62</td><td>0.58 20.03</td><td>16.60</td></tr></table>
|
| 170 |
+
|
| 171 |
+
Table 2: Accuracy (Acc.) and Macro-F1 (MF1), averaged over 5 random sequences. The architectures of SRK, KAN and CAT cannot work with Adapter-BERT. “—” means not applicable. Due to the limited space, standard deviation, running time and network size are given in Supplementary.
|
| 172 |
+
|
| 173 |
+
(3). Unlike BERT and Adapter-BERT, CTR does very well in both forgetting avoidance and knowledge transfer (outperforming all baselines). For baselines, EWC, UCL, OWM and HAT, although they perform better than NFH, they are significantly poorer than CTR as they don’t have methods to encourage knowledge transfer for ASC and DSC. KAN and SRK do knowledge transfer but they are weaker than many other CL methods. They perform very poorly for 20News as they have limited ability to overcome CF. CAT works well with large datasets, but is weak for small datasets.
|
| 174 |
+
|
| 175 |
+
(4). CTR’s improvements over SDL variants for DSC (large) is less than for DCS (small). This is understandable because when the training data is large, learning a separate model is already good, and knowledge transfer is less important.
|
| 176 |
+
|
| 177 |
+
(5). Compared with the SDL results, we can see that CTR has the least forgetting on 20News.
|
| 178 |
+
|
| 179 |
+
(6). Compared to B-CL, CTR is markedly better in knowledge transfer. The forgetting rates (FR) of B-CL and CTR are both low. The comparison is in fact the same as comparing dynamics routing and transfer routing. We can see that the proposed transfer routing is dramatically better than dynamic routing for knowledge transfer. Additionally, transfer routing eliminates the need for hyper-parameter tuning on the number of iterations of dynamic routing [50] to update the agreements.
|
| 180 |
+
|
| 181 |
+
(7). CTR outperforms LAMOL in ASC and 20News even with the less powerful BERT model that CTR adopts. LAMOL outperforms BERT-based MTL in DSC. This may be because LAMOL is based on GPT-2, which is known to be more powerful than BERT (also shown in the LAMOL paper). For 20News, since its tasks are very different/dissimilar, there is little shared knowledge. Dealing with CF is the main issue. LAMOL has serious forgetting as its FR values show.
|
| 182 |
+
|
| 183 |
+
(8). The results of MTL (the upper bound) are only slightly better than CTR, which again shows that CTR is highly effective in overcoming forgetting and encouraging knowledge transfer.
|
| 184 |
+
|
| 185 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">ASC</td><td colspan="2">DSC (small)</td><td colspan="2">DSC (full)</td><td colspan="2">20News</td></tr><tr><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td><td>Acc.</td><td>MF1</td></tr><tr><td>CTR(-KSM;-TSM)</td><td>0.5403</td><td>0.4481</td><td>0.6376</td><td>0.5395</td><td>0.6494</td><td>0.6340</td><td>0.6829</td><td>0.6170</td></tr><tr><td>CTR (-TSM)</td><td>0.8312</td><td>0.7107</td><td>0.7085</td><td>0.6759</td><td>0.8545</td><td>0.8380</td><td>0.8275</td><td>0.8064</td></tr><tr><td>CTR (-KSM)</td><td>0.8614</td><td>0.7852</td><td>0.8083</td><td>0.7841</td><td>0.8800</td><td>0.8726</td><td>0.9522</td><td>0.9521</td></tr><tr><td>CTR(-TR/KSM)</td><td>0.8819</td><td>0.8155</td><td>0.8244</td><td>0.8119</td><td>0.8831</td><td>0.8762</td><td>0.9476</td><td>0.9469</td></tr><tr><td>CTR(dynamic routing) (B-CL)</td><td>0.8829</td><td>0.8140</td><td>0.8201</td><td>0.8063</td><td>0.7976</td><td>0.7651</td><td>0.9507</td><td>0.9504</td></tr><tr><td>CTR (on top)</td><td>0.8135</td><td>0.6390</td><td>0.7301</td><td>0.6875</td><td>0.8266</td><td>0.8105</td><td>0.8927</td><td>0.8920</td></tr><tr><td>CTR (after the first FF layer)</td><td>0.8741</td><td>0.8014</td><td>0.8300</td><td>0.8183</td><td>0.8699</td><td>0.8596</td><td>0.9381</td><td>0.9373</td></tr><tr><td>CTR (after the other two FF layers)</td><td>0.8662</td><td>0.7863</td><td>0.8269</td><td>0.8161</td><td>0.8714</td><td>0.8612</td><td>0.9339</td><td>0.9316</td></tr><tr><td>CTR</td><td>0.8947</td><td>0.8362</td><td>0.8434</td><td>0.8329</td><td>0.8931</td><td>0.8875</td><td>0.9525</td><td>0.9523</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 3: Ablation experiment results.
|
| 188 |
+
|
| 189 |
+
Effectiveness of Knowledge Transfer. Forward transfer is defined as the forward performance (CTR(forward) in Table 2) subtracting the standalone (SDL) result. CTR(forward) is the test accuracy or MF1 of each task when it was first learned. Backward transfer is defined as the difference between the backward performance (CTR in Table 2, the final result after all tasks are learned) and the forward performance. The average results of CTR (forward) and CTR are given in Table 2. We observe that forward transfer of CTR is highly effective for the three datasets with similar tasks. For DSC, the less the data, the more effective is the transfer, which is reasonable. Backward transfer improves the accuracy and MF1 of ASC and DSC (small). For DSC (full), it is slightly weaker and for 20News, it is also slightly weaker due to a very small amount of forgetting, but the less than 0.0055 CF is negligible. Note that in [36, 46], forward transfer is measured by comparing the test results of the new task on the current learned network and a random initialized network before/without training the new task (like zero-shot). This method indicates whether the learned network contains some useful knowledge for the new task. However, it does not tell how much forward transfer actually happens after learning the new task, which is more important and is what our method measures.
|
| 190 |
+
|
| 191 |
+
Overcoming Forgetting. To validate CTR’s effectiveness in dealing forgetting with a sequence of dissimilar tasks, we compute the Forgetting Rate [34], $\begin{array} { r } { \mathrm { F R } = \frac { 1 } { t - 1 } \bar { \sum _ { i = 1 } ^ { t - 1 } A _ { i , i } } - \bar { A _ { t , i } } } \end{array}$ , where $A _ { i , i }$ is the forward accuracy of task $i$ and $A _ { t , i }$ is the accuracy of task $i$ after training the last task $t$ . We average over all tasks except the last one because the last task obviously has no forgetting. We report the forgetting rate FR (averaged over 5 random task sequences) for the 20News data on the two evaluation metrics in the last two columns of Table 2 (the other two datasets are mainly for knowledge transfer). CTR has very low FR values which indicate very little forgetting.
|
| 192 |
+
|
| 193 |
+
Ablation Study. The results of ablation experiments are in Table 3. “-KSM;-TSM” means that the knowledge sharing module (KSM) and the task specific module (TSM) are not used, and we simply deploy the Adapter-BERT. “-KSM” means that the knowledge sharing module (KSM) is not used. “-TSM” means that the task specific module (TSM) is not used. “-TR/KSM” means that the task router (TR) in KSM is not used. We directly send the transferable representation vtran(j|i to the next layer. “dynamic routing” means that we replace our transfer routing (-(SE&TR)/KSM) with dynamic routing [50], which is one of the most popular routing algorithms in capsule networks. “on top” means adding a CL-plugin on top of BERT. “after the first FF layer” means adding only one CL-plugin there in BERT. ”after the other two FF layers” means adding only one CL-plugin module there in BERT. Table 3 shows that the full CTR system gives the best results, indicating every component contributes to the model and other options of adding CL-plugins are all poorer.
|
| 194 |
+
|
| 195 |
+
# 6 Conclusion
|
| 196 |
+
|
| 197 |
+
This paper studied task continual learning (Task-CL) using the pre-trained model BERT to achieve both CF presentation and knowledge transfer. It proposed a novel technique called CTR to leverage the pre-trained BERT for CL. The key component of CTR is the CL-plugin inserted in BERT. A CL-plugin is a capsule network with a new transfer routing mechanism to encourage knowledge transfer among tasks and also to isolate task-specific knowledge to avoid forgetting. Experimental results using three NLP applications showed that CTR markedly improves the performance of both the new task and the old tasks via knowledge transfer and is also effective at overcoming catastrophic forgetting. One limitation of our work is the efficiency due to the use of capsules. Capsules try to represent a group of neurons in a vector reflecting properties of an entity. In NLP, an entity is a sentence/document which contains many tokens (e.g., 128) and features (e.g. 768 in BERTBASE). Grouping them makes the capsule very large (e.g., $1 2 8 \times 7 6 8 $ ), which slows down training.
|
| 198 |
+
|
| 199 |
+
# Acknowledgments
|
| 200 |
+
|
| 201 |
+
This work was supported in part by two National Science Foundation (NSF) grants (IIS-1910424 and IIS-1838770), a DARPA Contract HR001120C0023, and a Northrop Grumman research gift.
|
| 202 |
+
|
| 203 |
+
# References
|
| 204 |
+
|
| 205 |
+
[1] H. Ahn, S. Cha, D. Lee, and T. Moon. Uncertainty-based continual learning with adaptive regularization. In NIPS, 2019. [2] P. Buzzega, M. Boschini, A. Porrello, D. Abati, and S. Calderara. Dark experience for general continual learning: a strong, simple baseline. arXiv preprint arXiv:2004.07211, 2020.
|
| 206 |
+
[3] A. Carlson, J. Betteridge, B. Kisiel, B. Settles, E. Hruschka, and T. Mitchell. Toward an architecture for never-ending language learning. In AAAI, volume 24, 2010. [4] A. Chaudhry, M. Ranzato, M. Rohrbach, and M. Elhoseiny. Efficient lifelong learning with A-GEM. In ICLR, 2019. [5] Z. Chen and B. Liu. Lifelong machine learning. Synthesis Lectures on Artificial Intelligence and Machine Learning, 12(3):1–207, 2018. [6] Z. Chen, N. Ma, and B. Liu. Lifelong learning for sentiment classification. In ACL, 2015. [7] Y.-S. Chuang, S.-Y. Su, and Y.-N. Chen. Lifelong language knowledge distillation. arXiv preprint arXiv:2010.02123, 2020.
|
| 207 |
+
[8] J. Devlin, M. Chang, K. Lee, and K. Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In J. Burstein, C. Doran, and T. Solorio, editors, NAACL-HLT, 2019. [9] X. Ding, B. Liu, and P. S. Yu. A holistic lexicon-based approach to opinion mining. In Proceedings of the 2008 international conference on web search and data mining, 2008.
|
| 208 |
+
[10] C. Fernando, D. Banarse, C. Blundell, Y. Zwols, D. Ha, A. A. Rusu, A. Pritzel, and D. Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. CoRR, 2017.
|
| 209 |
+
[11] E. Grave, P. Bojanowski, P. Gupta, A. Joulin, and T. Mikolov. Learning word vectors for 157 languages. In LREC, 2018.
|
| 210 |
+
[12] C. Greco, B. Plank, R. Fernández, and R. Bernardi. Psycholinguistics meets continual learning: Measuring catastrophic forgetting in visual question answering. arXiv preprint arXiv:1906.04229, 2019.
|
| 211 |
+
[13] P. Gupta, Y. Chaudhary, T. Runkler, and H. Schuetze. Neural topic modeling with continual lifelong learning. In International Conference on Machine Learning, pages 3907–3917. PMLR, 2020.
|
| 212 |
+
[14] X. He and H. Jaeger. Overcoming catastrophic interference using conceptor-aided backpropagation. In ICLR, 2018.
|
| 213 |
+
[15] G. E. Hinton, A. Krizhevsky, and S. D. Wang. Transforming auto-encoders. In International conference on artificial neural networks, 2011.
|
| 214 |
+
[16] N. Houlsby, A. Giurgiu, S. Jastrzebski, B. Morrone, Q. de Laroussilhe, A. Gesmundo, M. Attariyan, and S. Gelly. Parameter-efficient transfer learning for NLP. In K. Chaudhuri and R. Salakhutdinov, editors, ICML, 2019.
|
| 215 |
+
[17] M. Hu and B. Liu. Mining and summarizing customer reviews. In Proceedings of ACM SIGKDD, 2004.
|
| 216 |
+
[18] W. Hu, Q. Qin, M. Wang, J. Ma, and B. Liu. Continual learning by using information of each class holistically. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 7797–7805, 2021.
|
| 217 |
+
[19] E. Jang, S. Gu, and B. Poole. Categorical reparameterization with gumbel-softmax. In ICLR, 2017.
|
| 218 |
+
[20] N. Kamra, U. Gupta, and Y. Liu. Deep generative dual memory network for continual learning. CoRR, 2017.
|
| 219 |
+
[21] Z. Ke, B. Liu, and X. Huang. Continual learning of a mixed sequence of similar and dissimilar tasks. In NeurIPS, 2020.
|
| 220 |
+
[22] Z. Ke, B. Liu, H. Wang, and L. Shu. Continual learning with knowledge transfer for sentiment classification. In ECML-PKDD, 2020.
|
| 221 |
+
[23] Z. Ke, B. Liu, H. Xu, and L. Shu. Classic: Continual and contrastive learning of aspect sentiment classification tasks. In EMNLP, 2021.
|
| 222 |
+
[24] Z. Ke, H. Xu, and B. Liu. Adapting bert for continual learning of a sequence of aspect sentiment classification tasks. In NAACL, pages 4746–4755, 2021.
|
| 223 |
+
[25] H. Khayrallah, B. Thompson, K. Duh, and P. Koehn. Regularized training objective for continued training for domain adaptation in neural machine translation. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, pages 36–44, 2018.
|
| 224 |
+
[26] Y. Kim. Convolutional neural networks for sentence classification. In A. Moschitti, B. Pang, and W. Daelemans, editors, EMNLP, 2014.
|
| 225 |
+
[27] J. Kirkpatrick, R. Pascanu, N. C. Rabinowitz, J. Veness, G. Desjardins, A. A. Rusu, K. Milan, J. Quan, T. Ramalho, A. Grabska-Barwinska, D. Hassabis, C. Clopath, D. Kumaran, and R. Hadsell. Overcoming catastrophic forgetting in neural networks. CoRR, 2016.
|
| 226 |
+
[28] K. Lang. Newsweeder: Learning to filter netnews. In Proceedings of the Twelfth International Conference on Machine Learning, 1995.
|
| 227 |
+
[29] M. D. Lange, R. Aljundi, M. Masana, and T. Tuytelaars. Continual learning: A comparative study on how to defy forgetting in classification tasks. CoRR, 2019.
|
| 228 |
+
[30] S. Lee, J. Kim, J. Jun, J. Ha, and B. Zhang. Overcoming catastrophic forgetting by incremental moment matching. In NIPS.
|
| 229 |
+
[31] Y. Li, L. Zhao, K. Church, and M. Elhoseiny. Compositional language continual learning. In International Conference on Learning Representations, 2019.
|
| 230 |
+
[32] Q. Liu, Z. Gao, B. Liu, and Y. Zhang. Automated rule selection for aspect extraction in opinion mining. In IJCAI, 2015.
|
| 231 |
+
[33] T. Liu, L. Ungar, and J. Sedoc. Continual learning for sentence representations using conceptors. arXiv preprint arXiv:1904.09187, 2019.
|
| 232 |
+
[34] Y. Liu, Y. Su, A. Liu, B. Schiele, and Q. Sun. Mnemonics training: Multi-class incremental learning without forgetting. In CVPR, 2020.
|
| 233 |
+
[35] Z. Liu, G. I. Winata, A. Madotto, and P. Fung. Exploring fine-tuning techniques for pre-trained cross-lingual models via continual learning. arXiv preprint arXiv:2004.14218, 2020.
|
| 234 |
+
[36] D. Lopez-Paz and M. Ranzato. Gradient episodic memory for continual learning. In NIPS, 2017.
|
| 235 |
+
[37] G. Lv, S. Wang, B. Liu, E. Chen, and K. Zhang. Sentiment classification by leveraging the shared knowledge from a sequence of domains. In DASFAA, 2019.
|
| 236 |
+
[38] A. Madotto, Z. Lin, Z. Zhou, S. Moon, P. Crook, B. Liu, Z. Yu, E. Cho, and Z. Wang. Continual learning in task-oriented dialogue systems. arXiv preprint arXiv:2012.15504, 2020.
|
| 237 |
+
[39] A. Mallya and S. Lazebnik. Packnet: Adding multiple tasks to a single network by iterative pruning. In CVPR, 2018.
|
| 238 |
+
[40] M. McCloskey and N. J. Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation. 1989.
|
| 239 |
+
[41] A. Merchant, E. Rahimtoroghi, E. Pavlick, and I. Tenney. What happens to BERT embeddings during fine-tuning? CoRR, 2020.
|
| 240 |
+
[42] J. Pfeiffer, A. Kamath, A. Rücklé, K. Cho, and I. Gurevych. Adapterfusion: Non-destructive task composition for transfer learning.
|
| 241 |
+
[43] Q. Qin, W. Hu, and B. Liu. Using the past knowledge to improve sentiment classification. In EMNLP-findings, 2020.
|
| 242 |
+
[44] V. V. Ramasesh, E. Dyer, and M. Raghu. Anatomy of catastrophic forgetting: Hidden representations and task semantics. In ICLR, 2021.
|
| 243 |
+
[45] S. Rebuffi, A. Kolesnikov, G. Sperl, and C. H. Lampert. icarl: Incremental classifier and representation learning. In CVPR, 2017.
|
| 244 |
+
[46] M. Riemer, I. Cases, R. Ajemian, M. Liu, I. Rish, Y. Tu, , and G. Tesauro. Learning to learn without forgetting by maximizing transfer and minimizing interference. In International Conference on Learning Representations, 2019.
|
| 245 |
+
[47] M. Rostami, S. Kolouri, and P. K. Pilly. Complementary learning for overcoming catastrophic forgetting using experience replay. In IJCAI, 2019.
|
| 246 |
+
[48] A. A. Rusu, N. C. Rabinowitz, G. Desjardins, H. Soyer, J. Kirkpatrick, K. Kavukcuoglu, R. Pascanu, and R. Hadsell. Progressive neural networks. CoRR, 2016.
|
| 247 |
+
[49] P. Ruvolo and E. Eaton. ELLA: an efficient lifelong learning algorithm. In ICML, pages 507–515, 2013.
|
| 248 |
+
[50] S. Sabour, N. Frosst, and G. E. Hinton. Dynamic routing between capsules. In NIPS, 2017.
|
| 249 |
+
[51] A. Seff, A. Beatson, D. Suo, and H. Liu. Continual learning in generative adversarial nets. CoRR, abs/1705.08395, 2017.
|
| 250 |
+
[52] J. Serrà, D. Suris, M. Miron, and A. Karatzoglou. Overcoming catastrophic forgetting with hard attention to the task. In ICML, 2018.
|
| 251 |
+
[53] Y. Shen, X. Zeng, and H. Jin. A progressive model to enable continual learning for semantic slot filling. In EMNLP-IJCNLP, Nov. 2019.
|
| 252 |
+
[54] H. Shin, J. K. Lee, J. Kim, and J. Kim. Continual learning with deep generative replay. In NIPS, 2017.
|
| 253 |
+
[55] L. Shu, H. Xu, and B. Liu. Lifelong learning CRF for supervised aspect extraction. In ACL, 2017.
|
| 254 |
+
[56] D. L. Silver, Q. Yang, and L. Li. Lifelong machine learning systems: Beyond learning algorithms. In Lifelong Machine Learning, Papers from the 2013 AAAI Spring Symposium, Palo Alto, California, USA, March 25-27, 2013, 2013.
|
| 255 |
+
[57] C. Sun, L. Huang, and X. Qiu. Utilizing BERT for aspect-based sentiment analysis via constructing auxiliary sentence. In NAACL, 2019.
|
| 256 |
+
[58] F.-K. Sun, C.-H. Ho, and H.-Y. Lee. Lamol: Language modeling is all you need for lifelong language learning. In ICLR, 2020.
|
| 257 |
+
[59] D. Tang, B. Qin, and T. Liu. Aspect level sentiment classification with deep memory network. In EMNLP, Nov. 2016.
|
| 258 |
+
[60] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017.
|
| 259 |
+
[61] H. Wang, B. Liu, S. Wang, N. Ma, and Y. Yang. Forward and backward knowledge transfer for sentiment classification. In ACML, 2019.
|
| 260 |
+
[62] S. Wang, G. Lv, S. Mazumder, G. Fei, and B. Liu. Lifelong learning memory networks for aspect sentiment classification. In IEEE International Conference on Big Data, 2018.
|
| 261 |
+
[63] Z. Wang, S. V. Mehta, B. Póczos, and J. Carbonell. Efficient meta lifelong-learning with limited memory. In EMNLP, 2020.
|
| 262 |
+
[64] R. Xia, J. Jiang, and H. He. Distantly supervised lifelong learning for large-scale social media sentiment analysis. IEEE Trans. Affective Computing, 8(4):480–491, 2017.
|
| 263 |
+
[65] H. Xu, B. Liu, L. Shu, and P. S. Yu. BERT post-training for review reading comprehension and aspect-based sentiment analysis. In J. Burstein, C. Doran, and T. Solorio, editors, NAACL-HLT, 2019.
|
| 264 |
+
[66] H. Xu, S. Xie, L. Shu, and P. S. Yu. Dual attention network for product compatibility and function satisfiability analysis. In AAAI, 2018.
|
| 265 |
+
[67] W. Xue and T. Li. Aspect based sentiment analysis with gated convolutional networks. In I. Gurevych and Y. Miyao, editors, ACL, 2018.
|
| 266 |
+
[68] G. Zeng, Y. Chen, B. Cui, and S. Yu. Continuous learning of context-dependent processing in neural networks. Nature Machine Intelligence, 2019.
|
| 267 |
+
[69] F. Zenke, B. Poole, and S. Ganguli. Continual learning through synaptic intelligence. In International Conference on Machine Learning, pages 3987–3995. PMLR, 2017.
|
md/train/S11KBYclx/S11KBYclx.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING CURVE PREDICTION WITH BAYESIAN NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Aaron Klein, Stefan Falkner, Jost Tobias Springenberg & Frank Hutter
|
| 4 |
+
Department of Computer Science
|
| 5 |
+
University of Freiburg
|
| 6 |
+
{kleinaa,sfalkner,springj,fh}@cs.uni-freiburg.de
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Different neural network architectures, hyperparameters and training protocols lead to different performances as a function of time. Human experts routinely inspect the resulting learning curves to quickly terminate runs with poor hyperparameter settings and thereby considerably speed up manual hyperparameter optimization. The same information can be exploited in automatic hyperparameter optimization by means of a probabilistic model of learning curves across hyperparameter settings. Here, we study the use of Bayesian neural networks for this purpose and improve their performance by a specialized learning curve layer.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Deep learning has celebrated many successes, but its performance relies crucially on good hyperparameter settings. Bayesian optimization (e.g, Brochu et al. (2010); Snoek et al. (2012); Shahriari et al. (2016)) is a powerful method for optimizing the hyperparameters of deep neural networks (DNNs). However, its traditional treatment of DNN performance as a black box poses fundamental limitations for large and computationally expensive data sets, for which training a single model can take weeks. Human experts go beyond this blackbox notion in their manual tuning and exploit cheaper signals about which hyperparameter settings work well: they estimate overall performance based on runs using subsets of the data or initial short runs to weed out bad parameter settings; armed with these tricks, human experts can often outperform Bayesian optimization.
|
| 15 |
+
|
| 16 |
+
Recent extensions of Bayesian optimization and multi-armed bandits therefore also drop the limiting blackbox assumption and exploit the performance of short runs (Swersky et al., 2014; Domhan et al., 2015; Li et al., 2017), performance on small subsets of the data (Klein et al., 2017), and performance on other, related data sets (Swersky et al., 2013; Feurer et al., 2015).
|
| 17 |
+
|
| 18 |
+
While traditional solutions for scalable Bayesian optimization include approximate Gaussian process models (e.g., Hutter et al.; Swersky et al. (2014)) and random forests (Hutter et al., 2011), a recent trend is to exploit the flexible model class of neural networks for this purpose (Snoek et al., 2015; Springenberg et al., 2016). In this paper, we study this model class for the prediction of learning curves. Our contributions in this paper are:
|
| 19 |
+
|
| 20 |
+
1. We study how well Bayesian neural networks can fit learning curves for various architectures and hyperparameter settings, and how reliable their uncertainty estimates are. 2. Building on the parametric learning curve models of Domhan et al. (2015), we develop a specialized neural network architecture with a learning curve layer that improves learning curve predictions. 3. We compare different ways to generate Bayesian neural networks: probabilistic back propagation (Hernández-Lobato and Adams, 2015) and two different stochastic gradient based Markov Chain Monte Carlo (MCMC) methods – stochastic gradient Langevin dynamics (SGLD (Welling and Teh, 2011)) and stochastic gradient Hamiltonian MCMC (SGHMC (Chen et al., 2014)) – for standard Bayesian neural networks and our specialized architecture and show that SGHMC yields better uncertainty estimates.
|
| 21 |
+
|
| 22 |
+
4. We evaluate the predictive quality for both completely new learning curves and for extrapolating partially-observed curves, showing better performance than the parametric function approach by Domhan et al. (2015) at stages were learning curves have not yet converged.
|
| 23 |
+
|
| 24 |
+
5. We extend the recent multi-armed bandit strategy Hyperband (Li et al., 2017) by sampling using our model rather than uniformly at random, thereby enabling it to approach nearoptimal configurations faster than traditional Bayesian optimization.
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
Figure 1: Example learning curves of random hyperparameter configurations of 4 different iterative machine learning methods: convolutional neural network (CNN), fully connected neural network (FCNet), logistic regression (LR), and variational auto-encoder (VAE). Although different configurations lead to different learning curves, they usually share some characteristics for a certain algorithm and dataset (but vary across these).
|
| 28 |
+
|
| 29 |
+
# 2 PROBABILISTIC PREDICTION OF LEARNING CURVES
|
| 30 |
+
|
| 31 |
+
In this section, we describe a general framework to model learning curves of iterative machine learning methods. We first describe the approach by Domhan et al. (2015) which we will dub LCExtrapolation from here on. Afterwards, we discuss a more general joint model across time steps and hyperparameter values that can exploit similarities between hyperparameter configurations and predict for unobserved learning curves. We also study the observation noise of different hyperparameter configurations and show how we can adapt our model to capture this noise.
|
| 32 |
+
|
| 33 |
+
# 2.1 LEARNING CURVE PREDICTION WITH BASIS FUNCTION
|
| 34 |
+
|
| 35 |
+
An intuitive model for learning curves proposed by Domhan et al. (2015) uses a set of $k$ different parametric functions $\phi _ { i } ( \pmb { \theta } _ { i } , t ) \in \{ \phi _ { 1 } ( \pmb { \theta } _ { 1 } , t ) , . . . , \phi _ { k } ( \pmb { \theta } _ { k } , t ) \}$ to extrapolate learning curves $\left( y _ { 1 } , \ldots , y _ { n } \right)$ from the first $n$ time steps. Each parametric function $\phi _ { i }$ depends on a time step $t \in [ 1 , T ]$ and on a parameter vector $\theta _ { i }$ . The individual functions are combined into a single model by a weighted linear combination
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
\hat { f } ( t | \Theta , { \pmb w } ) = \sum _ { i = 1 } ^ { k } w _ { i } \phi _ { i } ( t , \pmb \theta _ { i } ) ,
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
where $\boldsymbol { \Theta } = ( \theta _ { 1 } , \ldots , \theta _ { k } )$ denotes the combined vector of all parameters $\theta _ { 1 } , \ldots , \theta _ { k }$ , and $\textbf { \em w } =$ $( w _ { 1 } , \ldots , w _ { k } )$ is the concatenated vector of the respective weights of each function. Assuming observation noise around the true but unknown value $f ( t )$ , i.e., assuming $y _ { t } \sim \mathcal { N } ( \hat { f } ( t | \Theta , w ) , \sigma ^ { 2 } )$ , Domhan et al. (2015) define a prior for all parameters ${ \dot { P } } ( { \bf \dot { \Theta } } , w , \sigma ^ { 2 } )$ and use a gradient-free MCMC method (Foreman-Mackey et al., 2013) to obtain $S$ samples, $( \Theta _ { 1 } , \dot { w } _ { 1 } , \sigma _ { 1 } ^ { 2 } ) , \dots , ( \Theta _ { S } , { w } _ { S } , \sigma _ { S } ^ { 2 } )$ , from the posterior
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
P ( \Theta , w , \sigma ^ { 2 } | y _ { 1 } \dots , y _ { n } ) \propto P ( y _ { 1 } , \dots , y _ { n } | \Theta , w , \sigma ^ { 2 } ) P ( \Theta , w , \sigma ^ { 2 } )
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
using the likelihood
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
P ( y _ { 1 } , \dots , y _ { n } | \Theta , w , \sigma ^ { 2 } ) = \prod _ { t = 1 } ^ { n } \mathcal { N } ( y _ { t } ; \hat { f } ( t | \Theta , w ) , \sigma ^ { 2 } ) .
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
These samples then yield probabilistic extrapolations of the learning curve for future time steps $m$ with mean and variance predictions
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { c } { \displaystyle \hat { y } _ { m } = \mathbb { E } [ y _ { m } | y _ { 1 } , \dots y _ { n } ] \approx \frac { 1 } { S } \sum _ { s = 1 } ^ { S } \hat { f } ( m | \Theta _ { s } , w _ { s } ) , \mathrm { a n d } } \\ { \displaystyle \mathrm { v a r } ( \hat { y } _ { m } ) \approx \frac { 1 } { S } \sum _ { s = 1 } ^ { S } ( \hat { f } ( m | \Theta _ { s } , w _ { s } ) - \hat { y } _ { m } ) ^ { 2 } + \sum _ { s = 1 } ^ { S } \sigma _ { s } ^ { 2 } . } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
For our experiments, we use the original implementation by Domhan et al. (2015) with one modification: the original code included a term in the likelihood that enforced the prediction at $t = T$ to be strictly greater than the last value of that particular curve. This biases the estimation to never underestimate the accuracy at the asymptote. We found that in some of our benchmarks, this led to instabilities, especially with very noisy learning curves. Removing it cured that problem, and we did not observe any performance degradation on any of the other benchmarks.
|
| 60 |
+
|
| 61 |
+
The ability to include arbitrary parametric functions makes this model very flexible, and Domhan et al. (2015) used it successfully to terminate evaluations of poorly-performing hyperparameters early for various different architectures of neural networks (thereby speeding up Bayesian optimization by a factor of two). However, the model’s major disadvantage is that it does not use previously evaluated hyperparameters at all and therefore can only make useful predictions after observing a substantial initial fraction of the learning curve.
|
| 62 |
+
|
| 63 |
+
# 2.2 LEARNING CURVE PREDICTION WITH BAYESIAN NEURAL NETWORKS
|
| 64 |
+
|
| 65 |
+
In practice, similar hyperparameter configurations often lead to similar learning curves, and modelling this dependence would allow predicting learning curves for new configurations without the need to observe their initial performance. Swersky et al. (2014) followed this approach based on an approximate Gaussian process model. Their Freeze-Thaw method showed promising results for finding good hyperparameters of iterative machine learning algorithms using learning curve prediction to allocate most resources for well-performing configurations during the optimization. The method introduces a special covariance function corresponding to exponentially decaying functions to model the learning curves. This results in an analytically tractable model, but using different functions to account for cases where the learning curves do not converge exponentially is not trivial.
|
| 66 |
+
|
| 67 |
+
Here, we formulate the problem using Bayesian neural networks. We aim to model the validation accuracy $g ( { \pmb x } , t )$ of a configuration $\pmb { x } ~ \in ~ \pmb { \chi } ~ \subset ~ \mathbb { R } ^ { d }$ at time step $t ~ \in ~ ( 0 , 1 ]$ based on noisy observations ${ y ( { \pmb x } , t ) } \ \sim \ \bar { \mathcal { N } } ( { g ( { \pmb x } , t ) , \sigma ^ { 2 } } )$ . For each configuration $_ { \textbf { \em x } }$ trained for $T _ { x }$ time steps, we obtain $T _ { x }$ data points for our model; denoting the combined data by $\mathcal { D } =$ $\{ ( { \pmb x } _ { 1 } , t _ { 1 } , y _ { 1 1 } ) ) , ( { \pmb x } _ { 1 } , t _ { 2 } , y _ { 1 2 } ) , \dots , ( { \pmb x } _ { n } , T _ { x _ { n } } , y _ { n T _ { x _ { n } } } ) \}$ we can then write the joint probability of the data $\mathcal { D }$ and the network weights $W$ as
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
P ( \mathcal { D } , W ) = P ( W ) P ( \sigma ^ { 2 } ) \prod _ { i = 1 } ^ { | D | } \mathcal { N } ( y _ { i } ; \hat { g } ( { \pmb x } _ { i } , t _ { i } | W ) , \sigma ^ { 2 } ) .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where $\hat { g } ( \pmb { x } _ { i } , t _ { i } | W )$ is the prediction of a neural network. It is intractable to compute the posterior weight distribution $p ( W | \mathcal { D } )$ , but we can use MCMC to sample it, in particular stochastic gradient
|
| 74 |
+
|
| 75 |
+
MCMC methods, such as SGLD (Welling and Teh, 2011) or SGHMC (Chen et al., 2014). Given $M$ samples $W ^ { 1 } , \dots , W ^ { M }$ , we can then obtain the mean and variance of the predictive distribution $p ( g | \mathbf { x } , \bar { t } , \mathcal { D } )$ as
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\begin{array} { r l } & { \displaystyle \hat { \mu } ( \pmb { x } , t | \mathcal { D } ) = \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \hat { g } ( \pmb { x } , t | W ^ { i } ) , \mathrm { a n d } } \\ & { \displaystyle \widehat { \sigma ^ { 2 } } ( \pmb { x } , t | \mathcal { D } ) = \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \left( \hat { g } ( \pmb { x } , t | W ^ { i } ) - \hat { \mu } ( \pmb { x } , t | \mathcal { D } ) \right) ^ { 2 } , } \end{array}
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
respectively. We will write these shorthand as $\hat { \mu } ( { \pmb x } , t )$ and $\widehat { \sigma ^ { 2 } } ( \pmb { x } , t )$ . This is similar to Eqs. 4 and exactly the model that Springenberg et al. (2016) used for (blackbox) Bayesian optimization with Bayesian neural networks; the only difference is in the input to the model: here, there is a data point for every time step of the curve, whereas Springenberg et al. (2016) only used a single data point per curve (for its final time step).
|
| 82 |
+
|
| 83 |
+

|
| 84 |
+
Figure 2: Example functions generated with our $k = 5$ basis functions (formulas for which are given in Appendix B). For each function, we drew 50 different parameters $\theta _ { i }$ uniformly at random in the output domain of the hidden layer(s) of our model. This illustrates the type of functions used to model the learning curves.
|
| 85 |
+
|
| 86 |
+
# 2.3 HETEROSCEDASTIC NOISE OF HYPERPARAMETER CONFIGURATION
|
| 87 |
+
|
| 88 |
+
In the model described above, we assume homoscedastic noise across hyperparameter configurations. To evaluate how realistic this assumption is, we sampled 40 configurations of a fully connected network (see Section 3.1 for a more detailed description of how the data was generated and Table 2 for the list of hyperparameters) and evaluated each configuration $R = 1 0$ times with different pseudorandom number seeds (see the right panel of Figure 3 for some examples). Figure 3 (left) shows on the vertical axis the noise $\begin{array} { r } { \bar { \sigma ^ { 2 } } ( { \pmb x } , t ) = \frac { 1 } { R } \sum _ { r = 1 } ^ { R } ( y ( { \pmb x } , t ) - \bar { \mu } ( { \pmb x } , t ) ) ^ { 2 } } \end{array}$ and on the horizontal axis the rank of each configuration based on their asymptotic sample mean performance $\begin{array} { r } { 1 ) = \frac { 1 } { R } \sum _ { r = 1 } ^ { R } y ( \pmb { x } , t = 1 ) } \end{array}$ .
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 3: On the left, we plot the noise estimate of 40 different configurations on the FCNet benchmark sorted by their asymptotic mean performance at $t = 1$ . The color indicates the time step $t$ , darker meaning a larger value. On the right, we show the learning curves of 5 different configurations each evaluated 10 times (indicated with the same color) with a different seed.
|
| 92 |
+
|
| 93 |
+
Maybe not surprisingly, the noise seems to correlate with the asymptotic performance of a configuration. The fact that the noise between different configurations varies on different orders of magnitudes suggests a heteroscedastic noise model to best describe this behavior. We incorporate this observation by making the noise dependent on the input data to allow to predict different noise levels for different hyperparameters. In principle, one could also model a $t$ dependent noise, but we could not find the same trend across different datasets.
|
| 94 |
+
|
| 95 |
+
# 2.4 NEW BASIS FUNCTION LAYER FOR LEARNING CURVE PREDICTION WITH BAYESIAN NEURAL NETWORKS
|
| 96 |
+
|
| 97 |
+
We now combine Bayesian neural networks with the parametric functions to incorporate more knowledge about learning curves into the network itself. Instead of obtaining the parameters $\Theta$ and $\pmb { w }$ by sampling from the posterior, we use a Bayesian neural network to learn several mappings simultaneously:
|
| 98 |
+
|
| 99 |
+
1. $\hat { \mu } _ { \infty }$ : $\mathcal X \mathbb R$ , the asymptotic value of the learning curve
|
| 100 |
+
2. $\Theta$ : $\mathcal { X } \to \mathbb { R } ^ { K }$ , the parameters of a parametric function model (see Figure 2 for some example curves from our basis functions)
|
| 101 |
+
3. $v \colon \mathcal { X } \to \mathbb { R } ^ { k }$ , the corresponding weights for each function in the model
|
| 102 |
+
4. $\widehat { \sigma ^ { 2 } }$ : $\mathcal { X } \to \mathbb { R } ^ { + }$ , the observational noise for this hyperparameter configuration
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 4: Our neural network architecture to model learning curves. A common hidden layer is used to simultaneously model $\hat { \mu } _ { \infty }$ , the parameters $\Theta$ of the basis functions, their respective weights $\pmb { w }$ , and the noise $\widehat { \sigma ^ { 2 } }$ .
|
| 106 |
+
|
| 107 |
+
With these quantities, we can compute the likelihood in (3) which allows training the network.
|
| 108 |
+
|
| 109 |
+
Phrased differently, we use a neural network to predict the model parameters $\Theta$ and weights $\pmb { w }$ of our parametric functions, yielding the following form for our network’s mean predictions:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { r } { \hat { g } ( \pmb { x } _ { i } , t _ { i } | W ) = \hat { f } ( t _ { i } | \Theta ( \pmb { x } _ { i } , W ) , \pmb { w } ( \pmb { x } _ { i } , W ) ) . } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
A schematic of this is shown in Fig. 4. For training, we will use the same MCMC methods, namely SGLD and SGHMC mentioned above.
|
| 116 |
+
|
| 117 |
+
# 3 EXPERIMENTS
|
| 118 |
+
|
| 119 |
+
We now empirically evaluate the predictive performance of Bayesian neural networks, with and without our special learning curve layer. For both networks, we used a 3-layer architecture with tanh activations and 64 units per layer. We also evaluate two different sampling methods for both types of networks: stochastic gradient Langevin dynamics (SGLD) and stochastic gradient Hamiltonian MCMC (SGHMC), following the approach of Springenberg et al. (2016) to automatically adapt the noise estimate and the preconditioning of the gradients.
|
| 120 |
+
|
| 121 |
+
As baselines, we compare to other approaches suitable for this task. Besides the aforementioned work by Domhan et al. (2015), we also compare against random forests Breimann (2001) with empirical variance estimates (Hutter et al., 2014), a Gaussian process (GP) using the learning curve kernel from Swersky et al. (2014), another Bayesian neural network technique called probabilistic back propagation (PBP) (Hernández-Lobato and Adams, 2015), and the simple heuristic of using the last seen value (LastSeenValue) of each learning curve for extrapolation. The last model has been successfully used by Li et al. (2017) despite its simplicity.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 5: Qualitative comparison of the different models. The left panel shows the mean predictions of different methods on the CNN benchmark. All models observed the validation error of the first 12 epochs of the true learning curve (black). On the right, the posterior distributions over the value at 40 epochs is plotted.
|
| 125 |
+
|
| 126 |
+
# 3.1 DATASETS
|
| 127 |
+
|
| 128 |
+
For our empirical evaluation, we generated the following four datasets of learning curves, in each case sampling hyperparameter configurations at random from the hyperparameter spaces detailed in Table 2 in the appendix (see also Section D for some characteristic of these datasets):
|
| 129 |
+
|
| 130 |
+
• CNN: We sampled 256 configurations of 5 different hyperparameters of a 3-layer convolutional neural network (CNN) and trained each of them for 40 epochs on the CIFAR10 (Krizhevsky, 2009) benchmark.
|
| 131 |
+
FCNet: We sampled 4096 configurations of 10 hyperparameters of a 2-layer feed forward neural network (FCNet) on MNIST (LeCun et al., 2001), with batch normalization, dropout and ReLU activation functions, annealing the learning rate over time according to a power function. We trained the neural network for 100 epochs.
|
| 132 |
+
• LR: We sampled 1024 configurations of the 4 hyperparameters of logistic regression (LR) and also trained it for 100 epochs on MNIST. VAE: We sampled 1024 configuration of the 4 hyperparameters of a variational autoencoder (VAE) (Kingma and Welling, 2014). We trained the VAE on MNIST, optimizing the approximation of the lower bound for 300 epochs.
|
| 133 |
+
|
| 134 |
+
# .2 PREDICTING ASYMPTOTIC VALUES OF PARTIALLY OBSERVED CURVES
|
| 135 |
+
|
| 136 |
+
We first study the problem of predicting the asymptotic values of partially-observed learning curves tackled by Domhan et al. (2015). The LC-Extrapolation method by Domhan et al. (2015), the GP, and the last seen value work on individual learning curves and do not allow to model performance across hyperparameter configurations. Thus, we trained them separately on individual partial learning curves. The other models, including our Bayesian neural networks, on the other hand, can use training data from different hyperparameter configurations. Here, we used training data with the same number of epochs for every partial learning curve.1
|
| 137 |
+
|
| 138 |
+
The left panel of Figure 5 visualizes the extrapolation task, showing a learning curve from the CNN dataset and the prediction of the various models trained only using the first 12 of 40 epochs of the learning curve. The right panel shows the corresponding predictive distributions obtained with these models. LastSeenValue does not yield a distribution and uncertainties are not defined.
|
| 139 |
+
|
| 140 |
+
For a more quantitative evaluation, we used all models to predict the asymptotic value of all learning curves, evaluating predictions based on observing between $10 \%$ and $90 \%$ of the learning curves.
|
| 141 |
+
|
| 142 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=2>CNNMSE·10² ALL</td><td rowspan=1 colspan=2>FCNetMSE-102 ALL</td><td rowspan=1 colspan=1>MSE·10²</td><td rowspan=1 colspan=1>LRALL</td><td rowspan=1 colspan=2>VAEMSE·104 ALL</td></tr><tr><td rowspan=1 colspan=1>SGLD</td><td rowspan=1 colspan=1>1.8±0.9</td><td rowspan=1 colspan=1>0.60±0.25</td><td rowspan=1 colspan=1>4.5±0.6</td><td rowspan=1 colspan=1>0.13±0.05</td><td rowspan=1 colspan=1>1.1 ± 0.3</td><td rowspan=1 colspan=1>0.77±0.08</td><td rowspan=1 colspan=1>4.7 ± 1.7</td><td rowspan=1 colspan=1>2.16 ±0.07</td></tr><tr><td rowspan=1 colspan=1>SGLD-LC</td><td rowspan=1 colspan=1>1.4 ± 0.9</td><td rowspan=1 colspan=1>1.09 ± 0.22</td><td rowspan=1 colspan=1>3.3 ±0.7</td><td rowspan=1 colspan=1>0.54± 0.06</td><td rowspan=1 colspan=1>1.3 ± 0.7</td><td rowspan=1 colspan=1>0.94 ±0.09</td><td rowspan=1 colspan=1>3.1 ± 1.1</td><td rowspan=1 colspan=1>1.55 ± 0.01</td></tr><tr><td rowspan=1 colspan=1>SGHMC</td><td rowspan=1 colspan=1>0.8±0.6</td><td rowspan=1 colspan=1>0.96± 0.15</td><td rowspan=1 colspan=1>1.9 ±0.3</td><td rowspan=1 colspan=1>0.50± 0.04</td><td rowspan=1 colspan=1>0.5±0.2</td><td rowspan=1 colspan=1>1.08±0.05</td><td rowspan=1 colspan=1>3.6± 1.5</td><td rowspan=1 colspan=1>2.34± 0.07</td></tr><tr><td rowspan=1 colspan=1>SGHMC-LC</td><td rowspan=1 colspan=1>0.7±0.6</td><td rowspan=1 colspan=1>1.15 ± 0.34</td><td rowspan=1 colspan=1>2.0±0.3</td><td rowspan=1 colspan=1>0.80±0.05</td><td rowspan=1 colspan=1>0.5±0.2</td><td rowspan=1 colspan=1>1.17 ± 0.08</td><td rowspan=1 colspan=1>1.9 ± 1.1</td><td rowspan=1 colspan=1>1.39 ± 0.65</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Table 1: In each column we report the mean squared error (MSE) and the average log-likelihood (ALL) of the 16 fold CV learning curve prediction for a neural network without learning curve prediction layer (SGLD and SGHMC) and with our new layer (SGLD-LC and SGHMC-LC).
|
| 145 |
+
|
| 146 |
+
Figure 6 shows the mean squared error between the true asymptotic value and the models’ predictions (left) and the average log-likelihood of the true value given each model as a function of how much of the learning curves has been observed. Note that we removed some methods from the plots to avoid clutter; the same plots with all methods can be found in the supplementary material. We notice several patterns:
|
| 147 |
+
|
| 148 |
+
1. Throughout, our specialized network architecture performs better than the standard Bayesian neural networks, and SGHMC outperformed SGLD (see Appendix C).
|
| 149 |
+
2. PBP shows mixed results for the extrapolated mean, and does not provide reliable uncertainties (also see Appendix C). We hypothesize that this may be due to its linear activation functions.
|
| 150 |
+
3. If no uncertainties are required, LastSeenValue is hard to beat. This is because many configurations approach their final performance quite quickly.
|
| 151 |
+
4. The GP mean predictions are very competitive, but the average log-likelihood indicates overconfidence, especially for short learning curves. We assume that the prior assumption of an exponential function is not flexible enough in practice and that after observing some data points the Gaussian process becomes too certain of its predictions.
|
| 152 |
+
5. The random forest’s mean predictions almost match the quality of the GP. The uncertainty estimates are better, but still too aggressive when only a small fraction of the learning curve was observed. Random forests do not extrapolate and similar to LastSeenValue also achieve a very good mean prediction if the learning curve has almost converged.
|
| 153 |
+
6. Local models for single curves clearly outperform global models for almost complete learning curves. Global models, like our BNN approach, on the other hand, are trained on many configurations and need to generalize across these, yielding somewhat worse performance for this (arguably easy) task.2
|
| 154 |
+
|
| 155 |
+
# 3.3 PREDICTING UNOBSERVED LEARNING CURVES
|
| 156 |
+
|
| 157 |
+
As mentioned before, training a joint model across hyperparameters and time steps allows us to make predictions for completely unobserved learning curves of new configurations. To estimate how well Bayesian neural networks perform in this task, we used the datasets from Section 3.1 and split all of them into 16 folds, allowing us to perform cross-validation of the predictive performance. For each fold, we trained all models on the full learning curves in the training set and let them predict the held-out learning curves.
|
| 158 |
+
|
| 159 |
+
Table 1 shows the mean squared error and the average log-likelihood (both computed for all points in each learning curve) across the 16 folds. We make two observations: firstly, both neural network architectures lead to a reasonable mean squared error and average log-likelihood, for both SGLD and SGHMC. Except on the VAE dataset our learning curve layer seems to improve mean squared error and average log likelihood. Secondly, SGHMC performed better than SGLD, with the latter resulting in predictions with too small variances. Figure 7 visualizes the results for our CNN dataset in more detail, showing that true and predicted accuracies correlate quite strongly.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 6: Assessment of the predictive quality based on partially observed learning curves on all 4 benchmarks. The panels on the left show the mean squared error of the predicted asymptotic value (y-axis) after observing all learning curves up to a given fraction of maximum number of epochs (x-axis). The panels on the right show the average log-likelihood based on the predictive mean and variance of the asymptotic value. Note that LastSeenValue does not provide a predictive variance.
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 7: On the horizontal axis, we plot the true value and on the vertical axis the predicted values. Each point is colored by its log-likelihood (the brighter the higher). Our learning curve BNN trained with SGHMC leads to the best mean predictions and assigns the highest likelihood to the test points.
|
| 166 |
+
|
| 167 |
+
# 3.4 MODEL-BASED HYPERBAND
|
| 168 |
+
|
| 169 |
+
In this section, we show how our model can be used to improve hyperparameter optimization of iterative machine learning algorithms. For this, we extended the multi-armed bandit strategy Hyperband (Li et al., 2017), which in each iteration $i$ first samples $N _ { i }$ hyperparameter configurations $\dot { C } \dot { = } \{ { \pmb x } _ { 1 } , \ldots , { \pmb x } _ { N _ { i } } \}$ and then uses successive halving (Jamieson and Talwalkar, 2016) to iteratively discard poorly-performing configurations from $C$ . While the original Hyperband method samples configurations $C$ from a uniform distribution $\mathcal { U }$ over hyperparameter configurations, our extension instead samples them based on our model, with all other parts remaining unchanged. More precisely, we sample $M _ { i } \ > > \ N _ { i }$ configurations uniformly, $\hat { C } = \{ \pmb { x } _ { 1 } , \dotsc , \pmb { x } _ { M _ { i } } \} \sim \mathcal { U }$ , and pick the $N _ { i }$ configurations with the highest predicted asymptotic mean $a ( \pmb { x } ) = \hat { \mu } ( \pmb { x } , t = 1 )$ or upper confidence value $a ( { \pmb x } ) = \hat { \mu } ( { \pmb x } , t = 1 ) \hat { \bf \mu } + \hat { \sigma } ( \hat { \bf \ x } , t = 1 )$ .
|
| 170 |
+
|
| 171 |
+
For a thorough empirical evaluation and to reduce computational requirements we reused the data from Section 3.1 to construct a surrogate benchmark based on a random forest (see Appendix E for more details). After each iteration we report the final performance of the best observed configuration so far, along with the wall clock time that would have been needed for optimizing the true objective function. Reporting the (predicted) wall clock time (rather than the number of iterations) also takes our optimizer’s overhead into account. This is important since one may worry that this overhead may be substantial due to our use of a model; however, as we show it does not harm performance.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 8: Comparison of Hyperband, Hyperband with our model, and standard Bayesian optimization on the CNN benchmark. Hyperband finds a good configuration faster than standard Bayesian optimization, but it only approaches the global optimum quickly when extended with our model.
|
| 175 |
+
|
| 176 |
+
Figure 8 shows the immediate regret on the CNN benchmark as a function of wallclock time, for three optimizers: Hyperband, our model-based extension of Hyperband, as well as standard Bayesian optimization with a Gaussian process (a comparison to additional baselines can be found in Appendix E). Standard Bayesian optimization does not make use of learning curves and thus needs to evaluate each configuration for the full amount of epochs. Nevertheless, since training one configuration to the end takes less time than one round of successive halving, Bayesian optimization produces its first results earlier than Hyperband. In accordance with results by Li et al. (2017), in this experiment Hyperband found a configuration with good performance faster than standard Bayesian optimization, but its random sampling did not suffice to quickly approach the best configuration; given enough time Bayesian optimization performed better. However, extended by our model, Hyperband both found a good configuration fast and approached the global optimum fastest.
|
| 177 |
+
|
| 178 |
+
We would like to emphasize that our model-based extension of Hyperband is not limited to our particular Bayesian neural networks as the underlying model. Since Hyperband stops the majority of the configurations very early, the setting is quite similar to that of very short partially observed learning curves in Section 3.2, with the differences that some configurations have been evaluated for longer and that the model now has to generalize to unseen configurations. For example, for the CNN and LR benchmarks, the experiments in Section 3.2 showed that random forests achieve strong average log-likelihoods for very short partial learning curves, and we would therefore also expect them to work well when combined with Hyperband. However, given our model’s more robust likelihoods and mean squared error values we believe it to be less sensitive to the underlying data. Additionally, we can incorporate more prior knowledge about the general shape of the curves into our model, something that is not easily done for many other model classes.
|
| 179 |
+
|
| 180 |
+
# 4 CONCLUSION
|
| 181 |
+
|
| 182 |
+
We studied Bayesian neural networks for modelling the learning curves of iterative machine learning methods, such as stochastic gradient descent for convolutional neural networks. Based on the parametric learning curve models of Domhan et al. (2015), we also developed a specialized neural network architecture with a learning curve layer that improves learning curve predictions. In future work, we aim to study recurrent neural networks for predicting learning curves and will extend Bayesian optimization methods with Bayesian neural networks (Springenberg et al., 2016) based on our learning curve models.
|
| 183 |
+
|
| 184 |
+
# ACKNOWLEDGMENT
|
| 185 |
+
|
| 186 |
+
This work has partly been supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme under grant no. 716721, by the European Commission under grant no. H2020-ICT-645403-ROBDREAM, and by the German Research Foundation (DFG) under Priority Programme Autonomous Learning (SPP 1527, grant HU 1900/3-1).
|
| 187 |
+
|
| 188 |
+
# REFERENCES
|
| 189 |
+
|
| 190 |
+
E. Brochu, V. Cora, and N. de Freitas. A tutorial on Bayesian optimization of expensive cost functions, with application to active user modeling and hierarchical reinforcement learning. CoRR, 2010.
|
| 191 |
+
J. Snoek, H. Larochelle, and R. P. Adams. Practical Bayesian optimization of machine learning algorithms. In Proc. of NIPS’12, 2012.
|
| 192 |
+
B. Shahriari, K. Swersky, Z. Wang, R. Adams, and N. de Freitas. Taking the human out of the loop: A Review of Bayesian Optimization. Proc. of the IEEE, (1), 12/2015 2016.
|
| 193 |
+
K. Swersky, J. Snoek, and R. Adams. Freeze-thaw Bayesian optimization. CoRR, 2014.
|
| 194 |
+
T. Domhan, J. T. Springenberg, and F. Hutter. Speeding up automatic hyperparameter optimization of deep neural networks by extrapolation of learning curves. In Q. Yang and M. Wooldridge, editors, Proc. of IJCAI’15, 2015.
|
| 195 |
+
L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and A. Talwalkar. Hyperband: Bandit-based configuration evaluation for hyperparameter optimization. In Proc. of ICLR’17, 2017.
|
| 196 |
+
A. Klein, S. Falkner, S. Bartels, P. Hennig, and F. Hutter. Fast Bayesian optimization of machine learning hyperparameters on large datasets. In Proc. of AISTATS’17, 2017.
|
| 197 |
+
K. Swersky, J. Snoek, and R. Adams. Multi-task Bayesian optimization. In Proc. of NIPS’13, 2013.
|
| 198 |
+
M. Feurer, T. Springenberg, and F. Hutter. Initializing Bayesian hyperparameter optimization via meta-learning. In Proc. of AAAI’15, 2015.
|
| 199 |
+
F. Hutter, H. Hoos, K. Leyton-Brown, and K. Murphy. Time-bounded sequential parameter optimization.
|
| 200 |
+
F. Hutter, H. Hoos, and K. Leyton-Brown. Sequential model-based optimization for general algorithm configuration. In LION’11, 2011.
|
| 201 |
+
J. Snoek, O. Rippel, K. Swersky, R. Kiros, N. Satish, N. Sundaram, M. M. A. Patwary, Prabhat, and R. P. Adams. Scalable Bayesian optimization using deep neural networks. In Proc. of ICML’15, 2015.
|
| 202 |
+
J. Springenberg, A. Klein, S. Falkner, and F. Hutter. Bayesian optimization with robust Bayesian neural networks. In Proc. of NIPS’16, 2016.
|
| 203 |
+
J. Hernández-Lobato and R. Adams. Probabilistic backpropagation for scalable learning of Bayesian neural networks. In Proc. of ICML’15, 2015.
|
| 204 |
+
M. Welling and Y. Teh. Bayesian learning via stochastic gradient Langevin dynamics. In Proc. of ICML’11, 2011.
|
| 205 |
+
T. Chen, E.B. Fox, and C. Guestrin. Stochastic gradient Hamiltonian Monte Carlo. In Proc. of ICML’14, 2014.
|
| 206 |
+
D. Foreman-Mackey, D. W. Hogg, D. Lang, and J. Goodman. emcee $:$ The MCMC Hammer. PASP, 2013.
|
| 207 |
+
L. Breimann. Random forests. MLJ, 2001.
|
| 208 |
+
F. Hutter, L. Xu, H. Hoos, and K. Leyton-Brown. Algorithm runtime prediction: Methods and evaluation. AIJ, 2014.
|
| 209 |
+
A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
|
| 210 |
+
Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In S. Haykin and B. Kosko, editors, Intelligent Signal Processing. IEEE Press, 2001. URL http://www.iro.umontreal.ca/\~lisa/pointeurs/lecun-01a.pdf.
|
| 211 |
+
D. Kingma and M. Welling. Auto-encoding variational bayes. In Proc. of ICLR’14, 2014.
|
| 212 |
+
K. Jamieson and A. Talwalkar. Non-stochastic best arm identification and hyperparameter optimization. In Proc. of AISTATS’16, 2016.
|
| 213 |
+
K. Eggensperger, F. Hutter, H.H. Hoos, and K. Leyton-Brown. Efficient benchmarking of hyperparameter optimizers via surrogates. In Proc. of AAAI’15, 2015.
|
| 214 |
+
|
| 215 |
+
# A EXPERIMENTAL SETUP – DETAILS
|
| 216 |
+
|
| 217 |
+
Table 2 shows the hyperparameters of our 4 benchmarks described in Section 3.1 and their ranges.
|
| 218 |
+
Table 2: Hyperparameter configuration space of the four different iterative methods. For the FCNet we decayed the learning rate by a $\alpha _ { d e c a y } = ( 1 + \gamma * t ) ^ { - \kappa }$ and also sampled different values for $\gamma$ and $\kappa$ .
|
| 219 |
+
|
| 220 |
+
<table><tr><td></td><td>Name</td><td>Range</td><td>log scale</td></tr><tr><td rowspan="5">CNN</td><td>batch size</td><td>[32, 512]</td><td>1</td></tr><tr><td>number of units layer 1</td><td>[24,210]</td><td>√</td></tr><tr><td>number of units layer 2</td><td>[24,210]</td><td>√</td></tr><tr><td>number of units layer 3</td><td>[24,210]</td><td><</td></tr><tr><td>learning rate</td><td>[10-6,10-0]</td><td>√</td></tr><tr><td rowspan="9">FCNet</td><td>initial learning rate</td><td>[10-6,10°]</td><td>√</td></tr><tr><td>L2 regularization</td><td>[10-8,10-1]</td><td></td></tr><tr><td>batch size</td><td>[32,512]</td><td>√</td></tr><tr><td>Y</td><td>[-3,-1]</td><td></td></tr><tr><td>K</td><td>[0,1]</td><td></td></tr><tr><td>momentum</td><td>[0.3,0.999]</td><td></td></tr><tr><td>number units 1</td><td>[25,122]</td><td></td></tr><tr><td>number units 2</td><td>[25,212]</td><td></td></tr><tr><td>dropout rate layer 1</td><td>[0.0,0.99]</td><td></td></tr><tr><td rowspan="4">LR</td><td>dropout rate layer 2</td><td>[0.0,0.99]</td><td></td></tr><tr><td>learning rate</td><td>[10-6,100]</td><td>√</td></tr><tr><td>L2</td><td>[0.0,1.0]</td><td></td></tr><tr><td>batch size</td><td>[20,2000]</td><td></td></tr><tr><td rowspan="5">VAE</td><td>dropout rate on inputs L</td><td>[0.0,0.75]</td><td></td></tr><tr><td>number of hidden units</td><td>[1,3]</td><td></td></tr><tr><td>batch size</td><td>[32,2048] [16,512]</td><td></td></tr><tr><td>z dimension</td><td></td><td></td></tr><tr><td></td><td>[2,200]</td><td></td></tr></table>
|
| 221 |
+
|
| 222 |
+
# B DESCRIPTION OF THE BASIS FUNCTIONS
|
| 223 |
+
|
| 224 |
+
To reduce complexity, we used a subset of the basis function from Domhan et al. (2015) which we found to be sufficient for learning curve prediction. We adapted these functions to model the residual between the asymptotic value $y _ { \infty }$ and we scaled the parameters $\Theta$ to be in $[ 0 , 1 ]$ . Table 3 shows the exact equations we used.
|
| 225 |
+
|
| 226 |
+
# C PREDICTING ASYMPTOTIC VALUES OF PARTIALLY OBSERVED CURVES
|
| 227 |
+
|
| 228 |
+
Figure 9 shows the mean squared error and the average log-likelihood of predicting the asymptotic value after observing different amounts of the learning curve for all methods. See Section 3.2 in the main text for more details.
|
| 229 |
+
|
| 230 |
+
# D DATASET CHARACTERISTICS
|
| 231 |
+
|
| 232 |
+
Figure 10 shows the distributions over runtimes for all random configurations of different benchmarks. As it can be seen there is a high variance of the runtime between different configurations for all benchmarks and some configurations need order of magnitudes longer than others.
|
| 233 |
+
|
| 234 |
+

|
| 235 |
+
Figure 9: Assessment of the predictive quality based on partially observed learning curves on all 4 benchmarks. The panels on the left show the mean squared error of the predicted asymptotic value (y-axis) after observing all learning curves up to a given fraction of maximum number of epochs (x-axis). The panels on the right show the average log-likelihood based on the predictive mean and variance of the asymptotic value.
|
| 236 |
+
|
| 237 |
+
Table 3: The formulas of our 5 basis functions.
|
| 238 |
+
|
| 239 |
+
<table><tr><td rowspan=1 colspan=1>Name</td><td rowspan=1 colspan=1>Formula</td></tr><tr><td rowspan=1 colspan=1>vapor pressure</td><td rowspan=1 colspan=1>Φ(t,a,b,c)=e-a-0.1-b.t-11c-lg(t)e--01b</td></tr><tr><td rowspan=1 colspan=1>pow</td><td rowspan=1 colspan=1>(t,a,b)=a·(tb-1)</td></tr><tr><td rowspan=1 colspan=1>log power</td><td rowspan=1 colspan=1>Φ(ta,b,c)=2·[()-(((t)</td></tr><tr><td rowspan=1 colspan=1>exponential</td><td rowspan=1 colspan=1>Φ(t,a,b)=a·[e-10-b -e-10·b·t]</td></tr><tr><td rowspan=1 colspan=1>hill-3</td><td rowspan=1 colspan=1>(t,a,b,c)=a.[(cb.t-b+1)-1-(cb+1)-1]</td></tr></table>
|
| 240 |
+
|
| 241 |
+
Figure 11 shows the empirical cumulative distribution of the asymptotic performance of random configurations. These plots give an intuition about the difficulty of a benchmark as they show how many random configurations one has to sample in order to achieve a good performance.
|
| 242 |
+
|
| 243 |
+
# E OPTIMIZATION ON SURROGATE BENCHMARKS
|
| 244 |
+
|
| 245 |
+
We follow the approach by Eggensperger et al. (2015) and used the generated datasets from Section 3.1 to build surrogates of the objective functions. This allows us to compare different optimizers on this benchmark very efficiently while (approximately) preserving the characteristics of the underlying benchmark. Using surrogates instead of optimizing the real benchmarks allows us to carry out a more thorough empirical evaluation (since single function evaluations are cheap and we therefore can afford more and longer optimization runs). We used random forests as surrogates following Eggensperger et al. (2015) since they do not introduce a bias for our approach (in contrast to, e.g., surrogates based on standard feed forward neural networks trained with stochastic gradient descent ). For each benchmark, we used all configurations to train a random forest predicting the validation accuracy of a configuration at a certain time step as well as the wall clock time for its evaluation.
|
| 246 |
+
|
| 247 |
+
After each round of successive halving, we return the current best observed configuration and its asymptotic performance. For each function evaluation, we predict the accuracy, and the runtime. By adding the optimization overhead, we can predict the wallclock time necessary to optimize the real objective function. Reporting the wallclock time rather than the number of iterations also takes the additional overhead from running our method into account. Furthermore, we argue that the wallclock time is more interesting in practice.
|
| 248 |
+
|
| 249 |
+
As baselines, we compare to Gaussian process based Bayesian optimization with the upper confidence bound acquisition function (GP-BO-UCB) and the (log) expected improvement acquisition function (GP-BO-Log-EI), as well as Bayesian optimization with Bayesian neural networks (BOHAMIANN) (Springenberg et al., 2016). As an additional baseline, we use standard Bayesian neural networks (SGHMC-BNN) inside Hyperband instead of our specialized neural network architecture (SGHMCLCNet). We compare our model-based version of Hyperband against all these baselines with sampling from the asymptotic mean (SGHMC-LCNet-mean-sampling) and the asymptotic upper confidence bound (SGHMC-LCNet-ucb-sampling). Figure 12 shows that our specialized neural network architecture helps to speed up the convergence of Hyperband on the CNN and the FCNet benchmark. For the LR benchmarks our model still improves over Hyperband but does not perform better than Bayesian optimization. Hyperband as well as our method find the optimum already after the first round of successive halving for the VAE benchmark, which leads to an regret of 0.
|
| 250 |
+
|
| 251 |
+

|
| 252 |
+
Figure 10: Distributions over runtimes for different random configurations for the CNN, FCNet, LR and VAE benchmark described in Section 3.One can see that all distributions are long tailed and that especially on the FCNet benchmark some configuration need order of magnitudes longer than others.
|
| 253 |
+
|
| 254 |
+

|
| 255 |
+
Figure 11: Empirical cumulative distributions for the CNN, FCNet, LR and VAE benchmark.
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
Figure 12: Different optimizers on a random forests based suggorate of all collected learning curves on different benchmarks. Note how sampling from the model improves Hyperband’s performance by converging to the optimum faster.
|
md/train/SkPoRg10b/SkPoRg10b.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/Sklsm20ctX/Sklsm20ctX.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COMPETITIVE EXPERIENCE REPLAY
|
| 2 |
+
|
| 3 |
+
Hao Liu∗, Alexander Trott, Richard Socher, Caiming Xiong
|
| 4 |
+
Salesforce Research
|
| 5 |
+
Palo Alto, 94301
|
| 6 |
+
lhao499@gmail.com,{atrott, rsocher, cxiong}@salesforce.com
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Deep learning has achieved remarkable successes in solving challenging reinforcement learning (RL) problems when dense reward function is provided. However, in sparse reward environment it still often suffers from the need to carefully shape reward function to guide policy optimization. This limits the applicability of RL in the real world since both reinforcement learning and domain-specific knowledge are required. It is therefore of great practical importance to develop algorithms which can learn from a binary signal indicating successful task completion or other unshaped, sparse reward signals. We propose a novel method called competitive experience replay, which efficiently supplements a sparse reward by placing learning in the context of an exploration competition between a pair of agents. Our method complements the recently proposed hindsight experience replay (HER) by inducing an automatic exploratory curriculum. We evaluate our approach on the tasks of reaching various goal locations in an ant maze and manipulating objects with a robotic arm. Each task provides only binary rewards indicating whether or not the goal is achieved. Our method asymmetrically augments these sparse rewards for a pair of agents each learning the same task, creating a competitive game designed to drive exploration. Extensive experiments demonstrate that this method leads to faster converge and improved task performance.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Recent progress in deep reinforcement learning has achieved very impressive results in domains ranging from playing games (Mnih et al., 2015; Silver et al., 2016; 2017; OpenAI, 2018), to high dimensional continuous control (Schulman et al., 2016; 2017; 2015), and robotics (Levine et al., 2018; Kalashnikov et al., 2018; Andrychowicz et al., 2018b).
|
| 15 |
+
|
| 16 |
+
Despite these successes, in robotics control and many other areas, deep reinforcement learning still suffers from the need to engineer a proper reward function to guide policy optimization (see e.g. Popov et al. 2017, $\mathrm { N g }$ et al. 2006). In robotic control as stacking bricks, reward function need to be sharped to very complex which consists of multiple terms(Popov et al., 2017). It is extremely hard and not applicable to engineer such reward function for each task in real world since both reinforcement learning expertise and domain-specific knowledge are required. Learning to perform well in environments with sparse rewards remains a major challenge. Therefore, it is of great practical importance to develop algorithms which can learn from binary signal indicating successful task completion or other unshaped reward signal.
|
| 17 |
+
|
| 18 |
+
In environments where dense reward function is not available, only a small fraction of the agents’ experiences will be useful to compute gradient to optimize policy, leading to substantial high sample complexity. Providing agents with useful signals to pursue in sparse reward environments becomes crucial in these scenarios.
|
| 19 |
+
|
| 20 |
+
In the domain of goal-directed RL, the recently proposed hindsight experience replay (HER) (Andrychowicz et al., 2017) addresses the challenge of learning from sparse rewards by re-labelling visited states as goal states during training. However, this technique continues to suffer from sample inefficiency, ostensibly due to difficulties related to exploration. In this work, we address these limitations by introducing a method called Competitive Experience Replay $( C E R )$ . This technique attempts to emphasize exploration by introducing a competition between two agents attempting to learn the same task. Intuitively, agent $A$ (the agent ultimately used for evaluation) receives a penalty for visiting states that the competitor agent $( B )$ also visits; and $B$ is rewarded for visiting states found by $A$ . Our approach maintains the reward from the original task such that exploration is biased towards the behaviors best suited to accomplishing the task goals. We show that this competition between agents can automatically generate a curriculum of exploration and shape otherwise sparse reward. We jointly train both agents’ policies by adopting methods from multi-agent RL. In addition, we propose two versions of CER, independent CER, and interact CER, which differ in the state initialization of agent $B$ : whether it is sampled from the initial state distribution or sampled from off-policy samples of agent $A$ , respectively.
|
| 21 |
+
|
| 22 |
+
Whereas HER re-labels samples based on an agent’s individual rollout, our method re-labels samples based on intra-agent behavior; as such, the two methods do not interfere with each other algorithmically and are easily combined during training. We evaluate our method both with and without HER on a variety of reinforcement learning tasks, including navigating an ant agent to reach a goal position and manipulating objects with a robotic arm. For each such task the default reward is sparse, corresponding to a binary indicator of goal completion. Ablation studies show that our method is important for achieving a high success rate and often demonstrates faster convergence. Interestingly, we find that CER and HER are complementary methods and employ both to reach peak efficiency and performance. Furthermore, we observe that, when combined with HER, CER outperforms curiosity-driven exploration.
|
| 23 |
+
|
| 24 |
+
# 2 BACKGROUND
|
| 25 |
+
|
| 26 |
+
Here, we provide an introduction to the relevant concepts for reinforcement learning with sparse reward (Section 2.1), Deep Deterministic Policy Gradient, the backbone algorithm we build off of, (Section 2.2), and Hindsight Experience Replay (Section 2.3).
|
| 27 |
+
|
| 28 |
+
# 2.1 SPARSE REWARD REINFORCEMENT LEARNING
|
| 29 |
+
|
| 30 |
+
Reinforcement learning considers the problem of finding an optimal policy for an agent that interacts with an uncertain environment and collects reward per action. The goal of the agent is to maximize its cumulative reward. Formally, this problem can be viewed as a Markov decision process over the environment states $s \in S$ and agent actions $a \in A$ , with the (unknown) environment dynamics defined by the transition probability $T ( s ^ { \prime } | \bar { s } , a )$ and reward function $r ( s _ { t } , a _ { t } )$ , which yields a reward immediately following the action $a _ { t }$ performed in state $s _ { t }$ .
|
| 31 |
+
|
| 32 |
+
We consider goal-conditioned reinforcement learning from sparse rewards. This constitutes a modification to the reward function such that it depends on a goal $g \in G$ , such that $r _ { g } : S \times A \times G \to R$ . Every episode starts with sampling a state-goal pair from some distribution $p ( s _ { 0 } , g )$ . Unlike the state, the goal stays fixed for the whole episode. At every time step, an action is chosen according to some policy $\pi$ , which is expressed as a function of the state and the goal, $\pi : S \times G \to A$ . For generality, our only restriction on $G$ is that it is a subset of $S$ . In other words, the goal describes a target state and the task of the agent is to reach that state. Therefore, we apply the following sparse reward function:
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
r _ { t } = r _ { g } ( s _ { t } , a _ { t } , g ) = { \left\{ \begin{array} { l l } { 0 , { \mathrm { i f } } \ | s _ { t } - g | < \delta } \\ { - 1 , { \mathrm { o t h e r w i s e } } } \end{array} \right. }
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where $g$ is a goal, $| s _ { t } - g |$ is a distance measure, and $\delta$ is a predefined threshold that controls when the goal is considered completed.
|
| 39 |
+
|
| 40 |
+
Following policy gradient methods, we model the policy as a conditional probability distribution over states, $\pi _ { \boldsymbol { \theta } } ( a | [ s , g ] )$ , where $[ s , g ]$ denotes concatenation of state $s$ and goal $g$ , and $\theta$ are the learnable parameters. Our objective is to optimize $\theta$ with respect to the expected cumulative reward, given by:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
J ( \theta ) = \mathbb { E } _ { s \sim \rho _ { \pi } , a \sim \pi ( a | s , g ) , g \sim G } \left[ r _ { g } ( s , a , g ) \right] ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $\begin{array} { r } { \rho _ { \pi } ( s ) = \sum _ { t = 1 } ^ { \infty } \gamma ^ { t - 1 } \mathrm { P r } ( s _ { t } = s ) } \end{array}$ is the normalized discounted state visitation distribution with discount factor $\gamma \in [ 0 , 1 )$ . To simplify the notation, we denote $\mathbb { E } _ { s \sim \rho _ { \pi } , a \sim \pi ( a | s , g ) , g \sim G } [ \cdot ]$ by simply $\mathbb { E } _ { \pi } [ \cdot ]$ in the rest of paper. According to the policy gradient theorem (Sutton et al., 1998), the gradient of $J ( \theta )$ can be written as
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\nabla _ { \theta } J ( \theta ) = \mathbb { E } _ { \pi } \left[ \nabla _ { \theta } \log \pi ( a | s , g ) Q ^ { \pi } ( s , a , g ) \right] ,
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $\begin{array} { r } { Q ^ { \pi } ( s , a , g ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 1 } ^ { \infty } \gamma ^ { t - 1 } r _ { g } ( s _ { t } , a _ { t } , g ) | s _ { 1 } = s , a _ { 1 } = a \right] } \end{array}$ , called the critic, denotes the expected return under policy $\pi$ after taking an action $a$ in state $s$ , with goal $g$ .
|
| 53 |
+
|
| 54 |
+
# 2.2 DDPG ALGORITHM
|
| 55 |
+
|
| 56 |
+
Here, we introduce Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015), a model-free RL algorithm for continuous action spaces that serves as our backbone algorithm. Our proposed modifications need not be restricted to DDPG; however, we leave experimentation with other continuous control algorithms to future work. In DDPG, we maintain a deterministic target policy $\mu ( s , g )$ and a critic $Q ( s , a , g )$ , both implemented as deep neural networks (note: we modify the standard notation to accommodate goal-conditioned tasks). To train these networks, episodes are generated by sampling actions from the policy plus some noise, $a \sim \mu ( s , g ) + N ( 0 , 1 )$ . The transition tuple associated with each action $\left( { { s _ { t } } , { a _ { t } } , { g _ { t } } , { r _ { t } } , { s _ { t + 1 } } } \right)$ is stored in the so-called replay buffer. During training, transition tuples are sampled from the buffer to perform mini-batch gradient descent on the loss $L$ which encourages the approximated Q-function to satisfy the Bellman equation $\mathbf { \bar { \boldsymbol { L } } } = \mathbb { E } ( Q ( s _ { t } , a _ { t } , g _ { t } ) - y _ { t } ) ^ { 2 }$ , where $y _ { t } = r _ { t } + \bar { \gamma } Q ( s _ { t + 1 } , \bar { \mu } ( s _ { t + 1 } , g _ { t } ) , g _ { t } )$ . Similarly, the actor can be updated by training with mini-batch gradient descent on the loss $J ( \theta ) = - \mathbb { E } _ { s } Q ( s , \mu ( s , g ) , g )$ through the deterministic policy gradient algorithm (Silver et al., 2014),
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\nabla _ { \theta } J ( \theta ) = \mathbb { E } [ \nabla _ { \theta } \mu ( s , g ) \nabla _ { a } Q ( s , a , g ) | _ { a = \mu ( s , g ) } ] .
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
To make training more stable, the targets $y _ { t }$ are typically computed using a separate target network, whose weights are periodically updated to the current weights of the main network (Lillicrap et al., 2015; Mnih et al., 2013; 2015).
|
| 63 |
+
|
| 64 |
+
# 2.3 HINDSIGHT EXPERIENCE REPLAY
|
| 65 |
+
|
| 66 |
+
Despite numerous advances in the application of deep learning to RL challenges, learning in the presence of sparse rewards remains a major challenge. Intuitively, these algorithms depend on sufficient variability within the encountered rewards and, in many cases, random exploration is unlikely to uncover this variability if goals are difficult to reach. Recently, Andrychowicz et al. (2017) proposed Hindsight Experience Replay (HER) as a technique to address this challenge. The key insight of HER is that failed rollouts (where no task reward was obtained) can be treated as successful by assuming that a visited state was the actual goal. Basically, HER amounts to a relabelling strategy. For every episode the agent experiences, it gets stored in the replay buffer twice: once with the original goal pursued in the episode and once with the goal replaced with a future state achieved in the episode, as if the agent were instructed to reach this state from the beginning. Formally, HER randomly samples a mini-batch of episodes in buffer, for each episode $( \{ s ^ { i } \} _ { i = 1 } ^ { T } , \{ \stackrel { \smile } { g ^ { i } } \} _ { i = 1 } ^ { T } , \{ a ^ { i } \} _ { i = 1 } ^ { T } , \{ r ^ { i } \} _ { i = 1 } ^ { T } , \{ s ^ { \prime i } \} _ { i = 1 } ^ { T } \big )$ , for each state $s _ { t }$ , where $1 \leq t \leq T - 1$ in an episode, we randomly choose $s _ { k }$ where $t + 1 \leq k \leq T$ and relabel transition $\left( { { s _ { t } } , { a _ { t } } , { g _ { t } } , { r _ { t } } , { s _ { t + 1 } } } \right)$ to $\left( s _ { t } , a _ { t } , s _ { k } , r _ { t } ^ { \prime } , s _ { t + 1 } \right)$ and recalculate reward $r _ { t } ^ { \prime }$ ,
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
r _ { t } ^ { \prime } = r _ { g } ( s _ { t } , s _ { k } ) = \left\{ { 0 , \mathrm { i f } | s _ { t } - s _ { k } | < \delta , \atop { - 1 , \mathrm { o t h e r w i s e . } } } \right.
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
# 3 METHOD
|
| 73 |
+
|
| 74 |
+
In this section, we present Competitive Experience Replay (CER) for policy gradient methods (Section 3.1) and describe the application of multi-agent DDPG to enable this technique (Section 3.2).
|
| 75 |
+
|
| 76 |
+
# 3.1 COMPETITIVE EXPERIENCE REPLAY
|
| 77 |
+
|
| 78 |
+
While the re-labelling strategy introduced by HER provides useful rewards for training a goal-conditioned policy, it assumes that learning from arbitrary goals will generalize to the actual task goals. As such, exploration remains a fundamental challenge for goal-directed RL with sparse reward. We propose a relabelling strategy designed to overcome this challenge. Our method is partly inspired by the success of self-play in learning to play competitive games, where sparse rewards (i.e. win or lose) are common. Rather than train a single agent, we train a pair of agents on the same task and apply an asymmetric reward relabelling strategy to induce a competition designed to encourage exploration. We call this strategy Competitive Experience Replay (CER).
|
| 79 |
+
|
| 80 |
+
To implement CER, we learn a policy for each agent, $\pi _ { A }$ and $\pi _ { B }$ , as well as a multi-agent critic (see below), taking advantage of methods for decentralized execution and centralized training. During decentralized execution, $\pi _ { A }$ and $\pi _ { B }$ collect DDPG episode rollouts in parallel. Each agent effectively plays a singleplayer game; however, to take advantage of multi-agent training methods, we arbitrarily pair the rollout from $\pi _ { A }$ with that from $\pi _ { B }$ and store them as a single, multi-agent rollout in the replay buffer $\mathcal { D }$ . When training on a mini-batch of off policy samples, we first randomly sample a mini-batch of episodes in $\mathcal { D }$ and then randomly sample transitions in each episode. We denote the resulting mini-batch of transitions as $\{ ( s _ { A } ^ { i } , a _ { A } ^ { i } , g _ { A } ^ { i } , r _ { A } ^ { i } , s ^ { \prime } { } ^ { i } _ { A } ) , ( s _ { B } ^ { i } , a _ { B } ^ { i } , g _ { B } ^ { i } , r _ { B } ^ { i } , s ^ { \prime } { } ^ { i } _ { B } ) \} _ { i = 1 } ^ { m }$ , where $m$ is the size of the mini-batch.
|
| 81 |
+
|
| 82 |
+
Reward re-labelling in CER attempts to create an implicit exploration curriculum by punishing agent $A$ for visiting states that agent $B$ also visited, and, for those same states, rewarding agent $B$ . For each $A$ state $s _ { A } ^ { i }$ in a mini-batch of transitions, we check if any $B$ state $s _ { B } ^ { j }$ in the mini-batch satisfies $| s _ { A } ^ { i } - s _ { B } ^ { j } | < \delta$ and, if so, re-label $r _ { A } ^ { i }$ with $r _ { A } ^ { i } - 1$ . Conversely, each time such a nearby state pair is found, we increment the associated reward for agent $B$ , $r _ { B } ^ { j }$ , by $+ 1$ . Each transition for agent $A$ can therefore be penalized only once, whereas no restriction is placed on the extra reward given to a transition for agent $B$ . Following training both agents with the re-labelled rewards, we retain the policy $\pi _ { A }$ for evaluation. Additional implementation details are provided in the appendix (Section D).
|
| 83 |
+
|
| 84 |
+
We focus on two variations of CER that satisfy the multi-agent self-play requirements: first, the policy $\pi _ { B }$ receives its initial state from the task’s initial state distribution; second, although more restricted to re-settable environments, $\pi _ { B }$ receives its initial state from a random off-policy sample of $\pi _ { A }$ . We refer to the above methods as independent-CER and interact-CER, respectively, in the following sections.
|
| 85 |
+
|
| 86 |
+
Importantly, CER re-labels rewards based on intra-agent behavior, whereas HER re-labels rewards based on each individual agent’s behavior. As a result, the two methods can be easily combined. In fact, as our experiments demonstrate, CER and HER are complementary and likely reflect distinct challenges that are both addressed through reward re-labelling.
|
| 87 |
+
|
| 88 |
+
# 3.2 GOAL CONDITIONED MULTI-AGENT LEARNING
|
| 89 |
+
|
| 90 |
+
We extend multi-agent DDPG (MADDPG), proposed by Lowe et al. (2017), for training using CER. MADDPG attempts to learn a different policy per agent and a single, centralized critic that has access to the combined states, actions, and goals of all agents.
|
| 91 |
+
|
| 92 |
+
More precisely, consider a game with $N$ agents with policies parameterized by $\pmb { \theta } = \{ \theta _ { 1 } , \dots , \theta _ { N } \}$ , and let $\pmb { \pi } = \{ \bar { \pi } _ { 1 } , . . . , \bar { \pi } _ { N } \}$ be the set of all agent policies. $\mathbf { g } = [ \boldsymbol { g } _ { 1 } , \dots , \boldsymbol { g } _ { N } ]$ represents the concatenation of each agent’s goal, $\mathbf { s } = [ s _ { 1 } , \ldots , s _ { N } ]$ the concatenated states, and $\mathbf { a } = [ a _ { 1 } , \ldots , a _ { N } ]$ the concatenated actions. With this notation, we can write the gradient of the expected return for agent $i$ , $\bar { J ( \theta _ { i } ) } = \mathbb { E } [ R _ { i } ]$ as:
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\begin{array} { r } { \nabla _ { \theta _ { i } } J ( \theta _ { i } ) = \mathbb { E } _ { \pmb { \pi } } [ \nabla _ { \theta _ { i } } \log \pi _ { i } ( a _ { i } | s _ { i } , g _ { i } ) Q _ { i } ^ { \pi } ( \mathbf { s } , \mathbf { a } , \mathbf { g } ) ] . } \end{array}
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
With deterministic policies ${ \pmb \mu } = \{ \mu _ { 1 } , . . . , \mu _ { N } \}$ , the gradient becomes:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\nabla _ { \theta _ { i } } J ( \theta _ { i } ) = \mathbb { E } _ { \pmb { \mu } } [ \nabla _ { \theta _ { i } } \mu _ { i } ( s _ { i } , g _ { i } ) \nabla _ { a _ { i } } Q _ { i } ^ { \pmb { \mu } } ( \mathbf { s } , \mathbf { a } , \mathbf { g } ) | _ { a _ { i } = \mu _ { i } ( s _ { i } , g _ { i } ) } ] ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
The centralized action-value function $Q _ { i } ^ { \mu }$ , which estimates the expected return for agent $i$ , is updated as:
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\begin{array} { r } { \mathcal { L } ( \theta _ { i } ) = \mathbb { E } _ { { \mathbf s } , { \mathbf a } , { \mathbf r } , { \mathbf s } ^ { \prime } } [ ( Q _ { i } ^ { \mu } ( { \mathbf s } , { \mathbf a } , { \mathbf g } ) - y ) ^ { 2 } ] , \quad y = r _ { i } + \gamma Q _ { i } ^ { \mu ^ { \prime } } ( { \mathbf s } ^ { \prime } , a _ { 1 } ^ { \prime } , \dots , a _ { N } ^ { \prime } , { \mathbf g } ) \big | _ { a _ { j } ^ { \prime } = \mu _ { j } ^ { \prime } ( s _ { j } ) } , } \end{array}
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
where $\pmb { \mu } ^ { \prime } = \{ \pmb { \mu } _ { \theta _ { 1 } ^ { \prime } } , . . . , \pmb { \mu } _ { \theta _ { N } ^ { \prime } } \}$ is the set of target policies with delayed parameters $\theta _ { i } ^ { \prime }$ . In practice people usually soft update it as $\mathbf { \dot { \theta } } _ { i } ^ { \prime } \gets \tau \dot { \theta } _ { i } + ( 1 - \tau ) \theta _ { i } ^ { \prime }$ , where $\tau$ is a Polyak coefficient.
|
| 111 |
+
|
| 112 |
+
During training, we collect paired rollouts as described above, apply any re-labelling strategies (such as CER or HER) and use the MADDPG algorithm to train both agent policies and the centralized critic, concatenating states, actions, and goals where appropriate. Putting everything together, we summarize the full method in Algorithm 1.
|
| 113 |
+
|
| 114 |
+
# 4 EXPERIMENT
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 1: Goal conditioned ’U’ shaped maze and $\mathbf { \vec { \nabla } } S \mathbf { \vec { \nabla } }$ shaped maze. For each plot pair, the left illustrates a rendering of the maze type and the right shows the associated success rate throughout training for each method. Each line shows results averaged over 5 random initializations; the X-axis corresponds to epoch number and shaded regions show standard deviation. All metrics based on CER reference the performance of agent $A$ .
|
| 118 |
+
|
| 119 |
+
# 4.1 COMBINING COMPETITIVE EXPERIENCE REPLAY WITH EXISTING METHODS
|
| 120 |
+
|
| 121 |
+
We start by asking whether CER improves performance and sample efficiency in a sparse reward task. To this end, we constructed two different mazes, an easier ’U’ shaped maze and a more difficult $\mathbf { \vec { \nabla } } S \mathbf { \vec { \nabla } }$ shaped maze (Figure 1). The goal of the ant agent is to reach the target mark by a red sphere, whose location is randomly sampled for each new episode. At each step, the agent obtains a reward of 0 if the goal has been achieved and $- 1$ otherwise. Additional details of the ant maze environments are found in Appendix B. An advantage of this environment is that it can be reset to any given state, facilitating comparison between our two proposed variants of CER (int-CER requires the environment to have this feature).
|
| 122 |
+
|
| 123 |
+
We compare agents trained with HER, both variants of CER, and both variants of CER with HER. Since each uses DDPG as a backbone algorithm, we also include results from a policy trained using DDPG alone. To confirm that any difficulties are not simply due to DDPG, we include results from a policy trained using Proximal Policy Optimization (PPO) (Schulman et al., 2017). The results for each maze are shown in Figure 1. DDPG and PPO each performs quite poorly by itself, likely due to the sparsity of the reward in this task set up. Adding CER to DDPG partially overcomes this limitation in terms of final success rate, and, notably, reaches this stronger result with many fewer examples. A similar result is seen when adding HER to DDPG. Importantly, adding both HER and CER offers the best improvement of final success rate without requiring any observable increase in the number of episodes, as compared to each of the other baselines. These results support our hypothesis that existing state-of-the-art methods do not sufficiently address the exploration challenge intrinsic to sparse reward environments. Furthermore, these results show that CER improves both the quality and efficiency of learning in such challenging settings, especially when combined with HER. These results also show that int-CER tends to outperform ind-CER. As such, int-CER is considered preferable but has more restrictive technical requirements.
|
| 124 |
+
|
| 125 |
+
To examine the efficacy of our method on a broader range of tasks, we evaluate the change in performance when ind-CER is added to HER on the challenging multi-goal sparse reward environments introduced in Plappert et al. (2018). (Note: we would prefer to examine int-CER but are prevented by technical issues related to the environment.) Results for each of the 12 tasks we trained on are illustrated in Figure 3. Our method, when used on top of HER, improves performance wherever it is not already saturated. This is especially true on harder tasks, where HER alone achieves only modest success (e.g., HandManipulateEggFull and handManipulatePenRotate). These results further support the conclusion that existing methods often fail to achieve sufficient exploration. Our method, which provides a targeted solution to this challenge, naturally complements HER.
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 2: Comparing CER and ICM with and without HER. Each line shows task success rate averaged over 5 random initializations. $\mathrm { X }$ -axis is epoch number; shaded regions denote standard deviation.
|
| 129 |
+
|
| 130 |
+
# 4.2 COMPARING CER WITH CURIOSITY-DRIVEN EXPLORATION
|
| 131 |
+
|
| 132 |
+
CER is designed to encourage exploration, but, unlike other methods, uses the behavior of a competitor agent to automatically determine the criteria for exploratory reward. Numerous methods have been proposed for improving exploration; for example, count-based exploration (Bellemare et al., 2016; Tang et al., 2017), VIME (Houthooft et al., 2016), bootstrap DQN (Osband et al., 2016), goal exploration process (Forestier et al., 2017), parameter space noise (Plappert et al., 2017), dynamics curiosity and boredom (Schmidhuber, 1991), and EX2 (Fu et al., 2017). One recent and popular method, intrinsic curiosity module (ICM) (Pathak et al., 2017; Burda et al., 2018), augments task reward with curiosity-driven reward. Much like CER and HER, ICM provides a method to relabel the reward associated with each transition; this reward comes from the error in a jointly trained forward prediction model. We compare how CER and ICM affect task performance and how they interact with HER across 4 tasks where we were able to implement ICM successfully. Figure 2 shows the results on several robotic control and maze tasks. We observe CER to consistently outperform ICM when each is implemented in isolation. In addition, we observe HER to benefit more from the addition of CER than of ICM. Compared to ICM, CER also tends to improve the speed of learning. These results suggest that the underlying problem is not a lack of diversity of states being visited but the size of the state space that the agent must explore (as also discussed in Andrychowicz et al. (2017)). One interpretation is that, since the two CER agents are both learning the task, the dynamics of their competition encourage more task-relevant exploration. From this perspective, CER provides an automatic curriculum for exploration such that visited states are utilized more efficiently.
|
| 133 |
+
|
| 134 |
+

|
| 135 |
+
Figure 3: Evaluation of HER with ind-CER across different robotic control environments. Each line shows results averaged over 5 random initializations. X-axis shows epoch number; shaded regions denote standard deviation.
|
| 136 |
+
|
| 137 |
+
# 4.3 ANALYSIS OF CER
|
| 138 |
+
|
| 139 |
+
Figure 4 illustrates the success rates of agents of mini-batch samples whose reward is chang $A$ nd y C $B$ as well as the ‘effect ratio,’ whR during training, calculated as e fractiwhere $\begin{array} { r } { \phi = \frac { N } { M } } \end{array}$ $N$ $M$
|
| 140 |
+
strong correspondence between the success rate and effect ratio, likely reflecting the influence of CER on the
|
| 141 |
+
learning dynamics. While a deeper analysis would be required to concretely understand the interplay of these
|
| 142 |
+
two terms, we point out that CER re-labels a substantial fraction of rewards in the mini-batch. Interestingly,
|
| 143 |
+
even the relatively small effect ratio observed in the first few epochs is enough support rapid learning. We
|
| 144 |
+
speculate that the sampling strategy used in int-CER provides a more targeted re-labelling, leading to the more
|
| 145 |
+
rapid increase in success rate for agent $A$ . We observe that agent $B$ reaches a lower level of performance.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 4: Illustration of the automatically generated curriculum between $A$ and $B$ on ‘U‘ shaped AntMaze task. From left to right are success rate of ind-CER, effect ratio of ind-CER, success rate of int-CER, and effect ratio of int-CER. Each line shows results averaged over 5 random initializations. $\mathrm { X }$ -axis is epoch number.
|
| 151 |
+
Figure 5: State visitation frequency on ’U’ maze. Top row is from after 5 epochs; bottom row from after 35. Blue on the colormap denotes no visitation. The start and goal locations are labeled with the blue and green markers, respectively. ICM and CER are trained with HER also.
|
| 152 |
+
|
| 153 |
+
This likely results from resetting the parameters of agent $B$ periodically during early training, which we observe to improve the ultimate performance of agent $A$ (see Section D for details). It is also possible that the reward structure of CER asymmetrically benefits agent $A$ with respect to the underlying task.
|
| 154 |
+
|
| 155 |
+
To gain additional insight into how each method influences the behaviors learned across training, we visualize the frequency with which each location in the ‘U’ maze is visited after the 5th and 35th training epoch (Figure 5). Comparing DDPG and HER shows that the latter clearly helps move the state distribution towards the goal, especially during the early parts of training. When CER is added, states near the goal create a clear mode in the visitation distribution. This is never apparent with DDPG alone and only obvious for HER and $\mathrm { I C M + H E R }$ later in training. CER also appears to focus the visitation of the agent, as it less frequently gets caught along the outer walls. These disparities are emphasized in Figure 6, where we show the difference in the visitation profiles. The left two plots compare CER $^ +$ HER vs. HER. The right two plots compare Agent A vs Agent B from CER+HER. Interestingly, the Agents A and B exhibit fairly similar aggregate visitation profiles with the exception that Agent A reaches the goal more often later during training. These visitation profiles underscore both the quantitative and qualitative improvements associated with CER.
|
| 156 |
+
|
| 157 |
+
# 5 RELATED WORK
|
| 158 |
+
|
| 159 |
+
Self-play has a long history in this domain of research (Samuel, 1959; Tesauro, 1995; Heess et al., 2017). Silver et al. (2017) use self-play with deep reinforcement learning techniques to master the game of Go; and self-play has even been applied in Dota 5v5 (OpenAI, 2018).
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 6: State visitation difference on ’U’ maze. Left plots compare CER against HER; right plots compare the two CER agents. Each plot illustrates the difference in visitation, with red indicating more visitation by CER(A). Note: here, the “CER” agent is trained with $_ \mathrm { C E R + H E R }$ .
|
| 163 |
+
|
| 164 |
+
Curriculum learning is widely used for training neural networks (see e.g., Bengio et al., 2009; Graves et al., 2017; Elman, 1993; Olsson, 1995). A general framework for automatic task selection is Powerplay (Schmidhuber, 2013; Srivastava et al., 2013), which proposes an asymptotically optimal way of selecting tasks from a set of tasks with program search, and use replay buffer to avoid catastrophic forgetting. Florensa et al. (2017); Held et al. (2017) propose to automatically adjust task difficulty during training. Forestier et al. (2017) study intrinsically motivated goal for robotic learning. Recently, Sukhbaatar et al. (2017) suggest to use self-play between two agents where reward depends on the time of the other agent to complete to enable implicit curriculum. Our work is similar to theirs, but we propose to use sample-based competitive experience replay, which is not only more readily scalable to high-dimension control but also integrates easily with Hindsight Experience Replay (Andrychowicz et al., 2017). The method of initializing based on a state not sampled from the initial state distribution has been explored in other works. For example, Ivanovic et al. (2018) propose to create a backwards curriculum for continuous control tasks through learning a dynamics model. Resnick et al. (2018b) and Salimans & Chen (2018) propose to train policies on Pommerman (Resnick et al., 2018a) and the Atari game ‘Montezumas Revenge’ by starting each episode from a different point along a demonstration. Recently, Goyal et al. (2018) and Edwards et al. (2018) propose a learned backtracking model to generate traces that lead to high value states in order to obtain higher sample efficiency.
|
| 165 |
+
|
| 166 |
+
Experience replay has been introduced in (Lin, 1992) and later was a crucial ingredient in learning to master Atari games (Mnih et al., 2013; 2015). Wang et al. (2016) propose truncation with bias correction to reduce variance from using off-policy data in buffer and achieves good performance on continuous and discrete tasks. Different approaches have been proposed to incorporate model-free learning with experience replay(Gu et al., 2016; Feng et al., 2019). Schaul et al. (2015) improve experience replay by assigning priorities to transitions in the buffer to efficiently utilize samples. Horgan et al. (2018) further improve experience replay by proposing a distributed RL system in which experiences are shared between parallel workers and accumulated into a central replay memory and prioritized replay is used to update the policy based on the diverse accumulated experiences.
|
| 167 |
+
|
| 168 |
+
# 6 CONCLUSION
|
| 169 |
+
|
| 170 |
+
We introduce Competitive Experience Replay, a new and general method for encouraging exploration through implicit curriculum learning in sparse reward settings. We demonstrate an empirical advantage of our technique when combined with existing methods in several challenging RL tasks. In future work, we aim to investigate richer ways to re-label rewards based on intra-agent samples to further harness multi-agent competition, it’s interesting to investigate counterfactual inference to promote efficient re-label off-policy samples. We hope that this will facilitate the application of our method to more open-end environments with even more challenging task structures. In addition, future work will explore integrating our method into approaches more closely related to model-based learning, where adequate exposure to the dynamics of the environment is often crucial.
|
| 171 |
+
|
| 172 |
+
# REFERENCES
|
| 173 |
+
|
| 174 |
+
Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, pp. 5048–5058, 2017.
|
| 175 |
+
|
| 176 |
+
Marcin Andrychowicz, Bowen Baker, Maciek Chociej, Rafal Jozefowicz, Bob McGrew, Jakub Pachocki, Arthur Petron, Matthias Plappert, Glenn Powell, Alex Ray, Jonas Schneider, Szymon Sidor, Josh Tobin, Peter Welinder, Lilian Weng, and Wojciech Zaremba. Learning dexterous in-hand manipulation. arXiv:1808.00177, 2018a.
|
| 177 |
+
|
| 178 |
+
Marcin Andrychowicz, Bowen Baker, Maciek Chociej, Rafal Jozefowicz, Bob McGrew, Jakub Pachocki, Arthur Petron, Matthias Plappert, Glenn Powell, Alex Ray, et al. Learning dexterous in-hand manipulation. arXiv preprint arXiv:1808.00177, 2018b.
|
| 179 |
+
|
| 180 |
+
Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems, pp. 1471–1479, 2016.
|
| 181 |
+
|
| 182 |
+
Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009.
|
| 183 |
+
|
| 184 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
|
| 185 |
+
|
| 186 |
+
Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A Efros. Large-scale study of curiosity-driven learning. arXiv preprint arXiv:1808.04355, 2018.
|
| 187 |
+
|
| 188 |
+
Ashley D Edwards, Laura Downs, and James C Davidson. Forward-backward reinforcement learning. arXiv preprint arXiv:1803.10227, 2018.
|
| 189 |
+
|
| 190 |
+
Jeffrey L Elman. Learning and development in neural networks: The importance of starting small. Cognition, 48(1):71–99, 1993.
|
| 191 |
+
|
| 192 |
+
Yihao Feng, Hao Liu, Jian Peng, and Qiang Liu. Shrinkage-based bias-variance trade-off for deep reinforcement learning, 2019. URL https://openreview.net/forum?id=S1z9ehAqYX.
|
| 193 |
+
|
| 194 |
+
Carlos Florensa, David Held, Markus Wulfmeier, Michael Zhang, and Pieter Abbeel. Reverse curriculum generation for reinforcement learning. arXiv preprint arXiv:1707.05300, 2017.
|
| 195 |
+
|
| 196 |
+
Sebastien Forestier, Yoan Mollard, and Pierre-Yves Oudeyer. Intrinsically motivated goal exploration ´ processes with automatic curriculum learning. arXiv preprint arXiv:1708.02190, 2017.
|
| 197 |
+
|
| 198 |
+
Justin Fu, John Co-Reyes, and Sergey Levine. Ex2: Exploration with exemplar models for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2577–2587, 2017.
|
| 199 |
+
|
| 200 |
+
Anirudh Goyal, Philemon Brakel, William Fedus, Timothy Lillicrap, Sergey Levine, Hugo Larochelle, and Yoshua Bengio. Recall traces: Backtracking models for efficient reinforcement learning. arXiv preprint arXiv:1804.00379, 2018.
|
| 201 |
+
|
| 202 |
+
Alex Graves, Marc G Bellemare, Jacob Menick, Remi Munos, and Koray Kavukcuoglu. Automated curriculum learning for neural networks. arXiv preprint arXiv:1704.03003, 2017.
|
| 203 |
+
|
| 204 |
+
Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, pp. 2829–2838, 2016.
|
| 205 |
+
|
| 206 |
+
Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
|
| 207 |
+
|
| 208 |
+
David Held, Xinyang Geng, Carlos Florensa, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. arXiv preprint arXiv:1705.06366, 2017.
|
| 209 |
+
|
| 210 |
+
Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado Van Hasselt, and David Silver. Distributed prioritized experience replay. arXiv preprint arXiv:1803.00933, 2018.
|
| 211 |
+
|
| 212 |
+
Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Vime: Variational information maximizing exploration. In Advances in Neural Information Processing Systems, pp. 1109– 1117, 2016.
|
| 213 |
+
|
| 214 |
+
Boris Ivanovic, James Harrison, Apoorva Sharma, Mo Chen, and Marco Pavone. Barc: Backward reachability curriculum for robotic reinforcement learning. arXiv preprint arXiv:1806.06161, 2018.
|
| 215 |
+
|
| 216 |
+
Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation. arXiv preprint arXiv:1806.10293, 2018.
|
| 217 |
+
|
| 218 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 219 |
+
|
| 220 |
+
Sergey Levine, Peter Pastor, Alex Krizhevsky, Julian Ibarz, and Deirdre Quillen. Learning hand-eye coordination for robotic grasping with deep learning and large-scale data collection. The International Journal of Robotics Research, 37(4-5):421–436, 2018.
|
| 221 |
+
|
| 222 |
+
Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
|
| 223 |
+
|
| 224 |
+
Long-Ji Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3-4):293–321, 1992.
|
| 225 |
+
|
| 226 |
+
Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. In Advances in Neural Information Processing Systems, pp. 6379–6390, 2017.
|
| 227 |
+
|
| 228 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
|
| 229 |
+
|
| 230 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
|
| 231 |
+
|
| 232 |
+
Andrew Y Ng, Adam Coates, Mark Diel, Varun Ganapathi, Jamie Schulte, Ben Tse, Eric Berger, and Eric Liang. Autonomous inverted helicopter flight via reinforcement learning. In Experimental Robotics IX, pp. 363–372. Springer, 2006.
|
| 233 |
+
|
| 234 |
+
Roland Olsson. Inductive functional programming using incremental program transformation. Artificial intelligence, 74(1):55–81, 1995.
|
| 235 |
+
|
| 236 |
+
OpenAI. Openai five. https://blog.openai.com/openai-five/, 2018.
|
| 237 |
+
|
| 238 |
+
Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In Advances in neural information processing systems, pp. 4026–4034, 2016.
|
| 239 |
+
|
| 240 |
+
Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by selfsupervised prediction. In International Conference on Machine Learning (ICML), volume 2017, 2017.
|
| 241 |
+
|
| 242 |
+
Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv preprint arXiv:1706.01905, 2017.
|
| 243 |
+
|
| 244 |
+
Matthias Plappert, Marcin Andrychowicz, Alex Ray, Bob McGrew, Bowen Baker, Glenn Powell, Jonas Schneider, Josh Tobin, Maciek Chociej, Peter Welinder, et al. Multi-goal reinforcement learning: Challenging robotics environments and request for research. arXiv preprint arXiv:1802.09464, 2018.
|
| 245 |
+
|
| 246 |
+
Ivaylo Popov, Nicolas Heess, Timothy Lillicrap, Roland Hafner, Gabriel Barth-Maron, Matej Vecerik, Thomas Lampe, Yuval Tassa, Tom Erez, and Martin Riedmiller. Data-efficient deep reinforcement learning for dexterous manipulation. arXiv preprint arXiv:1704.03073, 2017.
|
| 247 |
+
|
| 248 |
+
Cinjon Resnick, Wes Eldridge, David Ha, Denny Britz, Jakob Foerster, Julian Togelius, Kyunghyun Cho, and Joan Bruna. Pommerman: A multi-agent playground. arXiv preprint arXiv:1809.07124, 2018a.
|
| 249 |
+
|
| 250 |
+
Cinjon Resnick, Roberta Raileanu, Sanyam Kapoor, Alex Peysakhovich, Kyunghyun Cho, and Joan Bruna. Backplay:” man muss immer umkehren”. arXiv preprint arXiv:1807.06919, 2018b.
|
| 251 |
+
|
| 252 |
+
Tim Salimans and Richard Chen. Learning montezumas revenge from a single demonstration. https://blog.openai.com/ learning-montezumas-revenge-from-a-single-demonstration/, 2018.
|
| 253 |
+
|
| 254 |
+
Arthur L Samuel. Some studies in machine learning using the game of checkers. IBM Journal of research and development, 3(3):210–229, 1959.
|
| 255 |
+
|
| 256 |
+
Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
|
| 257 |
+
|
| 258 |
+
Jurgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building neural¨ controllers. In Proc. of the international conference on simulation of adaptive behavior: From animals to animats, pp. 222–227, 1991.
|
| 259 |
+
|
| 260 |
+
Jurgen Schmidhuber. Powerplay: Training an increasingly general problem solver by continually searching ¨ for the simplest still unsolvable problem. Frontiers in psychology, 4:313, 2013.
|
| 261 |
+
|
| 262 |
+
John Schulman, Sergey Levine, Philipp Moritz, Michael I. Jordan, and Pieter Abbeel. Trust region policy optimization. In International Conference on Machine Learning, 2015.
|
| 263 |
+
|
| 264 |
+
John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. International Conference of Learning Representations (ICLR), 2016.
|
| 265 |
+
|
| 266 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. Advances in Neural Information Processing Systems, 2017.
|
| 267 |
+
|
| 268 |
+
David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In ICML, 2014.
|
| 269 |
+
|
| 270 |
+
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
|
| 271 |
+
|
| 272 |
+
David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. Mastering chess and shogi by self-play with a general reinforcement learning algorithm. arXiv preprint arXiv:1712.01815, 2017.
|
| 273 |
+
|
| 274 |
+
Rupesh Kumar Srivastava, Bas R Steunebrink, and Jurgen Schmidhuber. First experiments with powerplay.¨ Neural Networks, 41:130–136, 2013.
|
| 275 |
+
|
| 276 |
+
Sainbayar Sukhbaatar, Zeming Lin, Ilya Kostrikov, Gabriel Synnaeve, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. arXiv preprint arXiv:1703.05407, 2017.
|
| 277 |
+
|
| 278 |
+
Richard S Sutton, Andrew G Barto, et al. Reinforcement learning: An introduction. MIT press, 1998.
|
| 279 |
+
|
| 280 |
+
Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, OpenAI Xi Chen, Yan Duan, John Schulman, Filip DeTurck, and Pieter Abbeel. # exploration: A study of count-based exploration for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2753–2762, 2017.
|
| 281 |
+
|
| 282 |
+
Gerald Tesauro. Temporal difference learning and td-gammon. Communications of the ACM, 38(3):58–68, 1995.
|
| 283 |
+
|
| 284 |
+
Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026–5033. IEEE, 2012.
|
| 285 |
+
|
| 286 |
+
Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. arXiv preprint arXiv:1611.01224, 2016.
|
| 287 |
+
|
| 288 |
+
# A ALGORITHM
|
| 289 |
+
|
| 290 |
+
We summarize the algorithm for HER with CER in Algorithm 1.
|
| 291 |
+
|
| 292 |
+
<table><tr><td>Algorithm1HER with CER</td></tr><tr><td>Initialize a random process N for action exploration,max episode length to L Set CER to ind-CER or int-CER</td></tr><tr><td>for episode= 1 to M do</td></tr><tr><td>Receive initial state S A</td></tr><tr><td>Receive a goal rA for this episode</td></tr><tr><td>Initialize episode buffer buffer A</td></tr><tr><td>for t=1to L do</td></tr><tr><td>select action aA = μe(sA) +Nt w.r.t. the current policy and exploration Execute actions αA and observe reward rA and new state s'A</td></tr><tr><td>Store (sA,aA,gA,rA,SA') in buffer A</td></tr><tr><td>SA↑SA</td></tr><tr><td>end for</td></tr><tr><td> Receive initial state SB or Receive initial state SB, where SB is a state sampled from buffer A</td></tr><tr><td>Receive a goal rB for this episode Initialize episode buffer buffer B</td></tr><tr><td>for t=1 to L do</td></tr><tr><td>select action aB = μe(sB)+Nt w.r.t. the current policy and exploration</td></tr><tr><td>Execute actions αB and observe reward rB and new state s'B</td></tr><tr><td>Store (sB,aB,gB,rB,SB') in bufferB</td></tr><tr><td>SB↑SB</td></tr><tr><td>end for</td></tr><tr><td>ConcatenatebuferA and bufferg and store ({si}=1,{ai}T=1,{g}T=1,{ri}=1,{s'i}T=1) in replay buffer D</td></tr><tr><td>// Optimization based on off-policysamples</td></tr><tr><td>fork=1 toKdo // Relabelling off-policy samples</td></tr></table>
|
| 293 |
+
|
| 294 |
+
# B ENVIRONMENT DETAILS
|
| 295 |
+
|
| 296 |
+
Robotic control environments The robotic control environments shown in Figure 7 are part of challenging continuous robotics control suite (Plappert et al., 2018) integrated in OpenAI Gym (Brockman et al., 2016) and based on Mujoco simulation enginge (Todorov et al., 2012). The Fetch environments are based on the 7-DoF Fetch robotics arm, which has a two-fingered parallel gripper. The Hand environments are based on the Shadow Dexterous Hand, which is an anthropomorphic robotic hand with 24 degrees of freedom. In all tasks, rewards are sparse and binary: the agent obtains a reward of 0 if the goal has been achieved and $- 1$ otherwise. For more details please refer to Plappert et al. (2018).
|
| 297 |
+
|
| 298 |
+
Ant maze environments We also construct two maze environments with the re-settable property, rendered in Figure 1, in which walls are placed to construct ”U” or ”S” shaped maze. At the beginning of each episode, the agent is always initialized at position $( 0 , 0 )$ , and can move in any direction as long as it is not obstructed by a wall. The $\mathbf { X } ^ { - }$ and y-axis locations of the target ball are sampled uniformly from $[ - 5 , 2 0 ]$ , $[ - 5 , 2 0 ]$ , respectively.
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
Figure 7: Robotics control environments used in our experiments
|
| 302 |
+
|
| 303 |
+
# C COMPETITIVE EXPERIENCE REPLAY WITH DIFFERENT ADVERSARIAL AGENTS
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 8: Performance on FetchSlide (top) and HandManipulatePenFull (bottom) for different batch-size multipliers when training using HER (left columns) or HER $^ +$ CER (middle, right columns). Middle plots show the performance of agent $A$ and, in the right plots, performance of agent $B$ is shown for reference.
|
| 307 |
+
|
| 308 |
+
As Andrychowicz et al. (2017) and Andrychowicz et al. (2018a) observe (and we also observe), performance depends on the batch size. We leverage this observation to tune the relative strengths of Agents $A$ and $B$ by separately manipulating the batch sizes used for updating each.
|
| 309 |
+
|
| 310 |
+
For simplicity, we control the batch size by changing the number of MPI workers devoted to a particular update. Each MPI worker computes the gradients for a batch size of 256; averaging the gradients from each worker results in an effective batch size of $N * 2 5 6$ . For our single-agent baselines, we choose $N = 3 0$ workers, and, when using CER, a default of $N = 1 5$ for each $A$ and $B$ In the following, $A x B y$ denotes, for agent $A$ , $N = x$ and, for agent $B$ , $N = y$ . These results suggest that, while a sufficiently large batch size is important for achieving the best performance, the optimal configuration occurs when the batch sizes used for the two agents are balanced. Interestingly, we observe that batch size imbalance adversely effects both agents trained during CER.
|
| 311 |
+
|
| 312 |
+
# D IMPLEMENTATION DETAILS
|
| 313 |
+
|
| 314 |
+
In the code for HER (Andrychowicz et al., 2017), the authors use MPI to increase the batch size. MPI is used here to run rollouts in parallel and average gradients over all MPI workers. We found that MPI is crucial for good performance, since training for longer time with a smaller batch size gives sub-optimal performance. This is consistent with the authors’ findings in their code that having a much larger batch size helps a lot. For each experiment, we provide the per-worker batch sizes in Table 1; note that the effective batch size is multiplied by the number of MPI workers $N$ .
|
| 315 |
+
|
| 316 |
+
In our implementation, we do $N$ rollouts in parallel for each agent and have separate optimizers for each. We found that periodically resetting the parameters of agent $B$ in early stage of training helps agent $A$ more consistently reach a high level of performance. This resetting helps to strike an optimal balance between the influences of HER and CER in training agent $A$ . We also add L2 regularization, following the practice of Andrychowicz et al. (2017).
|
| 317 |
+
|
| 318 |
+
For the experiments with neural networks, all parameters are randomly initialized from $\mathcal { N } ( 0 , 0 . 2 )$ . We use networks with three layers of hidden layer size 256 and Adam (Kingma & Ba, 2014) for optimization. Presented results are averaged over 5 random seeds. We summarize the hyperparameters in Table 1.
|
| 319 |
+
|
| 320 |
+
Table 1: Hyperparameter values used in experiments.
|
| 321 |
+
|
| 322 |
+
<table><tr><td rowspan=1 colspan=1>Hyperparametername</td><td rowspan=1 colspan=1>'U'AntMaze</td><td rowspan=1 colspan=1>'S'AntMaze</td><td rowspan=1 colspan=1>FetchControl</td><td rowspan=1 colspan=1>HandControl</td></tr><tr><td rowspan=1 colspan=1>Buffer size</td><td rowspan=1 colspan=1>1E5</td><td rowspan=1 colspan=1>1E6</td><td rowspan=1 colspan=1>1E6</td><td rowspan=1 colspan=1>1E6</td></tr><tr><td rowspan=1 colspan=1>Batch size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>Max steps ofepisode</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>Reset epochs</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>Max reset epochs</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>30</td></tr><tr><td rowspan=1 colspan=1>Total epochs</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100/50</td><td rowspan=1 colspan=1>200</td></tr><tr><td rowspan=1 colspan=1>ActorLearning rate</td><td rowspan=1 colspan=1>0.0004</td><td rowspan=1 colspan=1>0.0004</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1>0.001</td></tr><tr><td rowspan=1 colspan=1>CriticLearning rate</td><td rowspan=1 colspan=1>0.0004</td><td rowspan=1 colspan=1>0.0004</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1>0.001</td></tr><tr><td rowspan=1 colspan=1>ActionL2 regularization</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>1.00</td></tr><tr><td rowspan=1 colspan=1>Polyak</td><td rowspan=1 colspan=1>0.95</td><td rowspan=1 colspan=1>0.95</td><td rowspan=1 colspan=1>0.95</td><td rowspan=1 colspan=1>0.95</td></tr></table>
|
md/train/SkyQWDcex/SkyQWDcex.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A CONTEXT-AWARE ATTENTION NETWORK FOR INTERACTIVE QUESTION ANSWERING
|
| 2 |
+
|
| 3 |
+
Huayu $\mathbf { L i } ^ { 1 : }$ ∗, Martin Renqiang $\mathbf { M } \mathbf { i n } ^ { 2 }$ , Yong $\mathbf { G e ^ { 3 } }$ , Asim Kadav2
|
| 4 |
+
|
| 5 |
+
Department of Computer Science, UNC Charlotte1 Machine Learning Group, NEC Laboratories America2 Management Information Systems, University of Arizona3 hli38@uncc.edu, renqiang@nec-labs.com, yongge@email.arizona.edu, asim@nec-labs.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We develop a new model for Interactive Question Answering (IQA), using GatedRecurrent-Unit recurrent networks (GRUs) as encoders for statements and questions, and another GRU as a decoder for outputs. Distinct from previous work, our approach employs context-dependent word-level attention for more accurate statement representations and question-guided sentence-level attention for better context modeling. Employing these mechanisms, our model accurately understands when it can output an answer or when it requires generating a supplementary question for additional input. When available, user’s feedback is encoded and directly applied to update sentence-level attention to infer the answer. Extensive experiments on QA and IQA datasets demonstrate quantitatively the effectiveness of our model with significant improvement over conventional QA models.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
The ultimate goal of Question Answering (QA) research is to build intelligent systems capable of naturally communicating with humans, which poses a major challenge for natural language processing and machine learning. Inspired by recent success of sequence-to-sequence models with an encoder-decoder framework (Sutskever et al., 2014; Cho et al., 2014), researchers have attempted to apply variants of such models with explicit memory and attention to QA tasks, aiming to move a step further from machine learning to machine reasoning (Sainbayar et al., 2015; Kumar et al., 2016; Xiong et al., 2016). Similarly, all these models employ encoders to map statements and questions to fixed-length feature vectors, and a decoder to generate outputs. Empowered by the adoption of memory and attention, they have achieved remarkable success on several challenging datasets, including the recently acclaimed Facebook bAbI dataset.
|
| 14 |
+
|
| 15 |
+
However, previous models suffer from the following important limitations. First, they fail to model context-dependent meaning of words. Different words may have different meanings in different contexts, which increases the difficulty of extracting the essential semantic logic flow of each sentence in different paragraphs. Second, many existing models only work in ideal QA settings and fail to address the uncertain situations under which models require additional user input to gather complete information to answer a given question. As shown in Table 1, the example on the left is an ideal QA problem. We can clearly understand what the question is and then locate the relevant sentences to generate the answer. However, it is hard to answer the question in the right example, because there are two types of bedrooms mentioned in the story and we do not know which bedroom the user refers to. These scenarios with incomplete information naturally appear in human conversations, and thus, effectively handling them is a key capability of intelligent QA models.
|
| 16 |
+
|
| 17 |
+
To address the challenges presented above, we propose a Context-aware Attention Network (CAN) to learn fine-grained representations for input sentences, and develop a mechanism to interact with the user for comprehensively understanding a given question. Specifically, we employ two-level attention applied at word level and sentence level to compute representations of all input sentences.
|
| 18 |
+
|
| 19 |
+
The office is north of the kitchen. The garden is south of the kitchen. Q: What is north of the kitchen? A: Office
|
| 20 |
+
|
| 21 |
+
The master bedroom is east of the garden. The guest bedroom is east of the office. Q: What is the bedroom east of? A: Unknown
|
| 22 |
+
|
| 23 |
+
Table 1: Two examples of QA problems. Left is an ideal QA example, where the question is very clear. Right is an example with incomplete information, where the question is ambiguous and it is difficult to provide an answer only using the input statements.
|
| 24 |
+
|
| 25 |
+
The context information extracted from the input story is allowed to influence the attention over each word, and governs the word semantic meaning contributing to a sentence representation. In addition, an interactive mechanism is activated to generate a supplementary question for the user when the model feels that it does not have complete information to answer a given question. User’s feedback is then encoded and exploited to attend over all input sentences to infer the answer. Our proposed model CAN can be viewed as an encoder-decoder approach augmented with two-level attention and an interactive mechanism, rendering our model self-adaptive, as illustrated in Figure 1.
|
| 26 |
+
|
| 27 |
+
Our contributions in this paper are as follows: (i) We develop a new encoder-decoder model called CAN for question answering with two-level attention. Due to the new attention mechanism, our model avoids the necessity of multiple-hop attention, required by previous QA models, and knows when it can readily output an answer and when it needs additional information. (ii) We augment the encoder-decoder framework for QA with an interactive mechanism for handling user’s feedback, which immediately changes sentence-level attention to infer the final answer without additional model training. (iii) We introduce a new dataset based on the bAbI dataset, namely ibAbI, for IQA tasks. $( i \nu )$ Extensive experiments show that our approach outperforms state-of-the-art models on both QA and IQA datasets. Specifically, our approach achieves $4 0 \%$ improvement over traditional QA models (e.g., MemN2N and $\mathrm { D M N + }$ ) on IQA datasets.
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
Figure 1: An example of QA problem using CAN.
|
| 31 |
+
|
| 32 |
+
# 2 RELATED WORK
|
| 33 |
+
|
| 34 |
+
Recent work on QA has been heavily influenced by research on various models with attention and/or memory. Most of these models employ an encoder-decoder framework, and have been successfully applied to image classification (Seo et al., 2016), image captioning (Xu et al., 2015; Mnih et al., 2014), machine translation (Cho et al., 2014; Bahdanau et al., 2015; Luong et al., 2015), document classification (Yang et al., 2016), and textual/visual QA (Sainbayar et al., 2015; Yang et al., 2015; Lu et al., 2016; Kumar et al., 2016; Xiong et al., 2016). For textual QA in the form of statementsquestion-answer triplets, Sainbayar et al. (2015) utilizes an external memory module. It maps each input sentence to an input representation space regarded as a memory component. The output representation is calculated by summarizing over input representations with different attention weights. This single-layer memory can be extended to multi-layer memory by reasoning the content and the question multiple times. Instead of simply stacking the memory layers, Kumar et al. (2016) have introduced a dynamic memory network (DMN) to update the memory vectors through a modified GRU, in which the gate weight is trained in a supervised fashion. To improve DMN by training without supervision, Xiong et al. (2016) encode input sentences with a bidirectional GRU and then utilize an attention-based GRU to summarize these input sentences. Neural Turing Machine (NTM) (Graves et al., 2014), a model with content and location-based memory addressing mechanisms, has also been used for QA tasks recently. There is other recent work about QA using external resources (Wu et al., 2015; Fader et al., 2014; Savenkov & Emory, 2016; Hermann et al., 2015; Golub & He, 2016), and exploring dialog tasks (Weston, 2016; Bordes & Weston, 2016).
|
| 35 |
+
|
| 36 |
+
Our model in this paper also addresses textual QA in the form of statements-question-answer triplets, but it differs from prior work in two aspects. First, in our attention network, the word attention are context-dependent for generating accurate sentence representations and the sentence attention are question-guided for generating context representation. Second, this new attention mechanism helps our model understand when it can readily output an answer and when it can generate a supplementary question for activating the user interaction. Incorporating user’s feedback does not require additional model training and this property makes our model highly self-adaptive.
|
| 37 |
+
|
| 38 |
+
# 3 GATED RECURRENT UNIT NETWORKS
|
| 39 |
+
|
| 40 |
+
Gated Recurrent Unit (GRU) (Cho et al., 2014) is the basic building block of our model for IQA. GRU has been widely adopted for many NLP tasks, such as machine translation (Bahdanau et al., 2015) and language modeling (Zaremba et al., 2014). GRU improves Long Short-term Memory (LSTM) (Hochreiter & Schmidhuber, 1997) by removing the cell component and making each hidden state adaptively capture the dependencies over different time scales using reset and update gates. For each time step $t$ with input $\mathbf { x } ^ { t }$ and previous hidden state $\mathbf { h } ^ { t - 1 }$ , we compute the updated hidden state $\mathbf { h } ^ { t } = G R U ( \mathbf { \bar { h } } ^ { t - 1 } , \mathbf { x } ^ { t } )$ by,
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r l r } { { \mathbf r } ^ { t } = \sigma ( { \mathbf U } _ { r } { \mathbf x } ^ { t } + { \mathbf W } _ { r } { \mathbf h } ^ { t - 1 } + { \mathbf b } _ { r } ) , } & { } & { { \mathbf z } ^ { t } = \sigma ( { \mathbf U } _ { z } { \mathbf x } ^ { t } + { \mathbf W } _ { z } { \mathbf h } ^ { t - 1 } + { \mathbf b } _ { z } ) , } \\ { \widetilde { { \mathbf h } } ^ { t } = t a n h ( { \mathbf U } _ { h } { \mathbf x } ^ { t } + { \mathbf W } _ { h } ( { \mathbf r } ^ { t } \odot { \mathbf h } ^ { t - 1 } ) + { \mathbf b } _ { h } ) , } & { } & { { \mathbf h } ^ { t } = { \mathbf z } ^ { t } \odot { \mathbf h } ^ { t - 1 } + ( { \mathbf 1 } - { \mathbf z } ^ { t } ) \odot \widetilde { { \mathbf h } } ^ { t } , } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $\sigma$ is the sigmoid activation function, $\odot$ is an element-wise product, $\mathbf { U } _ { r } , \mathbf { U } _ { z } , \mathbf { U } _ { h } \in \mathbb { R } ^ { K \times D }$ , $\mathbf { W } _ { r } , \mathbf { W } _ { z } , \mathbf { W } _ { h } \in \mathbf { \bar { \mathbb { R } } } ^ { K \times K } , \mathbf { b } _ { r } , \mathbf { b } _ { z } , \mathbf { b } _ { h } \in \mathbb { R } ^ { K \times 1 } ,$ $K$ is the hidden size and $D$ is the input size.
|
| 47 |
+
|
| 48 |
+
# 4 CONTEXT-AWARE ATTENTION NETWORK
|
| 49 |
+
|
| 50 |
+
In this section, we first illustrate the proposed model CAN (§ 4.1), including the question module $( \ S ~ 4 . 2 )$ , the input module $( \ S \ 4 . 3 )$ and the answer module $( \ S \ 4 . 4 )$ . We then describe each of these modules in detail. Finally, we elaborate the training procedure of CAN $( \ S 4 . 5 )$ .
|
| 51 |
+
|
| 52 |
+
# 4.1 FRAMEWORK
|
| 53 |
+
|
| 54 |
+
Given a story represented by $N$ input sentences (or statements), i.e., $( l _ { 1 } , \cdots , l _ { N } )$ , and a question $q$ , our goal is to generate an answer $a$ . Each sentence $l _ { t }$ includes a sequence of $N _ { t }$ words, denoted as $( w _ { 1 } ^ { t } , \cdot \cdot \cdot , w _ { N _ { t } } ^ { t } )$ , and a question with $N _ { q }$ words is represented as $( w _ { 1 } ^ { \bar { q } } , \cdot \cdot \cdot , w _ { N _ { q } } ^ { q } )$ . Let $V$ denote the size of dictionary, including the words from each $l _ { t }$ , $q$ and $a$ , and end-of-sentence (EOS) symbols.
|
| 55 |
+
|
| 56 |
+
The whole framework of our model is shown in Figure 2, consisting of the following three key parts:
|
| 57 |
+
|
| 58 |
+
• Question Module: The question module encodes the target question into a vector representation. • Input Module: The input module encodes a set of input sentences into a vector representation. • Answer Module: The answer module generates an answer based on the outputs of question and input modules. Unlike traditional QA models, it has two choices, either to output an answer immediately or to interact with the user for further information. Hence, if the model lacks sufficient evidence for answer prediction based on the existing knowledge at current timestamp, an interactive mechanism is enabled. Specifically, the model generates a supplementary question, and the user needs to provide a feedback, which is utilized to estimate an answer.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: The illustration of the proposed model, consisting of a question module, an input module and an answer module. The question module maps the question sentence into a sentence level space. The input module generates a context representation based on input sentences. The answer module has a binary choice, either to generate an answer immediately or to take an interactive mechanism.
|
| 62 |
+
|
| 63 |
+
# 4.2 QUESTION MODULE
|
| 64 |
+
|
| 65 |
+
Suppose a question is a sequence of $N _ { q }$ words, we encode each word $w _ { j }$ into a $K _ { w }$ -dimensional vector space $\mathbf { x } _ { j } ^ { q }$ using an embedding matrix $\mathbf { W } _ { w } ~ \in ~ \mathbb { R } ^ { K _ { w } \times V }$ , i.e., $\mathbf { x } _ { j } ^ { q } \ = \ \mathbf { W } _ { w } [ w _ { j } ]$ , where $[ w _ { j } ]$ is a one-hot vector associated with word $w _ { j }$ . The sequence order within a sentence significantly affects each word’s semantic meaning due to its dependence on the previous words. Thus, a GRU is employed by taking each word vector $\mathbf { x } _ { j } ^ { q }$ as input and updating the hidden state $\mathbf { g } _ { j } ^ { q } \in \mathbb { R } ^ { K _ { h } \times 1 }$ as:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\mathbf { g } _ { j } ^ { q } = G R U _ { w } ( \mathbf { g } _ { j - 1 } ^ { q } , \mathbf { x } _ { j } ^ { q } ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where the subscript of GRU is used to distinguish other GRUs used in the following sections. The hidden state $\mathbf { g } _ { j } ^ { q }$ can be regarded as the annotation vector of word $w _ { j }$ by incorporating the word order information. We also explore a variety of encoding schema, such as LSTM and RNN. However, LSTM is prone to overfitting due to large number of parameters, and RNN has a poor performance because of exploding and vanishing gradients (Bengio et al., 1994).
|
| 72 |
+
|
| 73 |
+
In addition, each word contributes differently to the representation of a question. For example, in a question ‘Where is the football?’, ‘where’ and ‘football’ play a critical role in summarizing this sentence. Therefore, an attention mechanism is introduced to generate a question representation by focusing on the important words for their semantic meaning. A positive weight $\gamma _ { j }$ is placed on each word to indicate the relative importance of contribution to the representation of the question. Specifically, this weight is measured as the similarity of corresponding word annotation vector $\mathbf { g } _ { j }$ and a word level latent vector $\mathbf { v } \in \mathbb { R } ^ { K _ { h } \times 1 }$ for question which is jointly learned during the training process. The question representation $\mathbf { u } \in \mathbb { R } ^ { K _ { c } \times \mathbf { \bar { 1 } } }$ is then generated by a weighted summation of the word annotation vectors and corresponding important weights, where we also use one-layer MLP to transfer it from sentence-level space into context-level space,
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { r l r } & { \gamma _ { j } = { s o f t m a x } ( { { \bf { v } } ^ { T } } { \bf { g } } _ { j } ^ { q } ) , } & { { \bf { u } } = { { \bf { W } } _ { c h } } \displaystyle \sum _ { j = 1 } ^ { N _ { q } } \gamma _ { j } { \bf { g } } _ { j } ^ { q } + { \bf { b } } _ { c } ^ { ( q ) } , } \\ & { n a x ~ \mathrm { i s ~ d e f i n e d ~ a s ~ } s o f t m a x ( { x _ { i } } ) = \frac { { \exp ( { x _ { i } } ) } } { \sum _ { j ^ { \prime } } \exp ( { x _ { j ^ { \prime } } } ) } , { { \bf { W } } _ { c h } } \in { { \mathbb R } } ^ { K _ { c } \times K _ { h } } , \mathrm { a n d ~ } { \bf { b } } _ { c } ^ { ( q ) } \in \Omega } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where sof t $\mathbf { b } _ { c } ^ { ( q ) } \in \mathbb { R } ^ { K _ { c } \times 1 }$
|
| 80 |
+
|
| 81 |
+
# 4.3 INPUT MODULE
|
| 82 |
+
|
| 83 |
+
Input module aims at generating a representation for input sentences, including a sentence encoder and a context encoder. Sentence encoder computes a sentence representation, and context encoder calculates a representation of input sentences, both of which are introduced in the following sections.
|
| 84 |
+
|
| 85 |
+
# 4.3.1 SENTENCE ENCODER
|
| 86 |
+
|
| 87 |
+
For each input sentence $l _ { t }$ , containing a sequence of $N _ { t }$ words $( w _ { 1 } , \cdots , w _ { N _ { t } } )$ , similar to the question module, each word $w _ { i }$ is embedded into word space $\mathbf { x } _ { i } ^ { t } \in \mathbb { R } ^ { K _ { w } \times 1 }$ with the embedding matrix $\mathbf { W } _ { w }$ , and a recurrent neural network is used to capture the context information from the words which have already been generated in the same sentence. Let $\mathbf { h } _ { i } ^ { t } \in \mathbb { R } ^ { K _ { h } \times 1 }$ denote the hidden state which can be interpreted as the word annotation in the input space. A GRU retrieves each word annotation by taking word vector as input and relying on previous hidden state,
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathbf { h } _ { i } ^ { t } = G R U _ { w } ( \mathbf { h } _ { i - 1 } ^ { t } , \mathbf { x } _ { i } ^ { t } ) .
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
In Eq.(4), each word annotation vector takes the sequence order into consideration to learn its semantic meaning based on previous information within a sentence through a recurrent neural network. A question answering system is usually given multiple input sentences which often form a story together. A single word has different meaning in the different stories. Learning a single sentence context at which a word is located is insufficient to understand the meaning of this word, in particular when the sentence is placed in a story context. In other words, only modeling a sequence of words prior to a word within a sentence may lose some important information which results in the failure of the generation of sentence representation. Hence, we take the whole context into account as well to appropriately characterize each word and well understand this sentence’s meaning. Suppose $\mathbf { s } _ { t - 1 } \in \overline { { \mathbb { R } } } ^ { K _ { c } \times 1 }$ is the annotation vector of previous sentence $l _ { t - 1 }$ , which will be introduced in the next section. To incorporate context information generated by previous sentences, we feed word annotation $\mathbf { h } _ { i } ^ { t }$ and previous sentence annotation $\mathbf { s } _ { t - 1 }$ through a two-layer MLP, where a context-aware word vector $\mathbf { e } _ { i } ^ { t } \in \mathbb { R } ^ { K _ { c } \times 1 }$ is obtained as follows:
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\mathbf { e } _ { i } ^ { t } = \sigma ( \mathbf { W } _ { e e } t a n h ( \mathbf { W } _ { e s } \mathbf { s } _ { t - 1 } + \mathbf { W } _ { e h } \mathbf { h } _ { i } ^ { t } + \mathbf { b } _ { e } ^ { ( 1 ) } ) + \mathbf { b } _ { e } ^ { ( 2 ) } ) ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $\mathbf { W } _ { e e } , \mathbf { W } _ { e s } \in \mathbb { R } ^ { K _ { c } \times K _ { c } }$ and $\mathbf { W } _ { e h } \in \mathbb { R } ^ { K _ { c } \times K _ { h } }$ are weight matrices, and ${ \bf b } _ { e } ^ { ( 1 ) }$ , $\mathbf { b } _ { e } ^ { ( 2 ) } \in \mathbb { R } ^ { K _ { c } \times 1 }$ are the bias terms. It is worth noting that $\mathbf { s } _ { t - 1 }$ is dependent on its previous sentence. Recursively, this sentence relies on its previous one as well. Hence, our model is able to encode the previous context. In addition, the sentence representation will focus on those words which are able to address the question. Inspired by this intuition, another word level attention mechanism is introduced to attend informative words about the question for generating a sentence’s representation. As the question representation is utilized to guide the word attention, a positive weight $\alpha _ { i } ^ { t }$ associated with each word is computed as the similarity of the question vector $\mathbf { u }$ and the corresponding context-aware word vector $\mathbf { e } _ { i } ^ { t }$ . Then the sentence representation $\mathbf { y } _ { t } ~ \in ~ \mathbb { R } ^ { K _ { h } \times 1 }$ is generated by aggregating the word annotation vectors with different weights,
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\alpha _ { i } ^ { t } = s o f t m a x ( \mathbf { u } ^ { T } \mathbf { e } _ { i } ^ { t } ) , \mathbf { y } _ { t } = \sum _ { i = 1 } ^ { N _ { t } } \alpha _ { i } ^ { t } \mathbf { h } _ { i } ^ { t } .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
# 4.3.2 CONTEXT ENCODER
|
| 106 |
+
|
| 107 |
+
Suppose a story is comprised of a sequence of sentences, i.e., $( l _ { 1 } , \cdots , l _ { N } )$ , each of which is encoded as a $K _ { h }$ -dimensional vector $\mathbf { y } _ { t }$ through a sentence encoder. As input sentences have a sequence order, simply using their sentence vectors for context generation cannot effectively capture the entire context of the sequence of sentences. To address this issue, a sentence annotation vector is introduced to capture the previous context and this sentence’s own meaning using a GRU. Given the sentence vector $\mathbf { y } _ { t }$ and the state $\mathbf { s } _ { t - 1 }$ of previous sentence, we get annotation vector $\mathbf { s } _ { t } \in \mathbb { R } ^ { K _ { c } \times 1 }$ as:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\begin{array} { r } { \mathbf { s } _ { t } = G R U _ { s } ( \mathbf { s } _ { t - 1 } , \mathbf { y } _ { t } ) . } \end{array}
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
A GRU can learn a sentence’s meaning based on previous context information. However, just relying on GRU at sentence level using simple word embedding vectors makes it difficult to learn the precise semantic meaning for each word in the story. Hence, we introduce a context-aware attention mechanism shown in Eq.(5) to properly encode each word for the generation of sentence representation, which guarantees that each word is reasoned under the specific context.
|
| 114 |
+
|
| 115 |
+
Once the sentence annotation vectors $( { \bf s } _ { 1 } , \cdots , { \bf s } _ { N } )$ are obtained as described above, a sentence level attention mechanism is enabled to emphasize those sentences that are highly relevant to the question. We can estimate the attention weight $\beta _ { t }$ with the similarity of the question and the corresponding sentence. Hence, the context representation $\mathbf { m }$ is retrieved by summing over all sentence representations associated with corresponding attention weights, and given by:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\beta _ { t } = s o f t m a x ( \mathbf { u } ^ { T } \mathbf { s } _ { t } ) ,
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\mathbf { m } = \sum _ { t = 1 } ^ { N } \beta _ { t } \mathbf { s } _ { t } .
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
Similar to bidirectional RNN, our model can be extended to use another sentence-level GRU that moves backward through time beginning from the end of the sequence.
|
| 126 |
+
|
| 127 |
+
# 4.4 ANSWER MODULE
|
| 128 |
+
|
| 129 |
+
The answer module utilizes a decoder to generate an answer, where it has two output cases according to the understanding ability of both the question and the context. One is to generate the answer immediately after receiving the context and question information. Another one is to generate a supplementary question and then use the user’s feedback to predict the answer. This process is taken by an interactive mechanism.
|
| 130 |
+
|
| 131 |
+
# 4.4.1 ANSWER GENERATION
|
| 132 |
+
|
| 133 |
+
Given the question representation $\mathbf { u }$ and the context representation $\mathbf { m }$ , another GRU is used as the decoder to generate a sentence as the answer. To fuse $\mathbf { u }$ and $\mathbf { m }$ together, we sum these vectors rather than concatenating them to reduce the total number of parameters. Suppose $\hat { \mathbf { x } } _ { k - 1 } \in \mathbb { R } ^ { K _ { w } \times 1 }$ is the predicted word vector in last step, GRU updates the hidden state $\mathbf { z } _ { k } \in \bar { \mathbb { R } ^ { K _ { o } \times 1 } }$ as follows,
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\hat { \mathbf { x } } _ { k } \overset { \mathbf { W } _ { w } } { = } s o f t m a x ( \mathbf { W } _ { o d } \mathbf { z } _ { k } + \mathbf { b } _ { o } ) , \qquad \mathbf { z } _ { k } = G R U _ { d } ( \mathbf { z } _ { k - 1 } , [ \mathbf { m } + \mathbf { u } ; \hat { \mathbf { x } } _ { k - 1 } ] )
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
where $\mathbf { \underline { { \underline { { W } } } } } _ { w }$ denotes the predicted word vector through the embedding matrix $\mathbf { W } _ { w }$ . Note that we require that each sentence ends with a special EOS symbol, including question mask and period symbol, which enables the model to define a distribution over sentences of all possible lengths.
|
| 140 |
+
|
| 141 |
+
Output Choices. In practice, the system is not aways able to answer question immediately based on its current knowledge due to the lack of some crucial information bridging the gap between question and context knowledge, i.e., incomplete issue. Therefore, we allow the decoder to make a binary choice, either to generate an answer immediately, or to enable an interactive mechanism. Specifically, if the model has sufficiently strong evidence for a successful answer prediction based on the well-learned context representation and question representation, the decoder will directly output the answer. Otherwise, the system generates a supplementary question for user, where an example is shown in Table 2. At this time, this user needs to offer a feedback which is then encoded to update the sentence-level attentions for answer generation. This procedure is our interactive mechanism.
|
| 142 |
+
|
| 143 |
+
Table 2: An example of interactive mechanism. ��SQ” denotes supplementary question.
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Problem</td><td>The master bedroom is east of the garden. The guest bedroom is east of the office. Target Question: What is the bedroom east of?</td></tr><tr><td>Interactive Mechanism</td><td>System:Which bedroom,master one or guest one? (SQ) User: Master bedroom(User's Feedback) System: Garden(Predicted Answer)</td></tr></table>
|
| 146 |
+
|
| 147 |
+
The sentence generated by the decoder ends with a special symbol, either a question mask or a period symbol. Hence, this special symbol is utilized to make a decision. In other words, if EOS symbol is a question mask, the generated sentence is regarded as a supplementary question and an interactive mechanism is enabled; otherwise the generated sentence is the estimated answer and the prediction task is done. In the next section, we will introduce the details of interactive mechanism.
|
| 148 |
+
|
| 149 |
+
# 4.4.2 INTERACTIVE MECHANISM
|
| 150 |
+
|
| 151 |
+
The interactive process is summarized as follows: 1) The decoder generates a supplementary question; 2) The user provides a feedback; 3) The feedback is used for answer prediction for the target question. Suppose the feedback contains a sequence of words, denoted as $( w _ { 1 } ^ { f } , \cdot \cdot \cdot , w _ { N _ { f } } ^ { f } )$ . Similar to the input module, each word $\boldsymbol { w _ { d } ^ { f } }$ is embedded to a vector $ { \mathbf { x } } _ { d } ^ { f }$ through an embedding matrix $\mathbf { W } _ { w }$ . Then the corresponding annotation vector $\mathbf { g } _ { d } ^ { f } \in \mathbb { R } ^ { K _ { h } \times 1 }$ is retrieved via a GRU by taking the embedding vector as input, and shown as follows:
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\mathbf { g } _ { d } ^ { f } = G R U _ { w } ( \mathbf { g } _ { d - 1 } ^ { f } , \mathbf { x } _ { d } ^ { f } ) .
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
Based on the annotation vectors, a representation $\mathbf { f } \in \mathbb { R } ^ { K _ { h } \times 1 }$ can be obtained by a simple attention mechanism where each word is considered to contribute equally, and given by:
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\mathbf { f } = \frac { 1 } { N _ { f } } \sum _ { d = 1 } ^ { N _ { f } } \mathbf { g } _ { d } ^ { f } .
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
Our goal is to utilize the feedback representation $\mathbf { f }$ to generate an answer for the target question. The provided feedback improves the ability to answer the question by distinguishing the relevance of each input sentence to the question. In other words, the similarity of specific input sentences in the provided feedback make these sentences more likely to address the question. Hence, we refine the attention weight of each sentence shown in Eq.(9) after receiving the user’s feedback, given by,
|
| 164 |
+
|
| 165 |
+
$$
|
| 166 |
+
{ \bf r } = t a n h ( { \bf W } _ { r f } { \bf f } + { \bf b } _ { r } ^ { ( f ) } ) , \qquad ( 1 3 ) \qquad \quad \beta _ { t } = s o f t m a x ( { \bf u } ^ { T } { \bf s } _ { t } + { \bf r } ^ { T } { \bf s } _ { t } )
|
| 167 |
+
$$
|
| 168 |
+
|
| 169 |
+
where $\mathbf { W } _ { r f } \in \mathbb { R } ^ { K _ { c } \times K _ { h } }$ and $\mathbf { b } _ { r } ^ { ( f ) } \in \mathbb { R } ^ { K _ { c } \times 1 }$ are the weight matrix and bias vector, respectively. Eq.(13) is an one-layer neural network to transfer feedback representation to context space. After obtaining the newly learned attention weights, we update the context representation using the softattention operation shown in Eq.(9). This updated context representation and question representation will be used as the input for decoder to generate an answer. Note that for simplifying the problem, we allow the decoder to only generate at most one supplementary question. In addition, one advantage of using the user’s feedback to update the attention weights of input sentences is that we do not need to re-train the encoder again once a feedback is entering the system.
|
| 170 |
+
|
| 171 |
+
# 4.5 TRAINING PROCEDURE
|
| 172 |
+
|
| 173 |
+
During training, all modules share an embedding matrix. There are three different GRUs employed for sentence encoding, context encoding and answer/supplementary question decoding. In other words, the same GRU is used to encode the question, input sentences and the user’s feedback. The second one is applied to generate context representation and the third one is used as decoder. Training can be treated as a supervised classification problem to minimize the cross-entropy error of the answer sequence and the supplementary question sequence.
|
| 174 |
+
|
| 175 |
+
# 5 EXPERIMENTS
|
| 176 |
+
|
| 177 |
+
In this section, we evaluate our approach with many baseline methods based on various datasets.
|
| 178 |
+
|
| 179 |
+
# 5.1 EXPERIMENTAL SETUP
|
| 180 |
+
|
| 181 |
+
Datasets. In this paper, we use two types of datasets to evaluate the performance of our approach. One is traditional QA dataset, where we use Facebook bAbI English 10k dataset (Weston et al., 2015). It contains 20 different types of tasks with emphasis on different forms of reasoning and induction. The second is the newly designed IQA dataset, where we extend bAbI to add interactive QA and denote it as ibAbI. Overall, we generate three ibAbI datasets based on task 1 (single supporting fact), task 4 (two argument relations), and task 7 (counting). Specifically, the former two datasets focus on solving ambiguous actors/objects problem, and the latter one is to ask further information that assists answer prediction. Table 3 shows three examples for our three ibAbI tasks.
|
| 182 |
+
|
| 183 |
+
In addition, we also mix IQA data and corresponding QA data together with different IQA ratios, where the IQA ratio is ranging from 0.3 to 1 (with step as 0.1) and denoted as $R _ { I Q A }$ . For example, in task 1, we randomly pick $R _ { I Q A } \times 1 0 0 $ percent data from ibAbI task 1, and then randomly select the remaining data from bAbI task 1. $R _ { I Q A } = 1$ indicates that the whole dataset only consists of IQA problems; otherwise (i.e., ranging from 0.3 to 0.9) it consists of both types of QA problems. Overall, we have three tasks for ibAbI dataset, and eight sub-datasets for each task. In the experiments, 10k examples are used as training and another 1k examples are used as testing.
|
| 184 |
+
|
| 185 |
+
Table 3: Examples of three different tasks on the generated ibAbI datasets. “Q” indicates the target question. “SQ” is the supplementary question. “FB” refers to user’s feedback. “A” is the answer.
|
| 186 |
+
|
| 187 |
+
<table><tr><td rowspan="3">IQA task 1: John journeyed to the garden. Daniel moved to the kitchen.</td><td>IQA task 4:</td><td>IQA task 7:</td></tr><tr><td>The master bedroom is east of the garden.</td><td>John grabbed the bread.</td></tr><tr><td>The guest bedroom is east of the office. The guest bedroom is west of the hallway.</td><td>John grabbed the milk.</td></tr><tr><td rowspan="4">Q:Where is he? SQ: Who is he?</td><td></td><td>John grabbed the apple.</td></tr><tr><td>The bathroom is east of the master bedroom.</td><td>Sandra went to the bedroom.</td></tr><tr><td>Q:What is the bedroom east of?</td><td>Q:How many special objects is John holding?</td></tr><tr><td>SQ:Which bedroom,master one or guest one?</td><td>SQ:What objects are you referring to?</td></tr><tr><td>FB:Daniel A: Kitchen</td><td>FB:Master bedroom A: Garden</td><td>FB: Milk,bread A: Two</td></tr></table>
|
| 188 |
+
|
| 189 |
+
Experiment Settings. We train our models using the Adam optimizer (Kingma & Ba, 2014). Xavier initialization is used for all parameters except for word embeddings, which utilize random uniform initialization ranging from $- { \sqrt { 3 } }$ to $\sqrt { 3 }$ . The learning rate is set as 0.001. The grid search method is utilized to find optimal parameters, such as batch size and hidden size.
|
| 190 |
+
|
| 191 |
+
# 5.2 BASELINE METHODS
|
| 192 |
+
|
| 193 |
+
To demonstrate the effectiveness of our approach CAN, we compare it with the following models:
|
| 194 |
+
|
| 195 |
+
• $\mathbf { D M N + }$ : Xiong et al. (2016) improve Dynamic Memory Networks (Kumar et al., 2016) by using stronger input and memory modules, where a bidirectional GRU is adopted to generate representations for statements and a neural network is used to update episodic memory multiple times. • MemN2N: This is an extension of Memory Network with weak supervision as proposed in Sainbayar et al. (2015). Here, an external memory module is used to encode the input statements and a recurrent attention mechanism is used to read the memory for answer prediction. • EncDec: We extend the encoder-decoder framework (Cho et al., 2014) to solve QA tasks as a baseline method. Specifically, EncDec uses a GRU to encode statements and questions, the end of hidden states is used as context representation, and another GRU to generate the output.
|
| 196 |
+
|
| 197 |
+
# 5.3 PERFORMANCE OF QUESTION ANSWERING
|
| 198 |
+
|
| 199 |
+
In this section, we evaluate model’s ability for answer prediction based on traditional QA dataset (i.e., bAbI-10k). For this task, our model (denoted as $\mathrm { C A N + Q A } ,$ ) does not use the interactive mechanism. As the output answers for this dataset only contain a single word, we adopt test error rate as evaluation metric. For $\mathrm { D M N } +$ and MemN2N methods, we select the best performance over bAbI dataset reported in (Xiong et al., 2016). The results of various models across 20 tasks are reported in Table 4. We summarize the main observations as follows:
|
| 200 |
+
|
| 201 |
+
• Our approach is better than all baseline methods in each individual task. For example, it reduces the error by $4 \%$ compared to $\mathrm { D M N } +$ in task 17, and compared to MemN2N, it reduces $1 8 . 4 \%$ and $4 . 8 \%$ error in task 17 and 18 respectively. We can achieve a better result primarily because our approach can model the semantic logic flow for statements. Table 5 shows two examples in task 17 and 18, where MemN2N predicts incorrectly while $\mathrm { C A N + Q A }$ can make correct predictions. In these two examples, the semantic logic determines the relationship between two objects mentioned in the question, such as chest and suitcase. In addition, Kumar et al. (2016) has shown that memory networks with multiple hops are better than the one with single hop. Our strong results illustrate that our approach has more accurate context modeling even without multiple hops. EncDec performs the worst amongst all models over all tasks. EncDec concatenates the statements and questions as a single input, resulting in the difficulty of training the GRU. For example, EncDec is not good on task 2 and 3 because these two tasks have longer inputs than other tasks. • The results of $\mathrm { D M N } +$ and MemN2N are much better than EncDec. It is not surprising that they can outperform EncDec, because they are specifically designed for question answering and do not suffer from the problem mentioned above by treating input sentences separately. • All models perform poorly on task 16. Xiong et al. (2016) points out that MemN2N with a simple update for memory could achieve a near perfect error rate of 0.4 while a more complex method will lead to a much worse result. This shows that a sophisticated modeling method makes it difficult to achieve a good performance in certain simple tasks with such limited data. This can be a possible reason for the poor performance of our model on this specific task as well.
|
| 202 |
+
|
| 203 |
+
In addition, different from MemN2N, we use a GRU to capture the semantic logic flow of input sentences, where the sentence-level attention can weaken the influence of unrelated sentences in a long story. Table 6 shows two examples of our results with long stories. From the attention weights, we can see our model can correctly search relevant sentences in a long story to address a question.
|
| 204 |
+
|
| 205 |
+
Table 4: Performance comparison of various models in terms of test error rate $( \% )$ in QA dataset.
|
| 206 |
+
|
| 207 |
+
<table><tr><td>Task</td><td>CAN+QA</td><td>DMN+</td><td>MemN2N</td><td>EncDec</td></tr><tr><td>1 - Single Supporting Fact</td><td>0.0</td><td>0.0</td><td>0.0</td><td>52.0</td></tr><tr><td>2 - Two Supporting Facts</td><td>0.1</td><td>0.3</td><td>0.3</td><td>66.1</td></tr><tr><td>3 - Three Supporting Facts</td><td>0.2</td><td>1.1</td><td>2.1</td><td>71.9</td></tr><tr><td>4 - Two Arg. Relations</td><td>0.0</td><td>0.0</td><td>0.0</td><td>29.2</td></tr><tr><td>5 - Three Arg.Relations</td><td>0.4</td><td>0.5</td><td>0.8</td><td>14.3</td></tr><tr><td>6 -Yes/No Questions</td><td>0.0</td><td>0.0</td><td>0.1</td><td>31.0</td></tr><tr><td>7 - Counting</td><td>0.3</td><td>2.4</td><td>2.0</td><td>23.6</td></tr><tr><td>8 - Lists/Sets</td><td>0.0</td><td>0.0</td><td>0.9</td><td>28.8</td></tr><tr><td>9 - Simple Negation</td><td>0.0</td><td>0.0</td><td>0.3</td><td>39.1</td></tr><tr><td>10 - Indefinite Knowledge</td><td>0.0</td><td>0.0</td><td>0.0</td><td>45.0</td></tr><tr><td>11-Basic Coreference</td><td>0.0</td><td>0.0</td><td>0.1</td><td>31.7</td></tr><tr><td>12 - Conjunction</td><td>0.0</td><td>0.0</td><td>0.0</td><td>35.0</td></tr><tr><td>13 - Compound Coref.</td><td>0.0</td><td>0.0</td><td>0.0</td><td>8.7</td></tr><tr><td>14- Time Reasoning</td><td>0.0</td><td>0.2</td><td>0.1</td><td>67.2</td></tr><tr><td>15 -Basic Deduction</td><td>0.0</td><td>0.0</td><td>0.0</td><td>62.2</td></tr><tr><td>16 -Basic Induction</td><td>43.0</td><td>45.3</td><td>51.8</td><td>54.0</td></tr><tr><td>17 -Positional Reasoning</td><td>0.2</td><td>4.2</td><td>18.6</td><td>43.1</td></tr><tr><td>18 - Size Reasoning</td><td>0.5</td><td>2.1</td><td>5.3</td><td>9.0</td></tr><tr><td>19 - Path Finding</td><td>0.0</td><td>0.0</td><td>2.3</td><td>89.6</td></tr><tr><td>20 - Agents Motivations</td><td>0.0</td><td>0.0</td><td>0.0</td><td>2.3</td></tr></table>
|
| 208 |
+
|
| 209 |
+
Table 5: Examples of bAbI task 17 (left) and 18 (right), where our model predicts correct answers while MemN2N makes wrong predictions.
|
| 210 |
+
|
| 211 |
+
<table><tr><td rowspan="4">The red square is below the triangle. The pink rectangle is to the left of the red square.</td><td>The boxis bigger than the suitcase.</td></tr><tr><td>The suitcase fits inside the container.</td></tr><tr><td>The box of chocolates fits inside the container.</td></tr><tr><td>The container fits inside the chest. The chocolate fits inside the suitcase.</td></tr><tr><td>Q: Is the triangle above the pink rectangle? A: yes</td><td>Q: Is the chest bigger than the suitcase? A: yes</td></tr></table>
|
| 212 |
+
|
| 213 |
+
<table><tr><td>Story</td><td>Support</td><td>Weight</td><td>Story</td><td>Support</td><td>Weight</td></tr><tr><td>Line1: Mary journeyed to the office. …</td><td></td><td>0.00</td><td>Line 1: John went back to the kitchen. Line 13 : Sandra grabbed the apple there.</td><td>yes</td><td>0.14</td></tr><tr><td>Line 48: Sandra grabbed the apple there. Line 49: Sandra dropped the apple. Line 50:·..</td><td>yes yes</td><td>0.13 0.85</td><td>Line 29: Sandra left the apple. Line 30:·..</td><td>yes</td><td>0.79</td></tr><tr><td colspan="4">What is Sandra carrying? Answer: nothing Prediction: nothing</td><td>What is Sandra carrying? Answer: nothing Prediction: nothing</td><td></td></tr></table>
|
| 214 |
+
|
| 215 |
+
Table 6: Examples of our model’s results on QA tasks. Supporting facts are shown in the datasets which our model does not use during training. “Weight” indicates the attention weight for sentence. Our model can locate correct supporting sentences for long stories.
|
| 216 |
+
|
| 217 |
+
# 5.4 PERFORMANCE OF INTERACTIVE QUESTION ANSWERING
|
| 218 |
+
|
| 219 |
+
In this section, we evaluate the performance of various models based on IQA dataset (as described in Section 5.1). For testing, we simulate the interactive procedure by taking the predefined feedback as user’s input for the generated supplementary question, and then generating an answer. All baseline methods do not have interactive part, so they take both statements and question as input and then estimate an answer. We compare our approach (CAN+IQA) with baseline methods in terms of test error rate shown in Table 7. From the results, we can achieve the following conclusions:
|
| 220 |
+
|
| 221 |
+
• Our method significantly outperforms all baseline methods. Specifically, we can achieve $0 \%$ test error rate in task 1 and task 4 with $R _ { I Q A } = 1 . 0$ ; while the best result of baseline methods can only get $4 0 . 5 \%$ test error rate. $\mathrm { C A N + I Q A }$ benefits from more accurate context modeling, which allows it to correctly understand when to output an answer or require additional information. For those QA problems with incomplete information, it is necessary to gather the additional information from users. Randomly guessing may harm model’s performance, which makes conventional QA models difficult to converge. But our approach uses an interactive procedure to obtain user’s feedback and allows the model to provide the correct answer.
|
| 222 |
+
|
| 223 |
+
• For the baseline methods, $\mathrm { D M N } +$ and MemN2N perform similarly and do better than EncDec. Their similar performance (which are worse than our approach) is due to the limitation that they could not learn the accurate meaning of statements and questions with limited resource and then have trouble training the models. But they are superior over EncDec as they treat each input sentence separately instead of modeling very long inputs.
|
| 224 |
+
|
| 225 |
+
In addition, we also quantitatively evaluate the quality of supplementary question generated by our approach where the details can be found in Appendix A.
|
| 226 |
+
|
| 227 |
+
<table><tr><td>Methods</td><td>RIQA = 1.0</td><td>RIQA =0.9</td><td>RIQA =0.8</td><td>RIQA =0.7</td><td>RIQA =0.6</td><td>RIQA =0.5</td><td>RIQA =0.4</td><td>RIQA = 0.3</td></tr><tr><td colspan="9">IQA Task 1</td></tr><tr><td>CAN+IQA</td><td>0.00</td><td>0.00</td><td>0.10</td><td>0.50</td><td>0.60</td><td>0.70</td><td>2.10</td><td>0.40</td></tr><tr><td>DMN+</td><td>42.2</td><td>42.1</td><td>33.0</td><td>28.9</td><td>25.0</td><td>19.9</td><td>17.3</td><td>11.6</td></tr><tr><td>MemN2N</td><td>40.5</td><td>38.9</td><td>34.4</td><td>30.0</td><td>23.9</td><td>18.4</td><td>16.9</td><td>13.9</td></tr><tr><td>EncDec</td><td>53.6</td><td>54.3</td><td>52.9</td><td>53.5</td><td>51.8</td><td>50.1</td><td>45.1</td><td>44.8</td></tr><tr><td colspan="9">IQA Task 4</td></tr><tr><td>CAN+IQA</td><td>0.00</td><td>1.30</td><td>0.10</td><td>0.60</td><td>0.60</td><td>1.10</td><td>1.40</td><td>1.20</td></tr><tr><td>DMN+</td><td>53.5</td><td>56.1</td><td>50.4</td><td>40.7</td><td>34.5</td><td>27.4</td><td>23.4</td><td>16.6</td></tr><tr><td>MemN2N</td><td>50.4</td><td>50.1</td><td>41.8</td><td>36.1</td><td>29.5</td><td>25.3</td><td>18.7</td><td>15.8</td></tr><tr><td>EncDec</td><td>55.9</td><td>54.9</td><td>52.5</td><td>49.2</td><td>45.9</td><td>38.9</td><td>30.4</td><td>24.2</td></tr><tr><td colspan="9">IQA Task7</td></tr><tr><td>CAN+IQA</td><td>0.30</td><td>2.10</td><td>2.50</td><td>1.80</td><td>2.00</td><td>0.70</td><td>0.20</td><td>0.30</td></tr><tr><td>DMN+</td><td>54.1</td><td>50.3</td><td>47.7</td><td>42.3</td><td>38.1</td><td>33.9</td><td>27.7</td><td>27.6</td></tr><tr><td>MemN2N</td><td>54.6</td><td>52.0</td><td>46.3</td><td>40.8</td><td>36.1</td><td>32.4</td><td>23.3</td><td>19.6</td></tr><tr><td>EncDec</td><td>55.5</td><td>50.9</td><td>48.6</td><td>44.7</td><td>39.1</td><td>32.3</td><td>31.9</td><td>26.6</td></tr></table>
|
| 228 |
+
|
| 229 |
+
Table 7: Performance comparison of various models in terms of test error rate $( \% )$ based on interactive question answering datasets with different IQA ratios.
|
| 230 |
+
|
| 231 |
+
# 5.5 QUALITATIVE ANALYSIS OF INTERACTIVE MECHANISM
|
| 232 |
+
|
| 233 |
+
In this section, we qualitatively show the attention weights over input sentences generated by our model on both QA and IQA data. We train our model $( \mathrm { C A N + I Q A } )$ on task 1 of ibAbI dataset with $Q _ { I Q A } = 0 . 9$ , and randomly select one IQA example from the testing data. Then we do the prediction on this IQA problem. In addition, we change this instance to a QA problem by replacing the question “Where is she?” with “Where is Sandra?”, and then do the prediction as well. The prediction results on both QA and IQA problems are shown in Table 8. From the results, we observe the following: 1) The attention that uses user’s feedback focuses on the key relevant sentence while the attention without feedback only focuses on an unrelated sentence. This happens because utilizing user’s feedback allows the model to understand a question better and locate the relevant input sentences. This illustrates the effectiveness of an interactive mechanism on addressing questions that require additional information. 2) The attention on both two problems can finally focus on the relevant sentences, showing the usefulness of our model for solving different types of QA problems.
|
| 234 |
+
|
| 235 |
+
# 6 CONCLUSION
|
| 236 |
+
|
| 237 |
+
In this paper, we present a self-adaptive model, CAN, which learns more accurate representations for statements and questions. More importantly, our model is aware what it knows and what it does not know within the context of the story, and takes an interactive mechanism to answer a question. Hence, our model takes an important step towards having a natural and intelligent conversation with humans. In the future, we plan to employ more powerful attention mechanisms with explicit unknown state modeling and multi-round feedback-guided fine-tuning to make the model fully selfaware, self-adaptive, and self-taught. We also plan to expand our results to harder co-reference and interactive visual QA tasks with uncertainty modeling.
|
| 238 |
+
|
| 239 |
+
Table 8: Examples of sentence attention weights obtained by our model in both QA and IQA data. “Before IM” indicates the sentence attention weights over input sentences before the user provides a feedback. “After IM” indicates the sentence attention weights updated by user’s feedback. The attention weights with value as 0.00 are very small. The results show that our approach can attend the key relevant sentences for both QA and IQA problems.
|
| 240 |
+
|
| 241 |
+
<table><tr><td rowspan=1 colspan=1>Input Sentences</td><td rowspan=1 colspan=1>Support</td><td rowspan=1 colspan=2>QA Data</td><td rowspan=1 colspan=1>Before IM</td><td rowspan=1 colspan=1>After IM</td></tr><tr><td rowspan=9 colspan=1>Mary journeyed to the kitchen.Sandra journeyed to the kitchen.Mary journeyed to the bedroom.Sandra moved to the bathroom.Sandra travelled to the office.Mary journeyed to the garden.Daniel travelled to the bathroom.Mary journeyed to the kitchen. John journeyed to the office.Mary moved to the bathroom.</td><td rowspan=4 colspan=1>yes</td><td rowspan=1 colspan=2>0.00</td><td rowspan=1 colspan=1>0.99</td><td rowspan=1 colspan=1>0.00</td></tr><tr><td rowspan=1 colspan=2>0.00</td><td rowspan=1 colspan=1>0.00</td><td rowspan=2 colspan=1>0.000.000.00</td></tr><tr><td rowspan=1 colspan=2>0.000.00</td><td rowspan=1 colspan=1>0.000.00</td></tr><tr><td rowspan=1 colspan=2>0.99</td><td rowspan=1 colspan=1>0.00</td><td rowspan=1 colspan=1>0.99</td></tr><tr><td rowspan=5 colspan=1></td><td rowspan=2 colspan=2>0.000.00</td><td rowspan=1 colspan=1>0.00</td><td rowspan=5 colspan=1>0.000.000.000.000.00</td></tr><tr><td rowspan=1 colspan=1>0.00</td></tr><tr><td rowspan=2 colspan=2>0.00</td><td rowspan=2 colspan=1>0.00</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=2>0.000.00</td><td rowspan=1 colspan=1>0.000.00</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>Q: Where is Sandra?A: Office</td><td rowspan=1 colspan=2>Q: Where is she? SQ: Who is she?FB: SandraA: Office</td></tr></table>
|
| 242 |
+
|
| 243 |
+
# REFERENCES
|
| 244 |
+
|
| 245 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
|
| 246 |
+
|
| 247 |
+
Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In ACL workshop, 2005.
|
| 248 |
+
|
| 249 |
+
Y. Bengio, P. Simard, and P. Frasconi. Learning long-term dependencies with gradient descent is difficult. Trans. Neur. Netw., 5(2):157–166, 1994. ISSN 1045-9227.
|
| 250 |
+
|
| 251 |
+
Antoine Bordes and Jason Weston. Learning end-to-end goal-oriented dialog. CoRR, abs/1605.07683, 2016.
|
| 252 |
+
|
| 253 |
+
Kyunghyun Cho, Bart van Merrienboer, C¸ aglar Gulc¸ehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. In EMNLP, pp. 1724–1734, 2014.
|
| 254 |
+
|
| 255 |
+
Anthony Fader, Luke Zettlemoyer, and Oren Etzioni. Open question answering over curated and extracted knowledge bases. In KDD, pp. 1156–1165, 2014.
|
| 256 |
+
|
| 257 |
+
David Golub and Xiaodong He. Character-level question answering with attention. CoRR, abs/1604.00727, 2016.
|
| 258 |
+
|
| 259 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014.
|
| 260 |
+
|
| 261 |
+
Karl Moritz Hermann, Tomas Kocisk ´ y, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa ´ Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In NIPS, pp. 1693– 1701, 2015.
|
| 262 |
+
|
| 263 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
|
| 264 |
+
|
| 265 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
|
| 266 |
+
Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. In ICML, pp. 1378–1387, 2016.
|
| 267 |
+
Jiasen Lu, Jianwei Yang, Dhruv Batra, and Devi Parikh. Hierarchical question-image co-attention for visual question answering. CoRR, abs/1606.00061, 2016.
|
| 268 |
+
Minh-Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attentionbased neural machine translation. CoRR, abs/1508.04025, 2015.
|
| 269 |
+
Volodymyr Mnih, Nicolas Heess, Alex Graves, and Koray Kavukcuoglu. Recurrent models of visual attention. In NIPS, pp. 2204–2212, 2014.
|
| 270 |
+
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: A method for automatic evaluation of machine translation. In Association for Computational Linguistics, pp. 311–318, 2002.
|
| 271 |
+
Sukhbaatar Sainbayar, Szlam Arthur, Weston Jason, and Fergus Rob. End-to-end memory networks. In NIPS, pp. 2440–2448, 2015.
|
| 272 |
+
Denis Savenkov and Eugene Agichtein Emory. When a knowledge base is not enough: Question answering over knowledge bases with external text data. In SIGIR, pp. 235–244, 2016.
|
| 273 |
+
Paul Hongsuck Seo, Zhe Lin, Scott Cohen, Xiaohui Shen, and Bohyung Han. Hierarchical attention networks. CoRR, abs/1606.02393, 2016.
|
| 274 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, pp. 3104–3112. 2014.
|
| 275 |
+
Jason Weston. Dialog-based language learning. NIPS, 2016.
|
| 276 |
+
Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. Towards ai-complete question answering: A set of prerequisite toy tasks. CoRR, abs/1502.05698, 2015.
|
| 277 |
+
Qi Wu, Peng Wang, Chunhua Shen, Anton van den Hengel, and Anthony R. Dick. Ask me anything: Free-form visual question answering based on knowledge from external sources. CoRR, abs/1511.06973, 2015.
|
| 278 |
+
Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic memory networks for visual and textual question answering. In ICML, pp. 2397–2406, 2016.
|
| 279 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron C. Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. CoRR, abs/1502.03044, 2015.
|
| 280 |
+
Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alexander J. Smola. Stacked attention networks for image question answering. CoRR, abs/1511.02274, 2015.
|
| 281 |
+
Zichao Yang, Diyi Yang, Chris Dyer, Xiaodong He, Alexander J. Smola, and Eduard H. Hovy. Hierarchical attention networks for document classification. In HLT, pp. 1480–1489, 2016.
|
| 282 |
+
Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. CoRR, abs/1409.2329, 2014.
|
| 283 |
+
|
| 284 |
+
# A SUPPLEMENTARY QUESTION ANALYSIS
|
| 285 |
+
|
| 286 |
+
We quantitatively evaluate the quality of supplementary question generated by our model based on IQA dataset. All baseline methods are designed to only predict an answer, none of them can generate a question. Thus we design another baseline method to generate supplementary question based on EncDec, and denote it as $E n c D e c ^ { * }$ . Specifically, in training procedure, $E n c D e c ^ { * }$ takes statements and questions as input. If the supplementary question is available, it is used as output; otherwise the corresponding answer is viewed as output. Similar to our approach, the EOS symbol is used to determine whether the generated sentence is question or not, where the question ends with question mark and the answer ends with period symbol.
|
| 287 |
+
|
| 288 |
+
To test model’s ability to generate supplementary question, we define some following metrics. Suppose the number of problems is $N$ , and the number of problems having supplementary question is $N _ { s }$ . Then $N _ { a } = N - N _ { s }$ is the number of remaining problems. Let $\begin{array} { r } { S Q u e A c c = { \frac { \hat { N } _ { s } } { N _ { s } } } } \end{array}$ Nˆs is the fraction of IQA problems which can be correctly estimated, and $\begin{array} { r } { A n s A c c = \frac { \hat { N } _ { a } } { N _ { a } } } \end{array}$ is the fraction of remaining problems which can be correctly estimated as QA problem. So $\begin{array} { r } { S Q u e A n s A c c = \frac { \hat { N } _ { s } + \hat { N } _ { a } } { N } } \end{array}$ = Nˆs+Nˆa is the overall accuracy. In addition, the widely used BLEU (Papineni et al., 2002) and METEROR (Banerjee & Lavie, 2005) are also adopted to evaluate the quality of generated supplementary question. The results of our method and baseline method are presented in Table 9.
|
| 289 |
+
|
| 290 |
+
From the results, we can observe that 1) Two models can almost correctly determine whether it is time to output a question or not; 2) Two models are able to generate the correct supplementary questions whose contents exactly match with the ground truth. There is no surprise that $E n c D e c ^ { * }$ also performs well in generating question, because it is specifically designed for only outputting questions. Thus, if given enough training data, $E n c D e c ^ { * }$ could predict good questions. However, the limitation is that it cannot predict a supplementary question and an answer at the same time. Different from $E n c D e c ^ { * }$ , our approach can accurately know when to output an answer or when to generate a supplementary question.
|
| 291 |
+
|
| 292 |
+
<table><tr><td>IQA Ratio</td><td>Method</td><td>SQueAcc</td><td>AnsAcc</td><td>SQueAnsAcc</td><td>BLEU-1</td><td>BLEU-4</td><td>METEOR</td></tr><tr><td colspan="8">IQA Task 1</td></tr><tr><td>0.8</td><td>CAN+IQA</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td></td><td>EncDec*</td><td>100%</td><td>99.5%</td><td>99.9%</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td colspan="8">IQA Task 4</td></tr><tr><td>0.8</td><td>CAN+IQA</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td></td><td>EncDec*</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td colspan="8">IQA Task 7</td></tr><tr><td>0.8</td><td>CAN+IQA</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td></td><td>EncDec*</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td></tr></table>
|
| 293 |
+
|
| 294 |
+
Table 9: Performance comparison of the generated supplementary question quality with $R _ { I Q A }$ as 0.8. Both two methods achieve $1 0 0 \%$ under all metrics in all tasks with other different $R _ { I Q A }$ values.
|
md/train/Syhr6pxCW/Syhr6pxCW.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PIXELNN: EXAMPLE-BASED IMAGE SYNTHESIS
|
| 2 |
+
|
| 3 |
+
Aayush Bansal Yaser Sheikh Deva Ramanan
|
| 4 |
+
|
| 5 |
+
Carnegie Mellon University {aayushb,yaser,deva}@cs.cmu.edu
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We present a simple nearest-neighbor (NN) approach that synthesizes highfrequency photorealistic images from an “incomplete” signal such as a lowresolution image, a surface normal map, or edges. Current state-of-the-art deep generative models designed for such conditional image synthesis lack two important things: (1) they are unable to generate a large set of diverse outputs, due to the mode collapse problem. (2) they are not interpretable, making it difficult to control the synthesized output. We demonstrate that NN approaches potentially address such limitations, but suffer in accuracy on small datasets. We design a simple pipeline that combines the best of both worlds: the first stage uses a convolutional neural network (CNN) to map the input to a (overly-smoothed) image, and the second stage uses a pixel-wise nearest neighbor method to map the smoothed output to multiple high-quality, high-frequency outputs in a controllable manner. Importantly, pixel-wise matching allows our method to compose novel high-frequency content by cutting-and-pasting pixels from different training exemplars. We demonstrate our approach for various input modalities, and for various domains ranging from human faces, pets, shoes, and handbags.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
We consider the task of generating high-resolution photo-realistic images from incomplete input such as a low-resolution image, sketches, surface normal map, or label mask. Such a task has a number of practical applications such as upsampling/colorizing legacy footage, texture synthesis for graphics applications, and semantic image understanding for vision through analysis-by-synthesis. These problems share a common underlying structure: a human/machine is given a signal that is missing considerable details, and the task is to reconstruct plausible details.
|
| 14 |
+
|
| 15 |
+
Consider the edge map of cat in Figure 1-c. When we humans look at this edge map, we can easily imagine multiple variations of whiskers, eyes, and stripes that could be viable and pleasing to the eye. Indeed, the task of image synthesis has been well explored, not just for its practical applications but also for its aesthetic appeal.
|
| 16 |
+
|
| 17 |
+
GANs: Current state-of-the-art approaches rely on generative adversarial networks (GANs) (Goodfellow et al., 2014), and most relevant to us, conditional GANS that generate image conditioned on an input signal (Denton et al., 2015; Radford et al., 2015; Isola et al., 2016). We argue that there are two prominent limitations to such popular formalisms: (1) First and foremost, humans can imagine multiple plausible output images given a incomplete input. We see this rich space of potential outputs as a vital part of the human capacity to imagine and generate. Conditional GANs are in principle able to generate multiple outputs through the injection of noise, but in practice suffer from limited diversity (i.e., mode collapse) (Fig. 2). Recent approaches even remove the noise altogether, treating conditional image synthesis as regression problem (Chen & Koltun, 2017). (2) Deep networks are still difficult to explain or interpret, making the synthesized output difficult to modify. One implication is that users are not able to control the synthesized output. Moreover, the right mechanism for even specifying user constraints (e.g., “generate a cat image that looks like my cat”) is unclear. This restricts applicability, particularly for graphics tasks.
|
| 18 |
+
|
| 19 |
+
Nearest-neighbors: To address these limitations, we appeal to a classic learning architecture that can naturally allow for multiple outputs and user-control: non-parametric models, or nearestneighbors (NN). Though quite a classic approach (Efros & Leung, 1999; Efros & Freeman, 2001;
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Our approach generates photorealistic output for various “incomplete” signals such as a low resolution image, a surface normal map, and edges/boundaries for human faces, cats, dogs, shoes, and handbags. Importantly, our approach can easily generate multiple outputs for a given input which was not possible in previous approaches (Isola et al., 2016) due to mode-collapse problem. Best viewed in electronic format.
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 2: Mode collapse problem for GANs: We ran pix-to-pix pipeline of Isola et al. (2016) 72 times. Despite the random noise set using dropout at test time, we observe similar output generated each time. Here we try to show 6 possible diverse examples of generation for a hand-picked bestlooking output from Isola et al. (2016).
|
| 26 |
+
|
| 27 |
+
Freeman et al., 2002; Hertzmann et al., 2001; Johnson et al., 2011), it has largely been abandoned in recent history with the advent of deep architectures. Intuitively, NN matches an incomplete input (b) Edges-to-Cats-and-Dogs query to a large corpus of training pairs of (incomplete inputs, high-quality outputs), and simply returns the corresponding output. This trivially generalizes to multiple outputs through $K$ -NN and allows for intuitive user control through on-the-fly modification of the training corpus - e.g., by restricting the training examplars to those that “look like my cat”.
|
| 28 |
+
|
| 29 |
+
In practice, there are several limitations in applying NN for conditional image synthesis. The first is a practical lack of training data. The second is a lack of an obvious distance metric. And the last is a computational challenge of scaling search to large training sets.
|
| 30 |
+
|
| 31 |
+
Approach: To reduce the dependency on training data, we take a compositional approach by matching local pixels instead of global images. This allows us to synthesize a face by “copy-pasting” the eye of one training image, the nose of another, etc. Compositions dramatically increase the representational power of our approach: given that we want to synthesize an image of $K$ pixels using $N$ training images (with $K$ pixels each), we can synthesize an exponential number $( N \bar { K } ) ^ { K }$ of compositions, versus a linear number of global matches $( N )$ . A significant challenge, however, is defining an appropriate feature descriptor for matching pixels in the incomplete input signal. We would like to capture context (such that whisker pixels are matched only to other whiskers) while allowing for compositionality (left-facing whiskers may match to right-facing whiskers). To do so, we make use of deep features, as described below.
|
| 32 |
+
|
| 33 |
+
Pipeline: Our precise pipeline (Figure 3) works in two stages. (1) We first train an initial regressor (CNN) that maps the incomplete input into a single output image. This output image suffers from the aforementioned limitations - it is a single output that will tend to look like a “smoothed” average of all the potential images that could be generated. (2) We then perform nearest-neighbor queries on pixels from this regressed output. Importantly, pixels are matched (to regressed outputs from training data) using a multiscale deep descriptor that captures the appropriate level of context. This enjoys the aforementioned benefits - we can efficiently match to an exponential number of training examples in an interpretable and controllable manner. Finally, an interesting byproduct of our approach is the generation of dense, pixel-level correspondences from the training set to the final synthesized outputs.
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 3: Overview of pipeline: Our approach is a two-stage pipeline. The first stage directly regresses an image from an incomplete input (using a CNN trained with $l _ { 2 }$ loss). This image will tend to look like a “smoothed” average of all the potential images that could be generated. In the second stage, we look for matching pixels in similarly-smoothed training images. Importantly, we match pixels using multiscale descriptors that capture the appropriate levels of context (such that eye pixels tend to match only to eyes). To do so, we make use of off-the-shelf hypercolumn features extracted from a CNN trained for semantic pixel segmentation. By varying the size of the matched set of pixels, we can generate multiple outputs (on the right).
|
| 37 |
+
|
| 38 |
+
# 2 RELATED WORK
|
| 39 |
+
|
| 40 |
+
Our work is inspired by a large body of work on discriminative and generative models, nearest neighbors architectures, pixel-level tasks, and dense pixel-level correspondences. We provide a broad overview, focusing on those most relevant to our approach.
|
| 41 |
+
|
| 42 |
+
Synthesis with CNNs: Convolutional Neural Networks (CNNs) have enjoyed great success for various discriminative pixel-level tasks such as segmentation (Bansal et al., 2017; Long et al., 2015), depth and surface normal estimation (Bansal et al., 2016; Eigen et al., 2013; Eigen & Fergus, 2015), semantic boundary detection (Bansal et al., 2017; Xie & Tu, 2015) etc. Such networks are usually trained using standard losses (such as softmax or $l _ { 2 }$ regression) on image-label data pairs. However, such networks do not typically perform well for the inverse problem of image synthesis from a (incomplete) label, though exceptions do exist (Chen & Koltun, 2017). A major innovation was the introduction of adversarially-trained generative networks (GANs) (Goodfellow et al., 2014). This formulation was hugely influential in computer visions, having been applied to various image generation tasks that condition on a low-resolution image (Denton et al., 2015; Ledig et al., 2016), segmentation mask (Isola et al., 2016), surface normal map (Wang & Gupta, 2016) and other inputs (Chen et al., 2016; Huang et al., 2016; Radford et al., 2015; Wu et al., 2016; Zhang et al., 2016a; Zhu et al., 2017). Most related to us is Isola et al. (2016) who proposed a general loss function for adversarial learning, applying it to a diverse set of image synthesis tasks. Importantly, they report the problem of mode collapse, and so cannot generate diverse outputs nor control the synthesis with user-defined constraints (unlike our work).
|
| 43 |
+
|
| 44 |
+
Interpretability and user-control: Interpreting and explaining the outputs of generative deep networks is an open problem. As a community, we do not have a clear understanding of what, where, and how outputs are generated. Our work is fundamentally based on copy-pasting information via nearest neighbors, which explicitly reveals how each pixel-level output is generated (by in turn revealing where it was copied from). This makes our synthesized outputs quite interpretable. One important consequence is the ability to intuitively edit and control the process of synthesis. Zhu et al. (2016) provide a user with controls for editing image such as color, and outline. But instead of using a predefined set of editing operations, we allow a user to have an arbitrarily-fine level of control through on-the-fly editing of the exemplar set (e.g., “resynthesize the output using the eye from this training image and the nose from that one”).
|
| 45 |
+
|
| 46 |
+
Correspondence: An important byproduct of pixelwise NN is the generation of pixelwise correspondences between the synthesized output and training examples. Establishing such pixel-level correspondence has been one of the core challenges in computer vision (Choy et al., 2016; Kanazawa et al., 2016; Liu et al., 2011; Long et al., 2014; Wei et al., 2015; Zhou et al., 2016a;b). Tappen & Liu (2012) used SIFT flow (Liu et al., 2011) to hallucinate details for image super-resolution. Zhou et al. (2016b) proposed a CNN to predict appearance flow that can be used to transfer information from input views to synthesize a new view. Kanazawa et al. (2016) generate 3D reconstructions by training a CNN to learn correspondence between object instances. Our work follows from the crucial observation of Long et al. (2014), who suggested that features from pre-trained convnets can also be used for pixel-level correspondences. In this work, we make an additional empirical observation: hypercolumn features trained for semantic segmentation learn nuances and details better than one trained for image classification. This finding helped us to establish semantic correspondences between the pixels in query and training images, and enabled us to extract high-frequency information from the training examples to synthesize a new image from a given input.
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 4: Frequency Analysis: We show the image and its corresponding Fourier spectrum. Note how the frequency spectrum improve as we move from left to right. The Fourier spectrum of our final output closely matches that of original high resolution image.
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 5: Global vs. Compositional: Given the low-resolution input images on the left, we show high-frequency output obtained with a global nearest neighbor versus a compositional reconstruction. We visualize the correspondences associated with the compositional reconstruction on the right. We surround the reconstruction with 8 neighboring training examples, and color code pixels to denote correspondences. For example, when reconstructing the female face, forehead pixels are copied from the top-left neighbor (orange) , while right-eye pixels are copied from the bottom-left neighbor (green).
|
| 53 |
+
|
| 54 |
+
Nonparametrics: Our work closely follows data-driven approaches that make use of nearest neighbors (Efros & Leung, 1999; Efros & Freeman, 2001; Freeman et al., 2000; 2002; Ren et al., 2005; Hays & Efros, 2007; Johnson et al., 2011; Shrivastava et al., 2011). Hays & Efros (2007) match a query image to 2 million training images for various tasks such as image completion. We make use of dramatically smaller training sets by allowing for compositional matches. Liu et al. (2007) propose a two-step pipeline for face hallucination where global constraints capture overall structure, and local constraints produce photorealistic local features. While they focus on the task of facial super-resolution, we address variety of synthesis applications.
|
| 55 |
+
|
| 56 |
+
Final, our compositional approach is inspired by Boiman & Irani (2006; 2007), who reconstruct a query image via compositions of training examples.
|
| 57 |
+
|
| 58 |
+
# 3 PIXELNN: ONE-TO-MANY MAPPINGS
|
| 59 |
+
|
| 60 |
+
We define the problem of conditional image synthesis as follows: given an input $x$ to be conditioned on (such as an edge map, normal depth map, or low-resolution image), synthesize a high-quality output image(s). To describe our approach, we focus on illustrative the task of image super-resolution,
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 6: Edges/Normals to RGB: Our approach used for faces, cats, and dogs to generate RGB maps for a given edge/normal map as input. One output was picked from the multiple generations.
|
| 64 |
+
|
| 65 |
+
where the input is a low-resolution image. We assume we are given training pairs of input/outputs, written as $( x _ { n } , y _ { n } )$ . The simplest approach would be formulating this task as a (nonlinear) regression problem:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\operatorname* { m i n } _ { \boldsymbol { w } } | | \boldsymbol { w } | | ^ { 2 } + \sum _ { n } | | \boldsymbol { y } _ { n } - \boldsymbol { f } ( \boldsymbol { x } _ { n } ; \boldsymbol { w } ) | | ^ { 2 }
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $f ( x _ { n } ; w )$ refers to the output of an arbitrary (possibly nonlinear) regressor parameterized with $w$ . In our formulation, we use a fully-convolutional neural net – specifically, PixelNet (Bansal et al., 2017) – as our nonlinear regressor. For our purposes, this regressor could be any trainable black-box mapping function. But crucially, such functions generate one-to-one mappings, while our underlying thesis is that conditional image synthesis should generate many mappings from an input. By treating synthesis as a regression problem, it is well-known that outputs tend to be oversmoothed (Johnson et al., 2016). In the context of the image colorization task (where the input is a grayscale image), such outputs tend to desaturated (Larsson et al., 2016; Zhang et al., 2016b).
|
| 72 |
+
|
| 73 |
+
Frequency analysis: Let us analyze this smoothing a bit further. Predicted outputs $f ( x )$ (we drop the dependance on $w$ to simplify notation) are particularly straightforward to analyze in the context of super-resolution (where the conditional input $x$ is a low-resolution image). Given a low-resolution image of a face, there may exist multiple textures (e.g., wrinkles) or subtle shape cues (e.g., of local features such as noses) that could be reasonably generated as output. In practice, this set of outputs tends to be “blurred” into a single output returned by a regressor. This can be readably seen in a frequency analysis of the input, output, and original target image (Fig. 4). In general, we see that the regressor generates mid-frequencies fairly well, but fails to return much high-frequency content. We make the operational assumption that a single output suffices for mid-frequency output, but multiple outputs are required to capture the space of possible high-frequency textures.
|
| 74 |
+
|
| 75 |
+
Global/Exemplar Matching: To capture multiple possible outputs, we appeal to a classic nonparametric approaches in computer vision. We note that a simple K-nearest-neighbor (KNN) algorithm has the trivial ability to report back $K$ outputs. However, rather than using a KNN model to return an entire image, we can use it to predict the (multiple possible) high-frequencies missing from $f ( x )$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
G l o b a l ( x ) = f ( x ) + \Bigl ( y _ { k } - f ( x _ { k } ) \Bigr ) \qquad \mathrm { w h e r e } \qquad k = \mathrm { a r g m i n D i s t } \Bigl ( f ( x ) , f ( x _ { n } ) \Bigr )
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $D i s t$ is some distance function measuring similarity between two (mid-frequency) reconstructions. To generate multiple outputs, one can report back the $K$ best matches from the training set instead of the overall best match.
|
| 82 |
+
|
| 83 |
+
Compositional Matching: However, the above is limited to report back high frequency images in the training set. As we previously argued, we can synthesize a much larger set of outputs by copying and pasting (high-frequency) patches from the training set. To allow for such compositional matchings, we simply match individual pixels rather than global images. Writing $f _ { i } ( x )$ for the $i ^ { t h }$ pixel in the reconstructed image, the final composed output can be written as:
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 7: Low-Resolution to High-Resolution: We used our approach for hallucinating $9 6 \times 9 6$ images from an input $1 2 \times 1 2$ low-resolution image. One output was picked from multiple generations.
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 8: Edges-to-Shoes: Our approach used to generate multiple outputs of shoes from the edges. We picked seven distinct examples from multiple generations.
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
{ \begin{array} { r } { C o m p _ { i } ( x ) = f _ { i } ( x ) + \left( y _ { j k } - f _ { j } ( x _ { k } ) \right) } \end{array} } \quad { \mathrm { w h e r e } } \quad ( j , k ) = \operatorname { a r g m i n } \operatorname { D i s t } \Bigl ( f _ { i } ( x ) , f _ { m } ( x _ { n } ) \Bigr )
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $y _ { j k }$ refers to the output pixel $j$ in training example $k$ .
|
| 96 |
+
|
| 97 |
+
Distance function & Pixel representation: A crucial question in non-parametric matching is the choice of distance function. To compare global images, contemporary approaches tend to learn a deep embedding where similarity is preserved (Bell & Bala, 2015; Chopra et al., 2005; Long et al., 2015). Distance functions for pixels are much more subtle (3). In theory, one could also learn a metric for pixel matching, but this requires large-scale training data with dense pixel-level correspondences.
|
| 98 |
+
|
| 99 |
+
Suppose we are trying to generate the left corner of an eye. If our distance function takes into account only local information around the corner, we might mistakenly match to the other eye or mouth. If our distance function takes into account only global information, then compositional matching reduces to global (exemplar) matching. Instead, we exploit the insight from previous works that different layers of a deep network tend to capture different amounts of spatial context (due to varying receptive fields) (Bansal et al., 2017; Hariharan et al., 2015; Raiko et al., 2012; Sermanet et al., 2013). Hypercolumn descriptors (Hariharan et al., 2015) aggregate such information across multiple layers into a highly accurate, multi-scale pixel representation (visualized in Fig. 3). We construct a pixel descriptor using features from conv- $\{ 1 _ { 2 } , 2 _ { 2 } , 3 _ { 3 } , 4 _ { 3 } , 5 _ { 3 } \}$ for a PixelNet model trained for semantic segmentation (on PASCAL Context (Mottaghi et al., 2014)).
|
| 100 |
+
|
| 101 |
+
To measure pixel similarity, we compute cosine distances between two descriptors. We visualize the compositional matches (and associated correspondences) in Figure 5. Finally, Figure 6, and Figure 7 shows the output of our approach for various input modalities.
|
| 102 |
+
|
| 103 |
+
Efficient search: We have so far avoided the question of run-time for our pixel-wise NN search. A naive approach would be to exhaustively search for every pixel in the dataset but that would make the computation vary linearly with the size of dataset. On the other hand, deep generative models outpace naive NN search, which is one of the reasons for their popularity over NN search.
|
| 104 |
+
|
| 105 |
+
To speed up search, we made some non-linear approximations: Given a reconstructed image $f ( x )$ , we first (1) find the global K-NN using conv-5 features and then (2) search for pixel-wise matches only in a $T \times T$ pixel window around pixel $i$ in this set of $K$ images. In practice, we vary $K$ from $\{ 1 , 2 , . . , 1 0 \}$ and $T$ from $\{ 1 , 3 , 5 , 1 0 , 9 6 \}$ and generate 72 candidate outputs for a given input. Because the size of synthesized image is $9 6 \times 9 6$ , our search parameters include both a fullycompositional output $( K = 1 0 , T = 9 6 )$ and a fully global exemplar match $\mathit { K } = 1 , T = 1 \rangle$ as candidate outputs. Our approximate neighbor neighbor search takes .2 fps. We did not optimize our approach for speed. Importantly, we make use of a single CPU to perform our nearest neighbor search, while Isola et al. (2016)makes use of a GPU. We posit that GPU-based nearest-neighbor libraries (e.g., FAISS) will allow for real-time performance comparable to Isola et al. (2016).
|
| 106 |
+
|
| 107 |
+

|
| 108 |
+
Figure 9: Edges-to-Bags: Our approach used to generate multiple outputs of bags from the edges. We picked seven distinct examples from multiple generations.
|
| 109 |
+
|
| 110 |
+

|
| 111 |
+
Figure 10: Multiple Outputs for Edges/Normals to RGB: Our approach used to generate multiple outputs of faces, cats, and dogs from the edges/normals. As an example, note how the subtle details such as eyes, stripes, and whiskers of cat (left) that could not be inferred from the edge map are different in multiple generations.
|
| 112 |
+
|
| 113 |
+
Figure 8, Figure 9, and Figure 10 show examples of multiple outputs generated using our approach by simply varying these parameters.
|
| 114 |
+
|
| 115 |
+
# 4 EXPERIMENTS
|
| 116 |
+
|
| 117 |
+
We now present our findings for multiple modalities such as a low-resolution image $1 2 \times 1 2$ image), a surface normal map, and edges/boundaries for domains such as human faces, cats, dogs, handbags, and shoes. We compare our approach both quantitatively and qualitatively with the recent work of Isola et al. (2016) that use generative adversarial networks for pixel-to-pixel translation.
|
| 118 |
+
|
| 119 |
+
Dataset: We conduct experiments for human faces, cats and dogs, shoes, and handbags using various modalities.
|
| 120 |
+
|
| 121 |
+
Human Faces We use 100, 000 images from the training set of CUHK CelebA dataset (Liu et al., 2015) to train a regression model and do NN. We used the subset of test images to evaluate our approach. The images were resized to $9 6 \times 9 6$ following Gucluturk et al. (2016).
|
| 122 |
+
|
| 123 |
+
Cats and Dogs: We use 3, 686 images of cats and dogs from the Oxford-IIIT Pet dataset (Parkhi et al., 2012). Of these 3, 000 images were used for training, and remaining 686 for evaluation. We used the bounding box annotation made available by Parkhi et al. (2012) to extract head of the cats and dogs.
|
| 124 |
+
|
| 125 |
+
<table><tr><td>Normals-to-RGB</td><td></td><td></td><td>Mean Median RMSE 11.25</td><td></td><td>22.5°</td><td>30°</td><td>AP</td></tr><tr><td>Human Faces</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Pix-to-Pix</td><td>17.2</td><td>14.3</td><td>21.0</td><td>37.2</td><td>74.7</td><td>86.8</td><td>0.34</td></tr><tr><td>Pix-to-Pix (Oracle)</td><td>15.8</td><td>13.1</td><td>19.4</td><td>41.9</td><td>78.5</td><td>89.3</td><td>0.34</td></tr><tr><td>PixelNN (Rand-1)</td><td>12.8</td><td>10.4</td><td>16.0</td><td>54.2</td><td>86.6</td><td>94.1</td><td>0.38</td></tr><tr><td>PixelNN (Oracle)</td><td>10.8</td><td>8.7</td><td>13.5</td><td>63.7</td><td>91.6</td><td>96.7</td><td>0.42</td></tr><tr><td>Cats and Dogs</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Pix-to-Pix</td><td>14.7</td><td>12.8</td><td>17.5</td><td>42.6</td><td>82.5</td><td>92.9</td><td>0.82</td></tr><tr><td>Pix-to-Pix (Oracle)</td><td>13.2</td><td>11.4</td><td>15.7</td><td>49.2</td><td>87.1</td><td>95.3</td><td>0.85</td></tr><tr><td>PixelNN (Rand-1)</td><td>16.6</td><td>14.3</td><td>19.8</td><td>36.8</td><td>76.2</td><td>88.8</td><td>0.80</td></tr><tr><td>PixelNN (Oracle)</td><td>13.8</td><td>11.9</td><td>16.6</td><td>46.9</td><td>84.9</td><td>94.1</td><td>0.92</td></tr></table>
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Edges-to-RGB</td><td>AP</td><td></td><td>|Mean Median RMSE 11.25°</td><td></td><td></td><td>22.50</td><td>300</td></tr><tr><td>Human Faces</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Pix-to-Pix</td><td>0.35</td><td>12.1</td><td>9.6</td><td>15.5</td><td>58.1</td><td>88.1</td><td>94.7</td></tr><tr><td>Pix-to-Pix(Oracle)</td><td>0.35</td><td>11.5</td><td>9.1</td><td>14.6</td><td>61.1</td><td>89.7</td><td>95.6</td></tr><tr><td>PixelNN (Rand-1)</td><td>0.38</td><td>13.3</td><td>10.6</td><td>16.8</td><td>52.9</td><td>85.0</td><td>92.9</td></tr><tr><td>PixelNN (Oracle)</td><td>0.41</td><td>11.3</td><td>9.0</td><td>14.4</td><td>61.6</td><td>90.0</td><td>95.7</td></tr><tr><td>Cats and Dogs</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Pix-to-Pix</td><td>0.78</td><td>18.2</td><td>16.0</td><td>21.8</td><td>32.4</td><td>71.0</td><td>85.1</td></tr><tr><td>Pix-to-Pix(Oracle) 0.81</td><td></td><td>16.5</td><td>14.2</td><td>19.8</td><td>37.2</td><td>76.4</td><td>89.0</td></tr><tr><td>PixelNN (Rand-1)</td><td>0.77</td><td>18.9</td><td>16.4</td><td>22.5</td><td>30.3</td><td>68.9</td><td>83.5</td></tr><tr><td>PixelNN (Oracle)</td><td>0.89</td><td>16.3</td><td>14.1</td><td>19.6</td><td>37.6</td><td>77.0</td><td>89.4</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 1: We compared our approach, PixelNN, with the GAN-based formulation of Isola et al. (2016) for human faces, and cats and dogs. We used an off-the-shelf PixelNet model trained for surface normal estimation and edge detection. We use the output from real images as ground truth surface normal and edge map respectively.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 11: Comparison of our approach with Pix-to-Pix (Isola et al., 2016).
|
| 133 |
+
|
| 134 |
+
For human faces, and cats and dogs, we used the pre-trained PixelNet (Bansal et al., 2017) to extract surface normal and edge maps. We did not do any post-processing (NMS) to the outputs of edge detection.
|
| 135 |
+
|
| 136 |
+
Shoes & Handbags: We followed Isola et al. (2016) for this setting. 50, 000 training images of shoes were used from (Yu & Grauman, 2014), and 137, 000 images of Amazon handbags from (Zhu et al., 2016). The edge maps for this data was computed using HED (Xie & Tu, 2015) by Isola et al. (2016).
|
| 137 |
+
|
| 138 |
+
Qualitative Evaluation: Figure 11 shows the comparison of our NN based approach (PixelNN) with Isola et al. (2016) (Pix-to-Pix).
|
| 139 |
+
|
| 140 |
+
Quantitative Evaluation: We quantitatively evaluate our approach to measure if our generated outputs for human faces, cats and dogs can be used to determine surface normal and edges from an off-the-shelf trained PixelNet (Bansal et al., 2017) model for surface normal estimation and edge detection. The outputs from the real images are considered as ground truth for evaluation as it gives an indication of how far are we from them. Somewhat similar approach is used by Isola et al. (2016) to measure their synthesized cityscape outputs and compare against the output using real world images, and Wang & Gupta (2016) for object detection evaluation.
|
| 141 |
+
|
| 142 |
+
We compute six statistics, previously used by (Bansal et al., 2016; Eigen & Fergus, 2015; Fouhey et al., 2013; Wang et al., 2015), over the angular error between the normals from a synthesized image and normals from real image to evaluate the performance – Mean, Median, RMSE, ${ \bf 1 1 . 2 5 ^ { \circ } }$ , $2 2 . 5 ^ { \circ }$ , and $3 0 ^ { \circ }$ – The first three criteria capture the mean, median, and RMSE of angular error, where lower is better. The last three criteria capture the percentage of pixels within a given angular error, where higher is better. We evaluate the edge detection performance using average precision (AP).
|
| 143 |
+
|
| 144 |
+
Table 1 quantitatively shows the performance of our approach with (Isola et al., 2016). Our approach generates multiple outputs and we do not have any direct way of ranking the outputs, therefore we show the performance using a random selection from one of 72 outputs, and an oracle selecting the best output. To do a fair comparison, we ran trained models for Pix-to-Pix (Isola et al., 2016) 72 times and used an oracle for selecting the best output as well. We observe that our approach generates better multiple outputs as performance improves significantly from a random selection to oracle as compared with Isola et al. (2016). Our approach, though based on simple NN, achieves result quantitatively and qualitatively competitive (and many times better than) with state-of-the-art models based on GANs and produce outputs close to natural images.
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 12: Controllable synthesis: We generate the output of cats given a user input from a edge map. From the edge map, we do not know what type of cat it is. A user can suggest what kind of the output they would like, and our approach can copy-paste the information.
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 13: Failure Cases: We show some failure cases for different input types. Our approach mostly fails when it is not able to find suitable nearest neighbors.
|
| 151 |
+
|
| 152 |
+
Controllable synthesis: Finally, NN provides a user with intuitive control over the synthesis process. We explore a simple approach based on on-the-fly pruning of the training set. Instead of matching to the entire training library, a user can specify a subset of relevant training examples. Figure 12 shows an example of controllable synthesis. A user “instructs” the system to generate an image that looks like a particular dog-breed by either denoting the subset of training examplars (e.g., through a subcategory label), or providing an image that can be used to construct an on-the-fly neighbor set.
|
| 153 |
+
|
| 154 |
+
Failure cases: Our approach mostly fails when there are no suitable NNs to extract the information from. Figure 13 shows some example failure cases of our approach. One way to deal with this problem is to do exhaustive pixel-wise NN search but that would increase the run-time to generate the output. We believe that system-level optimization such as Scanner1, may potentially be useful in improving the run-time performance for pixel-wise NNs.
|
| 155 |
+
|
| 156 |
+
# 5 DISCUSSION
|
| 157 |
+
|
| 158 |
+
We present a simple approach to image synthesis based on compositional nearest-neighbors. Our approach somewhat suggests that GANs themselves may operate in a compositional “copy-andpaste” fashion. Indeed, examining the impressive outputs of recent synthesis methods suggests that some amount of local memorization is happening. However, by making this process explicit, our system is able to naturally generate multiple outputs, while being interpretable and amenable to user constraints. An interesting byproduct of our approach is dense pixel-level correspondences. If training images are augmented with semantic label masks, these labels can be transfered using our correspondences, implying that our approach may also be useful for image analysis through label transfer (Liu et al., 2011).
|
| 159 |
+
|
| 160 |
+
# REFERENCES
|
| 161 |
+
|
| 162 |
+
Aayush Bansal, Bryan Russell, and Abhinav Gupta. Marr Revisited: 2D-3D model alignment via surface normal prediction. In CVPR, 2016.
|
| 163 |
+
|
| 164 |
+
Aayush Bansal, Xinlei Chen, Bryan Russell, Abhinav Gupta, and Deva Ramanan. Pixelnet: Representation of the pixels, by the pixels, and for the pixels. arXiv:1702.06506, 2017.
|
| 165 |
+
|
| 166 |
+
Sean Bell and Kavita Bala. Learning visual similarity for product design with convolutional neural networks. ACM Transactions on Graphics, 2015.
|
| 167 |
+
|
| 168 |
+
Oren Boiman and Michal Irani. Similarity by composition. In NIPS, 2006.
|
| 169 |
+
|
| 170 |
+
Oren Boiman and Michal Irani. Detecting irregularities in images and in video. IJCV, 2007.
|
| 171 |
+
|
| 172 |
+
Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. arXiv preprint arXiv:1707.09405, 2017.
|
| 173 |
+
|
| 174 |
+
Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. CoRR, abs/1606.03657, 2016.
|
| 175 |
+
|
| 176 |
+
Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In CVPR, 2005.
|
| 177 |
+
|
| 178 |
+
Christopher B Choy, JunYoung Gwak, Silvio Savarese, and Manmohan Chandraker. Universal correspondence network. In NIPS, 2016.
|
| 179 |
+
|
| 180 |
+
Emily L. Denton, Soumith Chintala, Arthur Szlam, and Robert Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. CoRR, abs/1506.05751, 2015.
|
| 181 |
+
|
| 182 |
+
Alexei A. Efros and William T. Freeman. Image quilting for texture synthesis and transfer. In Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH $\cdot _ { 0 1 }$ . ACM, 2001.
|
| 183 |
+
|
| 184 |
+
Alexei A. Efros and Thomas K. Leung. Texture synthesis by non-parametric sampling. In ICCV, 1999.
|
| 185 |
+
|
| 186 |
+
David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In ICCV, 2015.
|
| 187 |
+
|
| 188 |
+
David Eigen, Dilip Krishnan, and Rob Fergus. Restoring an image taken through a window covered with dirt or rain. In ICCV, 2013.
|
| 189 |
+
|
| 190 |
+
David F. Fouhey, Abhinav Gupta, and Martial Hebert. Data-driven 3D primitives for single image understanding. In ICCV, 2013.
|
| 191 |
+
|
| 192 |
+
William T. Freeman, Egon C. Pasztor, and Owen T. Carmichael. Learning low-level vision. Int. J. Comput. Vision, 40(1):25–47, October 2000. ISSN 0920-5691.
|
| 193 |
+
|
| 194 |
+
William T. Freeman, Thouis R. Jones, and Egon C Pasztor. Example-based super-resolution. IEEE Comput. Graph. Appl., 22(2):56–65, March 2002. ISSN 0272-1716. doi: 10.1109/38.988747. URL http://dx. doi.org/10.1109/38.988747.
|
| 195 |
+
|
| 196 |
+
Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial networks. CoRR, abs/1406.2661, 2014.
|
| 197 |
+
|
| 198 |
+
Yagmur Gucluturk, Umut Guclu, Rob van Lier, and Marcel A. J. van Gerven. Convolutional sketch inversion. In ECCV, 2016.
|
| 199 |
+
|
| 200 |
+
Bharath Hariharan, Pablo Arbelaez, Ross Girshick, and Jitendra Malik. Hypercolumns for object segmentation ´ and fine-grained localization. In CVPR, 2015.
|
| 201 |
+
|
| 202 |
+
James Hays and Alexei A Efros. Scene completion using millions of photographs. ACM Transactions on Graphics, 2007.
|
| 203 |
+
|
| 204 |
+
Aaron Hertzmann, Charles E. Jacobs, Nuria Oliver, Brian Curless, and David H. Salesin. Image analogies. In Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques. ACM, 2001.
|
| 205 |
+
|
| 206 |
+
Xun Huang, Yixuan Li, Omid Poursaeed, John E. Hopcroft, and Serge J. Belongie. Stacked generative adversarial networks. CoRR, abs/1612.04357, 2016.
|
| 207 |
+
|
| 208 |
+
Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arxiv, 2016.
|
| 209 |
+
Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and superresolution. In ECCV, 2016.
|
| 210 |
+
Micah K. Johnson, Kevin Dale, Shai Avidan, Hanspeter Pfister, William T. Freeman, and Wojciech Matusik. Cg2real: Improving the realism of computer generated images using a large collection of photographs. IEEE Transactions on Visualization and Computer Graphics, 2011.
|
| 211 |
+
Angjoo Kanazawa, David W. Jacobs, and Manmohan Chandraker. Warpnet: Weakly supervised matching for single-view reconstruction. CoRR, abs/1604.05592, 2016.
|
| 212 |
+
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Learning representations for automatic colorization. In ECCV, 2016.
|
| 213 |
+
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew P. Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image super-resolution using a generative adversarial network. CoRR, abs/1609.04802, 2016.
|
| 214 |
+
Ce Liu, Heung-Yeung Shum, and William T. Freeman. Face hallucination: Theory and practice. IJCV, 2007.
|
| 215 |
+
Ce Liu, Jenny Yuen, and Antonio Torralba. Sift flow: Dense correspondence across scenes and its applications. IEEE Trans. Pattern Anal. Mach. Intell., 2011.
|
| 216 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In ICCV, 2015.
|
| 217 |
+
Jonathan Long, Ning Zhang, and Trevor Darrell. Do convnets learn correspondence? In NIPS, 2014.
|
| 218 |
+
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional models for semantic segmentation. In CVPR, 2015.
|
| 219 |
+
Roozbeh Mottaghi, Xianjie Chen, Xiaobai Liu, Nam-Gyu Cho, Seong-Whan Lee, Sanja Fidler, Raquel Urtasun, and Alan Yuille. The role of context for object detection and semantic segmentation in the wild. In CVPR, 2014.
|
| 220 |
+
O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. V. Jawahar. Cats and dogs. In CVPR, 2012.
|
| 221 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015.
|
| 222 |
+
Tapani Raiko, Harri Valpola, and Yann LeCun. Deep learning made easier by linear transformations in perceptrons. In AISTATS, volume 22, pp. 924–932, 2012.
|
| 223 |
+
Liu Ren, Alton Patrick, Alexei A. Efros, Jessica K. Hodgins, and James M. Rehg. A data-driven approach to quantifying natural human motion. ACM Trans. Graph., 2005.
|
| 224 |
+
Pierre Sermanet, Koray Kavukcuoglu, Soumith Chintala, and Yann LeCun. Pedestrian detection with unsupervised multi-stage feature learning. In CVPR, 2013.
|
| 225 |
+
Abhinav Shrivastava, Tomasz Malisiewicz, Abhinav Gupta, and Alexei A. Efros. Data-driven visual similarity for cross-domain image matching. ACM Transaction of Graphics (TOG), 2011.
|
| 226 |
+
Marshall F. Tappen and Ce Liu. A bayesian approach to alignment-based image hallucination. In ECCV, 2012.
|
| 227 |
+
Xiaolong Wang and Abhinav Gupta. Generative image modeling using style and structure adversarial networks. In ECCV, 2016.
|
| 228 |
+
Xiaolong Wang, David Fouhey, and Abhinav Gupta. Designing deep networks for surface normal estimation. In CVPR, 2015.
|
| 229 |
+
Lingyu Wei, Qixing Huang, Duygu Ceylan, Etienne Vouga, and Hao Li. Dense human body correspondences using convolutional networks. CoRR, abs/1511.05904, 2015.
|
| 230 |
+
Jiajun Wu, Chengkai Zhang, Tianfan Xue, William T Freeman, and Joshua B Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. In NIPS, 2016.
|
| 231 |
+
Saining Xie and Zhuowen Tu. Holistically-nested edge detection. In ICCV, 2015.
|
| 232 |
+
A. Yu and K. Grauman. Fine-Grained Visual Comparisons with Local Learning. In CVPR, 2014.
|
| 233 |
+
Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris N. Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. CoRR, abs/1612.03242, 2016a.
|
| 234 |
+
Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. ECCV, 2016b.
|
| 235 |
+
Tinghui Zhou, Philipp Krahenb ¨ uhl, Mathieu Aubry, Qixing Huang, and Alexei A. Efros. Learning dense ¨ correspondence via 3d-guided cycle consistency. In CVPR, 2016a.
|
| 236 |
+
Tinghui Zhou, Shubham Tulsiani, Weilun Sun, Jitendra Malik, and Alexei A Efros. View synthesis by appearance flow. In ECCV, 2016b.
|
| 237 |
+
Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A. Efros. Generative visual manipulation on the ¨ natural image manifold. In ECCV, 2016.
|
| 238 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. CoRR, abs/1703.10593, 2017.
|
md/train/SyxAb30cY7/SyxAb30cY7.md
ADDED
|
@@ -0,0 +1,529 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ROBUSTNESS MAY BE AT ODDS WITH ACCURACY
|
| 2 |
+
|
| 3 |
+
Dimitris Tsipras∗, Shibani Santurkar∗, Logan Engstrom∗, Alexander Turner, Aleksander M ˛adry
|
| 4 |
+
Massachusetts Institute of Technology
|
| 5 |
+
{tsipras,shibani,engstrom,turneram,madry}@mit.edu
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We show that there exists an inherent tension between the goal of adversarial robustness and that of standard generalization. Specifically, training robust models may not only be more resource-consuming, but also lead to a reduction of standard accuracy. We demonstrate that this trade-off between the standard accuracy of a model and its robustness to adversarial perturbations provably exists even in a fairly simple and natural setting. These findings also corroborate a similar phenomenon observed in practice. Further, we argue that this phenomenon is a consequence of robust classifiers learning fundamentally different feature representations than standard classifiers. These differences, in particular, seem to result in unexpected benefits: the features learned by robust models tend to align better with salient data characteristics and human perception.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Deep learning models have achieved impressive performance on a number of challenging benchmarks in computer vision, speech recognition and competitive game playing (Krizhevsky et al., 2012; Graves et al., 2013; Mnih et al., 2015; Silver et al., 2016; He et al., 2015a). However, it turns out that these models are actually quite brittle. In particular, one can often synthesize small, imperceptible perturbations of the input data and cause the model to make highly-confident but erroneous predictions (Dalvi et al., 2004; Biggio & Roli, 2017; Szegedy et al., 2013).
|
| 14 |
+
|
| 15 |
+
This problem of so-called adversarial examples has garnered significant attention recently and resulted in a number of approaches both to finding these perturbations, and to training models that are robust to them (Goodfellow et al., 2014b; Nguyen et al., 2015; Moosavi-Dezfooli et al., 2016; Carlini & Wagner, 2016; Sharif et al., 2016; Kurakin et al., 2016a; Evtimov et al., 2017; Athalye et al., 2017). However, building such adversarially robust models has proved to be quite challenging. In particular, many of the proposed robust training methods were subsequently shown to be ineffective (Carlini & Wagner, 2017; Athalye et al., 2018; Uesato et al., 2018). Only recently, has there been progress towards models that achieve robustness that can be demonstrated empirically and, in some cases, even formally verified (Madry et al., 2017; Kolter & Wong, 2017; Sinha et al., 2017; Tjeng & Tedrake, 2017; Raghunathan et al., 2018; Dvijotham et al., 2018a; Xiao et al., 2018b).
|
| 16 |
+
|
| 17 |
+
The vulnerability of models trained using standard methods to adversarial perturbations makes it clear that the paradigm of adversarially robust learning is different from the classic learning setting. In particular, we already know that robustness comes at a cost. This cost takes the form of computationally expensive training methods (more training time), but also, as shown recently in Schmidt et al. (2018), the potential need for more training data. It is natural then to wonder: Are these the only costs of adversarial robustness? And, if so, once we choose to pay these costs, would it always be preferable to have a robust model instead of a standard one? The goal of this work is to explore these questions and thus, in turn, to bring us closer to understanding the phenomenon of adversarial robustness.
|
| 18 |
+
|
| 19 |
+
Our contributions It might be natural to expect that training models to be adversarially robust, albeit more resource-consuming, can only improve performance in the standard classification setting. In this work, we show, however, that the picture here is much more nuanced: these two goals might be fundamentally at odds. Specifically, even though applying adversarial training, the leading method for training robust models, can be beneficial in some regimes of training data size, in general, there is a trade-off between the standard accuracy and adversarially robust accuracy of a model. In fact, we show that this trade-off provably exists even in a fairly simple and natural setting.
|
| 20 |
+
|
| 21 |
+
At the root of this trade-off is the fact that features learned by the optimal standard and optimal robust classifiers are fundamentally different and, interestingly, this phenomenon persists even in the limit of infinite data. This thus also goes against the natural expectation that given sufficient data, classic machine learning tools would be sufficient to learn robust models and emphasizes the need for techniques specifically tailored to training robust models.
|
| 22 |
+
|
| 23 |
+
Our exploration also uncovers certain unexpected benefit of adversarially robust models. In particular, adversarially robust learning tends to equip the resulting models with invariances that we would expect to be also present in human vision. This, in turn, leads to features that align better with human perception, and could also pave the way towards building models that are easier to understand. Consequently, the feature embeddings learnt by robust models yield also clean inter-class interpolations, similar to those found by generative adversarial networks (GANs) (Goodfellow et al., 2014b) and other generative models. This hints at the existence of a stronger connection between GANs and adversarial robustness.
|
| 24 |
+
|
| 25 |
+
# 2 ON THE PRICE OF ADVERSARIAL ROBUSTNESS
|
| 26 |
+
|
| 27 |
+
Recall that in the canonical classification setting, the primary focus is on maximizing standard accuracy, i.e. the performance on (yet) unseen samples from the underlying distribution. Specifically, the goal is to train models that have low expected loss (also known as population risk):
|
| 28 |
+
|
| 29 |
+
$$
|
| 30 |
+
\underset { ( x , y ) \sim \mathcal { D } } { \mathbb { E } } [ \mathcal { L } ( x , y ; \theta ) ] .
|
| 31 |
+
$$
|
| 32 |
+
|
| 33 |
+
Adversarial robustness The existence of adversarial examples largely changed this picture. In particular, there has been a lot of interest in developing models that are resistant to them, or, in other words, models that are adversarially robust. In this context, the goal is to train models that have low expected adversarial loss:
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
\underset { ( x , y ) \sim \mathcal { D } } { \mathbb { E } } \left[ \underset { \delta \in \Delta } { \operatorname* { m a x } } \mathcal { L } ( x + \delta , y ; \theta ) \right] .
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
Here, $\Delta$ represents the set of perturbations that the adversary can apply to induce misclassification. In this work, we focus on the case when $\Delta$ is the set of $\ell _ { p }$ -bounded perturbations, i.e. $\Delta = \{ \delta \in$ $\mathbb { R } ^ { d } \mid \| \delta \| _ { p } \leq \varepsilon \}$ . This choice is the most common one in the context of adversarial examples and serves as a standard benchmark. It is worth noting though that several other notions of adversarial perturbations have been studied. These include rotations and translations (Fawzi & Frossard, 2015; Engstrom et al., 2017), and smooth spatial deformations (Xiao et al., 2018a). In general, determining the “right” $\Delta$ to use is a domain specific question.
|
| 40 |
+
|
| 41 |
+
Adversarial training The most successful approach to building adversarially robust models so far (Madry et al., 2017; Kolter & Wong, 2017; Sinha et al., 2017; Raghunathan et al., 2018) was socalled adversarial training (Goodfellow et al., 2014b). Adversarial training is motivated by viewing (2) as a statistical learning question, for which we need to solve the corresponding (adversarial) empirical risk minimization problem:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { \mathbb { E } } _ { ( x , y ) \sim \widehat { \mathcal { D } } } \left[ \operatorname* { m a x } _ { \delta \in S } \mathcal { L } ( x + \delta , y ; \theta ) \right] .
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
The resulting saddle point problem can be hard to solve in general. However, it turns out to be often tractable in practice, at least in the context of $\ell _ { p }$ -bounded perturbations (Madry et al., 2017). Specifically, adversarial training corresponds to a natural robust optimization approach to solving this problem (Ben-Tal et al., 2009). In this approach, we repeatedly find the worst-case input perturbations $\delta$ (solving the inner maximization problem), and then update the model parameters to reduce the loss on these perturbed inputs.
|
| 48 |
+
|
| 49 |
+
Though adversarial training is effective, this success comes with certain drawbacks. The most obvious one is an increase in the training time (we need to compute new perturbations each parameter update step). Another one is the potential need for more training data as shown recently in (Schmidt et al., 2018). These costs make training more demanding, but is that the whole price of being adversarially robust? In particular, if we are willing to pay these costs: Are robust classifiers better than standard ones in every other aspect? This is the key question that motivates our work.
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 1: Comparison of the standard accuracy of models trained against an $\ell _ { 2 }$ -bounded adversary as a function of size of the training dataset. We observe that when training with few samples, adversarial training has a positive effect on model generalization (especially on MNIST). However, as training data increase, the standard accuracy of robust models drops below that of the standard model $( \varepsilon _ { t r a i n } = 0 )$ ). Similar results for $\ell _ { \infty }$ trained networks are shown in Figure 6 of Appendix G.
|
| 53 |
+
|
| 54 |
+
Adversarial Training as a Form of Data Augmentation Our point of start is a popular view of adversarial training as the “ultimate” form of data augmentation. According to this view, the adversarial perturbation set $\Delta$ is seen as the set of invariants that a good model should satisfy (regardless of the adversarial robustness considerations). Thus, finding the worst-case $\delta$ corresponds to augmenting the training data in the “most confusing” and thus also “most helpful” manner. A key implication of this view is that adversarial training should be beneficial for the standard accuracy of a model (Torkamani & Lowd, 2013; 2014; Goodfellow et al., 2014b; Miyato et al., 2018).
|
| 55 |
+
|
| 56 |
+
Indeed, in Figure 1, we see this effect, when classifiers are trained with relatively few samples (particularly on MNIST). In this setting, the amount of training data available is insufficient to learn a good standard classifier and the set of adversarial perturbations used is “compatible” with the learning task. (That is, good standard models for this task need to be also somewhat invariant to these perturbations.) In such regime, robust training does indeed act as data augmentation, regularizing the model and leading to a better solution (from standard accuracy point of view). (Note that this effect seems less pronounced for CIFAR-10, possibly because $\ell _ { p }$ -invariance is not as important for a good standard CIFAR-10 classifier.)
|
| 57 |
+
|
| 58 |
+
Surprisingly however, in Figure 6 we see that as we include more samples in the training set, this positive effect becomes less significant. In fact, after some point adversarial training actually decreases the standard accuracy. In Figure 7 in Appendix G we study the behaviour of models trained using adversarial training with different $\ell _ { p }$ -bounded adversaries. We observe a steady decline in standard accuracy as the strength of the adversary increases. (Note that this still holds if we train on batches that also contain natural examples, as in Kurakin et al. (2016a). See Appendix B.) Similar effects were also observed in prior work (Kurakin et al., 2016b; Madry et al., 2017; Dvijotham et al., 2018b; Wong et al., 2018; Xiao et al., 2018b; Su et al., 2018; Babbar & Schölkopf, 2018).
|
| 59 |
+
|
| 60 |
+
The goal of this work is to illustrate and explain the roots of this phenomenon. In particular, we would like to understand:
|
| 61 |
+
|
| 62 |
+
# Why does there seem to be a trade-off between standard and adversarially robust accuracy?
|
| 63 |
+
|
| 64 |
+
As we will show, this effect is not an artifact of our adversarial training methods but in fact is inevitable consequence of different goals of adversarial robustness and standard generalization.
|
| 65 |
+
|
| 66 |
+
As we discussed above, we often observe that employing adversarial training leads to a decrease in a model’s standard accuracy. In what follows, we show that this phenomenon is a manifestation of an inherent tension between standard accuracy and adversarially robust accuracy. In particular, we present a theoretical model that demonstrates it. In fact, this phenomenon can be illustrated in a fairly simple setting which suggests that it is quite prevalent.
|
| 67 |
+
|
| 68 |
+
Our binary classification task Our data model consists of input-label pairs $( x , y )$ sampled from a distribution $\mathcal { D }$ as follows:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
y \overset { u . a . r } { \sim } \{ - 1 , + 1 \} , \qquad x _ { 1 } = \left\{ \begin{array} { l l } { { + y , } } & { { \mathrm { w . p . ~ } p } } \\ { { - y , } } & { { \mathrm { w . p . ~ } 1 - p } } \end{array} , \right. \qquad x _ { 2 } , \ldots , x _ { d + 1 } \overset { i . i . d } { \sim } \mathcal { N } ( \eta y , 1 ) ,
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where ${ \mathcal { N } } ( \mu , \sigma ^ { 2 } )$ is a normal distribution with mean $\mu$ and variance $\sigma ^ { 2 }$ , and $p \geq 0 . 5$ . We chose $\eta$ to be large enough so that a simple classifier attains high standard accuracy $( > 9 9 \% )$ ) – e.g. $\eta = \Theta ( 1 / \sqrt { d } )$ will suffice. The parameter $p$ quantifies how correlated the feature $x _ { 1 }$ is with the label. For the sake of example, we can think of $p$ as being 0.95. This choice is fairly arbitrary; the trade-off between standard and robust accuracy will be qualitatively similar for any $p < 1$ .
|
| 75 |
+
|
| 76 |
+
Standard classification is easy Note that samples from $\mathcal { D }$ consist of a single feature that is moderately correlated with the label and $d$ other features that are only very weakly correlated with it. Despite the fact that each one of the latter type of features individually is hardly predictive of the correct label, this distribution turns out to be fairly simple to classify from a standard accuracy perspective. Specifically, a natural (linear) classifier
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
f _ { \mathrm { a v g } } ( x ) : = \mathrm { s i g n } ( w _ { \mathrm { u n i f } } ^ { \top } x ) , \quad \mathrm { ~ w h e r e ~ } w _ { \mathrm { u n i f } } : = \left[ 0 , \frac { 1 } { d } , \ldots , \frac { 1 } { d } \right] ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
achieves standard accuracy arbitrarily close to $1 0 0 \%$ , for $d$ large enough. Indeed, observe that
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\operatorname* { P r } [ f _ { \mathrm { a v g } } ( x ) = y ] = \operatorname* { P r } [ \mathrm { s i g n } ( w _ { \mathrm { u n i f } } x ) = y ] = \operatorname* { P r } \left[ { \frac { y } { d } } \sum _ { i = 1 } ^ { d } { \mathcal { N } } ( \eta y , 1 ) > 0 \right] = \operatorname* { P r } \left[ { \mathcal { N } } \left( \eta , { \frac { 1 } { d } } \right) > 0 \right] ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
which is $> 9 9 \%$ when $\eta \geq 3 / \sqrt { d }$ .
|
| 89 |
+
|
| 90 |
+
Adversarially robust classification Note that in our discussion so far, we effectively viewed the average of $x _ { 2 } , \ldots , x _ { d + 1 }$ as a single “meta-feature” that is highly correlated with the correct label. For a standard classifier, any feature that is even slightly correlated with the label is useful. As a result, a standard classifier will take advantage (and thus rely on) the weakly correlated features $x _ { 2 } , \ldots , x _ { d + 1 }$ (by implicitly pooling information) to achieve almost perfect standard accuracy.
|
| 91 |
+
|
| 92 |
+
However, this analogy breaks completely in the adversarial setting. In particular, an $\ell _ { \infty }$ -bounded adversary that is only allowed to perturb each feature by a moderate $\varepsilon$ can effectively override the effect of the aforementioned meta-feature. For instance, if $\varepsilon = 2 \eta$ , an adversary can shift each weaklycorrelated feature towards $- y$ . The classifier would now see a perturbed input $x ^ { \prime }$ such that each of the features $x _ { 2 } ^ { \prime } , \ldots , x _ { d + 1 } ^ { \prime }$ are sampled i.i.d. from $\mathcal { N } ( - \eta y , 1 )$ (i.e., now becoming anti-correlated with the correct label). Thus, when $\varepsilon \geq 2 \eta$ , the adversary can essentially simulate the distribution of the weakly-correlated features as if belonging to the wrong class.
|
| 93 |
+
|
| 94 |
+
Formally, the probability of the meta-feature correctly predicting $y$ in this setting (4) is
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\operatorname* { m i n } _ { \lVert \delta \rVert _ { \infty } \leq \varepsilon } \operatorname* { P r } [ \mathrm { s i g n } ( x + \delta ) = y ] = \operatorname* { P r } \left[ \mathcal { N } ( \eta , 1 ) - \varepsilon > 0 \right] = \operatorname* { P r } \left[ \mathcal { N } \left( - \eta , 1 \right) > 0 \right] .
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
As a result, the simple classifier in (4) that relies solely on these features cannot get adversarial accuracy better than $\mathrm { \bar { 1 \% } }$ .
|
| 101 |
+
|
| 102 |
+
Intriguingly, this discussion draws a distinction between robust features $( x _ { 1 } )$ and non-robust features $( x _ { 2 } , \ldots , x _ { d + 1 } )$ that arises in the adversarial setting. While the meta-feature is far more predictive of the true label, it is extremely unreliable in the presence of an adversary. Hence, a tension between standard and adversarial accuracy arises. Any classifier that aims for high accuracy (say $> 9 9 \%$ ) will have to heavily rely on non-robust features (the robust feature provides only, say, $9 5 \%$ accuracy). However, since the non-robust features can be arbitrarily manipulated, this classifier will inevitably have low adversarial accuracy. We make this formal in the following theorem proved in Appendix C.
|
| 103 |
+
|
| 104 |
+
Theorem 2.1 (Robustness-accuracy trade-off). Any classifier that attains at least $1 - \delta$ standard accuracy on $\mathcal { D }$ has robust accuracy at most $\textstyle { \frac { p } { 1 - p } } \delta$ against an $\ell _ { \infty }$ -bounded adversary with $\varepsilon \geq 2 \eta$ .
|
| 105 |
+
|
| 106 |
+
This bound implies that if $p < 1$ , as standard accuracy approaches $1 0 0 \%$ $\delta 0 ,$ ), adversarial accuracy falls to $0 \%$ . As a concrete example, consider $p = 0 . 9 5$ , then any classifier with standard accuracy more than $1 - \delta$ will have robust accuracy at most $1 9 \delta ^ { 1 }$ . Also it is worth noting that the theorem is tight. If $\delta = 1 - p$ , both the standard and adversarial accuracies are bounded by $p$ which is attained by the classifier that relies solely on the first feature. Additionally, note that compared to the scale of the features $\pm 1$ , the value of √ $\varepsilon$ required to manipulate the standard classifier is very small $( \varepsilon = O ( \eta )$ , where $\eta = O ( 1 / { \sqrt { d } } ) ;$ .
|
| 107 |
+
|
| 108 |
+
On the (non-)existence of an accurate and robust classifier It might be natural to expect that in the regime of infinite data, the standard classifier itself acts as a robust classifier. Note however, that this is not true for the setting we analyze above. Here, the trade-off between standard and adversarial accuracy is an inherent trait of the data distribution itself and not due to having insufficient samples. In this particular classification task, we (implicitly) assumed that there does not exist a classifier that is both robust and very accurate (i.e. $> 9 9 \%$ standard and robust accuracy). Thus, for this task, any classifier that is very accurate (including the Bayes classifier – the classifier minimizing classification error having full-information about the distribution) will necessarily be non-robust.
|
| 109 |
+
|
| 110 |
+
This seemingly goes against the common assumption in adversarial ML that humans are such perfect robust and accurate classifiers for standard datasets. However, note that there is no concrete evidence supporting this assumption. In fact, humans often have far from perfect performance in vision benchmarks (Karpathy, 2011; 2014; Russakovsky et al., 2015) and are outperformed by ML models in certain tasks (He et al., 2015b; Gastaldi, 2017). It is plausible that standard ML models are able to outperform humans in these tasks by relying on brittle features that humans are naturally invariant to and the observed decrease in performance might be the manifestation of that.
|
| 111 |
+
|
| 112 |
+
# 2.2 THE IMPORTANCE OF ADVERSARIAL TRAINING
|
| 113 |
+
|
| 114 |
+
As we have seen in the distributional model $\mathcal { D }$ (3), a classifier that achieves very high standard accuracy (1) will inevitably have near-zero adversarial accuracy. This is true even when a classifier with reasonable standard and robust accuracy exists. Hence, in an adversarial setting (2), where the goal is to achieve high adversarial accuracy, the training procedure needs to be modified. We now make this phenomenon concrete for linear classifiers trained using the soft-margin SVM loss. Specifically, in Appendix D we prove the following theorem.
|
| 115 |
+
|
| 116 |
+
Theorem 2.2 (Adversarial training matters). For $\eta \geq 4 / \sqrt { d }$ and $p \leq 0 . 9 7 5$ (the first feature is not perfect), a soft-margin SVM classifier of unit weight norm minimizing the distributional loss achieves a standard accuracy of $> 9 9 \%$ and adversarial accuracy of $\textless 1 \%$ against an $\ell _ { \infty }$ -bounded adversary of $\varepsilon \geq 2 \eta$ . Minimizing the distributional adversarial loss instead leads to a robust classifier that has standard and adversarial accuracy of p against any $\varepsilon < 1$ .
|
| 117 |
+
|
| 118 |
+
This theorem shows that if our focus is on robust models, adversarial training is crucial to achieve non-trivial adversarial accuracy in this setting. Simply optimizing the standard accuracy of the model (i.e. standard training) leads to poor robust accuracy. Soft-margin SVM classifiers and the constant 0.975 are chosen for mathematical convenience. Our proofs do not depend on them in a crucial way and can be adapted, in a straightforward manner, to other natural settings, e.g. logistic regression.
|
| 119 |
+
|
| 120 |
+
Transferability An interesting implication of our analysis is that standard training produces classifiers that rely on features that are weakly correlated with the correct label. This will be true for any classifier trained on the same distribution. Hence, the adversarial examples that are created by perturbing each feature in the direction of $- y$ will transfer across classifiers trained on independent samples from the distribution. This constitutes an interesting manifestation of the generally observed phenomenon of transferability (Szegedy et al., 2013) and might hint at its origin.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 2: Visualization of the loss gradient with respect to input pixels. Recall that these gradients highlight the input features which affect the loss most strongly, and thus are important for the classifier’s prediction. We observe that the gradients are significantly more interpretable for adversarially trained networks – they align well with perceptually relevant features. In contrast, for standard networks they appear very noisy. We observe that gradients of $\ell _ { \infty }$ -trained models tend to be sparser than those of $\ell _ { 2 }$ -trained models. (For MNIST, blue and red pixels denote positive and negative gradient regions respectively. For CIFAR-10 and ImageNet, we clip gradients to within $\pm 3 \sigma$ and rescale them to lie in the [0, 1] range.) Additional visualizations are in Figure 10 of Appendix G.
|
| 124 |
+
|
| 125 |
+
Empirical examination In Section 2.1, we showed that the trade-off between standard accuracy and robustness might be inevitable. To examine how representative our theoretical model is of real-world datasets, we also experimentally investigate this issue on MNIST (LeCun et al., 1998) as it is amenable to linear classifiers. Interestingly, we observe a qualitatively similar behavior. For instance, in Figure 5(b) in Appendix E, we see that the standard classifier assigns weight to even weakly-correlated features. (Note that in settings with finite training data, such brittle features could arise even from noise – see Appendix E.) The robust classifier on the other hand does not assign any weight beyond a certain threshold. Further, we find that it is possible to obtain a robust classifier by directly training a standard model using only features that are relatively well-correlated with the label (without adversarial training). As expected, as more features are incorporated into the training, the standard accuracy is improved at the cost of robustness (see Appendix E Figure 5(c)).
|
| 126 |
+
|
| 127 |
+
# 3 UNEXPECTED BENEFITS OF ADVERSARIAL ROBUSTNESS
|
| 128 |
+
|
| 129 |
+
In Section 2, we established that robust and standard models might depend on very different sets of features. We demonstrated how this can lead to a decrease in standard accuracy for robust models. In this section, we will argue that the features learned by robust models can also be beneficial.
|
| 130 |
+
|
| 131 |
+
At a high level, robustness to adversarial perturbations can be viewed as an invariance property of a model. A model that achieves small loss for all perturbations in the set $\Delta$ , will necessarily have learned features that are invariant to such perturbations. Thus, robust training can be viewed as a method to embed certain invariances in a model. Since we also expect humans to be invariant to these perturbations (e.g. small $\ell _ { p }$ -bounded changes of the pixels), robust models will be more aligned with human vision than standard models. In this section, we present evidence supporting the view.
|
| 132 |
+
|
| 133 |
+
Loss gradients in the input space align well with human perception As a starting point, we want to investigate which features of the input most strongly affect the prediction of the classifier both for standard and robust models. To this end, we visualize the gradients of the loss with respect to individual features (pixels) of the input in Figure 2. We observe that gradients for adversarially trained networks align well with perceptually relevant features (such as edges) of the input image. In contrast, for standard networks, these gradients have no coherent patterns and appear very noisy to humans. We want to emphasize that no preprocessing was applied to the gradients (other than scaling and clipping for visualization). On the other hand, extraction of interpretable information from the gradients of standard networks has so far only been possible using additional sophisticated techniques (Simonyan et al., 2013; Yosinski et al., 2015; Olah et al., 2017).
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 3: Visualizing large- $\varepsilon$ adversarial examples for standard and robust $( \ell _ { 2 } / \ell _ { \infty }$ -adversarial training) models. We construct these examples by iteratively following the (negative) loss gradient while staying with $\ell _ { 2 }$ -distance of $\varepsilon$ from the original image. We observe that the images produced for robust models effectively capture salient data characteristics and appear similar to examples of a different class. (The value of $\varepsilon$ is equal for all models and much larger than the one used for training.) Additional examples are visualized in Figure 8 and 9 of Appendix G.
|
| 137 |
+
|
| 138 |
+
This observation effectively outlines an approach to train models that align better with human perception by design. By encoding the correct prior into the set of perturbations $\Delta$ , adversarial training alone might be sufficient to yield interpretable gradients. We believe that this phenomenon warrants an in-depth investigation and we view our experiments as only exploratory.
|
| 139 |
+
|
| 140 |
+
Adversarial examples exhibit salient data characteristics Given how the gradients of standard and robust models are concentrated on qualitatively different input features, we want to investigate how the adversarial examples of these models appear visually. To find adversarial examples, we start from a given test image and apply Projected Gradient Descent (PGD; a standard first-order optimization method) to find the image of highest loss within an $\ell _ { p }$ -ball of radius $\varepsilon$ around the original image 2. This procedure will change the pixels that are most influential for a particular model’s predictions and thus hint towards how the model is making its predictions.
|
| 141 |
+
|
| 142 |
+
The resulting visualizations are presented in Figure 3 (details in Appendix A). Surprisingly, we can observe that adversarial perturbations for robust models tend to produce salient characteristics of another class. In fact, the corresponding adversarial examples for robust models can often be perceived as samples from that class. This behavior is in stark contrast to standard models, for which adversarial examples appear as noisy variants of the input image.
|
| 143 |
+
|
| 144 |
+
These findings provide additional evidence that adversarial training does not necessarily lead to gradient obfuscation (Athalye et al., 2018). Following the gradient changes the image in a meaningful way and (eventually) leads to images of different classes. Hence, the robustness of these models does not stem from having gradients that are ill-suited for first-order methods.
|
| 145 |
+
|
| 146 |
+
Smooth cross-class interpolations via gradient descent By linearly interpolating between the original image and the image produced by PGD we can produce a smooth, “perceptually plausible” interpolation between classes (Figure 4). Such interpolation have thus far been restricted to generative models such as GANs (Goodfellow et al., 2014a) and VAEs (Kingma & Welling, 2013), involved manipulation of learned representations (Upchurch et al., 2016), and hand-designed methods (Suwajanakorn et al., 2015; Kemelmacher-Shlizerman, 2016). In fact, we conjecture that the similarity of these inter-class trajectories to GAN interpolations is not a coincidence. We postulate that the saddle point problem that is key in both these approaches may be at the root of this effect. We hope that future research will investigate this connection further and explore how to utilize the loss landscape of robust models as an alternative method to smoothly interpolate between classes.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 4: Interpolation between original image and large- $\varepsilon$ adversarial example as in Figure 3.
|
| 150 |
+
|
| 151 |
+
# 4 RELATED WORK
|
| 152 |
+
|
| 153 |
+
Due to the large body of related work, we will only focus on the most relevant studies here and defer the full discussion to Appendix F. Fawzi et al. (2018b) prove upper bounds on the robust of classifiers and exhibit a standard vs. robust accuracy trade-off for a specific classifier families on a synthetic task. Their setting also (implicitly) utilizes the notion of robust and non-robust features, however these features have small magnitude rather than weak correlation. Ross & Doshi-Velez (2017) propose regularizing the gradient of the classifier with respect to its input. They find that the resulting classifiers have more interpretable gradients and targeted adversarial examples resemble the target class for digit and character recognition tasks. There has been recent of work proving upper bounds on classifier robustness (Gilmer et al., 2018; Schmidt et al., 2018; Fawzi et al., 2018a). However, this work is orthogonal to ours as in these settings there exist classifiers that are both robust and accurate.
|
| 154 |
+
|
| 155 |
+
# 5 CONCLUSIONS AND FUTURE DIRECTIONS
|
| 156 |
+
|
| 157 |
+
In this work, we show that the goal of adversarially robust generalization might fundamentally be at odds with that of standard generalization. Specifically, we identify an inherent trade-off between the standard accuracy and adversarial robustness of a model, that provably manifests in a concrete, simple setting. This trade-off stems from intrinsic differences between the feature learned by standard and robust models. Our analysis also explains the drop in standard accuracy observed when employing adversarial training in practice. Moreover, it emphasizes the need to develop robust training methods, since robustness is unlikely to arise as a consequence of standard training.
|
| 158 |
+
|
| 159 |
+
We discover that even though adversarial robustness comes at a price, it has some unexpected benefits. Robust models learn features that align well with salient data characteristics. The root of this phenomenon is that the set of adversarial perturbations encodes some prior for human perception. Thus, classifiers that are robust to these perturbations are also necessarily invariant to input modifications that we expect humans to be invariant to. We demonstrate a striking consequence of this phenomenon: robust models yield clean feature interpolations similar to those obtained from generative models such as GANs (Goodfellow et al., 2014b). This emphasizes the possibility of a stronger connection between GANs and adversarial robustness.
|
| 160 |
+
|
| 161 |
+
Finally, our findings show that the interplay between adversarial robustness and standard classification might be more nuanced that one might expect. This motivates further work to fully undertand the relative costs and benefits of each of these notions.
|
| 162 |
+
|
| 163 |
+
# ACKNOWLEDGEMENTS
|
| 164 |
+
|
| 165 |
+
Shibani Santurkar was supported by the National Science Foundation (NSF) under grants IIS-1447786, IIS-1607189, and CCF-1563880, and the Intel Corporation. Dimitris Tsipras was supported in part by the NSF grant CCF-1553428. Aleksander M ˛adry was supported in part by an Alfred P. Sloan Research Fellowship, a Google Research Award, and the NSF grant CCF-1553428.
|
| 166 |
+
|
| 167 |
+
# REFERENCES
|
| 168 |
+
|
| 169 |
+
Tensor flow models repository. https://github.com/tensorflow/models/tree/master/ resnet, 2017.
|
| 170 |
+
Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. arXiv preprint arXiv:1707.07397, 2017.
|
| 171 |
+
Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. arXiv preprint arXiv:1802.00420, 2018.
|
| 172 |
+
Rohit Babbar and Bernhard Schölkopf. Adversarial extreme multi-label classification. arXiv preprint arXiv:1803.01570, 2018.
|
| 173 |
+
Aharon Ben-Tal, Laurent El Ghaoui, and Arkadi Nemirovski. Robust optimization. Princeton University Press, 2009.
|
| 174 |
+
Battista Biggio and Fabio Roli. Wild patterns: Ten years after the rise of adversarial machine learning. arXiv preprint arXiv:1712.03141, 2017.
|
| 175 |
+
Sébastien Bubeck, Eric Price, and Ilya Razenshteyn. Adversarial examples from computational constraints. arXiv preprint arXiv:1805.10204, 2018.
|
| 176 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. arXiv preprint arXiv:1608.04644, 2016.
|
| 177 |
+
Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. arXiv preprint arXiv:1705.07263, 2017.
|
| 178 |
+
Nilesh Dalvi, Pedro Domingos, Mausam, Sumit Sanghai, and Deepak Verma. Adversarial classification. In International Conference on Knowledge Discovery and Data Mining (KDD), 2004.
|
| 179 |
+
J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
|
| 180 |
+
Krishnamurthy Dvijotham, Sven Gowal, Robert Stanforth, Relja Arandjelovic, Brendan O’Donoghue, Jonathan Uesato, and Pushmeet Kohli. Training verified learners with learned verifiers. arXiv preprint arXiv:1805.10265, 2018a.
|
| 181 |
+
Krishnamurthy Dvijotham, Robert Stanforth, Sven Gowal, Timothy Mann, and Pushmeet Kohli. A dual approach to scalable verification of deep networks. arXiv preprint arXiv:1803.06567, 2018b.
|
| 182 |
+
Logan Engstrom, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. A rotation and a translation suffice: Fooling cnns with simple transformations. arXiv preprint arXiv:1712.02779, 2017.
|
| 183 |
+
Ivan Evtimov, Kevin Eykholt, Earlence Fernandes, Tadayoshi Kohno, Bo Li, Atul Prakash, Amir Rahmati, and Dawn Song. Robust physical-world attacks on machine learning models. arXiv preprint arXiv:1707.08945, 2017.
|
| 184 |
+
|
| 185 |
+
Alhussein Fawzi and Pascal Frossard. Manitest: Are classifiers really invariant? In British Machine Vision Conference (BMVC), number EPFL-CONF-210209, 2015.
|
| 186 |
+
|
| 187 |
+
Alhussein Fawzi, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Robustness of classifiers: from adversarial to random noise. In Advances in Neural Information Processing Systems, pp. 1632–1640, 2016.
|
| 188 |
+
|
| 189 |
+
Alhussein Fawzi, Hamza Fawzi, and Omar Fawzi. Adversarial vulnerability for any classifier. arXiv preprint arXiv:1802.08686, 2018a.
|
| 190 |
+
|
| 191 |
+
Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Analysis of classifiers’ robustness to adversarial perturbations. Machine Learning, 107(3):481–508, 2018b.
|
| 192 |
+
|
| 193 |
+
Xavier Gastaldi. Shake-shake regularization. arXiv preprint arXiv:1705.07485, 2017.
|
| 194 |
+
|
| 195 |
+
Justin Gilmer, Luke Metz, Fartash Faghri, Samuel S Schoenholz, Maithra Raghu, Martin Wattenberg, and Ian Goodfellow. Adversarial spheres. arXiv preprint arXiv:1801.02774, 2018.
|
| 196 |
+
|
| 197 |
+
Ian Goodfellow. Adversarial examples. Presentation at Deep Learning Summer School, 2015. http:// videolectures.net/deeplearning2015_goodfellow_adversarial_examples/.
|
| 198 |
+
|
| 199 |
+
Ian 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, pp. 2672–2680, 2014a.
|
| 200 |
+
|
| 201 |
+
Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014b.
|
| 202 |
+
|
| 203 |
+
Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013.
|
| 204 |
+
|
| 205 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. corr abs/1512.03385 (2015), 2015a.
|
| 206 |
+
|
| 207 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015b.
|
| 208 |
+
|
| 209 |
+
Andrej Karpathy. Lessons learned from manually classifying cifar-10. http://karpathy.github.io/ 2011/04/27/manually-classifying-cifar10/, 2011. Accessed: 2018-09-23.
|
| 210 |
+
|
| 211 |
+
Andrej Karpathy. What I learned from competing against a ConvNet on ImageNet. http://karpathy.github.io/2014/09/02/ what-i-learned-from-competing-against-a-convnet-on-imagenet/, 2014. Accessed: 2018-09-23.
|
| 212 |
+
|
| 213 |
+
Ira Kemelmacher-Shlizerman. Transfiguring portraits. ACM Transactions on Graphics (TOG), 35(4):94, 2016.
|
| 214 |
+
|
| 215 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 216 |
+
|
| 217 |
+
J Zico Kolter and Eric Wong. Provable defenses against adversarial examples via the convex outer adversarial polytope. arXiv preprint arXiv:1711.00851, 2017.
|
| 218 |
+
|
| 219 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 220 |
+
|
| 221 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
|
| 222 |
+
|
| 223 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016a.
|
| 224 |
+
|
| 225 |
+
Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016b.
|
| 226 |
+
|
| 227 |
+
Yann LeCun, Corinna Cortes, and Christopher J.C. Burges. The mnist database of handwritten digits. Website, 1998. URL http://yann.lecun.com/exdb/mnist/.
|
| 228 |
+
|
| 229 |
+
Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. AT&T Labs [Online]. Available: http://yann. lecun. com/exdb/mnist, 2, 2010.
|
| 230 |
+
|
| 231 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
|
| 232 |
+
|
| 233 |
+
Takeru Miyato, Shin-ichi Maeda, Shin Ishii, and Masanori Koyama. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 2018.
|
| 234 |
+
|
| 235 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
|
| 236 |
+
|
| 237 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: A simple and accurate method to fool deep neural networks. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 2574–2582, 2016.
|
| 238 |
+
|
| 239 |
+
Anh Mai Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2015, Boston, MA, USA, June 7-12, 2015, pp. 427–436, 2015.
|
| 240 |
+
|
| 241 |
+
Chris Olah, Alexander Mordvintsev, and Ludwig Schubert. Feature visualization. Distill, 2017. doi: 10.23915/ distill.00007. https://distill.pub/2017/feature-visualization.
|
| 242 |
+
|
| 243 |
+
Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. arXiv preprint arXiv:1801.09344, 2018.
|
| 244 |
+
|
| 245 |
+
Andrew Slavin Ross and Finale Doshi-Velez. Improving the adversarial robustness and interpretability of deep neural networks by regularizing their input gradients. arXiv preprint arXiv:1711.09404, 2017.
|
| 246 |
+
|
| 247 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
|
| 248 |
+
|
| 249 |
+
Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander M ˛adry. Adversarially robust generalization requires more data. arXiv preprint arXiv:1804.11285, 2018.
|
| 250 |
+
|
| 251 |
+
Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K. Reiter. Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, October 24-28, 2016, pp. 1528–1540, 2016.
|
| 252 |
+
|
| 253 |
+
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
|
| 254 |
+
|
| 255 |
+
Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
|
| 256 |
+
|
| 257 |
+
Aman Sinha, Hongseok Namkoong, and John Duchi. Certifiable distributional robustness with principled adversarial training. arXiv preprint arXiv:1710.10571, 2017.
|
| 258 |
+
|
| 259 |
+
Dong Su, Huan Zhang, Hongge Chen, Jinfeng Yi, Pin-Yu Chen, and Yupeng Gao. Is robustness the cost of accuracy?–a comprehensive study on the robustness of 18 deep image classification models. arXiv preprint arXiv:1808.01688, 2018.
|
| 260 |
+
|
| 261 |
+
Supasorn Suwajanakorn, Steven M Seitz, and Ira Kemelmacher-Shlizerman. What makes tom hanks look like tom hanks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3952–3960, 2015.
|
| 262 |
+
|
| 263 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
|
| 264 |
+
|
| 265 |
+
Vincent Tjeng and Russ Tedrake. Verifying neural networks with mixed integer programming. arXiv preprint arXiv:1711.07356, 2017.
|
| 266 |
+
|
| 267 |
+
Mohamad Ali Torkamani and Daniel Lowd. On robustness and regularization of structural support vector machines. In International Conference on Machine Learning, pp. 577–585, 2014.
|
| 268 |
+
|
| 269 |
+
MohamadAli Torkamani and Daniel Lowd. Convex adversarial collective classification. In International Conference on Machine Learning, pp. 642–650, 2013.
|
| 270 |
+
|
| 271 |
+
Jonathan Uesato, Brendan O’Donoghue, Aaron van den Oord, and Pushmeet Kohli. Adversarial risk and the dangers of evaluating against weak attacks. arXiv preprint arXiv:1802.05666, 2018.
|
| 272 |
+
Paul Upchurch, Jacob Gardner, Geoff Pleiss, Robert Pless, Noah Snavely, Kavita Bala, and Kilian Weinberger. Deep feature interpolation for image content changes. arXiv preprint arXiv:1611.05507, 2016.
|
| 273 |
+
Yizhen Wang, Somesh Jha, and Kamalika Chaudhuri. Analyzing the robustness of nearest neighbors to adversarial examples. arXiv preprint arXiv:1706.03922, 2017.
|
| 274 |
+
Eric Wong, Frank Schmidt, Jan Hendrik Metzen, and J Zico Kolter. Scaling provable adversarial defenses. arXiv preprint arXiv:1805.12514, 2018.
|
| 275 |
+
Yuxin Wu et al. Tensorpack. https://github.com/tensorpack/, 2016.
|
| 276 |
+
Chaowei Xiao, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. Spatially transformed adversarial examples. arXiv preprint arXiv:1801.02612, 2018a.
|
| 277 |
+
Kai Y Xiao, Vincent Tjeng, Nur Muhammad Shafiullah, and Aleksander Madry. Training for faster adversarial robustness verification via inducing relu stability. arXiv preprint arXiv:1809.03008, 2018b.
|
| 278 |
+
Huan Xu and Shie Mannor. Robustness and generalization. Machine learning, 86(3):391–423, 2012.
|
| 279 |
+
Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015.
|
| 280 |
+
|
| 281 |
+
# A EXPERIMENTAL SETUP
|
| 282 |
+
|
| 283 |
+
# A.1 DATASETS
|
| 284 |
+
|
| 285 |
+
We perform our experimental analysis on the MNIST (LeCun et al., 2010), CIFAR-10 (Krizhevsky & Hinton, 2009) and (restricted) ImageNet (Deng et al., 2009) datasets. For binary classification, we filter out all the images from the MNIST dataset other than the “5” and “7” labelled examples. For the ImageNet dataset, adversarial training is significantly harder since the classification problem is challenging by itself and standard classifiers are already computationally expensive to train. We thus restrict our focus to a smaller subset of the dataset. We group together a subset of existing, semantically similar ImageNet classes into 8 different super-classes, as shown in Table 1. We train and evaluate only on examples corresponding to these classes.
|
| 286 |
+
|
| 287 |
+
Table 1: Classes used in the Restricted ImageNet model. The class ranges are inclusive.
|
| 288 |
+
|
| 289 |
+
<table><tr><td>Class</td><td>Corresponding ImageNet Classes</td></tr><tr><td>“Dog”</td><td>151 to 268</td></tr><tr><td>“Cat”</td><td>281 to 285</td></tr><tr><td>“Frog”</td><td>30 to 32</td></tr><tr><td>“Turtle”</td><td>33 to 37</td></tr><tr><td>“Bird”</td><td>80 to 100</td></tr><tr><td>"Primate”</td><td>365 to 382</td></tr><tr><td>“Fish”</td><td>389 to 397</td></tr><tr><td>“Crab”</td><td>118 to 121</td></tr><tr><td>"Insect”</td><td>300 to 319</td></tr></table>
|
| 290 |
+
|
| 291 |
+
# A.2 MODELS
|
| 292 |
+
|
| 293 |
+
• Binary MNIST (Section 2.2): We train a linear classifier with parameters $w \in \mathbb { R } ^ { 7 8 4 } , b \in \mathbb { R }$ on the dataset described in Section A.1 (labels $- 1$ and $+ 1$ correspond to images labelled as “5” and “7” respectively). We use the cross-entropy loss and perform 100 epochs of gradient descent in training.
|
| 294 |
+
|
| 295 |
+
• MNIST: We use the simple convolution architecture from the TensorFlow tutorial (TFM, 2017) 3.
|
| 296 |
+
• CIFAR-10: We consider a standard ResNet model (He et al., 2015a). It has 4 groups of residual layers with filter sizes (16, 16, 32, 64) and 5 residual units each 4.
|
| 297 |
+
• Restricted ImageNet: We use a ResNet-50 (He et al., 2015a) architecture using the code from the tensorpack repository (Wu et al., 2016). We do not modify the model architecture, and change the training procedure only by changing the number of examples per “epoch” from 1,280,000 images to 76,800 images.
|
| 298 |
+
|
| 299 |
+
# A.3 ADVERSARIAL TRAINING
|
| 300 |
+
|
| 301 |
+
We perform adversarial training to train robust classifiers following Madry et al. (2017). Specifically, we train against a projected gradient descent (PGD) adversary, starting from a random initial perturbation of the training data. We consider adversarial perturbations in $\ell _ { p }$ norm where $p = \{ 2 , \infty \}$ . Unless otherwise specified, we use the values of $\varepsilon$ provided in Table 2 to train/evaluate our models.
|
| 302 |
+
|
| 303 |
+
Table 2: Value of $\varepsilon$ used for adversarial training/evaluation of each dataset and $\ell _ { p }$ -norm.
|
| 304 |
+
|
| 305 |
+
<table><tr><td>Adversary</td><td>Binary MNIST</td><td>MNIST</td><td>CIFAR-10</td><td>Restricted Imagenet</td></tr><tr><td>l8</td><td>0.2</td><td>0.3</td><td>4/255</td><td>0.005</td></tr><tr><td>l</td><td>1</td><td>1.5</td><td>0.314</td><td>1</td></tr></table>
|
| 306 |
+
|
| 307 |
+
# A.4 ADVERSARIAL EXAMPLES FOR LARGE ε
|
| 308 |
+
|
| 309 |
+
The images we generated for Figure 3 were allowed a much larger perturbation from the original sample in order to produce visible changes to the images. These values are listed in Table 3. Since
|
| 310 |
+
|
| 311 |
+
Table 3: Value of $\varepsilon$ used for large- $\varepsilon$ adversarial examples of Figure 3.
|
| 312 |
+
|
| 313 |
+
<table><tr><td>Adversary</td><td>MNIST</td><td>CIFAR-10</td><td>Restricted Imagenet</td></tr><tr><td>l8</td><td>0.3</td><td>0.125</td><td>0.25</td></tr><tr><td>l</td><td>4</td><td>4.7</td><td>40</td></tr></table>
|
| 314 |
+
|
| 315 |
+
these levels of perturbations would allow to truly change the class of the image, training against such strong adversaries would be impossible. Still, we observe that smaller values of $\varepsilon$ suffices to ensure that the models rely on the most robust (and hence interpretable) features.
|
| 316 |
+
|
| 317 |
+
# B MIXING NATURAL AND ADVERSARIAL EXAMPLES IN EACH BATCH
|
| 318 |
+
|
| 319 |
+
In order to make sure that the standard accuracy drop in Figure 7 is not an artifact of only training on adversarial examples, we experimented with including unperturbed examples in each training batch, following the recommendation of (Kurakin et al., 2016a). We found that while this slightly improves the standard accuracy of the classifier, it decreases it’s robust accuracy by a roughly proportional amount, see Table 4.
|
| 320 |
+
|
| 321 |
+
# C PROOF OF THEOREM 2.1
|
| 322 |
+
|
| 323 |
+
The main idea of the proof is that an adversary with $\varepsilon = 2 \eta$ is able to change the distribution of features $x _ { 2 } , \ldots , x _ { d + 1 }$ to reflect a label of $- y$ instead of $y$ by subtracting $\varepsilon y$ from each variable. Hence any information that is used from these features to achieve better standard accuracy can be used by the adversary to reduce adversarial accuracy. We define $G _ { + }$ to be the distribution of $x _ { 2 } , \ldots , x _ { d + 1 }$ when $y = + 1$ and $G _ { - }$ to be that distribution when $y = - 1$ . We will consider the setting where $\varepsilon = 2 \eta$ and fix the adversary that replaces $x _ { i }$ by $x _ { i } - y \varepsilon$ for each $i \geq 2$ . This adversary is able to change $G _ { + }$ to $G _ { - }$ in the adversarial setting and vice-versa.
|
| 324 |
+
|
| 325 |
+
Table 4: Standard and robust accuracy corresponding to robust training with half natural and half adversarial samples. The accuracies correspond to standard, robust and half-half training.
|
| 326 |
+
|
| 327 |
+
<table><tr><td></td><td></td><td colspan="3">Standard Accuracy</td><td colspan="3">Robust Accuracy</td></tr><tr><td>Norm</td><td>m</td><td>Standard</td><td>Half-half</td><td>Robust</td><td>Standard</td><td>Half-half</td><td>Robust</td></tr><tr><td rowspan="7">lo LSINN</td><td></td><td>99.31%</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>0.1</td><td>99.31%</td><td>99.43%</td><td>99.36%</td><td>29.45%</td><td>95.29%</td><td>95.05%</td></tr><tr><td>0.2</td><td>99.31%</td><td>99.22%</td><td>98.99%</td><td>0.05%</td><td>90.79%</td><td>92.86%</td></tr><tr><td>0.3</td><td>99.31%</td><td>99.17%</td><td>97.37%</td><td>0.00%</td><td>89.51%</td><td>89.92%</td></tr><tr><td></td><td>99.31%</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>0.5</td><td>99.31%</td><td>99.35%</td><td>99.41%</td><td>94.67%</td><td>97.60%</td><td>97.70%</td></tr><tr><td>1.5</td><td>99.31%</td><td>99.29%</td><td>99.24%</td><td>56.42%</td><td>87.71%</td><td>88.59%</td></tr><tr><td rowspan="5"></td><td>2.5</td><td>99.31%</td><td>99.12%</td><td>97.79%</td><td>46.36%</td><td>60.27%</td><td>63.73%</td></tr><tr><td>0</td><td>92.20%</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>2/255</td><td>92.20%</td><td>90.13%</td><td>89.64%</td><td>0.99%</td><td>69.10%</td><td>69.92%</td></tr><tr><td>4/255</td><td>92.20%</td><td>88.27%</td><td>86.54%</td><td>0.08%</td><td>55.60%</td><td>57.79%</td></tr><tr><td>8/255 0</td><td>92.20%</td><td>84.72%</td><td>79.57%</td><td>0.00%</td><td>37.56%</td><td>41.93%</td></tr><tr><td rowspan="4">l2</td><td></td><td>92.20%</td><td>=</td><td>-</td><td>1</td><td>1</td><td>=</td></tr><tr><td>20/255</td><td>92.20%</td><td>92.04%</td><td>91.77%</td><td>45.60%</td><td>83.94%</td><td>84.70%</td></tr><tr><td>255</td><td>92.20%</td><td>88.95%</td><td>88.38%</td><td>8.80%</td><td>67.29%</td><td>68.69%</td></tr><tr><td>320 /255</td><td>92.20%</td><td>81.74%</td><td>75.75%</td><td>3.30%</td><td>34.45%</td><td>39.76%</td></tr></table>
|
| 328 |
+
|
| 329 |
+
Consider any classifier $f ( x )$ that maps an input $x$ to a class in $\{ - 1 , + 1 \}$ . Let us fix the probability that this classifier predicts class $+ 1$ for some fixed value of $x _ { 1 }$ and distribution of $x _ { 2 } , \ldots , x _ { d + 1 }$ Concretely, we define $p _ { i j }$ to be the probability of predicting $+ 1$ given that the first feature has sign $i$ and the rest of the features are distributed according to $G _ { j }$ . Formally,
|
| 330 |
+
|
| 331 |
+
$$
|
| 332 |
+
\begin{array} { l } { { p _ { + + } = \displaystyle \operatorname* { P r } _ { x _ { 2 } , \ldots , d + 1 } \sim G _ { + } ( f ( x ) = + 1 \mid x _ { 1 } = + 1 ) , } } \\ { { p _ { + - } = \displaystyle \operatorname* { P r } _ { x _ { 2 } , \ldots , d + 1 } \sim G _ { - } ( f ( x ) = + 1 \mid x _ { 1 } = + 1 ) , } } \\ { { p _ { - + } = \displaystyle \operatorname* { P r } _ { x _ { 2 } , \ldots , d + 1 } \sim G _ { + } ( f ( x ) = + 1 \mid x _ { 1 } = - 1 ) , } } \\ { { p _ { -- } = \displaystyle \operatorname* { P r } _ { x _ { 2 } , \ldots , d + 1 } \sim G _ { - } ( f ( x ) = + 1 \mid x _ { 1 } = - 1 ) . } } \end{array}
|
| 333 |
+
$$
|
| 334 |
+
|
| 335 |
+
Using these definitions, we can express the standard accuracy of the classifier as
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\begin{array} { l } { \operatorname* { P r } ( f ( x ) = y ) = \operatorname* { P r } ( y = + 1 ) \left( p \cdot p _ { + + } + ( 1 - p ) \cdot p _ { - + } \right) } \\ { \qquad + \operatorname* { P r } ( y = - 1 ) \left( p \cdot ( 1 - p _ { -- } ) + ( 1 - p ) \cdot ( 1 - p _ { + - } ) \right) } \\ { \qquad = \displaystyle \frac { 1 } { 2 } \left( p \cdot p _ { + + } + ( 1 - p ) \cdot p _ { - + } + p \cdot ( 1 - p _ { -- } ) + ( 1 - p ) \cdot ( 1 - p _ { + - } ) \right) } \\ { \qquad = \displaystyle \frac { 1 } { 2 } \left( p \cdot ( 1 + p _ { + + } - p _ { -- } ) + ( 1 - p ) \cdot ( 1 + p _ { - + } - p _ { + - } ) ) \right) . } \end{array}
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
Similarly, we can express the accuracy of this classifier against the adversary that replaces $G _ { + }$ with $G _ { - }$ (and vice-versa) as
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
\begin{array} { r l } & { \operatorname* { P r } ( f ( x _ { \mathrm { a d v } } ) = y ) = \operatorname* { P r } ( y = + 1 ) ( p \cdot p _ { + - } + ( 1 - p ) \cdot p _ { -- } ) } \\ & { \qquad + \operatorname* { P r } ( y = - 1 ) ( p \cdot ( 1 - p _ { - + } ) + ( 1 - p ) \cdot ( 1 - p _ { + + } ) ) } \\ & { = \cfrac { 1 } { 2 } ( p \cdot p _ { + - } + ( 1 - p ) \cdot p _ { -- } + p \cdot ( 1 - p _ { - + } ) + ( 1 - p ) \cdot ( 1 - p _ { + + } ) ) } \\ & { = \cfrac { 1 } { 2 } ( p \cdot ( 1 + p _ { + - } - p _ { - + } ) + ( 1 - p ) \cdot ( 1 + p _ { -- } - p _ { + + } ) ) ) . } \end{array}
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
For convenience we will define $a = 1 - p _ { + + } + p _ { -- }$ and $b = 1 - p _ { - + } + p _ { + - }$ . Then we can rewrite
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\begin{array} { r l } { { \mathrm { s t a n d a r d ~ a c c u r a c y : ~ } } } & { { \displaystyle \frac { 1 } { 2 } ( p ( 2 - a ) + ( 1 - p ) ( 2 - b ) ) } } \\ { { } } & { { = 1 - \displaystyle \frac { 1 } { 2 } ( p a + ( 1 - p ) b ) , } } \\ { { \mathrm { } } } & { { } } \\ { { \mathrm { ~ d v e r s a r i a l ~ a c c u r a c y : ~ } } } & { { \displaystyle \frac { 1 } { 2 } ( ( 1 - p ) a + p b ) . } } \end{array}
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
We are assuming that the standard accuracy of the classifier is at least $1 - \delta$ for some small $\delta$ . This implies that
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
1 - \frac 1 2 ( p a + ( 1 - p ) b ) \geq 1 - \delta \implies p a + ( 1 - p ) b \leq 2 \delta .
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
Since $p _ { i j }$ are probabilities, we can guarantee that $a \ge 0$ . Moreover, since $p \geq 0 . 5$ , we have $p / ( 1 - \bar { p } ) \geq 1$ . We use these to upper bound the adversarial accuracy by
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
\begin{array} { c } { \displaystyle \frac 1 2 ( ( 1 - p ) a + p b ) \leq \frac 1 2 \left( ( 1 - p ) \frac { p ^ { 2 } } { ( 1 - p ) ^ { 2 } } a + p b \right) } \\ { = \displaystyle \frac { p } { 2 ( 1 - p ) } ( p a + ( 1 - p ) b ) } \\ { \leq \displaystyle \frac { p } { 1 - p } \delta . } \end{array}
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
# D PROOF OF THEOREM 2.2
|
| 366 |
+
|
| 367 |
+
We consider the problem of fitting the distribution $\mathcal { D }$ of (3) by using a standard soft-margin SVM classifier. Specifically, this can be formulated as:
|
| 368 |
+
|
| 369 |
+
$$
|
| 370 |
+
\operatorname* { m i n } _ { w } \mathbb { E } \big [ \operatorname* { m a x } ( 0 , 1 - y w ^ { \top } x ) \big ] + \frac { 1 } { 2 } \lambda \| w \| _ { 2 } ^ { 2 }
|
| 371 |
+
$$
|
| 372 |
+
|
| 373 |
+
for some value of $\lambda$ . We will assume that we tune $\lambda$ such that the optimal solution $w ^ { * }$ has $\ell _ { 2 }$ -norm of 1. This is without much loss of generality since our proofs can be adapted to the general case. We will refer to the first term of (5) as the margin term and the second term as the regularization term.
|
| 374 |
+
|
| 375 |
+
First we will argue that, due to symmetry, the optimal solution will assign equal weight to all the features $x _ { i }$ for $i = 2 , \ldots , d + 1$ .
|
| 376 |
+
|
| 377 |
+
Lemma D.1. Consider an optimal solution $w ^ { * }$ to the optimization problem (5). Then,
|
| 378 |
+
|
| 379 |
+
$$
|
| 380 |
+
w _ { i } ^ { * } = w _ { j } ^ { * } \forall i , j \in \{ 2 , . . . , d + 1 \} .
|
| 381 |
+
$$
|
| 382 |
+
|
| 383 |
+
Proof. Assume that $\exists i , j \in \{ 2 , . . . , d + 1 \}$ such that $w _ { i } ^ { * } \neq w _ { j } ^ { * }$ . Since the distribution of $x _ { i }$ and $x _ { j }$ are identical, we can swap the value of $w _ { i }$ and $w _ { j }$ , to get an alternative set of parameters $\hat { w }$ that has the same loss function value ( $\hat { w } _ { j } = w _ { i }$ , $\hat { w } _ { i } = w _ { j }$ , $\hat { w } _ { k } = w _ { k }$ for $k \neq i , j )$ .
|
| 384 |
+
|
| 385 |
+
Moreover, since the margin term of the loss is convex in $w$ , using Jensen’s inequality, we get that averaging $w ^ { * }$ and $\hat { w }$ will not increase the value of that margin term. Note, however, that $\lVert \frac { w ^ { * } + \hat { w } } { 2 } \rVert _ { 2 } < \lVert w ^ { * } \rVert _ { 2 }$ , hence the regularization loss is strictly smaller for the average point. This contradicts the optimality of $w ^ { * }$ . □
|
| 386 |
+
|
| 387 |
+
Since every optimal solution will assign equal weight to all √ $x _ { i }$ for $k \geq 2$ , we can replace these features by their sum (and divide by $\sqrt { d }$ for convenience). We will define
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
z = \frac { 1 } { \sqrt { d } } \sum _ { i = 2 } ^ { d + 1 } x _ { i } ,
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
which, by the properties of the normal distribution, is distributed as
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
z \sim \mathcal { N } ( y \eta \sqrt { d } , 1 ) .
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
By assigning a weight of $v$ to that combined feature the optimal solutions can be parametrized as
|
| 400 |
+
|
| 401 |
+
$$
|
| 402 |
+
w ^ { \top } x = w _ { 1 } x _ { 1 } + v z ,
|
| 403 |
+
$$
|
| 404 |
+
|
| 405 |
+
where the regularization term of the loss is $\lambda ( w _ { 1 } ^ { 2 } + v ^ { 2 } ) / 2$ .
|
| 406 |
+
|
| 407 |
+
Recall that our chosen value of $\eta$ is $4 / \sqrt { d }$ , which implies that the contribution of $v z$ is distributed normally with mean 4yv and variance $v ^ { 2 }$ . By the concentration of the normal distribution, the probability of $v z$ being larger than $v$ is large. We will use this fact to show that the optimal classifier will assign on $v$ at least as much weight as it assigns on $w _ { 1 }$ .
|
| 408 |
+
|
| 409 |
+
Lemma D.2. Consider the optimal solution $( w _ { 1 } ^ { * } , v ^ { * } )$ of the problem (5). Then
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
v ^ { * } \geq \frac { 1 } { \sqrt { 2 } } .
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
Proof. Assume for the sake of contradiction that $v ^ { * } < 1 / \sqrt { 2 }$ . Then, with probability at least $1 - p$ the first feature predicts the wrong label and without enough weight, the remaining features cannot compensate for it. Concretely,
|
| 416 |
+
|
| 417 |
+
$$
|
| 418 |
+
\begin{array} { r l } & { \mathbb E [ \operatorname* { m a x } ( 0 , 1 - y w ^ { \top } x ) ] \geq ( 1 - p ) \mathbb E \left[ \operatorname* { m a x } \left( 0 , 1 + w _ { 1 } - \mathcal N \left( 4 v , v ^ { 2 } \right) \right) \right] } \\ & { \qquad \geq ( 1 - p ) \mathbb E \left[ \operatorname* { m a x } \left( 0 , 1 + \frac 1 { \sqrt 2 } - \mathcal N \left( \frac 4 { \sqrt 2 } , \frac 1 2 \right) \right) \right] } \\ & { \qquad > ( 1 - p ) \cdot 0 . 0 1 6 . } \end{array}
|
| 419 |
+
$$
|
| 420 |
+
|
| 421 |
+
We will now show that a solution that assigns zero weight on the first feature $\mathbf { \nabla } _ { v } = 1$ and $w _ { 1 } = 0$ ), achieves a better margin loss.
|
| 422 |
+
|
| 423 |
+
$$
|
| 424 |
+
\begin{array} { r l } & { \mathbb { E } { [ \operatorname* { m a x } ( 0 , 1 - y w ^ { \top } x ) ] } = \mathbb { E } \left[ \operatorname* { m a x } \left( 0 , 1 - \mathcal { N } \left( 4 , 1 \right) \right) \right] } \\ & { \qquad < 0 . 0 0 0 4 . } \end{array}
|
| 425 |
+
$$
|
| 426 |
+
|
| 427 |
+
Hence, as long as $p \leq 0 . 9 7 5$ , this solution has a smaller margin loss than the original solution. Since both solutions have the same norm, the solution that assigns weight only on $v$ is better than the original solution $( w _ { 1 } ^ { * } , v ^ { * } )$ , contradicting its optimality. □
|
| 428 |
+
|
| 429 |
+
We have established that the learned classifier will assign more weight to $v$ than $w _ { 1 }$ . Since $z$ will be at least $y$ with large probability, we will show that the behavior of the classifier depends entirely on $z$
|
| 430 |
+
|
| 431 |
+
Lemma D.3. The standard accuracy of the soft-margin SVM learned for problem (5) is at least $9 9 \%$
|
| 432 |
+
|
| 433 |
+
Proof. By Lemma D.2, the classifier predicts the sign of √ $w _ { 1 } x _ { 1 } + v z$ where $v z \sim \mathcal { N } ( 4 y v , v ^ { 2 } )$ and $v \geq 1 / \sqrt { 2 }$ . Hence with probability at least $9 9 \%$ , $v z y > 1 / \sqrt 2 \geq w _ { 1 }$ and thus the predicted class is $y$ (the correct class) independent of $x _ { 1 }$ . □
|
| 434 |
+
|
| 435 |
+
We can utilize the same argument to show that an adversary that changes the distribution of $z$ has essentially full control over the classifier prediction.
|
| 436 |
+
|
| 437 |
+
Lemma D.4. The adversarial accuracy of the soft-margin SVM learned for (5) is at most $1 \%$ against an $\ell _ { \infty }$ -bounded adversary of $\varepsilon = 2 \eta$ .
|
| 438 |
+
|
| 439 |
+
Proof. Observe that the adversary can shift each feature $x _ { i }$ towards $y$ by $2 \eta$ . This will cause $z$ to be distributed as
|
| 440 |
+
|
| 441 |
+
$$
|
| 442 |
+
z _ { \mathrm { a d v } } \sim \mathcal { N } ( - y \eta \sqrt { d } , 1 ) .
|
| 443 |
+
$$
|
| 444 |
+
|
| 445 |
+
Therefore with probability at least $9 9 \%$ , $v y z < - y \le - w _ { 1 }$ and the predicted class will be $- y$ (wrong class) independent of $x _ { 1 }$ .
|
| 446 |
+
|
| 447 |
+
It remains to show that adversarial training for this classification task with $\varepsilon > 2 \eta$ will results in a classifier that has relies solely on the first feature.
|
| 448 |
+
|
| 449 |
+
Lemma D.5. Minimizing the adversarial variant of the loss (5) results in a classifier that assigns 0 weight to features $x _ { i }$ for $i \geq 2$ .
|
| 450 |
+
|
| 451 |
+
Proof. The optimization problem that adversarial training solves is
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\operatorname* { m i n } _ { w } \operatorname* { m a x } _ { \| \delta \| _ { \infty } \leq \varepsilon } \mathbb { E } \big [ \operatorname* { m a x } ( 0 , 1 - y w ^ { \top } ( x + \delta ) ) \big ] + \frac { 1 } { 2 } \lambda \| w \| _ { 2 } ^ { 2 } ,
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
which is equivalent to
|
| 458 |
+
|
| 459 |
+
$$
|
| 460 |
+
\operatorname* { m i n } _ { \boldsymbol { w } } \mathbb { E } \big [ \operatorname* { m a x } ( 0 , 1 - { y \boldsymbol { w } } ^ { \top } { \boldsymbol { x } } + \varepsilon \| { \boldsymbol { w } } \| _ { 1 } ) \big ] + \frac { 1 } { 2 } \lambda \| { \boldsymbol { w } } \| _ { 2 } ^ { 2 } .
|
| 461 |
+
$$
|
| 462 |
+
|
| 463 |
+
Consider any optimal solution $w$ for which $w _ { i } > 0$ for some $i > 2$ . The contribution of terms depending on $w _ { i }$ to $1 - y w ^ { \top } x + \varepsilon \| w \| _ { 1 }$ is a normally-distributed random variable with mean $2 \eta - \varepsilon \leq 0$ . Since the mean is non-positive, setting $w _ { i }$ to zero can only decrease the margin term of the loss. At the same time, setting $w _ { i }$ to zero strictly decreases the regularization term, contradicting the optimality of $w$ . □
|
| 464 |
+
|
| 465 |
+
Clearly, such a classifier will have standard and adversarial accuracy of $p$ against any $\varepsilon < 1$ since such a value of $\varepsilon$ is not sufficient to change the sign of the first feature. This concludes the proof of the theorem.
|
| 466 |
+
|
| 467 |
+
# E ROBUSTNESS-ACCURACY TRADE-OFF: AN EMPIRICAL EXAMINATION
|
| 468 |
+
|
| 469 |
+
Our theoretical analysis shows that there is an inherent tension between standard accuracy and adversarial robustness. At the core of this trade-off is the concept of robust and non-robust features. The robustness of a feature is characterized by the strength of its correlation with the correct label. It is natural to wonder whether this concept of robust features is an artifact of our theoretical analysis or if it manifests more broadly. We thus investigate this issue experimentally on a dataset that is amenable to linear classifiers, MNIST (LeCun et al., 1998) (details in Appendix A).
|
| 470 |
+
|
| 471 |
+
Recall the goal of standard classification for linear classifiers is to predict accurately, i.e. $y =$ $\mathrm { s i g n } ( w ^ { \top } x )$ . Hence the correlation of a feature $i$ with the true label, computed as $| \mathbb { E } [ y x _ { i } ] |$ , quantifies how useful this feature is for classification. In the adversarial setting, against an $\varepsilon \ell _ { \infty }$ -bounded adversary we need to ensure that $y = \mathrm { s i g n } ( w ^ { \top } x - \varepsilon y \| w \| _ { 1 } )$ . In that case we expect a feature $i$ to be helpful if $| \mathbb { E } [ y x _ { i } ] | \ge \varepsilon$ .
|
| 472 |
+
|
| 473 |
+
This calculation suggests that in the adversarial setting, there is an implicit threshold on feature correlations imposed by the threat model (the perturbation allowed to the adversary). While standard models may utilize all features with non-zero correlations, a robust model cannot rely on features with correlation below this threshold. In Figure 5(b), we visualize the correlation of each pixel (feature) in the MNIST dataset along with the learned weights of the standard and robust classifiers. As expected, we see that the standard classifier assigns weights even to weakly-correlated pixels so as to maximize prediction confidence. On the other hand, the robust classifier does not assign any weight below a certain correlation threshold which is dictated by the adversary’s strength $\left( \varepsilon \right)$ (Figures 5(a, b))
|
| 474 |
+
|
| 475 |
+
Interestingly, the standard model assigns non-zero weight even to very weakly correlated pixels (Figure 5(a)). In settings with finite training data, such non-robust features could arise from noise. (For instance, in $N$ tosses of an unbiased coin, the expected imbalance between heads and tails is $O ( { \sqrt { N } } )$ with high probability.) A standard classifier would try to take advantage of even this “hallucinated” information by assigning non-zero weights to these features.
|
| 476 |
+
|
| 477 |
+

|
| 478 |
+
Figure 5: Analysis of linear classifier trained on a binary MNIST task (5 vs. 7). (Details in Appendix Table 5.) (a) Visualization of network weights per input feature. (b) Comparison of feature-label correlation to the weight assigned to the feature by each network. Adversarially trained networks put weights only on a small number of strongly-correlated or “robust” features. (c) Performance of a model trained using standard training only on the most robust features. Specifically, we sort features based on decreasing correlation with the label and train using only the most correlated ones. Beyond a certain threshold, we observe that as more non-robust or (weakly correlated) features are available to the model, the standard accuracy increases at the cost of robustness.
|
| 479 |
+
|
| 480 |
+
# E.1 AN ALTERNATIVE PATH TO ROBUSTNESS?
|
| 481 |
+
|
| 482 |
+
The analysis above highlights an interesting trade-off between the predictive power of a feature and its vulnerability to adversarial perturbations. This brings forth the question – Could we use these insights to train robust classifiers with standard methods (i.e. without performing adversarial training)? As a first step, we train a (standard) linear classifier on MNIST utilizing input features (pixels) that lie above a given correlation threshold (see Figure 5(c)). As expected, as more non robust features are incorporated in training, the standard accuracy increases at the cost of robustness. Further, we observe that a standard classifier trained in this manner using few robust features attains better robustness than even adversarial training. This results suggest a more direct (and potentially better) method of training robust networks in certain settings.
|
| 483 |
+
|
| 484 |
+
# F ADDITIONAL RELATED WORK
|
| 485 |
+
|
| 486 |
+
Fawzi et al. (2016) derive parameter-dependent bounds on the robustness of any fixed classifier. Our results focus on the statistical setting itself and provide lower bounds for all classifiers learned in this setting.
|
| 487 |
+
|
| 488 |
+
Wang et al. (2017) analyze the adversarial robustness of nearest neighbor classifiers. Instead we focus on lower bounds that are inherent to the statistical setting itself and apply to all classifiers.
|
| 489 |
+
|
| 490 |
+
Schmidt et al. (2018) study the generalization aspect of adversarially robustness. They show that the number of samples needed to achieve adversarially robust generalization is polynomially larger in the dimension than the number of samples needed to ensure standard generalization. However, in the limit of infinite data, one can learn classifiers that are both robust and accurate.
|
| 491 |
+
|
| 492 |
+
Gilmer et al. (2018) demonstrate a setting where even a small amount of standard error implies that most points provably have a misclassified point close to them. In this setting, achieving perfect standard accuracy (easily achieved by a simple classifier) is sufficient to achieve perfect adversarial robustness. In contrast, our work focuses on a setting where adversarial training (provably) matters and there exists a trade-off between standard and adversarial accuracy.
|
| 493 |
+
|
| 494 |
+
Xu & Mannor (2012) explore the connection between robustness and generalization, showing that, in a certain sense, robustness can imply generalization. This direction is orthogonal to our, since we work in the limit of infinite data, optimizing the distributional loss directly.
|
| 495 |
+
|
| 496 |
+
Fawzi et al. (2018a) prove lower bounds on the robustness of any classifier based on certain generative assumptions. Since these bounds apply to all classifiers, independent of architecture and training procedure, they fail to capture the situation we face in practice where robust optimization can significantly improve the adversarial robustness of standard classifiers (Madry et al., 2017; Kolter & Wong, 2017; Raghunathan et al., 2018; Sinha et al., 2017).
|
| 497 |
+
|
| 498 |
+
A recent work (Bubeck et al., 2018) turns out to (implicitly) rely on the distinction between robust and non-robust features in constructing a distribution for which adversarial robustness is hard from a different, computational point of view.
|
| 499 |
+
|
| 500 |
+
Goodfellow et al. (2014b) observed that adversarial training results in feature weights that depend on fewer input features (similar to Figure 5(a)). Additionally, it has been observed that for naturally trained RBF classifiers on MNIST, targeted adversarial attacks resemble images of the target class (Goodfellow, 2015).
|
| 501 |
+
|
| 502 |
+
Su et al. (2018) empirically observe a similar trade-off between the accuracy and robustness of standard models across different deep architectures on ImageNet.
|
| 503 |
+
|
| 504 |
+
Babbar & Schölkopf (2018) study an extreme multi-label problem and observe that for classes with relatively few examples, $\ell _ { 1 }$ -regularization (which corresponds to adversarial training for linear models) is helpful, while for classes with more samples, it is harmful to the model accuracy.
|
| 505 |
+
|
| 506 |
+
# G OMITTED FIGURES
|
| 507 |
+
|
| 508 |
+
Table 5: Comparison of performance of linear classifiers trained on a binary MNIST dataset with standard and adversarial training. The performance of both models is evaluated in terms of standard and adversarial accuracy. Adversarial accuracy refers to the percentage of examples that are correctly classified after being perturbed by the adversary. Here, we use an $\ell _ { \infty }$ threat model with $\varepsilon = 0 . 2 0$ (with images scaled to have coordinates in the range $[ 0 , 1 ] \rangle$ ).
|
| 509 |
+
|
| 510 |
+
<table><tr><td></td><td colspan="2">Standard Accuracy (%)</td><td colspan="2">Adversarial Accuracy (%)</td><td>|u|1</td></tr><tr><td></td><td>Train</td><td>Test</td><td>Train</td><td>Test</td><td></td></tr><tr><td>Standard Training</td><td>98.38</td><td>92.10</td><td>13.69</td><td>14.95</td><td>41.08</td></tr><tr><td>Adversarial Training</td><td>94.05</td><td>70.05</td><td>76.05</td><td>74.65</td><td>13.69</td></tr></table>
|
| 511 |
+
|
| 512 |
+

|
| 513 |
+
Figure 6: Comparison of standard accuracies of models trained against an $\ell _ { \infty }$ -bounded adversary as a function of the size of the training dataset. We observe that in the low-data regime, adversarial training has an effect similar to data augmentation and helps with generalization in certain cases (particularly on MNIST). However, in the limit of sufficient training data, we see that the standard accuracy of robust models is less than that of the standard model $\mathbf { \bar { \varepsilon } } _ { t r a i n } = 0 ,$ ), which supports the theoretical analysis in Section 2.1.
|
| 514 |
+
|
| 515 |
+

|
| 516 |
+
Figure 7: Standard test accuracy of adversarially trained classifiers. The adversary used during training is constrained within some $\ell _ { p }$ -ball of radius $\varepsilon _ { \mathrm { t r a i n } }$ (details in Appendix A). We observe a consistent decrease in accuracy as the strength of the adversary increases.
|
| 517 |
+
|
| 518 |
+

|
| 519 |
+
Figure 8: Large- $\varepsilon$ adversarial examples, bounded in $\ell _ { \infty }$ -norm, similar to those in Figure 3.
|
| 520 |
+
|
| 521 |
+

|
| 522 |
+
Figure 9: Large- $\varepsilon$ adversarial examples, bounded in $\ell _ { 2 }$ -norm, similar to those in Figure 3.
|
| 523 |
+
|
| 524 |
+

|
| 525 |
+
|
| 526 |
+
# (c) Restricted ImageNet
|
| 527 |
+
|
| 528 |
+

|
| 529 |
+
Figure 10: Visualization of the gradient of the loss with respect to input features (pixels) for standard and adversarially trained networks for 10 randomly chosen samples, similar to those in Figure 2. Gradients are significantly more interpretable for adversarially trained networks – they align almost perfectly with perceptually relevant features. For MNIST, blue and red pixels denote positive and negative gradient regions respectively. For CIFAR10 and Restricted ImageNet we clip pixel to 3 standard deviations and scale to [0, 1].
|
md/train/SyxKrySYPr/SyxKrySYPr.md
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# STABILIZING TRANSFORMERS FOR REINFORCEMENT LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Owing to their ability to both effectively integrate information over long time horizons and scale to massive amounts of data, self-attention architectures have recently shown breakthrough success in natural language processing (NLP), achieving state-of-the-art results in domains such as language modeling and machine translation. Harnessing the transformer’s ability to process long time horizons of information could provide a similar performance boost in partially observable reinforcement learning (RL) domains, but the large-scale transformers used in NLP have yet to be successfully applied to the RL setting. In this work we demonstrate that the standard transformer architecture is difficult to optimize, which was previously observed in the supervised learning setting but becomes especially pronounced with RL objectives. We propose architectural modifications that substantially improve the stability and learning speed of the original Transformer and XL variant. The proposed architecture, the Gated Transformer-XL (GTrXL), surpasses LSTMs on challenging memory environments and achieves state-of-the-art results on the multi-task DMLab-30 benchmark suite, exceeding the performance of an external memory architecture. We show that the GTrXL, trained using the same losses, has stability and performance that consistently matches or exceeds a competitive LSTM baseline, including on more reactive tasks where memory is less critical. GTrXL offers an easy-to-train, simple-to-implement but substantially more expressive architectural alternative to the standard multi-layer LSTM ubiquitously used for RL agents in partially observable environments.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
It has been argued that self-attention architectures (Vaswani et al., 2017) deal better with longer temporal horizons than recurrent neural networks (RNNs): by construction, they avoid compressing the whole past into a fixed-size hidden state and they do not suffer from vanishing or exploding gradients in the same way as RNNs. Recent work has empirically validated these claims, demonstrating that self-attention architectures can provide significant gains in performance over the more traditional recurrent architectures such as the LSTM (Dai et al., 2019; Radford et al., 2019; Devlin et al., 2019; Yang et al., 2019). In particular, the Transformer architecture (Vaswani et al., 2017) has had breakthrough success in a wide variety of domains: language modeling (Dai et al., 2019; Radford et al., 2019; Yang et al., 2019), machine translation (Vaswani et al., 2017; Edunov et al., 2018), summarization (Liu & Lapata), question answering (Dehghani et al., 2018; Yang et al., 2019), multi-task representation learning for NLP (Devlin et al., 2019; Radford et al., 2019; Yang et al., 2019), and algorithmic tasks (Dehghani et al., 2018).
|
| 12 |
+
|
| 13 |
+
The repeated success of the transformer architecture in domains where sequential information processing is critical to performance makes it an ideal candidate for partially observable RL problems, where episodes can extend to thousands of steps and the critical observations for any decision often span the entire episode. Yet, the RL literature is dominated by the use of LSTMs as the main mechanism for providing memory to the agent (Espeholt et al., 2018; Kapturowski et al., 2019; Mnih et al., 2016). Despite progress at designing more expressive memory architectures (Graves et al., 2016; Wayne et al., 2018; Santoro et al., 2018) that perform better than LSTMs in memory-based tasks and partially-observable environments, they have not seen widespread adoption in RL agents perhaps due to their complex implementation, with the LSTM being seen as the go-to solution for environments where memory is required. In contrast to these other memory architectures, the transformer is well-tested in many challenging domains and has seen several open-source implementations in a variety of deep learning frameworks 1.
|
| 14 |
+
|
| 15 |
+
Motivated by the transformer’s superior performance over LSTMs and the widespread availability of implementations, in this work we investigate the transformer architecture in the RL setting. In particular, we find that the canonical transformer is significantly difficult to optimize, often resulting in performance comparable to a random policy. This difficulty in training transformers exists in the supervised case as well. Typically a complex learning rate schedule is required (e.g., linear warmup or cosine decay) in order to train (Vaswani et al., 2017; Dai et al., 2019), or specialized weight initialization schemes are used to improve performance (Radford et al., 2019). These measures do not seem to be sufficient for RL. In Mishra et al. (2018), for example, transformers could not solve even simple bandit tasks and tabular Markov Decision Processes (MDPs), leading the authors to hypothesize that the transformer architecture was not suitable for processing sequential information.
|
| 16 |
+
|
| 17 |
+
However in this work we succeed in stabilizing training with a reordering of the layer normalization coupled with the addition of a new gating mechanism to key points in the submodules of the transformer. Our novel gated architecture, the Gated Transformer-XL (GTrXL) (shown in Figure 1, Right), is able to learn much faster and more reliably and exhibit significantly better final performance than the canonical transformer. We further demonstrate that the GTrXL achieves state-ofthe-art results when compared to the external memory architecture MERLIN (Wayne et al., 2018) on the multitask DMLab-30 suite (Beattie et al., 2016). Additionally, we surpass LSTMs significantly on memory-based DMLab-30 levels while matching performance on the reactive set, as well as significantly outperforming LSTMs on memory-based continuous control and navigation environments. We perform extensive ablations on the GTrXL in challenging environments with both continuous actions and high-dimensional observations, testing the final performance of the various components as well as the GTrXL’s robustness to seed and hyperparameter sensitivity compared to LSTMs and the canonical transformer. We demonstrate a consistent superior performance while matching the stability of LSTMs, providing evidence that the GTrXL architecture can function as a drop-in replacement to the LSTM networks ubiquitously used in RL.
|
| 18 |
+
|
| 19 |
+
# 2 TRANSFORMER ARCHITECTURE AND VARIANTS
|
| 20 |
+
|
| 21 |
+
The transformer network consists of several stacked blocks that repeatedly apply self-attention to the input sequence. The transformer layer block itself has remained relatively constant since its original introduction (Vaswani et al., 2017; Liu et al., 2018; Radford et al., 2019). Each layer consists of two submodules: an attention operation followed by a position-wise multi-layer network (see Figure 1 (left)). The input to the transformer block is an embedding from the previous layer $E ^ { ( l - 1 ) } \in \bar { \mathbb { R } } ^ { T \times D }$ , where $T$ is the number of time steps, $D$ is the hidden dimension, and $l \in [ 0 , L ]$ is the layer index with $L$ being the total number of layers. We assume $E ^ { ( 0 ) }$ is an arbitrarily-obtained input embedding of dimension $[ T , D ]$ , e.g. a word embedding in the case of language modeling or an embedding of the per-timestep observations in an RL environment.
|
| 22 |
+
|
| 23 |
+
Multi-Head Attention: The Multi-Head Attention (MHA) submodule computes in parallel $H$ softattention operations for every time step. A residual connection (He et al., 2016a) and layer normalization (Ba et al., 2016) are then applied to the output (see Appendix C for more details):
|
| 24 |
+
|
| 25 |
+
$$
|
| 26 |
+
\begin{array} { r } { \overline { { Y } } ^ { ( l ) } = \mathbf { M } \mathbf { u } \mathbf { l } \mathrm { t i } \mathbf { H } \mathrm { e a d } \mathbf { A } \mathrm { t t e n t i o n } ( E ^ { ( l - 1 ) } ) , \quad \hat { Y } ^ { ( l ) } = E ^ { ( l - 1 ) } + \overline { { Y } } ^ { ( l ) } , \quad Y ^ { ( l ) } = \mathbf { L } \mathbf { a } \mathbf { y } \mathrm { e r N o r m } ( \hat { Y } ^ { ( l ) } ) , } \end{array}
|
| 27 |
+
$$
|
| 28 |
+
|
| 29 |
+
Multi-Layer Perceptron: The Multi-Layer Perceptron (MLP) submodule applies a $1 \times 1$ temporal convolutional network $f ^ { ( l ) }$ (i.e., kernel size 1, stride 1) over every step in the sequence, producing a new embedding tensor $E ^ { ( l ) } \in \mathbb { R } ^ { T \times D }$ . As in Dai et al. (2019), the network output does not include an activation function. After the MLP, there is a residual update followed by layer normalization:
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
\begin{array} { r } { \overline { { E } } ^ { ( l ) } = f ^ { ( l ) } ( Y ^ { ( l ) } ) , \qquad \hat { E } ^ { ( l ) } = Y ^ { ( l ) } + \overline { { E } } ^ { ( l ) } , \qquad E ^ { ( l ) } = \mathrm { L a y e r N o r m } ( \hat { E } ^ { ( l ) } ) . } \end{array}
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
Relative Position Encodings: The basic MHA operation does not take sequence order into account explicitly because it is permutation invariant. Positional encodings are a widely used solution in domains like language where order is an important semantic cue, appearing in the original transformer architecture (Vaswani et al., 2017). To enable a much larger contextual horizon than would otherwise be possible, we use the relative position encodings and memory scheme used in Dai et al. (2019). In this setting, there is an additional $\tau$ -step memory tensor $M ^ { ( l ) } \in \mathbb { R } ^ { T \times D }$ , which is treated as constant during weight updates. The MHA submodule then becomes:
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 1: Transformer variants, showing just a single layer block (there are $L$ layers total). Left: Canonical Transformer(-XL) block with multi-head attention and position-wise MLP submodules and the standard layer normalization (Ba et al., 2016) placement with respect to the residual connection (He et al., 2016a). Center: TrXL-I moves the layer normalization to the input stream of the submodules. Coupled with the residual connections, there is a gradient path that flows from output to input without any transformations. Right: The GTrXL block, which additionally adds a gating layer in place of the residual connection of the TrXL-I.
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { r l } & { \overline { { Y } } ^ { ( l ) } = \mathrm { R e l a t i v e M u l t i H e a d A t t e n t i o n } ( \mathrm { S t o p G r a d } ( M ^ { ( l - 1 ) } ) , E ^ { ( l - 1 ) } ) } \\ & { \hat { Y } ^ { ( l ) } = E ^ { ( l - 1 ) } + \overline { { Y } } ^ { ( l ) } , \qquad Y ^ { ( l ) } = \mathrm { L a y e r N o r m } ( \hat { Y } ^ { ( l ) } ) } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where StopGrad is a stop-gradient function that prevents gradients flowing backwards during backpropagation. We refer to Appendix $\textrm { C }$ for a more detailed description.
|
| 45 |
+
|
| 46 |
+
# 3 GATED TRANSFORMER ARCHITECTURES
|
| 47 |
+
|
| 48 |
+
While the transformer architecture has achieved breakthrough results in modeling sequences for supervised learning tasks (Vaswani et al., 2017; Liu et al., 2018; Dai et al., 2019), a demonstration of the transformer as a useful RL memory has been notably absent. Previous work has highlighted training difficulties and poor performance (Mishra et al., 2018). When transformers have not been used for temporal memory but instead as a mechanism for attention over the input space, they have had success—notably in the challenging multi-agent Starcraft 2 environment (Vinyals et al., 2019). Here, the transformer was applied solely across Starcraft units and not over time.
|
| 49 |
+
|
| 50 |
+
Multiplicative interactions have been successful at stabilizing learning across a wide variety of architectures (Hochreiter & Schmidhuber, 1997; Srivastava et al., 2015; Cho et al., 2014). Motivated by this, we propose the introduction of powerful gating mechanisms in place of the residual connections within the transformer block, coupled with changes to the order of layer normalization in the submodules. As will be empirically demonstrated, the “Identity Map Reordering” and gating mechanisms are critical for stabilizing learning and improving performance.
|
| 51 |
+
|
| 52 |
+
# 3.1 IDENTITY MAP REORDERING
|
| 53 |
+
|
| 54 |
+
Our first change is to place the layer normalization on only the input stream of the submodules, a modification described in several previous works (He et al., 2016b; Radford et al., 2019; Baevski & Auli, 2019). The model using this Identity Map Reordering is termed TrXL-I in the following, and is depicted visually in Figure 1 (center). A key benefit to this reordering is that it now enables an identity map from the input of the transformer at the first layer to the output of the transformer after the last layer. This is in contrast to the canonical transformer, where there are a series of layer normalization operations that non-linearly transform the state encoding. Because the layer norm reordering causes a path where two linear layers are applied in sequence, we apply a ReLU activation to each sub-module output before the residual connection (see Appendix C for equations).
|
| 55 |
+
|
| 56 |
+
The TrXL-I already exhibits a large improvement in stability and performance over TrXL (see Section 4.3.1). One hypothesis as to why the Identity Map Reordering improves results is as follows: assuming that the submodules at initialization produce values that are in expectation near zero, the state encoding is passed un-transformed to the policy and value heads, enabling the agent to learn a Markovian policy at the start of training (i.e., the network is initialized such that $\bar { \pi ( } \cdot | s _ { t } , \dots , s _ { 1 } ) \approx \pi ( \cdot | s _ { t } )$ and $V ^ { \bar { \pi } } ( s _ { t } | s _ { t - 1 } , \ldots , s _ { 1 } ) \approx \bar { V ^ { \pi } } ( s _ { t } | s _ { t - 1 } ) )$ . In many environments, reactive behaviours need to be learned before memory-based ones can be effectively utilized, i.e., an agent needs to learn how to walk before it can learn how to remember where it has walked.
|
| 57 |
+
|
| 58 |
+
# 3.2 GATING LAYERS
|
| 59 |
+
|
| 60 |
+
We further improve performance and optimization stability by replacing the residual connections in Equations 4 and 2 with gating layers. We call the gated architecture with the identity map reordering the Gated Transformer(-XL) (GTrXL). The final GTrXL layer block is written below:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { r l } & { \overline { { Y } } ^ { ( l ) } = \mathrm { R e l a t i v e M u l t i H e a d A t t e n t i o n } ( \mathrm { L a y e r N o r m } ( \left[ \mathrm { S t o p G r a d } ( M ^ { ( l - 1 ) } ) , E ^ { ( l - 1 ) } \right] ) ) } \\ & { { Y } ^ { ( l ) } = g _ { \mathrm { M H A } } ^ { ( l ) } ( E ^ { ( l - 1 ) } , \mathrm { R e L U } ( \overline { { Y } } ^ { ( l ) } ) ) } \\ & { \overline { { E } } ^ { ( l ) } = f ^ { ( l ) } ( \mathrm { L a y e r N o r m } ( Y ^ { ( l ) } ) ) } \\ & { E ^ { ( l ) } = g _ { \mathrm { M L P } } ^ { ( l ) } ( Y ^ { ( l ) } , \mathrm { R e L U } ( \overline { { E } } ^ { ( l ) } ) ) } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $g$ is a gating layer function. A visualization of our final architecture is shown in Figure 1 (right), with the modifications from the canonical transformer highlighted in red. In our experiments we ablate a variety of gating layers with increasing expressivity:
|
| 67 |
+
|
| 68 |
+
Input: The gated input connection has a sigmoid modulation on the input stream, similar to the short-cut-only gating from He et al. (2016b):
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
g ^ { ( l ) } ( x , y ) = \sigma ( W _ { g } ^ { ( l ) } x ) \odot x + y
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
Output: The gated output connection has a sigmoid modulation on the output stream:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
g ^ { ( l ) } ( x , y ) = x + \sigma ( W _ { g } ^ { ( l ) } x - b _ { g } ^ { ( l ) } ) \odot y
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
Highway: The highway connection (Srivastava et al., 2015) modulates both streams with a sigmoid:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
g ^ { ( l ) } ( x , y ) = \sigma ( W _ { g } ^ { ( l ) } x + b _ { g } ^ { ( l ) } ) \odot x + ( 1 - \sigma ( W _ { g } ^ { ( l ) } x + b _ { g } ^ { ( l ) } ) ) \odot y
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
Sigmoid-Tanh: The sigmoid-tanh (SigTanh) gate (Van den Oord et al., 2016) is similar to the Output gate but with an additional tanh activation on the output stream:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
g ^ { ( l ) } ( x , y ) = x + \sigma ( W _ { g } ^ { ( l ) } y - b ) \odot \operatorname { t a n h } ( U _ { g } ^ { ( l ) } y )
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Gated-Recurrent-Unit-type gating: The Gated Recurrent Unit (GRU) (Chung et al., 2014) is a recurrent network that performs similarly to an LSTM (Hochreiter & Schmidhuber, 1997) but has fewer parameters. We adapt its powerful gating mechanism as an untied activation function in depth:
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\begin{array} { r l } { r = \sigma ( W _ { r } ^ { ( l ) } y + U _ { r } ^ { ( l ) } x ) , \quad } & { z = \sigma ( W _ { z } ^ { ( l ) } y + U _ { z } ^ { ( l ) } x - b _ { g } ^ { ( l ) } ) , \quad \quad \hat { h } = \mathrm { t a n h } ( W _ { g } ^ { ( l ) } y + U _ { g } ^ { ( l ) } ( r \odot x ) ) , } \\ & { \quad \quad g ^ { ( l ) } ( x , y ) = ( 1 - z ) \odot x + z \odot \hat { h } . } \end{array}
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
Gated Identity Initialization: We have claimed that the Identity Map Reordering aids policy optimization because it initializes the agent close to a Markovian policy $/$ value function. If this is indeed the cause of improved stability, we can explicitly initialize the various gating mechanisms to be close to the identity map. This is the purpose of the bias $b _ { g } ^ { ( l ) }$ in the applicable gating layers. We later demonstrate in an ablation that initially setting $b _ { g } ^ { ( l ) } > 0$ can greatly improve learning speed.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 2: Average return on DMLab-30, re-scaled such that a human has mean 100 score on each level and a random policy has 0. Left: Results averaged over the full DMLab-30 suite. Right: DMLab-30 partitioned into a “Memory” and “Reactive” split (described in Appendix D). The GTrXL has a substantial gain over LSTM in memory-based environments, while even slightly surpassing performance on the reactive set. We plot 6-8 hyperparameter settings per architecture (see Appendix B). MERLIN scores obtained from personal communication with the authors.
|
| 102 |
+
|
| 103 |
+
# 4 EXPERIMENTS
|
| 104 |
+
|
| 105 |
+
In this section, we provide experiments on a variety of challenging single and multi-task RL domains: DMLab-30 (Beattie et al., 2016), Numpad and Memory Maze (see Fig. 8). Crucially we demonstrate that the proposed Gated Transformer-XL (GTrXL) not only shows substantial improvements over LSTMs on memory-based environments, but suffers no degradation of performance on reactive environments. The GTrXL also exceeds MERLIN (Wayne et al., 2018), an external memory architecture which used a Differentiable Neural Computer (Graves et al., 2016) coupled with auxiliary losses, surpassing its performance on both memory and reactive tasks.
|
| 106 |
+
|
| 107 |
+
For all transformer architectures except when otherwise stated, we train relatively deep 12-layer networks with embedding size 256 and memory size 512. These networks are comparable to the state-of-the-art networks in use for small language modeling datasets (see enwik8 results in (Dai et al., 2019)). We chose to train deep networks in order to demonstrate that our results do not necessarily sacrifice complexity for stability, i.e. we are not making transformers stable for RL simply by making them shallow. Our networks have receptive fields that can potentially span any episode in the environments tested, with an upper bound on the receptive field of 6144 (12 layers $\times$ 512 memory (Dai et al., 2019)). Future work will look at scaling transformers in RL even further, e.g. towards the 52-layer network in Radford et al. (2019). See App. B for experimental details.
|
| 108 |
+
|
| 109 |
+
For all experiments, we used V-MPO (Anonymous Authors, 2019), an on-policy adaptation of Maximum a Posteriori Policy Optimization (MPO) (Abdolmaleki et al., 2018a;b) that performs approximate policy iteration based on a learned state-value function $V ( s )$ instead of the state-action value function used in MPO. Rather than directly updating the parameters in the direction of the policy gradient, V-MPO uses the estimated advantages to first construct a target distribution for the policy update subject to a sample-based KL constraint, then calculates the gradient that partially moves the parameters toward that target, again subject to a KL constraint. V-MPO was shown to achieve state-of-the-art results for LSTM-based agents on the multi-task DMLab-30 benchmark suite.
|
| 110 |
+
|
| 111 |
+
# 4.1 TRANSFORMER AS EFFECTIVE RL MEMORY ARCHITECTURE
|
| 112 |
+
|
| 113 |
+
We first present results of the best performing GTrXL variant, the GRU-type gating, against a competitive LSTM baseline, demonstrating a substantial improvement on the multi-task DMLab-30 do
|
| 114 |
+
|
| 115 |
+
<table><tr><td>Model</td><td>Mean Human Norm.</td><td>Mean Human Norm., 1OO-capped</td></tr><tr><td>LSTM TrXL</td><td>99.3 ± 1.0 5.0 ± 0.2</td><td>84.0± 0.4 5.0± 0.2</td></tr><tr><td>TrXL-I MERLIN@100B</td><td>107.0 ± 1.2</td><td>87.4 ± 0.3 89.4</td></tr><tr><td>GTrXL (GRU)</td><td>115.2 117.6 ± 0.3</td><td>89.1±0.2</td></tr><tr><td>GTrXL (Input)</td><td>51.2 ± 13.2</td><td>47.6 ± 12.1</td></tr><tr><td>GTrXL (Output)</td><td>112.8 ± 0.8</td><td>87.8 ± 0.3</td></tr><tr><td>GTrXL (Highway)</td><td>90.9 ± 12.9</td><td>75.2 ± 10.4</td></tr><tr><td>GTrXL (SigTanh)</td><td>101.0 ± 1.3</td><td>83.9 ± 0.7</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 1: Final human-normalized return averaged across all 30 DMLab levels for baselines and GTrXL variants. We also include the 100-capped score where the per-level mean score is clipped at 100, providing a metric that is proportional to the percentage of levels that the agent is superhuman. We see that the GTrXL (GRU) surpasses LSTM by a significant gap and exceeds the performance of MERLIN (Wayne et al., 2018) trained for 100 billion environment steps. The GTrXL (Output) and the proposed reordered TrXL-I also surpass LSTM but perform slightly worse than MERLIN and are not as robust as GTrXL (GRU) (see Sec. 4.3.2). We sample 6-8 hyperparameters per model. We include standard error over runs.
|
| 118 |
+
|
| 119 |
+

|
| 120 |
+
Figure 3: Numpad results demonstrating that the GTrXL has much better memory scaling properties than LSTM. Left: As the Numpad environment’s memory requirement increases (because of larger pad size), the GTrXL suffers much less than LSTM. However, because of the combinatorial nature of Numpad, the GTrXL eventually also starts dropping in performance at $4 \mathbf { x } 4$ . We plot mean and standard error of the last 200 episodes after training each model for 0.15B, 1.0B and 2.0B environment steps for Numpad size 2, 3 and 4, respectively. Center, Right: Learning curves for the GTrXL on $2 \times 2$ and $4 \times 4$ Numpad. Even when the LSTM is trained for twice as long, the GTrXL still has a substantial improvement over it. We plot 5 hyperparameter settings per model for learning curves.
|
| 121 |
+
|
| 122 |
+
main (Beattie et al., 2016). DMLab-30 is a large-scale, multitask benchmark comprising 30 firstperson 3D environments with image observations and has been widely used as a benchmark for architectural and algorithmic improvements (Wayne et al., 2018; Espeholt et al., 2018; Kapturowski et al., 2019; Hessel et al., 2018). The levels test a wide agent competencies such as language comprehension, navigation, handling of partial observability, memory, planning, and other forms of long horizon reasoning, with episodes lasting over 4000 environment steps. Figure 2 shows mean return over all levels as training progresses, where the return is human normalized as done in previous work (meaning a human has a per-level mean score of 100 and a random policy has a score of 0), while Table 1 has the final performance at 10 billion environment steps. The GTrXL has a significant gap over a 3-layer LSTM baseline trained using the same V-MPO algorithm. Furthermore, we included the final results of a previously-published external memory architecture, MERLIN (Wayne et al., 2018). Because MERLIN was trained for 100 billion environment steps with a different algorithm, IMPALA (Espeholt et al., 2018), and also involved an auxiliary loss critical for the memory component to function, the learning curves are not directly comparable and we only report the final performance of the architecture as a dotted line. Despite the differences, our results demonstrate that the GTrXL can match the previous state-of-the-art on DMLab-30. An informative split between a set of memory-based levels and more reactive ones (listed in Appendix D) reveals that our model specifically has large improvements in environments where memory plays a critical role. Meanwhile, GTrXL also shows improvement over LSTMs on the set of reactive levels, as memory can still be effectively utilized in some of these levels.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 4: Learning curves for the gating mechanisms, along with MERLIN score at 100 billion frames as a reference point. We can see that the GRU performs as well as any other gating mechanism on the reactive set of tasks. On the memory environments, the GRU gating has a significant gain in learning speed and attains the highest final performance at the fastest rate. We plot both mean (bold) and the individual 6-8 hyperparameter samples per model (light).
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 5: Sensitivity analysis of GTrXL variants versus $\mathrm { T r X L }$ and LSTM baselines. We sample 25 different hyperparameter sets and seeds and plot the ranked average return at 3 points during training (0.5B, 1.0B and 2.0B environment steps). Higher and flatter lines indicate more robust architectures. The same hyperparameter sampling distributions were used across models (see Appendix B). We plot human performance as a dotted line.
|
| 129 |
+
|
| 130 |
+
# 4.2 SCALING WITH MEMORY HORIZON
|
| 131 |
+
|
| 132 |
+
We next demonstrate that the GTrXL scales better compared to an LSTM when an environment’s temporal horizon is increased, using the “Numpad” continuous control task of Humplik et al. (2019) which allows an easy combinatorial increase in the temporal horizon. In Numpad, a robotic agent is situated on a platform resembling the $3 { \tt X } 3$ number pad of a telephone (generalizable to $N \times N$ pads). The agent can interact with the pads by colliding with them, causing them to be activated (visualized in the environment state as the number pad glowing). The goal of the agent is to activate a specific sequence of up to $N ^ { 2 }$ numbers, but without knowing this sequence a priori. The only feedback the agent gets is by activating numbers: if the pad is the next one in the sequence, the agent gains a reward of $+ 1$ , otherwise all activated pads are cleared and the agent must restart the sequence. Each correct number in the sequence only provides reward once, i.e. each subsequent activation of that number will no longer provide rewards. Therefore the agent must explicitly develop a search strategy to determine the correct pad sequence. Once the agent completes the full sequence, all pads are reset and the agent gets a chance to repeat the sequence again for more reward. This means higher reward directly translates into how well the pad sequence has been memorized. An image of the scenario is provided in Figure 3. There is the restriction that contiguous pads in the sequence must be contiguous in space, i.e. the next pad in the sequence can only be in the Moore neighborhood of the previous pad. Furthermore, no pad can be pressed twice in the sequence.
|
| 133 |
+
|
| 134 |
+
We present two results in this environment in Figure 3. The first measures the final performance of the trained models as a function of the pad size. We can see that LSTM performs badly on all 3 pad sizes, and performs worse as the pad size increases from 2 to 4. The GTrXL performs much better, and almost instantly solves the environment with its much more expressive memory. On the center and right images, we provide learning curves for the $2 \times 2$ and $4 \times 4$ Numpad environments, and show that even when the LSTM is trained twice as long it does not reach GTrXL’s performance.
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
Figure 6: Learning curves comparing a thinner GTrXL (GRU) with half the embedding dimension of the other presented gated variants and TrXL baselines. The Thin GTrXL (GRU) has fewer parameters than any other model presented but still matches the performance of the best performing counterpart, the GTrXL (Output), which has over 10 million more parameters. We plot both mean (bold) and 6-8 hyperparameter settings (light) per model.
|
| 138 |
+
|
| 139 |
+
Table 2: Parameter-controlled ablation. We report standard error of the means of 6-8 runs per model.
|
| 140 |
+
|
| 141 |
+
<table><tr><td>Model</td><td>Mean Human Norm. Score</td><td>#Param. Millions</td></tr><tr><td>LSTM</td><td>99.3 ±1.0</td><td>9.25M</td></tr><tr><td>Large LSTM</td><td>103.5 ± 0.9</td><td>51.3M</td></tr><tr><td>TrXL</td><td>5.0± 0.2</td><td>28.6M</td></tr><tr><td>TrXL-I</td><td>107.0 ± 1.2</td><td>28.6M</td></tr><tr><td>Thin GTrXL (GRU)</td><td>111.5 ± 0.6</td><td>22.4M</td></tr><tr><td>GTrXL (GRU)</td><td>117.6 ± 0.3</td><td>66.4M</td></tr><tr><td>GTrXL (Input)</td><td>51.2 ±13.2</td><td>34.9M</td></tr><tr><td>GTrXL (Output)</td><td>112.8 ± 0.8</td><td>34.9M</td></tr><tr><td>GTrXL (Highway)</td><td>90.9 ± 12.9</td><td>34.9M</td></tr><tr><td>GTrXL (SigTanh)</td><td>101.0 ± 1.3</td><td>41.2M</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 3: Percentage of the 25 parameter settings where the training loss diverged within 2 billion env. steps. We do not report numbers for GTrXL gating types that were unstable in DMLab-30. For diverged runs we plot the returns in Figure 5 as 0 afterwards.
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Model</td><td>% Diverged</td></tr><tr><td>LSTM</td><td>0%</td></tr><tr><td>TrXL</td><td>0%</td></tr><tr><td>TrXL-I</td><td>16%</td></tr><tr><td>GTrXL(GRU)</td><td>0%</td></tr><tr><td>GTrXL (Output)</td><td>12%</td></tr></table>
|
| 146 |
+
|
| 147 |
+
# 4.3 GATING VARIANTS $^ +$ IDENTITY MAP REORDERING
|
| 148 |
+
|
| 149 |
+
We demonstrated that the GRU-type-gated GTrXL can achieve state-of-the-art results on DMLab30, surpassing both a deep LSTM and an external memory architecture, and also that the GTrXL has a memory which scales better with the memory horizon of the environment. However, the question remains whether the expressive gating mechanisms of the GRU could be replaced by simpler alternatives. In this section, we perform extensive ablations on the gating variants described in Section 3.2, and show that the GTrXL (GRU) has improvements in learning speed, final performance and optimization stability over all other models, even when controlling for the number of parameters.
|
| 150 |
+
|
| 151 |
+
# 4.3.1 PERFORMANCE ABLATION
|
| 152 |
+
|
| 153 |
+
We first report the performance of the gating variants in DMLab-30. Table 1 and Figure 4 show the final performance and training curves of the various gating types in both the memory / reactive split, respectively. The canonical TrXL completely fails to learn, while the TrXL-I improves over the LSTM. Of the gating varieties, the GTrXL (Output) can recover a large amount of the performance of the GTrXL (GRU), especially in the reactive set, but as shown in Sec. 4.3.2 is generally far less stable. The GTrXL (Input) performs worse than even the TrXL-I, reinforcing the identity map path hypothesis. Finally, the GTrXL (Highway) and GTrXL (SigTanh) are more sensitive to the hyperparameter settings compared to the alternatives, with some settings doing worse than TrXL-I.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 7: Ablation of the gated identity initialization on Memory Maze by comparing 10 runs of a model run with the bias initialization and 10 runs of a model without. Every run has independently sampled hyperparameters from a distribution. We plot the ranked mean return of the 10 runs of each model at 1, 2, and 4 billion environment steps. Each mean return is the average of the past 200 episodes at the point of the model snapshot. We plot human performance as a dotted line.
|
| 157 |
+
|
| 158 |
+
# 4.3.2 HYPERPARAMETER AND SEED SENSITIVITY
|
| 159 |
+
|
| 160 |
+
Beyond improved performance, we next demonstrate a significant reduction in hyperparameter and seed sensitivity for the GTrXL (GRU) compared to baselines and other GTrXL variants. We use the “Memory Maze” environment, a memory-based navigation task in which the agent must discover the location of an apple randomly placed in a maze of blocks. The agent receives a positive reward for collecting the apple and is then teleported to a random location in the maze, with the apple’s position held fixed. The agent can make use of landmarks situated around the room to return as quickly as possible to the apple for subsequent rewards. Therefore, an effective mapping of the environment results in more frequent returns to the apple and higher reward.
|
| 161 |
+
|
| 162 |
+
We chose to perform the sensitivity ablation on Memory Maze because (1) it requires the use of longrange memory to be effective and (2) it includes both continuous and discrete action sets (details in Appendix A) which makes optimization more difficult. In Figure 5, we sample 25 independent V-MPO hyperparameter settings from a wide range of values and train the networks to 2 billion environment steps (see Appendix B). Then, at various points in training (0.5B, 1.0B and 2.0B), we rank all runs by their mean return and plot this ranking. Models with curves which are both higher and flatter are thus more robust to hyperparameters and random seeds. Our results demonstrate that (1) the GTrXL (GRU) can learn this challenging memory environment in much fewer environment steps than LSTM, and (2) that GTrXL (GRU) beats the other gating variants in stability by a large margin, thereby offering a substantial reduction in necessary hyperparameter tuning. The values in Table 3 list what percentage of the 25 runs per model had losses that diverged to infinity. We can see that the only model reaching human performance in 2 billion environment steps is the GTrXL (GRU), with 10 runs having a mean score 8 and above.
|
| 163 |
+
|
| 164 |
+
# 4.3.3 PARAMETER COUNT-CONTROLLED COMPARISONS
|
| 165 |
+
|
| 166 |
+
For the final gating ablation, we compare transformer variants while tracking their total parameter count to control for the increase in capacity caused by the introduction of additional parameters in the gating mechanisms. To demonstrate that the advantages of the GTrXL (GRU) are not solely due to an increase in parameter count, we halve the number of attention heads (which also effectively halves the embedding dimension due to the convention that the embedding size is the number of heads multiplied by the attention head dimension). The effect is a substantial reduction in parameter count, resulting in less parameters than even the canonical TrXL. Fig. 6 and Tab. 2 compare the different models to the “Thin” GTrXL (GRU), with Tab. 2 listing the parameter counts. We include a parameter-matched LSTM model with 12 layers and 512 hidden size. The Thin GTrXL (GRU) surpasses every other model (within variance) except the GTrXL (GRU), even surpassing the next best-performing model, the GTrXL (Output), with over 10 million less parameters.
|
| 167 |
+
|
| 168 |
+
# 4.3.4 GATED IDENTITY INITIALIZATION ABLATION
|
| 169 |
+
|
| 170 |
+
All applicable gating variants in the previous sections were trained with the gated identity initialization. We observed in initial Memory Maze results that the gated identity initialization significantly improved optimization stability and learning speed. Figure 7 compares an otherwise identical 4- layer GTrXL (GRU) trained with and without the gated identity initialization. Similarly to the previous sensitivity plots, we plot the ranked mean return of 10 runs at various times during training. As can be seen from Fig. 7, there is a significant gap caused by the bias initialization, suggesting that preconditioning the transformer to be close to Markovian results in large learning speed gains.
|
| 171 |
+
|
| 172 |
+
# 5 RELATED WORK
|
| 173 |
+
|
| 174 |
+
Gating has been shown to be effective to address the vanishing gradient problem and thus improve the learnability of recurrent models. LSTM networks (Hochreiter & Schmidhuber, 1997; Graves, 2013) rely on an input, forget and output gate that protect the update of the cell. GRU (Chung et al., 2014; Cho et al., 2014) is another popular gated recurrent architecture that simplifies the LSTM cell, reducing the number of gates to two. Finding an optimal gating mechanism remains an active area of research, with other existing proposals (Krause et al., 2016; Kalchbrenner et al., 2015; Wu et al., 2016), as well as works trying to discover optimal gating by neural architecture search (Zoph & Le, 2017) More generally, gating and multiplicative interactions have a long history (Rumelhart et al., 1986). Gating has been investigated previously for improving the representational power of feedforward and recurrent models (Van den Oord et al., 2016; Dauphin et al., 2017), as well as learnability (Srivastava et al., 2015; Zilly et al., 2017). Initialization has also played a crucial role in making deep models trainable (LeCun et al., 1998; Glorot & Bengio, 2010; Sutskever et al., 2013).
|
| 175 |
+
|
| 176 |
+
There has been a wide variety of work looking at improving memory in reinforcement learning agents. External memory approaches typically have a regular feedforward or recurrent policy interact with a memory database through read and write operations. Priors are induced through the design of the specific read/write operations, such as those resembling a digital computer (Wayne et al., 2018; Graves et al., 2016) or an environment map (Parisotto & Salakhutdinov, 2018; Gupta et al., 2017). An alternative non-parametric perspective to memory stores an entire replay buffer of the agent’s past observations, which is made available for the agent to itself reason over either through fixed rules (Blundell et al., 2016) or an attention operation (Pritzel et al., 2017). Others have looked at improving performance of LSTM agents by extending the architecture with stacked hierarchical connections / multiple temporal scales and auxiliary losses (Jaderberg et al., 2019; Stooke et al., 2019) or allowing an inner-loop update to the RNN weights (Miconi et al., 2018). Other work has examined self-attention in the context of exploiting relational structure within the inputspace (Zambaldi et al., 2019) or within recurrent memories (Santoro et al., 2018).
|
| 177 |
+
|
| 178 |
+
# 6 CONCLUSION
|
| 179 |
+
|
| 180 |
+
In this paper we provided evidence that confirms previous observations in the literature that standard transformer models are unstable to train in the RL setting and often fail to learn completely (Mishra et al., 2018). We presented a new architectural variant of the transformer model, the GTrXL, which has increased performance, more stable optimization, and greater robustness to initial seed and hyperparameters than the canonical architecture. The key contributions of the GTrXL are reordered layer normalization modules and a gating layer instead of the standard residual connection. We performed extensive ablation experiments testing the robustness, ease of optimization and final performance of the gating layer variations, as well as the effect of the reordered layer normalization. These results empirically demonstrate that the GRU-type gating performs best across all metrics, exhibiting comparable robustness to hyperparameters and random seeds as an LSTM while still maintaining a performance improvement. Furthermore, the GTrXL (GRU) learns faster, more stably and achieves a higher final performance (even when controlled for parameters) than the other gating variants on the challenging multitask DMLab-30 benchmark suite.
|
| 181 |
+
|
| 182 |
+
Having demonstrated substantial and consistent improvement in DMLab-30, Numpad and Memory Maze over the ubiquitous LSTM architectures currently in use, the GTrXL makes the case for wider adoption of transformers in RL. A core benefit of the transformer architecture is its ability to scale to very large and deep models, and to effectively utilize this additional capacity in larger datasets. In future work, we hope to test the limits of the GTrXL’s ability to scale in the RL setting by providing it with a large and varied set of training environments.
|
| 183 |
+
|
| 184 |
+
REFERENCES
|
| 185 |
+
Abbas Abdolmaleki, Jost Tobias Springenberg, Jonas Degrave, Steven Bohez, Yuval Tassa, Dan Belov, Nicolas Heess, and Martin Riedmiller. Relative Entropy Regularized Policy Iteration. arXiv preprint, 2018a. URL https://arxiv.org/pdf/1812.02256.pdf.
|
| 186 |
+
Abbas Abdolmaleki, Jost Tobias Springenberg, Yuval Tassa, Remi Munos, Nicolas Heess, and Martin Riedmiller. Maximum a Posteriori Policy Optimisation. Int. Conf. Learn. Represent., 2018b. URL https://arxiv.org/pdf/1806.06920.pdf.
|
| 187 |
+
Anonymous Authors. V-MPO: On-Policy Maximum a Posteriori Policy Optimization for Discrete and Continuous Control. Under review, Int. Conf. Learn. Represent., 2019.
|
| 188 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 189 |
+
Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. Int. Conf. Learn. Represent., 2019.
|
| 190 |
+
Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, ¨ Andrew Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, et al. Deepmind lab. ´ arXiv preprint arXiv:1612.03801, 2016.
|
| 191 |
+
Charles Blundell, Benigno Uria, Alexander Pritzel, Yazhe Li, Avraham Ruderman, Joel Z Leibo, Jack Rae, Daan Wierstra, and Demis Hassabis. Model-free episodic control. arXiv preprint arXiv:1606.04460, 2016.
|
| 192 |
+
Peter Buchlovsky, David Budden, Dominik Grewe, Chris Jones, John Aslanides, Frederic Besse, Andy Brock, Aidan Clark, Sergio Gomez Colmenarejo, Aedan Pope, Fabio Viola, and Dan Belov. TF-Replicator: Distributed Machine Learning for Researchers. arXiv preprint, 2019. URL http://arxiv.org/abs/1902.00465.
|
| 193 |
+
Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
|
| 194 |
+
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
|
| 195 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2978–2988, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1285. URL https://www.aclweb.org/anthology/P19-1285.
|
| 196 |
+
Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 933–941. JMLR. org, 2017.
|
| 197 |
+
Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal transformers. Int. Conf. Learn. Represent., 2018.
|
| 198 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, 2019.
|
| 199 |
+
Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. Understanding back-translation at scale. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 489–500, 2018.
|
| 200 |
+
Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymyr Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, Shane Legg, and Koray Kavukcuoglu. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. In International Conference on Machine Learning, pp. 1406–1415, 2018.
|
| 201 |
+
|
| 202 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In In Proceedings of the International Conference on Artificial Intelligence and Statistics (AISTATS10). Society for Artificial Intelligence and Statistics, 2010.
|
| 203 |
+
|
| 204 |
+
Google. Cloud TPU, 2018. URL https://cloud.google.com/tpu/.
|
| 205 |
+
|
| 206 |
+
Alex Graves. Generating sequences with recurrent neural networks, 2013.
|
| 207 |
+
|
| 208 |
+
Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471, 2016.
|
| 209 |
+
|
| 210 |
+
Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2616–2625, 2017.
|
| 211 |
+
|
| 212 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016a.
|
| 213 |
+
|
| 214 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016b.
|
| 215 |
+
|
| 216 |
+
Matteo Hessel, Hubert Soyer, Lasse Espeholt, Wojciech Czarnecki, Simon Schmitt, and Hado van Hasselt. Multi-task Deep Reinforcement Learning with PopArt. arXiv preprint, 2018. URL https://arxiv.org/pdf/1809.04474.pdf.
|
| 217 |
+
|
| 218 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 219 |
+
|
| 220 |
+
Jan Humplik, Alexandre Galashov, Leonard Hasenclever, Pedro A. Ortega, Yee Whye Teh, and Nicolas Heess. Meta reinforcement learning as task inference. arXiv preprint, 2019. URL http://arxiv.org/abs/1905.06424.
|
| 221 |
+
|
| 222 |
+
Max Jaderberg, Wojciech M Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garcia Castaneda, Charles Beattie, Neil C Rabinowitz, Ari S Morcos, Avraham Ruderman, et al. Humanlevel performance in 3d multiplayer games with population-based reinforcement learning. Science, 364(6443):859–865, 2019.
|
| 223 |
+
|
| 224 |
+
Nal Kalchbrenner, Ivo Danihelka, and Alex Graves. Grid long short-term memory. 07 2015.
|
| 225 |
+
|
| 226 |
+
Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent experience replay in distributed reinforcement learning. Int. Conf. Learn. Represent., 2019.
|
| 227 |
+
|
| 228 |
+
Ben Krause, Liang Lu, Iain Murray, and Steve Renals. Multiplicative lstm for sequence modelling, 2016.
|
| 229 |
+
|
| 230 |
+
Yann LeCun, Leon Bottou, Genevieve B. Orr, and Klaus-Robert M ´ uller. Efficient backprop. In ¨ Neural Networks: Tricks of the Trade, This Book is an Outgrowth of a 1996 NIPS Workshop, pp. 9–50, London, UK, UK, 1998. Springer-Verlag. ISBN 3-540-65311-2. URL http://dl. acm.org/citation.cfm?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 645754.668382.
|
| 231 |
+
|
| 232 |
+
Peter J Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. Int. Conf. Learn. Represent., 2018.
|
| 233 |
+
|
| 234 |
+
Yang Liu and Mirella Lapata. Text summarization with pretrained encoders. Conference on Empirical Methods in Natural Language Processing.
|
| 235 |
+
|
| 236 |
+
Thomas Miconi, Kenneth Stanley, and Jeff Clune. Differentiable plasticity: training plastic neural networks with backpropagation. In International Conference on Machine Learning, pp. 3556– 3565, 2018.
|
| 237 |
+
|
| 238 |
+
Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A Simple Neural Attentive MetaLearner. Int. Conf. Learn. Represent., 2018. URL https://openreview.net/pdf?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ B1DmUzWAW.
|
| 239 |
+
|
| 240 |
+
Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937, 2016.
|
| 241 |
+
|
| 242 |
+
Michael Neunert, Abbas Abdolmaleki, Markus Wulfmeier, Thomas Lampe, Nicolas Heess, Roland Hafner, and Martin Riedmiller. Continuous-Discrete Deep Reinforcement Learning for Hybrid Control in Robotics. To appear in Conf. on Robot Learn. (CoRL), 2019.
|
| 243 |
+
|
| 244 |
+
Emilio Parisotto and Ruslan Salakhutdinov. Neural map: Structured memory for deep reinforcement learning. Int. Conf. Learn. Represent., 2018.
|
| 245 |
+
|
| 246 |
+
Alexander Pritzel, Benigno Uria, Sriram Srinivasan, Adria Puigdom \` enech Badia, Oriol Vinyals, \` Demis Hassabis, Daan Wierstra, and Charles Blundell. Neural episodic control. In International Conference on Machine Learning, pp. 2827–2836, 2017.
|
| 247 |
+
|
| 248 |
+
Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 249 |
+
|
| 250 |
+
D. E. Rumelhart, G. E. Hinton, and J. L. McClelland. Parallel distributed processing: Explorations in the microstructure of cognition, vol. 1. chapter 2: A General Framework for Parallel Distributed Processing, pp. 45–76. MIT Press, Cambridge, MA, USA, 1986. ISBN 0-262-68053-X. URL http://dl.acm.org/citation.cfm?id=104279.104286.
|
| 251 |
+
|
| 252 |
+
Adam Santoro, Ryan Faulkner, David Raposo, Jack Rae, Mike Chrzanowski, Theophane Weber, Daan Wierstra, Oriol Vinyals, Razvan Pascanu, and Timothy Lillicrap. Relational recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 7299–7310, 2018.
|
| 253 |
+
|
| 254 |
+
Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ arXiv preprint arXiv:1505.00387, 2015.
|
| 255 |
+
|
| 256 |
+
Adam Stooke, Valentin Dalibard, Siddhant M Jayakumar, Wojciech M Czarnecki, and Max Jaderberg. Perception-prediction-reaction agents for deep reinforcement learning. SPIRL Workshop, 2019.
|
| 257 |
+
|
| 258 |
+
Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In Sanjoy Dasgupta and David McAllester (eds.), Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pp. 1139–1147, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR. URL http://proceedings.mlr.press/v28/sutskever13.html.
|
| 259 |
+
|
| 260 |
+
Aaron Van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Conditional image generation with pixelcnn decoders. In Advances in neural information processing systems, pp. 4790–4798, 2016.
|
| 261 |
+
|
| 262 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, pp. 5998–6008, 2017. URL https://papers.nips.cc/paper/ 7181-attention-is-all-you-need.pdf.
|
| 263 |
+
|
| 264 |
+
Oriol Vinyals, Igor Babuschkin, Junyoung Chung, Michael Mathieu, Max Jaderberg, Wojtek Czarnecki, Andrew Dudzik, Aja Huang, Petko Georgiev, Richard Powell, Timo Ewalds, Dan Horgan, Manuel Kroiss, Ivo Danihelka, John Agapiou, Junhyuk Oh, Valentin Dalibard, David Choi, Laurent Sifre, Yury Sulsky, Sasha Vezhnevets, James Molloy, Trevor Cai, David Budden, Tom Paine, Caglar Gulcehre, Ziyu Wang, Tobias Pfaff, Toby Pohlen, Dani Yogatama, Julia Cohen, Katrina McKinney, Oliver Smith, Tom Schaul, Timothy Lillicrap, Chris Apps, Koray Kavukcuoglu, Demis Hassabis, and David Silver. AlphaStar: Mastering the Real-Time Strategy Game StarCraft II. https://deepmind.com/blog/ alphastar-mastering-real-time-strategy-game-starcraft-ii/, 2019.
|
| 265 |
+
|
| 266 |
+
Greg Wayne, Chia-Chun Hung, David Amos, Mehdi Mirza, Arun Ahuja, Agnieszka GrabskaBarwinska, Jack Rae, Piotr Mirowski, Joel Z. Leibo, Adam Santoro, Mevlana Gemici, Malcolm Reynolds, Tim Harley, Josh Abramson, Shakir Mohamed, Danilo Rezende, David Saxton, Adam Cain, Chloe Hillier, David Silver, Koray Kavukcuoglu, Matt Botvinick, Demis Hassabis, and Timothy Lillicrap. Unsupervised predictive memory in a goal-directed agent. arXiv preprint arXiv:1803.10760, 2018.
|
| 267 |
+
Yuhuai Wu, Saizheng Zhang, Ying Zhang, Yoshua Bengio, and Ruslan R Salakhutdinov. On multiplicative integration with recurrent neural networks. In Advances in neural information processing systems, pp. 2856–2864, 2016.
|
| 268 |
+
Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in Neural Information Processing Systems, 2019.
|
| 269 |
+
Vinicius Zambaldi, David Raposo, Adam Santoro, Victor Bapst, Yujia Li, Igor Babuschkin, Karl Tuyls, David Reichert, Timothy Lillicrap, Edward Lockhart, Murray Shanahan, Victoria Langston, Razvan Pascanu, Matthew Botvinick, Oriol Vinyals, and Peter Battaglia. Deep reinforcement learning with relational inductive biases. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HkxaFoC9KQ.
|
| 270 |
+
Julian Georg Zilly, Rupesh Kumar Srivastava, Jan Koutn´ık, and Jurgen Schmidhuber. Recurrent ¨ highway networks. In Proceedings of the 34th International Conference on Machine LearningVolume 70, pp. 4189–4198. JMLR. org, 2017.
|
| 271 |
+
Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. In ICLR, 2017. URL https://arxiv.org/abs/1611.01578.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure 8: Left: The Numpad environment, showing the controllable “sphere” robot and a full $3 { \bf x } 3$ pad. Pads are activated when the robot collides with their center. The robot can move on the plane as well as jump to avoid pressing numbers. Right: Top down view of “Memory Maze”: (1) Central chamber, (2) blocks among which the apple is placed, (3) landmarks the agent can use to locate the apple, (4) one of the possible location of the apple.
|
| 275 |
+
Table 4: Native action space for DMLab. See https://github.com/deepmind/lab/ blob/master/docs/users/actions.md for more details.
|
| 276 |
+
|
| 277 |
+
# APPENDIX
|
| 278 |
+
|
| 279 |
+
# A ENVIRONMENT DETAILS
|
| 280 |
+
|
| 281 |
+
Numpad: Numpad has three actions, two of which move the sphere towards some direction in the x,y plane and the third allows the agent to jump in order to get over a pad faster. The observation consists of a variety of proprioceptive information (e.g. position, velocity, acceleration) as well as which pads in the sequence have been correctly activated (these will shut off if an incorrect pad is later hit), and the previous action and reward. Episodes last a fixed 500 steps and the agent can repeat the correct sequence any number of times to receive reward. Observations were processed using a simple 2-layer MLP with tanh activations to produce the transformer’s input embedding.
|
| 282 |
+
|
| 283 |
+
DMLab-30: Ignoring the “jump” and “crouch” actions which we do not use, an action in the native DMLab action space consists of 5 integers whose meaning and allowed values are given in Table 4. Following previous work on DMLab (Hessel et al., 2018), we used the reduced action set given in Table 5 with an action repeat of 4. Observations are $7 2 \times 9 6$ RGB images. Some levels require a language input, and for that all models use an additional 64-dimension LSTM to process the sentence.
|
| 284 |
+
|
| 285 |
+
In Wayne et al. (2018), the DMLab Arbitrary Visuomotor Mapping task was specifically used to highlight the MERLIN architecture’s ability to utilize memory. In Figure 9 we show that, given a similarly reduced action set as used in Wayne et al. (2018), see Table 6, the GTrXL architecture can also reliably attain human-level performance on this task.
|
| 286 |
+
|
| 287 |
+
<table><tr><td>ACTION NAME</td><td>RANGE</td></tr><tr><td>LOOKLEFT_RIGHT_PIXELS_PER_FRAME</td><td>[-512, 512]</td></tr><tr><td>LOOK_DOWN_UP_PIXELS_PER_FRAME</td><td>[-512, 512]</td></tr><tr><td>STRAFE_LEFT_RIGHT</td><td>[-1, 1]</td></tr><tr><td>MOVE_BACK_FORWARD</td><td>[-1, 1]</td></tr><tr><td>FIRE</td><td>[0,1]</td></tr></table>
|
| 288 |
+
|
| 289 |
+
Memory Maze: An action in the native Memory Maze action space consists of 8 continuous actions and a single discrete action whose meaning and allowed values are given in Table 7. Unlike for DMLab, we used a hybrid continuous-discrete distribution (Neunert et al., 2019) to directly output policies in the game’s native action space. Observations are $7 2 \times 9 6$ RGB images.
|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
|
| 293 |
+
Figure 9: Learning curves for the DMLab Arbitrary Visuomotor Mapping task using a reduced action set.
|
| 294 |
+
|
| 295 |
+
<table><tr><td>ACTION</td><td>NATIVE DMLAB ACTION</td></tr><tr><td>Forward (FW)</td><td>0, 0, 0,</td></tr><tr><td>Backward (BW)</td><td>1, [ 0, 0, 0, -1,</td></tr><tr><td>Strafe left</td><td>0, 0, -1, 0,</td></tr><tr><td>Strafe right</td><td>0, 0, 1,</td></tr><tr><td>Small look left (LL)</td><td>[-10, 0, 0,</td></tr><tr><td>Small look right (LR)</td><td>[10, 0,</td></tr><tr><td>Large look left (LL)</td><td>0, [-60, 0, 0,</td></tr><tr><td>Large look right (LR)</td><td>[60, 0, 0,</td></tr><tr><td>Look down</td><td>0, 10,</td></tr><tr><td>Look up</td><td>0, -10,</td></tr><tr><td>FW + small LL</td><td>0,</td></tr><tr><td>FW+ small LR</td><td>[-10, [10,</td></tr><tr><td>FW + large LL</td><td>0, [-60,</td></tr><tr><td>FW + large LR</td><td>0, [60, 0,</td></tr><tr><td></td><td>0, 0,</td></tr><tr><td>Fire</td><td>[0, 0,</td></tr></table>
|
| 296 |
+
|
| 297 |
+
Table 5: Simplified action set for DMLab from Hessel et al. (2018).
|
| 298 |
+
Table 6: Simplified action set for DMLab Arbitrary Visuomotor Mapping (AVM). This action set is the same as the one used for AVM in Wayne et al. (2018) but with an additional no-op, which may also be replaced with the Fire action.
|
| 299 |
+
|
| 300 |
+
<table><tr><td>ACTION</td><td colspan="4">NATIVE DMLAB ACTION</td></tr><tr><td>Small look left (LL)</td><td>[-10,</td><td>0,</td><td>0,</td><td>0、0]</td></tr><tr><td>Small look right (LR) </td><td>[10,</td><td>0,</td><td>0,</td><td>0、0]</td></tr><tr><td>Look down</td><td>[0,</td><td>10,</td><td>0,</td><td>0, 01</td></tr><tr><td>Look up</td><td></td><td>[0,-10,</td><td>0,</td><td>0、0j</td></tr><tr><td>No-op</td><td>[ 0,</td><td>0,</td><td>0,</td><td>0、 01</td></tr></table>
|
| 301 |
+
|
| 302 |
+
Image Encoder: For DMLab-30 and Memory Maze, we used the same image encoder as in (Anonymous Authors, 2019) for multitask DMLab-30. The ResNet was adapted from Hessel et al. (2018) and each of its layer blocks consists of a $( 3 \times 3$ , stride 1) convolution, followed by $3 \times 3$ , stride 2) max-pooling, followed by $2 3 \times 3$ residual blocks with ReLU non-linearities.
|
| 303 |
+
|
| 304 |
+
<table><tr><td>ACTION NAME</td><td>RANGE</td></tr><tr><td>LOOKLEFT_RIGHT</td><td>[-1.0, 1.0]</td></tr><tr><td>LOOK_DOWN_UP</td><td>[-1.0, 1.0]</td></tr><tr><td>STRAFE_LEFT_RIGHT</td><td>[-1.0, 1.0]</td></tr><tr><td>MOVE_BACK_FORWARD</td><td>[-1.0, 1.0]</td></tr><tr><td>HAND_ROTATE_AROUND_RIGHT</td><td>[-1.0, 1.0]</td></tr><tr><td>HAND_ROTATE_AROUND_UP</td><td>[-1.0, 1.0]</td></tr><tr><td>HAND_ROTATE_AROUND_FORWARD</td><td>[-1.0, 1.0]</td></tr><tr><td>HAND_PUSH_PULL</td><td>[-10.0,10.0]</td></tr><tr><td>HAND-GRIP</td><td>{0,1}</td></tr></table>
|
| 305 |
+
|
| 306 |
+
Table 7: Hybrid action set for Memory Maze, consisting of 8 continuous actions and a single discrete action.
|
| 307 |
+
|
| 308 |
+
Agent Output: As in (Anonymous Authors, 2019), in all cases we use a 256-unit MLP with a linear output to get the policy logits (for discrete actions), Gaussian distribution parameters (for continuous actions) or value function estimates.
|
| 309 |
+
|
| 310 |
+
# B EXPERIMENTAL DETAILS
|
| 311 |
+
|
| 312 |
+
For all experiments, beyond sampling independent random seeds, each run also has V-MPO hyperparameters sampled from a distribution (see Table 8). The sampled hyperparameters are kept fixed across all models for a specific experiment, meaning that if one of the $\epsilon _ { \alpha }$ sampled is 0.002, then all models will have 1 run with $\epsilon _ { \alpha } = 0 . 0 0 2$ and so on for the rest of the samples. The exception is for the DMLab-30 LSTM, where a more constrained range was found to perform better in preliminary experiments. Each model had 8 seeds started, but not all runs ran to completion due to compute issues. These hyperparameter settings were dropped randomly and not due to poor environment performance. We report how many seeds ran to completion for all models. At least 6 seeds finished for every model tested. We list architecture details by section below. All LSTM models have residual skip connections in depth.
|
| 313 |
+
|
| 314 |
+
Table 8: V-MPO hyperparameters per environment.
|
| 315 |
+
|
| 316 |
+
<table><tr><td rowspan="2">Hyperparameter</td><td colspan="3">Environment</td></tr><tr><td>DMLab-30</td><td>Numpad</td><td>Memory Maze</td></tr><tr><td>Batch Size</td><td>128</td><td>128</td><td>128</td></tr><tr><td>Unroll Length</td><td>95</td><td>95</td><td>95</td></tr><tr><td>Discount</td><td>0.99</td><td>0.99</td><td>0.99</td></tr><tr><td>Action Repeat</td><td>4</td><td>1</td><td>4</td></tr><tr><td>Pixel Control Cost</td><td>2 ×10-3</td><td>1</td><td>1</td></tr><tr><td>Target Update Period</td><td>10</td><td>10</td><td>10</td></tr><tr><td>Initial n</td><td>1.0</td><td>10.0</td><td>1.0</td></tr><tr><td>Initial α</td><td>5.0</td><td></td><td>5.0</td></tr><tr><td>Initial αμ</td><td>-</td><td>1.0</td><td>1.0</td></tr><tr><td>Initial αΣ</td><td>=</td><td>1.0</td><td>1.0</td></tr><tr><td>En</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td rowspan="2">Eα (log-uniform)</td><td>LSTM [0.001, 0.025)</td><td>-</td><td>[0.001, 0.1)</td></tr><tr><td>TrXL Variants [0.001, 0.1)</td><td></td><td></td></tr><tr><td>Eαμ (log-uniform) Eα (log-uniform)</td><td></td><td>[0.005,0.01) [5 × 10-6,4 × 10-4)</td><td>[0.005,0.01) [5 × 10-6,4 × 10-5)</td></tr></table>
|
| 317 |
+
|
| 318 |
+
# B.1 TRAINING SETUP
|
| 319 |
+
|
| 320 |
+
All experiments in this work were carried out in an actor-learner framework (Espeholt et al., 2018) that utilizes TF-Replicator (Buchlovsky et al., 2019) for distributed training on TPUs in the 16-core
|
| 321 |
+
|
| 322 |
+
Table 9: DMLab-30 Ablation Architecture Details. We report the number of runs per model that ran to completion (i.e. 10 billion environment steps). We follow the standard convention that the hidden/embedding dimension of transformers is equal to the head dimension multiplied by the number of heads. (Sec. 4.1 & Sec. 4.3).
|
| 323 |
+
|
| 324 |
+
<table><tr><td>Model</td><td>#Layers</td><td>Head Dim.</td><td>#Heads</td><td>Hidden Dim.</td><td>Memory Size</td><td>Runs Completed</td></tr><tr><td>LSTM</td><td>3</td><td>-</td><td>■</td><td>256</td><td></td><td>8</td></tr><tr><td>Large LSTM</td><td>12</td><td>1</td><td>1</td><td>512</td><td>1</td><td>6</td></tr><tr><td>TrXL</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>6</td></tr><tr><td>TrXL-I</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>6</td></tr><tr><td>GTrXL (GRU)</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>8</td></tr><tr><td>GTrXL (Input)</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>6</td></tr><tr><td>GTrXL (Output)</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>7</td></tr><tr><td>GTrXL (Highway)</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>7</td></tr><tr><td>GTrXL (SigTanh)</td><td>12</td><td>64</td><td>8</td><td>512</td><td>512</td><td>6</td></tr><tr><td>Thin GTrXL (GRU)</td><td>12</td><td>64</td><td>4</td><td>256</td><td>512</td><td>8</td></tr></table>
|
| 325 |
+
|
| 326 |
+
Table 10: Numpad Architecture Details. (Sec. 4.2).
|
| 327 |
+
|
| 328 |
+
<table><tr><td>Model</td><td>#Layers</td><td>Head Dim.</td><td>#Heads</td><td>Hidden Dim.</td><td>Memory Size</td><td>Runs Completed</td></tr><tr><td>LSTM</td><td>3</td><td>1</td><td>1</td><td>256</td><td>1</td><td>5</td></tr><tr><td>GTrXL (GRU)</td><td>12</td><td>64</td><td>8</td><td>256</td><td>512</td><td>5</td></tr></table>
|
| 329 |
+
|
| 330 |
+
Table 11: Sensitivity ablation architecture details (Sec. 4.3.2).
|
| 331 |
+
|
| 332 |
+
<table><tr><td>Model</td><td># Layers</td><td>Head Dim.</td><td>#Heads</td><td>Hidden Dim.</td><td>Memory Size</td></tr><tr><td>LSTM</td><td>3</td><td>-</td><td>1</td><td>256</td><td>-</td></tr><tr><td>TrXL</td><td>12</td><td>64</td><td>8</td><td>256</td><td>512</td></tr><tr><td>TrXL-I</td><td>12</td><td>64</td><td>8</td><td>256</td><td>512</td></tr><tr><td>GTrXL(GRU)</td><td>12</td><td>64</td><td>8</td><td>256</td><td>512</td></tr><tr><td>GTrXL (Output)</td><td>12</td><td>64</td><td>8</td><td>256</td><td>512</td></tr></table>
|
| 333 |
+
|
| 334 |
+
Table 12: Gated identity initialization ablation architecture details (Sec. 4.3.4).
|
| 335 |
+
|
| 336 |
+
<table><tr><td>Model</td><td>#Layers</td><td>Head Dim.</td><td>#Heads</td><td>Hidden Dim.</td><td>Memory Size</td><td>Runs Completed</td></tr><tr><td>GTrXL (GRU)</td><td>4</td><td>64</td><td>4</td><td>256</td><td>512</td><td>8</td></tr></table>
|
| 337 |
+
|
| 338 |
+
configuration (Google, 2018). “Actors” running on CPUs performed network inference and interactions with the environment, and transmitted the resulting trajectories to the centralised “learner“.
|
| 339 |
+
|
| 340 |
+
# C MULTI-HEAD ATTENTION DETAILS
|
| 341 |
+
|
| 342 |
+
# C.1 MULTI-HEAD ATTENTION
|
| 343 |
+
|
| 344 |
+
The Multi-Head Attention (MHA) submodule computes in parallel $H$ soft-attention operations for every time step, producing an output tensor $Y ^ { ( l ) } ~ \in ~ \mathbb { R } ^ { T \times D }$ . MHA operates by first calculating the query $Q ^ { ( l ) } \bar { \in } \bar { \mathbb { R } } ^ { H \times T \times d }$ , keys $\bar { K ^ { ( l ) } } \in \mathbb { R } ^ { H \times T \times d }$ , and values $V ^ { ( l ) } \in \bar { \mathbb { R } ^ { H \times T \times d } }$ (where through trainable linear projections W (l)Q , W (l)K , and W (l)V , respectively, and then using the combined resulting embedding $E ^ { ( l ) }$ is then applied and finally layer normalization (Ba et al., 2016).
|
| 345 |
+
|
| 346 |
+

|
| 347 |
+
Figure 10: The 25 hyperparameter settings sampled for the sensitivity ablation (Sec. 4.3.2). X-axis is in log scale and values are sampled from the corresponding ranges given in Table 8.
|
| 348 |
+
|
| 349 |
+
# MultiHeadAttention $( E ^ { ( l - 1 ) } )$ :
|
| 350 |
+
|
| 351 |
+
$$
|
| 352 |
+
\begin{array} { r l } & { Q ^ { ( l ) } , K ^ { ( l ) } , V ^ { ( l ) } = W _ { Q } ^ { ( l ) } E ^ { ( l - 1 ) } , W _ { K } ^ { ( l ) } E ^ { ( l - 1 ) } , W _ { V } ^ { ( l ) } E ^ { ( l - 1 ) } } \\ & { \qquad \alpha _ { h t m } ^ { ( l ) } = Q _ { h t d } K _ { h m d } } \\ & { W _ { h t m } ^ { ( l ) } = \mathbf { M a s k e d S o f t m a x } ( \alpha ^ { ( l ) } , \mathrm { a x i s } = m ) } \\ & { \qquad \overline { { Y } } _ { h t d } ^ { ( l ) } = W _ { h t m } ^ { ( l ) } V _ { h m d } ^ { ( l ) } } \\ & { \qquad \hat { Y } ^ { ( l ) } = E ^ { ( l - 1 ) } + \mathrm { L i n e a r } ( \overline { { Y } } ^ { ( l ) } ) } \\ & { \qquad Y ^ { ( l ) } = \mathrm { L a y e r N o r m } ( \hat { Y } ^ { ( l ) } ) } \end{array}
|
| 353 |
+
$$
|
| 354 |
+
|
| 355 |
+
where we used Einstein summation notation to denote the tensor multiplications, MaskedSoftmax is a causally-masked softmax to prevent addressing future information, Linear is a linear layer applied per time-step and we omit reshaping operations for simplicity.
|
| 356 |
+
|
| 357 |
+
# C.2 RELATIVE MULTI-HEAD ATTENTION
|
| 358 |
+
|
| 359 |
+
The basic MHA operation does not take sequence order into account explicitly because it is permutation invariant, so positional encodings are a widely used solution in domains like language where order is an important semantic cue, appearing in the original transformer architecture (Vaswani et al., 2017). To enable a much larger contextual horizon than would otherwise be possible, we use the relative position encodings and memory scheme described in Dai et al. (2019). In this setting, there is an additional $\tau$ -step memory tensor $M ^ { ( l ) } \in \mathbb { R } ^ { T \times D }$ , which is treated as constant during weight updates.
|
| 360 |
+
|
| 361 |
+
# RelativeMultiHeadAttention $( M ^ { ( l - 1 ) } , E ^ { ( l - 1 ) } )$ :
|
| 362 |
+
|
| 363 |
+
$$
|
| 364 |
+
\begin{array} { r l } & { \tilde { E } ^ { ( l - 1 ) } = [ M ^ { ( l - 1 ) } , E ^ { ( l - 1 ) } ] } \\ & { Q ^ { ( l ) } , K ^ { ( l ) } , V ^ { ( l ) } = W _ { Q } ^ { ( l ) } E ^ { ( l - 1 ) } , W _ { K } ^ { ( l ) } \tilde { E } ^ { ( l - 1 ) } , W _ { V } ^ { ( l ) } \tilde { E } ^ { ( l - 1 ) } } \\ & { \quad \quad \quad \quad \quad R = W _ { R } ^ { ( l ) } \Phi } \\ & { \quad \quad \quad \quad \quad \quad \alpha _ { h t m } ^ { ( l ) } = Q _ { h t d } K _ { h m d } + Q _ { h t d } R _ { h m d } + u _ { h + d } K _ { h t m } + v _ { h + d } R _ { h m d } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \frac { V _ { h t m } ^ { ( l ) } } { Y _ { h t d } ^ { ( l ) } } = \mathbf { M a s k e d S o f } \mathrm { t m a x } ( \boldsymbol { \alpha } ^ { ( l ) } , \mathrm { a x i s s m } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \dot { Y } ^ { ( l ) } = E ^ { ( l - 1 ) } + \mathrm { L i n e a r } ( \overline { { Y ^ { ( l ) } } } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \end{array}
|
| 365 |
+
$$
|
| 366 |
+
|
| 367 |
+
where $\Phi$ is the standard sinusoid encoding matrix, $u ^ { ( l ) } , v ^ { ( l ) } \in \mathbb { R } ^ { H \times d }$ are trainable parameters, the $^ *$ represents the broadcast operation, and $W _ { R }$ is a linear projection used to produce the relative location-based keys (see Dai et al. (2019) for a detailed derivation).
|
| 368 |
+
|
| 369 |
+
# C.3 IDENTITY MAP REORDERING
|
| 370 |
+
|
| 371 |
+
The Identity Map Reordering modifies the standard transformer formulation as follows: the layer norm operations are applied only to the input of the sub-module and a non-linear ReLU activation is applied to the output stream.
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
\begin{array} { r l } & { \overline { { Y } } ^ { ( l ) } = \mathrm { R e l a t i v e M u l t i H e a d A t t e n t i o n } ( \mathrm { L a y e r N o r m } ( \left[ \mathrm { S t o p G r a d } ( M ^ { ( l - 1 ) } ) , E ^ { ( l - 1 ) } \right] ) ) } \\ & { { Y } ^ { ( l ) } = E ^ { ( l - 1 ) } + \mathrm { R e L U } ( \overline { { Y } } ^ { ( l ) } ) } \\ & { \overline { { E } } ^ { ( l ) } = f ^ { ( l ) } ( \mathrm { L a y e r N o r m } ( Y ^ { ( l ) } ) ) } \\ & { E ^ { ( l ) } = Y ^ { ( l ) } + \mathrm { R e L U } ( \overline { { E } } ^ { ( l ) } ) } \end{array}
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
See Figure 1 (Center) for a visual depiction of the TrXL-I.
|
| 378 |
+
|
| 379 |
+
D DMLAB-30 MEMORY/REACTIVE PARTITION
|
| 380 |
+
Table 13: Partition of DMLab-30 levels into a memory-based and reactive split of levels.
|
| 381 |
+
|
| 382 |
+
<table><tr><td>Memory</td><td>Reactive</td></tr><tr><td>rooms_select_nonmatching-object rooms_watermaze explore_obstructed_goals_small explore_goal_locations_small explore_object_rewards_few explore_obstructed_goals_large</td><td>rooms_collect_good_objects_train rooms_exploit_deferred_effects_train rooms_keys_doors-puzzle language_select_described_object language_select_located_object language_execute_random_task</td></tr></table>
|
| 383 |
+
|
| 384 |
+
<table><tr><td>Model</td><td>Median Human Normalized Score</td></tr><tr><td>LSTM</td><td>136.6 ± 3.4</td></tr><tr><td>GTrXL</td><td>137.1 ± 5.0</td></tr></table>
|
| 385 |
+
|
| 386 |
+

|
| 387 |
+
Table 14: Final human-normalized median return across all 57 Atari levels for LSTM and GTrXL at 11.4 billion environment steps (equivalent to 200 million per individual game). Both models are 256 dimensions in width. We include standard error over runs.
|
| 388 |
+
Figure 11: Median human-normalized returns as training progresses for both GTrXL and LSTM models. We run 8 hyperparameter settings per model.
|
| 389 |
+
|
| 390 |
+
# E ATARI-57 RESULTS
|
| 391 |
+
|
| 392 |
+
In this section, we run the GTrXL on the multitask Atari-57 benchmark. Although Atari-57 was not designed specifically to test an agent’s memory capabilities, we include these results here to demonstrate that we suffer no performance regression on a popular environment suite, providing further evidence that GTrXL can be used as an architectural replacement to the LSTM.
|
| 393 |
+
|
| 394 |
+
The LSTM and GTrXL are matched in width at 256 dimensions. The GTrXL is 12 layers deep to show our model’s learning stability even at large capacity. The LSTM architecture matches the one reported in Anonymous Authors (2019). We train for 11.4 billion environment steps, equivalent to 200 million per environment. We run 8 hyperparameter settings per model.
|
md/train/TScOKQW67Mj/TScOKQW67Mj.md
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Efficient Softmax Approximation for Deep Neural Networks with Attention Mechanism
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 There has been a rapid advance of custom hardware (HW) for accelerating the
|
| 11 |
+
2 inference speed of deep neural networks (DNNs). Previously, the softmax layer
|
| 12 |
+
3 was not a main concern of DNN accelerating HW, because its portion is relatively
|
| 13 |
+
4 small in multi-layer perceptron or convolutional neural networks. However,as the
|
| 14 |
+
5 attention mechanisms are widely used in various modern DNNs,a cost-efficient
|
| 15 |
+
6 implementation of softmax layer is becoming very important. In this paper, we
|
| 16 |
+
7 propose two methods to approximate softmax computation,which are based on
|
| 17 |
+
8 the usage of LookUp Tables (LUTs). The required size of LUT is quite small
|
| 18 |
+
9 (about 7Oo Bytes) because ranges of numerators and denominators of softmax are
|
| 19 |
+
10 stable if normalization is applied to the input. We have validated the proposed
|
| 20 |
+
11 technique over different AI tasks (object detection,machine translation, speech
|
| 21 |
+
12 recognition, semantic equivalence) and DNN models (DETR,Transformer, BERT)
|
| 22 |
+
13 by a variety of benchmarks (COCO17, WMT14, WMT17, GLUE). We showed
|
| 23 |
+
14 that 8-bit approximation allows to obtain acceptable accuracy loss below $1 . 0 \%$
|
| 24 |
+
|
| 25 |
+
# 151Introduction
|
| 26 |
+
|
| 27 |
+
16 After Vaswani et al. had introduced Transformer model in [27] for machine translation task, the
|
| 28 |
+
17 attention based architecture became popular firstly in Natural Language Processng (NLP) appli
|
| 29 |
+
18 cations, e.g.: speech recognition [16], [21], [9]; summarization [7]; language understanding [5],
|
| 30 |
+
19 [33],[15],[18]; and video captioning [3]. Recently attention-based models are used in even wider
|
| 31 |
+
20 practical areas including Computer Vision (CV) tasks for object detection [2]; image transformation
|
| 32 |
+
21 [26]; image classification [6]; and even symbolic integration and solving diferential equations [14].
|
| 33 |
+
22 Despite the attractiveness of transformer-based models, its direct implementation into the platform
|
| 34 |
+
23 with constrained computational power (e.g., mobile SoC,edge devices)1 is very challnging due to
|
| 35 |
+
24 big memory footprint and latency.
|
| 36 |
+
|
| 37 |
+
Therefore, model compresson techniques such as quantization,and distillation are needed for those models. Many approaches have been introduced on quantizing matrix multiplication of transformer architecture.For example,in [22] it was used second order Hessian information, what allows to significantly compress the size of the model up to $1 3 \times$ times,while maintaining at most $2 . 3 \%$ of performance degradation (for the case of ultra-low precision 2-bits quantization). In [35] it was used a quantization-aware training during the fine-tuning phase of BERT, what allows to compress BERT model by $4 \times$ (with 8-bit quantization) with minimal accuracy loss (less than $1 \%$ ). In[1], a machine language translation model was quantized by 8-bit, while maintaining less than $0 . 5 \%$ drop
|
| 38 |
+
|
| 39 |
+
33 in accuracy. Moreover, in [2O] it was shown that 8-bit quantized models provide the same or even
|
| 40 |
+
34 higher accuracy as the full-precision models. Most of the above methods consider the quantization of
|
| 41 |
+
35 matrix multiplications operations only. However,as it is shown in [4],[24] in modern DNNs with
|
| 42 |
+
36 attention mechanism (e.g., Transformer, BERT, GPT-x) the softmax function is also used intensively,
|
| 43 |
+
37 especially at the longer sequence lengths,so it is necessary to optimize its for performance.
|
| 44 |
+
38 In this paper we propose methods for efficient computation of the softmax layer at the HW accelerator.
|
| 45 |
+
39 The method is based on piece-wise-constant approximation and usage of LUTs. To the best of our
|
| 46 |
+
40 knowledge,it is the first paper where softmax quantization of the models with attention mechanism is
|
| 47 |
+
41 tested and verified on a variety of AI tasks.In Section 2 we show why our research is important and
|
| 48 |
+
42 valuable.In Section 3 we consider the drawbacks of existed softmax approximation methods in the
|
| 49 |
+
43 perspective of HW accelerator, and summarize the differentiation of our methods from the previous
|
| 50 |
+
44 arts.In Section 4 we describe the details of the proposed methods. Section 5 shows the experimental
|
| 51 |
+
45 validation over different models and datasets, and Section 6 concludes the paper.
|
| 52 |
+
|
| 53 |
+
# 162 Background and motivation
|
| 54 |
+
|
| 55 |
+
47 Modern GPUs are powerful, but big, expensive, and power-hungry. Therefore, alternative HW
|
| 56 |
+
48 accelerators (e.g., NPU) for on-device inference are under active development by diferent vendors,
|
| 57 |
+
49 especially for Federated Learning and Edge computing. However, such devices mostly are focused on
|
| 58 |
+
50 the acceleration of matrix multiplication operations,and do not include means to compute complex
|
| 59 |
+
51 activation functions. Typically,in such devices the data is sent outside of the accelerator to compute
|
| 60 |
+
52 activations on host CPU.For example,according to the guidelines of Coral (TM),a softmax layer of
|
| 61 |
+
53 DNN model in Edge TPU have to be run on host CPU ², what is acceptable for traditional CV tasks
|
| 62 |
+
54 (which are typically uni-directional, have minimum dependencies, and softmax layer is located at the
|
| 63 |
+
55 end of the computational graph of DNN model), however is very inefficient for NLP tasks (which are
|
| 64 |
+
56 typically more complicated with a lot of dependencies and active employment of softmax layer in the
|
| 65 |
+
57 middle of DNN model). In opposite to traditional logic-centric approach, some researches are trying
|
| 66 |
+
58 to perform computation closer to the memory (so called memory-centric approach). For example
|
| 67 |
+
59 in [23], there is shown a DRAM-based AI accelerator. This approach allows significantly speed-up
|
| 68 |
+
60 the overall computation process, but for the computation of the activations the data should also be
|
| 69 |
+
61 moved to host processor, what is an even bigger issue in the DRAM environment.
|
| 70 |
+
62 The Eq.(1) from [27] describes how attention is computed in the model. This particular form,
|
| 71 |
+
63 named "scaled dot-product attention" takes the matrix multiplication product of queries and keys
|
| 72 |
+
64 of $\mathbf { R } ^ { N \times L \times H }$ as input forthesoftmaxlayer where $N$ means number of heads, $L$ means sequence
|
| 73 |
+
65 length and $H$ means hidden size for the case where batch size equals to 1. In other words, performing
|
| 74 |
+
66 $( N ^ { \mathbf { \bar { \nu } } } \times L \times L )$ softmax operations is required per one attention. Furthermore,encoder in typical
|
| 75 |
+
67 transformer consists of six multi-head attentions which means $6 \times ( N \times L \times L )$ operation is required
|
| 76 |
+
68 for encoder solely. Assuming the number of heads is 8 and sequence length is 128, it already takes
|
| 77 |
+
69 786,432 operations for softmax of the transformer encoder. This overhead increases as number of
|
| 78 |
+
70 heads and sequence length increases which is typical case for high-performing models.
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
A t t e n t i o n ( Q , K , V ) = S o f t m a x \left( \frac { Q K ^ { T } } { \sqrt { d _ { K } } } \right) V
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
71 For example, it requires performing $1 2 \times ( 1 2 \times 1 2 8 \times 1 2 8 ) = 2 , 3 5 9 , 2 9 6$ softmax operations for
|
| 85 |
+
72 one sample inference for typical BERT configuration [5] over sequence of length 128. In the case
|
| 86 |
+
73 when HW accelerator is used for matrix multiplication only, and activation to be computed at the
|
| 87 |
+
74 CPU (what is common case for HW accelerators, optimized for CNN-models), the huge amount of
|
| 88 |
+
75 data must be moved between CPU and the accelerator. Such data movement negatively impacts on
|
| 89 |
+
76 the overallcomputation time and power consumption, which can be critical for on-device inference.
|
| 90 |
+
77 Therefore, HW accelerator must be able to compute softmax layer without CPU involvement.
|
| 91 |
+
|
| 92 |
+
# 78 3Related work and key contributions
|
| 93 |
+
|
| 94 |
+
'9The common equation to compute softmax function over the input $x$ is a fraction as shown below:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\sigma ( x _ { i } ) = \frac { e ^ { x _ { i } } } { \Sigma e ^ { x _ { i } } } = \frac { e ^ { x _ { i } - m a x ( x ) } } { \Sigma e ^ { x _ { i } - m a x ( x ) } }
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
80 There are different ways to implement it. For example, some approaches straightforwardly compute
|
| 101 |
+
81 the numerator and denominator firstly,and then a division operation is performed. In such case the
|
| 102 |
+
82 HW accelerator should contain a divider, what requires additional HW costs and can also cause
|
| 103 |
+
83 performance degradation, if divider is not fully pipe-lined.
|
| 104 |
+
84 In [25] it is proposed to use basic-split calculation method, which allows to split the exponentiation
|
| 105 |
+
85 calculation of the softmax into several specific basics which are implemented by LUT (ROM). It
|
| 106 |
+
86 allows to simplify the complexity of hardware and signal propagation delay. However, to recover
|
| 107 |
+
87 the whole computed value of exponent some additional multiplications are needed. Moreover, to
|
| 108 |
+
88 obtain the final value of softmax the division is stillused. In [30] it is proposed to add threshold
|
| 109 |
+
89 layers to accelerate the training speed and replace the Euler's base value with a dynamic base value
|
| 110 |
+
90 to improve the network accuracy. Such approach allowed to save up to $15 \%$ of training model
|
| 111 |
+
91 convergence time and also increase by 3 to $5 \%$ the average accuracy. But during the computation
|
| 112 |
+
92 of softmax the divider is still used. In [17] the combination of LUT and multi-segment polynomial
|
| 113 |
+
93 fiting have been used to compute exponential operations of integer and fractional parts in separate.
|
| 114 |
+
94 In addition, they adopt radix-4 Booth-Wallce based multiplier for computing the whole value
|
| 115 |
+
95 of exponent,and modified shift-compare divider for computation of the final value of softmax.
|
| 116 |
+
96 To avoid big area costs for traditional divider, the authors in [8] propose to reduce the operand
|
| 117 |
+
97 bit-width,and approximate exponential and division operations with cost-effective addition and
|
| 118 |
+
98 bit shifts operations. In their design they have approximated the division operation in Eq. (2) by
|
| 119 |
+
99 replacing the denominator with closest $\dot { 2 } ^ { b }$ value, where $b$ is some integer constant. Then division
|
| 120 |
+
100 is implemented just as simple bit shifts operation. In [24] it is proposed to replace the base as
|
| 121 |
+
101 $e ^ { x } \to 2 ^ { x }$ , then all computations are more hardware-friendly, however the division operation is still
|
| 122 |
+
102 required. Also, to restore accuracy a fine-tuning of the model is needed, what is not applicable
|
| 123 |
+
103 for post-training quantization paradigm. Although the methods described above are decreasing the
|
| 124 |
+
104 hardware complexity of softmax computation they all still rely on the division operation.
|
| 125 |
+
105 To avoid division operation at all, some other solutions apply the logarithmic transformation to
|
| 126 |
+
106 the original softmax function,and thus substitute costly division operation by subtraction of the
|
| 127 |
+
107 logarithm. In [34], for example, it is proposed to use a logarithmic operation implemented as a LUT
|
| 128 |
+
108 and a subtractor to replace the division operation, what allows to further decrease the complexity of
|
| 129 |
+
109 hardware,as well critical path of the whole design. In [10] simplified version of Integral Stochastic
|
| 130 |
+
110 Computation is used in order to build FSM-based exponentiation. Division operation is substituted
|
| 131 |
+
111 by LUT-based logarithmic operation and subtraction, similarly to [34]. In [31] the authors are further
|
| 132 |
+
112 developing the method proposed in [34], by applying mathematical transformations and linear fitting.
|
| 133 |
+
113 After optimization,their final design includes only shift operations,leading one detector, and adders.
|
| 134 |
+
114 Finally, there are some extreme approximation cases represented in [13] and [28], where logarithmic
|
| 135 |
+
115 computation and subtraction are skipped at all.
|
| 136 |
+
116 Despite its atractiveness,logarithmic transformation approach can be used only in the cases when
|
| 137 |
+
117 softmax layer is the last layer in DNN and its functionality is simply“scoring”among the candidates
|
| 138 |
+
118 for classification tasks. However,if softmax layer is used inside of computational graph of DNN (e.g.,
|
| 139 |
+
119 DNNs with attention-mechanism) then error caused by quantizations will be accumulated drastically,
|
| 140 |
+
120 directly impacting on the final accuracy.For example,in Table 1 there is shown the averaged accuracy
|
| 141 |
+
121 drop for DETR models caused by a softmax approximation in uint8 precision by some prior arts.
|
| 142 |
+
122 As it can be seen from the Table 1,a straightforward usage of Eq.(2) from [31] causes big accuracy
|
| 143 |
+
123 drop,and even after applying some improvements to the original method (shown as case Eq. $( 2 ) +$ ),
|
| 144 |
+
124 the accuracy drop is still high ( $2 \%$ to $19 \%$ ).For more details of the prior arts experiments please refer
|
| 145 |
+
125 to Appendix A.1. However, if for the same conditions we use the method proposed in Section 4.1, we
|
| 146 |
+
126 can see that accuracy drop reduced by $\times 4$ to $\times 2 0$ times,and it is below $0 . 5 \%$ for plain DETR models
|
| 147 |
+
127 (no DC5 dilation at the last stage).
|
| 148 |
+
128 The work presented in this paper has focused on the development of methods for efficient computation
|
| 149 |
+
129 of softmax layer during the inference at the edge devices, what usually have limited computational
|
| 150 |
+
130 power and suffer from constraints of the bandwidth.
|
| 151 |
+
131 Previous works for HW accelerator of softmax layer are focused on the logic-centric approach and
|
| 152 |
+
132used dedicated hardware for its implementation. In such case the utilization of hardware is low,
|
| 153 |
+
133 performance can be slower, and no reconfigurability is provided. In our paper we have used an
|
| 154 |
+
134 alternative memory-centric approximate computing approach. It keeps accuracy loss small, while
|
| 155 |
+
135 allws computing softmax operation with no divider. The size of the required memory (i.e., LUT) is
|
| 156 |
+
136 reasonably small and can be reconfigured on demand.
|
| 157 |
+
137 The methods proposed in the paper contribute to building the alternative concept of hardware
|
| 158 |
+
138 architecture to accelerate essential operations for AI applications, especially for on-device inference.
|
| 159 |
+
139 To summarize,we have three-fold difference from the previous works:
|
| 160 |
+
|
| 161 |
+
Table 1: Averaged accuracy drop by different methods over DETR models (Average Precision), $\%$
|
| 162 |
+
|
| 163 |
+
<table><tr><td>METHOD</td><td>DETR (R50)</td><td>DETR+DC5(R50)</td><td>DETR (R101)</td><td>DETR+DC5(R101)</td></tr><tr><td>EQ.(2) IN [31]</td><td>7.20</td><td>19.30</td><td>10.25</td><td>25.37</td></tr><tr><td>EQ.(2)+ IN [31]</td><td>2.50</td><td>12.93</td><td>5.38</td><td>18.85</td></tr><tr><td>SECTION 4.1</td><td>0.33</td><td>2.92</td><td>0.22</td><td>2.73</td></tr></table>
|
| 164 |
+
|
| 165 |
+
· Applicability of our methods to DNN with attention mechanism is experimentally proven over variety of the models for different AI applications.All previous methods were used only for the cases when softmax is the last layer in DNN,and is used for“scoring".
|
| 166 |
+
No divider is needed to fully implement the method. Moreover, for 2D LUT method even multiplier is not needed.Thus, hardware overhead is minimal,and is almost free if used in the DRAM-based AI accelerator. Our solutions utilize integer precision, what makes it compatible with traditional HW accelerators used for matrix multiplication,and simplify the integration of methods into full system (all prior methods are based on a fixed point precision).
|
| 167 |
+
|
| 168 |
+
# 1494 Proposed methods
|
| 169 |
+
|
| 170 |
+
150 In this paper we use memory-centric approach to build the accelerator for softmax computation
|
| 171 |
+
151 in hardware platform with limited resources. We propose two LUT-based methods for efficient
|
| 172 |
+
152 computation,which provide high performance and do not require a divider. The details of the
|
| 173 |
+
153 methods are described below and appropriate software models are shown in Appendix A.2.
|
| 174 |
+
|
| 175 |
+
# 4.1Normalization of reciprocal exponentiation
|
| 176 |
+
|
| 177 |
+
In this subsection we consider the method,which is based on the normalization of reciprocal exponentiation, and hereafter we call it REXP for short.
|
| 178 |
+
|
| 179 |
+
157The original reciprocal exponentiation method was proposed in [28], where they used the inverse I58way of max-normalization and the reciprocal of exponential function as below:
|
| 180 |
+
|
| 181 |
+
$$
|
| 182 |
+
\sigma ^ { * } ( x _ { i } ) = \frac { 1 } { e ^ { m a x ( x ) - x _ { i } } }
|
| 183 |
+
$$
|
| 184 |
+
|
| 185 |
+
159And thus,the final value of softmax can be obtained by reading from a simple LUT-table. Content of
|
| 186 |
+
160LUT is computed as shown below:
|
| 187 |
+
|
| 188 |
+
$$
|
| 189 |
+
L U T _ { 1 / e } [ i ] = \left\lfloor \frac { 1 } { e ^ { i } } \cdot ( 2 ^ { w } - 1 ) \right\rceil , \forall i = 0 , 1 , . . . , x _ { q } + 1
|
| 190 |
+
$$
|
| 191 |
+
|
| 192 |
+
161where $w$ is a number of bits for quantization, and $x _ { q } = \lceil l n ( 2 ^ { w } - 1 ) \rceil$ is an efficient quantization
|
| 193 |
+
162boundary.
|
| 194 |
+
|
| 195 |
+
63In addition to very low computational complexity, this method has other desired properties [28]:
|
| 196 |
+
|
| 197 |
+
· bounded and stable ( $\frac { 1 } { e ^ { m a x ( x ) - x _ { i } } } \in ( 0 , 1 ] )$ · and nonlinear $\begin{array} { r } { ( \frac { 1 } { e ^ { \alpha x } } \ne \alpha \frac { 1 } { e ^ { x } } ) } \end{array}$ )
|
| 198 |
+
|
| 199 |
+
167 But due to its aggressive approximation nature, it can be applied only to simple CV tasks, and if
|
| 200 |
+
168 used for attention-based DNN models causes the explosion of accuracy drop (see Appendix A.1 for
|
| 201 |
+
169 details). Thus,in this paper we further develop that method to be applicable for wider class of DNN
|
| 202 |
+
170 models.
|
| 203 |
+
171 During our initial investigations,we have noticed that method described in Eq.( 3) is just scaled
|
| 204 |
+
172 version of real softmax. So, we proposed to normalize it with some probability density function
|
| 205 |
+
173 (PDF) scale,such that $\textstyle { \int } P D F = { \mathrm { \hat { 1 } } }$ . However, if used straight-forwardly, it would need to involve a
|
| 206 |
+
174 division operation, what is strongly un-desirable for devices with constrained computational power.
|
| 207 |
+
175 Therefore, instead of dividing, we propose to substitute division by multiplication with some PDF
|
| 208 |
+
176 normalizing constant as below:
|
| 209 |
+
|
| 210 |
+
$$
|
| 211 |
+
\sigma ( x _ { i } ) = \frac { \sigma ^ { * } ( x _ { i } ) } { P D F n o r m } \sigma ^ { * } ( x _ { i } ) \cdot \alpha
|
| 212 |
+
$$
|
| 213 |
+
|
| 214 |
+
177where $\alpha = e ^ { - l n \left( \Sigma \sigma ^ { \ast } \left( x _ { i } \right) \right) }$ is PDF normalizing constant.
|
| 215 |
+
|
| 216 |
+
178Then final equation to compute softmax approximation by proposed REXP method is shown below:
|
| 217 |
+
|
| 218 |
+
$$
|
| 219 |
+
\sigma ( x _ { i } ) = \frac { e ^ { - l n \left( \Sigma \sigma ^ { * } \left( x _ { i } \right) \right) } } { e ^ { m a x \left( x \right) - x _ { i } } } = \frac { 1 } { e ^ { m a x \left( x \right) - x _ { i } } } \cdot e ^ { - l n \left( \Sigma \sigma ^ { * } \left( x _ { i } \right) \right) }
|
| 220 |
+
$$
|
| 221 |
+
|
| 222 |
+
179 Thus, to compute the softmax value it requires just two LUTs of considerably small size, where
|
| 223 |
+
180 content of the first LUT is computed accordingly to Eq.(4), and the second LUT values can be
|
| 224 |
+
181computed as below:
|
| 225 |
+
|
| 226 |
+
$$
|
| 227 |
+
L U T _ { \alpha } [ j ] = \left\lfloor \frac { 1 } { j } \cdot ( 2 ^ { w } - 1 ) \right\rceil , \forall j = 0 , 1 , . . . , x _ { s } - 1
|
| 228 |
+
$$
|
| 229 |
+
|
| 230 |
+
182where $j = \Sigma \sigma ^ { * } ( x _ { i } )$ $x _ { s }$ is selected quantization boundary, and $L U T _ { \alpha } [ x _ { s } ] = 0$
|
| 231 |
+
|
| 232 |
+
# ;4.22-Dimensional LUT
|
| 233 |
+
|
| 234 |
+
184 In this subsection we propose another method which is based on the substitution of a division
|
| 235 |
+
185 operation in Eq.(2) by 2-Dimensional (2D) LUT to speed-up and simplify the computation, while
|
| 236 |
+
186 maintaining accuracy even for attention-based DNN models. Hereafter we willrefer to this method
|
| 237 |
+
187 as 2D LUT.
|
| 238 |
+
188 For this purpose,we have started with the estimation of distributions of $e ^ { x }$ and $\Sigma e ^ { x }$ terms for typical
|
| 239 |
+
189 inference runs. Our investigation showed that if max-based normalization is applied to the input
|
| 240 |
+
190 values (i.e., $x ( x - \operatorname* { m a x } ( { \bar { x } } ) ) )$ , the distribution of $e ^ { x }$ is stable within range $e ^ { x } \in ( 0 , 1 ]$ regardless of
|
| 241 |
+
191 the input values, and range of $\Sigma e ^ { x }$ term depends on the length of the input $x$ . Thus, it allows us to
|
| 242 |
+
192 have stable computation even within small size of LUT.
|
| 243 |
+
|
| 244 |
+
Generic architecture and concept of the proposed method for efcient softmax implementation as 2D LUT is shown in Figure 1. There are two LUTs used: 1D LUT for approximation of $e ^ { x }$ values, and 2D LUT for storing softmax output values dependent on the values of numerator $e ^ { x }$ (used as the 1-st index in the table),and denominator $\Sigma e ^ { x }$ (used as the 2-nd index) of Eq.(2). As it can be seen from Figure 1(right),to calculate the indexes for corresponded value in 2D LUT table, only most-significant bits (MSB)are needed. Thus,the simplest hardware realization can be done within wiring only (when MSB bits are directly connected to the appropriate address selectors)3. Also, the proposed method can be easily modified to the case where,1-st index of 2D LUT table is calculated not from $e ^ { x }$ but directly from input $x$ . In such case there is no need to store intermediate values of $e ^ { x }$
|
| 245 |
+
|
| 246 |
+
While the content of 1D LUT for approximation of $e ^ { x }$ values is straightforward, 2D LUT contains the family of linear approximations where each row contains the softmax output scaled according tc
|
| 247 |
+
|
| 248 |
+

|
| 249 |
+
Figure 1: Generic concept of the proposed 2D LUT method (left). Reading softmax output value from pre-computed 2D LUT(right). Computational flow consists from two steps: a) obtaining of $e _ { i } ^ { x }$ values by reading from 1D LUT and accumulation of $\Sigma e ^ { x }$ term, b) obtaining $\sigma ( x _ { i } )$ values by reading from 2D LUT.
|
| 250 |
+
|
| 251 |
+
204 $\Sigma e ^ { x }$ term as shown in Eq.(8). The indexes of LUT are computed according to Eq.(9) and Eq.(10), $w$
|
| 252 |
+
205means the number of bits for the value in selected precision.
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
L U T _ { \sigma } [ i ] [ j ] = \left\lfloor \frac { i \cdot s c a l e _ { e ^ { x } } } { j \cdot s c a l e _ { \Sigma } } \cdot ( 2 ^ { w } - 1 ) \right\rceil
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
206where
|
| 259 |
+
|
| 260 |
+
$$
|
| 261 |
+
i = 0 , . . . , \left\lfloor \frac { m a x ( e ^ { x } ) } { s c a l e _ { e ^ { x } } } \right\rceil
|
| 262 |
+
$$
|
| 263 |
+
|
| 264 |
+
$$
|
| 265 |
+
j = 1 , . . . , \left\lfloor \frac { m a x ( \Sigma e ^ { x } ) } { s c a l e _ { \Sigma } } \right\rceil
|
| 266 |
+
$$
|
| 267 |
+
|
| 268 |
+
207 Since $x \to ( x - \operatorname* { m a x } ( x ) )$ normalization was used, so $m a x ( e ^ { x } ) = 1 . 0$ ,Therefore, $s c a l e _ { e ^ { x } }$ factor
|
| 269 |
+
208 allows to define the number of columns in LUT to make it small enough for practical applications. In
|
| 270 |
+
209 our experiment we have selected $s c a l e _ { e ^ { x } } = 0 . 1$ for all precisions,what allows us to reduce the size
|
| 271 |
+
210 of LUT significantly (i.e., $i = 0 , . . . , 1 0$ for all versions of $L U T _ { \sigma }$ ). The value of $m a x ( \Sigma e ^ { x } )$ depends
|
| 272 |
+
211 on the distribution of input values. Our experiments showed that $m a x ( \Sigma e ^ { x } ) = 6 0$ is big enough for
|
| 273 |
+
212 the tested NLP applications.We also selected $s c a l e _ { \Sigma } = 1 . 0$ for simplicity of the computations. Thus,
|
| 274 |
+
213 finally, those parameters give us $L U T _ { \sigma }$ of typical size $1 1 \times 6 0$
|
| 275 |
+
|
| 276 |
+
# :145Experimental validation
|
| 277 |
+
|
| 278 |
+
To validate the proposed methods and check how well they generalize we have conducted several experiments with different models (DETR,Transformer,and BERT) for diferent applications (object detection, machine translation,sentiment analysis,and semantic equivalence) over variety of datasets. In all those experiments we have used available pre-trained models, where we applied dynamic posttraining quantization (hereafter we referred to quantized models as PTQ-D) 4. Then we substituted a conventional softmax layer in quantized models with the LUT-based computation as described in Section 4. We did not consider any retraining or fine-tuning of the models after quantization, and the same off-line generated LUTs were used among all models. Our code allows to select LUTs with different precision from int16 down to uint2, what allows to analyze the sensitivity of the model to softmax approximation even for ultra-low 2-bits quantization. The details of experiments are described below,and results are summarized in Figure 2, Figure 3,and Table 2 .For more details please refer to Table 6,and Table 7 in Appendix.As it can be seen from figures, proposed LUT-based softmax computation methods maintain accuracy drop below $1 . 0 \%$ down to 8-bit quantization for all NLP and DETR (no DC5) models.
|
| 279 |
+
|
| 280 |
+
# 5.1 Object detection
|
| 281 |
+
|
| 282 |
+
For our first experiments we have used DEtection TRansofmer (DETR) models for object detection [2], with available pre-trained models 5.As it can be seen from Table 6, we were able to reproduce the same results for original FP32 reference model over COCO dataset. We have used the same IoU metric by Average Precision (AP) as in Table 1 in [2]. Then we run a bunch of experiments to check how accuracy of object detection willbe decreased due to PTQ-D quantization and LUT-based approximation as proposed in REXP method (see Section 4.1). Table 5 in Appendix shows the LUTs size for several pre-selected cases in int16 and uint8 precision. There are three cases selected which are different in the size of $L U T _ { \alpha }$ : it is $1 \times 2 5 6$ for case 1, $1 \times 3 2 0$ for case 2,and $1 \times 5 1 2$ for case 3.
|
| 283 |
+
|
| 284 |
+
Analysis of Figure 2 shows that accuracy drop caused by application of softmax approximation is small $( < 1 \% )$ and acceptable for plain DETR models (no DC5 used). Bigger accuracy drop for $+ \mathrm { D C } 5$ cases is caused by the bigger size of self-atentions of the encoder (see details in Section 5.3). We expect that increasing size ofLUTs will help to solve this issue. The behavior of average recall values is similar to average precision values.
|
| 285 |
+
|
| 286 |
+

|
| 287 |
+
Figure 2: DETR averaged accuracy drop of PTQ-D models with softmax approximations Vs. original FP32 models: average precision (left) and average recall(right). As it can be seen from the figure, for DETR models without dilation at the last stage (no DC5) the accuracy drop for all cases is below $1 \%$ and shows very similar behavior.
|
| 288 |
+
|
| 289 |
+
# 2435.2 NLP tasks
|
| 290 |
+
|
| 291 |
+
Next, we have validated the proposed methods by experimenting with several NLP tasks. Similarly, to DETR case,Table 8 in Appendix shows the LUTs size for several pre-selected cases for those experiments. In Table 2 below there are accumulated values from the experiments with NLP models. The bold values in the table shows highest values per model per method after applying quantization and softmax approximation. As it follows from the analysis of experiment results,about 7Oo Bytes for 2D LUT method, and up to 50 Bytes for REXP method would be enough for practical applications.
|
| 292 |
+
|
| 293 |
+
# 5.2.1Machine Translation
|
| 294 |
+
|
| 295 |
+
Among NLP tasks we have started with machine translation.For our experiments we have used transofmer-base model for En-Ge translation [12] from OpenNMT library, with available pre-trained model 6,configured to replicate the results from original paper. To avoid dependency of the evaluation results on the selected tokenization scheme,we have used spm_decode 7to detokenize the output of translation,and then applied multi - bleu.perl script 8 to calculate BLEU score.
|
| 296 |
+
|
| 297 |
+
Table 2: Experimental validation over different NLP models and datasets
|
| 298 |
+
|
| 299 |
+
<table><tr><td>PRECISION</td><td colspan="4">TRANSFORMER</td><td colspan="4">BERT</td></tr><tr><td></td><td colspan="2">2D LUT</td><td colspan="2">REXP</td><td colspan="2">2D LUT</td><td colspan="2">REXP</td></tr><tr><td></td><td>WMT 2014</td><td>WMT 2017</td><td>WMT 2014</td><td>WMT 2017</td><td>SST-2</td><td>MRPC</td><td>SST-2</td><td>MRPC</td></tr><tr><td>FP32</td><td>(BLEU) 26.98</td><td>(BLEU) 28.09</td><td>(BLEU) 26.98</td><td>(BLEU) 28.09</td><td>(%) 92.32</td><td>(F1) 90.19</td><td>(%) 92.32</td><td>(F1) 90.19</td></tr><tr><td>PTQ-D</td><td>26.86</td><td>27.95</td><td>26.86</td><td>27.95</td><td>91.74</td><td>89.53</td><td>91.74</td><td>89.53</td></tr><tr><td>INT16</td><td>26.87</td><td>28.02</td><td>26.89</td><td>27.64</td><td>91.63</td><td>89.50</td><td>91.74</td><td>89.26</td></tr><tr><td>UINT8</td><td>26.76</td><td>27.9</td><td>26.8</td><td>27.66</td><td>91.63</td><td>89.35</td><td>91.17</td><td>89.34</td></tr><tr><td>UINT4</td><td>26.26</td><td>27.43</td><td>26.68</td><td>28.02</td><td>91.40</td><td>88.01</td><td>91.17</td><td>88.77</td></tr><tr><td>UINT2</td><td>24.42</td><td>25.06</td><td>25.29</td><td>25.86</td><td>89.22</td><td>56.67</td><td>91.63</td><td>86.12</td></tr></table>
|
| 300 |
+
|
| 301 |
+
256 Thus,as it can be seen from Table 2, we were able to reproduce the same BLEU score for FP32
|
| 302 |
+
257 reference model as in original model. Then we run several experiments to check how accuracy of
|
| 303 |
+
258 the translation wil be changed due to LUT-based quantization in different precisions,and we can
|
| 304 |
+
259 confirm that down up to 8-bit quantization the deviation of BLEU score from reference is small for
|
| 305 |
+
260 both datasets $( < 0 . { \bar { 5 } } \% )$ . Also, if we consider impact of the proposed methods only, then we can
|
| 306 |
+
261 see that accuracy drop is much smaller, and sometimes even recovers vs. PTQ-D quantization (see
|
| 307 |
+
262 Figure 3 (right)).
|
| 308 |
+
|
| 309 |
+

|
| 310 |
+
Figure 3: Accuracy drop for NLP experiments: PTQ-D models $^ +$ softmax approximations vs. FP32 models (left),and PTQ-D models $^ +$ softmax approximations vs. plain PTQ-D models (right). As it can be seen from the figure,down to uint8 precision the accuracy drop for all cases is below $1 \%$ and shows very similar behavior. This confirm very good generalization of the proposed method over different models and applications.
|
| 311 |
+
|
| 312 |
+
# 5.2.2Sentiment analysis
|
| 313 |
+
|
| 314 |
+
To extend the variety of NLP applications,we also tested the same LUTs with BERT model [5]. We have used sentiment analysis task from GLUE benchmark [29] to test the model. We have used huggingface library 9,and trained the model with the hyper-parameters described in 10. The results of our experiments showed, that similarly to machine translation, the impact of proposed method (softmax layer approximation by LUTs) is smallr vs. accuracy drop caused by PTQ-D quantization (see Figure 3).
|
| 315 |
+
|
| 316 |
+
# 5.2.3Semantic equivalence
|
| 317 |
+
|
| 318 |
+
For semantic equivalence test we used The Microsoft Research Paraphrase Corpus (MRPC) 11 in GLUE benchmark.As the classes are imbalanced ( $6 8 \%$ positive, $32 \%$ negative), we follow the
|
| 319 |
+
|
| 320 |
+
273 common practice and used F1 score as a metric. We have used huggingface library and followed
|
| 321 |
+
274 the guidelines from PyTorch tutorial 12 to obtain PTQ-D quantized model. Then,similarly to previous
|
| 322 |
+
275 tests we have substituted a conventional softmax layer with the proposed LUT-based methods. The
|
| 323 |
+
276 results of our experiments showed the similar trend with sentiment analysis test.
|
| 324 |
+
|
| 325 |
+
# 2775.3 Ablation study of DETR models experiment
|
| 326 |
+
|
| 327 |
+
As it is stated in [2],to increase the feature resolution for smallobjects,a dilation to the last stage of the backbone was added ( $+ \mathrm { D C } 5$ cases of DETR models). This modification increases the cost in the self-attentions of the encoder, leading to an overall $\times 2$ increase in computational cost. Such changes also reflect on the properties of softmax factors. In Figure 4 there are shown the histogram of $\Sigma e ^ { x }$ values distributions for the first 2OO tensors of DETR model run for bins $= 5 0$ $\mathtt { r a n g e } = ( 0 , 5 0 0 )$ As it can be seen from the figure, the distribution of DETR $+ \mathrm { D C } 5$ (R50) variant is more right-tailed, due to the bigger number of high-magnitude values. This causes the bigger accuracy drop when LUT-based quantization method is used, due to the lack of the discrepancy for those values. Thus, for such models (DETR with added dilation at the last stage) the accuracy of object detection after application of the proposed method can be limited. However, as we can see from Figure 2) increasing of the size of $L U { \bar { T } } _ { \alpha }$ from 256 Bytes to 512 Bytes allows to decrease the accuracy drop from $9 \%$ to $3 \%$ for $\mathrm { D E T R + D C } 5$ (R101) unit8 case. Thus, we expect that further increasing the size of LUTs will help to obtain even more accurate results for DETR models with dilation.
|
| 328 |
+
|
| 329 |
+

|
| 330 |
+
Figure 4: Histogram of $\Sigma e ^ { x }$ values distributions for DETR model variants: plain DETR (R5O) (left), and with dilation I $) \mathrm { E T R } { + } \mathrm { D C } 5$ (R50) (right). Red dot line represents the average of the all values per one run of the inference of DETR model. It is clearly seen from the figure that distribution of DETR $+ \mathrm { D C } 5$ (R50) variant is more flat, having more high-magnitude values. This causes the bigger accuracy drop for the quantized model due to lack of the discrepancy for those values.
|
| 331 |
+
|
| 332 |
+
# 2916Conclusion
|
| 333 |
+
|
| 334 |
+
In this paper two alternative methods for efficient softmax computation for DNN models with atention mechanism are proposed. The methods are memory-centric in contrast to known logiccentric approach and are based on the usage ofLUTs for reading of the pre-computed values, instead of the direct computation. Thus,it allows to build the HW accelerator without usage of costly and power-hungry divider. In turn, it allows to decrease the power consumption and latency of the whole inference,what is crucial for edge computing. All results obtained in the paper were validated over different AI tasks (object detection, machine translation, sentiment analysis, and semantic equivalence) and models (DETR,Transformer, BERT) by variety of benchmarks (COCO2017, WMT14, WMT17, GLUE), showing acceptable accuracy and good generalization of the proposed methods.
|
| 335 |
+
|
| 336 |
+
References
|
| 337 |
+
[1] Aishwarya Bhandare, Vamsi Sripathi, Deepthi Karkada, Vivek Menon, Sun Choi, Kushal Datta, and Vikram Saletore.Eficient 8-bit quantization of transformer neural machine language translation model. CoRR,abs/1906.00532,2019.
|
| 338 |
+
[2] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers, 2020.
|
| 339 |
+
[3] Ming Chen, Yingming_Li, Zhongfei Zhang, and Siyu_Huang. Tvt: Two-view transformer network for video captioning. In Jun Zhu and Ichiro Takeuchi, editors, Proceedings of The l0th Asian Conference on Machine Learning, volume 95 of Proceedings of Machine Learning Research, pages 847-862. PMLR,14-16 Nov 2018.
|
| 340 |
+
[4] Jacek Czaja, Michal Galus, Tomasz Patejko,and Jian Tang. Softmax optimizations for intel xeon processor-based platforms. CoRR,abs/1904.12380,2019.
|
| 341 |
+
[5] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR,abs/1810.04805, 2018.
|
| 342 |
+
[6] Alexey Dosovitskiy,Lucas Beyer,Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Mathias Minderer, Georg Heigold, Sylvain Gely, Jakob Uszkoreit,and Neil Houlsby.An image is worth 16x16 words: Transformers for image recognition at scale,2020.
|
| 343 |
+
[7] Sebastian Gehrmann, Yuntian Deng, and Alexander Rush. Botom-up abstractive summarization. In Proceedings of the2O18 Conference on Empirical Methods in Natural Language Processing, pages 4098-4109,2018.
|
| 344 |
+
[8] Xue Geng, Jie Lin, Bin Zhao, Anmin Kong, Mohamed M. Sabry Aly, and Vijay Chandrasekhar. Hardware-aware softmax approximation for deep neural networks. In C.V. Jawahar, Hongdong Li, Greg Mori,and Konrad Schindler, editors, Computer Vision- ACCV 2018, pages 107-12, Cham, 2019. Springer International Publishing.
|
| 345 |
+
[9] Yanzhang He, Tara N. Sainath, Rohit Prabhavalkar, Ian McGraw, Raziel Alvarez, Ding Zhao, David Rybach, Anjuli Kannan, Yonghui Wu, Ruoming Pang, Qiao Liang, Deepti Bhatia, Yuan Shangguan, Bo Li, Golan Pundak, Khe Chai Sim, Tom Bagby, Shuo yiin Chang, Kanishka Rao, and Alexander Gruenstein. Streaming end-to-end speech recognition for mobile devices,2018.
|
| 346 |
+
[10] R. Hu, B. Tian, S. Yin,and S. Wei. Efcient hardware architecture of softmax layer in deep neural network. In2018 IEEE23rd International Conference on Digital Signal Procesing (DSP), pages 1-5, Nov 2018.
|
| 347 |
+
[11] Andrey Ignatov, Radu Timofte, Wilim Chou, Ke Wang, Max Wu, Tim Hartley,and Luc Van Gool.AI benchmark: Running deep neural networks on android smartphones. CoRR, abs/1810.01109,2018.
|
| 348 |
+
[12] Guillume Klein, Yoon Kim, Yuntian Deng, Jean Senellart, and Alexander M. Rush. OpenNMT: Open-source toolkit for neural machine translation. In Proc. ACL, 2017.
|
| 349 |
+
[13] Ioannis Kouretas and Vassilis Paliouras. Hardware implementation of a softmax-like function for deep learning. Technologies, 8(3), 2020.
|
| 350 |
+
[14] Guillaume Lample and Frangois Charton. Deep learning for symbolic mathematics. CoRR, abs/1912.01412, 2019.
|
| 351 |
+
[15] Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations, 2019.
|
| 352 |
+
[16] Bo Li, Shuo yiin Chang,Tara N. Sainath,Ruoming Pang, Yanzhang He, Trevor Strohman, and Yonghui Wu. Towards fast and accurate streaming end-to-end asr, 2020.
|
| 353 |
+
[17] Z. Li, H. Li, X. Jiang, B. Chen, Y. Zhang, and G. Du.Efficient fpga implementation of softmax function for dnn applications. In 2018 12th IEEE International Conference on Anticounterfeiting, Security, and Identification (ASID), pages 212-216, Nov 2018.
|
| 354 |
+
50[18] Yinhan Liu,Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettemoyer, and Veselin Stoyanov. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692, 2019.
|
| 355 |
+
53[19] M. G. Sarwar Murshed, Christopher Murphy, Daqing Hou, Nazar Khan, Ganesh Ananthanarayanan, and Faraz Hussain. Machine learning at the network edge: A survey, 2019.
|
| 356 |
+
55[20] Gabriele Prato,Ella Charlaix,and Mehdi Rezagholizadeh.Fully quantized transformer for improved translation, 2019. [21] Tara N. Sainath, Yanzhang He, Bo Li, Arun Narayanan,Ruoming Pang, Antoine Bruguier, Shuo yiin Chang, Wei Li, Raziel Alvarez, Zhifeng Chen, Chung-Cheng Chiu, David Garcia, Alex Gruenstein, Ke Hu, Minho Jin, Anjuli Kannan, Qiao Liang, Ian McGraw, Cal Peyser, Rohit Prabhavalkar, Golan Pundak, David Rybach, Yuan Shangguan, Yash Sheth, Trevor Strohman, Mirko Visontai, Yonghui Wu, Yu Zhang,and Ding Zhao. A streaming on-device end-to-end model surpassing server-side conventional model quality and latency, 2020.
|
| 357 |
+
63[22] Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao,Amir Gholami, Michael W. Mahoney,and Kurt Keutzer. Q-bert: Hessian based ultra low precision quantization of bert, 2019. [23] Hyunsung Shin, Dongyoung Kim, Eunhyeok Park, Sungho Park, Yongsik Park, and Sungjoo Yoo. Mcdram: Low latency and energy-effcient matrix computations in dram. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 37(11):2613-2622, 2018.
|
| 358 |
+
70[24] Jacob R. Stevens, Rangharajan Venkatesan, Steve Dai, Brucek Khailany,and Anand Raghunathan. Softermax: Hardware/software co-design of an eficient softmax for transformers. CoRR,abs/2103.09301,2021. [25] Q. Sun, Z. Di,Z. Lv, F. Song, Q. Xiang, Q. Feng, Y. Fan, X. Yu,and W. Wang. A high speed softmax vlsi architecture based on basic-split. In 2018 14th IEEE International Conference on Solid-State and Integrated Circuit Technology (ICSICT), pages 1-3, Oct 2018. [26] Hugo Touvron,Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers distillation through attention, 2021.
|
| 359 |
+
78[27] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,Llion Jones,Aidan N. Gomez, Lukasz Kaiser, and Ilia Polosukhin. Attention is all you need. CoRR,abs/1706.03762, 2017. [28] Ihor Vasyltsov and Wooseok Chang. Lightweight Approximation of Softmax Layer for On-Device Inference. Springer International Publishing, 2021.
|
| 360 |
+
82[29] Alex Wang,Amanpreet Singh, Julian Michael,Felix Hil,Omer Levy,and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. CoRR,abs/1804.07461,2018.
|
| 361 |
+
85[30] K. Wang, Y. Huang, Y. Ho,and W. Fang. A customized convolutional neural network design using improved softmax layer for real-time human emotion recognition. In 2019 IEEE International Conference on Artificial Intelligence Circuits and Systems (AICAS), pages 102-106, March 2019.
|
| 362 |
+
89[31] M. Wang,S.Lu,D. Zhu, J.Lin,and Z. Wang. A high-speed and low-complexity architecture for softmax function in deep learning. In 2O18 IEEE Asia Pacific Conference on Circuits and Systems (APCCAS), pages 223-226, Oct 2018.
|
| 363 |
+
92[32] Siqi Wang,Anuj Pathania,and Tulika Mitra. Neural network inference on mobile socs. IEEE Design Test, page 1-1,2020.
|
| 364 |
+
94[33] Zhilin_ Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell,Ruslan Salakhutdinov, and Quoc V. Le. Xlnet: Generalized autoregressive pretraining for language understanding. CoRR, abs/1906.08237,2019.
|
| 365 |
+
[34] B. Yuan. Efcient hardware architecture of softmax layer in deep neural network. In 2016 29th IEEE International System-on-Chip Conference (SOCC), pages 323-326, Sep.2016.
|
| 366 |
+
[35] Ofir Zafrir, Guy Boudoukh,Peter Izsak,and Moshe Wasserblat. Q8bert: Quantized 8bit bert, 2019.
|
| 367 |
+
[36] Xingzhou Zhang, Yifan Wang, Sidi Lu,Liangkai Liu, Lanyu Xu,and Weisong Shi. Openei: An open framework for edge intelligence. CoRR,abs/1906.01864,2019.
|
| 368 |
+
|
| 369 |
+
# Checklist
|
| 370 |
+
|
| 371 |
+
1. For all authors..
|
| 372 |
+
|
| 373 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?[Yes] See also Section 3,where key contributions were listed.
|
| 374 |
+
(b) Did you describe the limitations of your work?[Yes] See Section 5.3.
|
| 375 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 376 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] We read the ethics review guidelines and confirm that content of our paper is not related to any ethics issue, since it is focused on the optimization of computations.
|
| 377 |
+
|
| 378 |
+
2. If you are including theoretical results...
|
| 379 |
+
|
| 380 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 381 |
+
|
| 382 |
+
3. If you ran experiments...
|
| 383 |
+
|
| 384 |
+
(a) Did you include the code,data,and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See supplemental materials.
|
| 385 |
+
(b) Did you specify all the training details (e.g., data splits,hyperparameters, how they were chosen)? [N/A] In our paper we do not consider any training, or fine-tuning. We focus on the inference only.
|
| 386 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] Since we did not do any training, we did not need to run experiment multiple times (inference output is deterministic).
|
| 387 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] Since we did not do any training, it is not related to our work.
|
| 388 |
+
|
| 389 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets..
|
| 390 |
+
|
| 391 |
+
(a) If your work uses existing assets, did you cite the creators?[Yes] Al used assets are cited either as a reference,or by direct URL link in the footnote,or in the body of the paper.
|
| 392 |
+
(b) Did you mention the license of the assets? [Yes] The license of the used assets are noticed either in the appropriate reference,or direct URL link of asset.
|
| 393 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Some code and generated LUTs to reproduce our results are provided in supplemental materials.
|
| 394 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating? [N/A]
|
| 395 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 396 |
+
|
| 397 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 398 |
+
|
| 399 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 400 |
+
(b) Did you describe any potential participant risks,with links to Institutional Review Board (IRB) approvals,if applicable? [N/A]
|
| 401 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/_X_4Akcd8Re/_X_4Akcd8Re.md
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING LONG-TERM VISUAL DYNAMICS WITH REGION PROPOSAL INTERACTION NETWORKS
|
| 2 |
+
|
| 3 |
+
Haozhi Qi UC Berkeley
|
| 4 |
+
|
| 5 |
+
Xiaolong Wang UC San Diego
|
| 6 |
+
|
| 7 |
+
Deepak Pathak CMU
|
| 8 |
+
|
| 9 |
+
Yi Ma UC Berkeley
|
| 10 |
+
|
| 11 |
+
Jitendra Malik UC Berkeley
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Learning long-term dynamics models is the key to understanding physical common sense. Most existing approaches on learning dynamics from visual input sidestep long-term predictions by resorting to rapid re-planning with short-term models. This not only requires such models to be super accurate but also limits them only to tasks where an agent can continuously obtain feedback and take action at each step until completion. In this paper, we aim to leverage the ideas from success stories in visual recognition tasks to build object representations that can capture inter-object and object-environment interactions over a long-range. To this end, we propose Region Proposal Interaction Networks (RPIN), which reason about each object’s trajectory in a latent region-proposal feature space. Thanks to the simple yet effective object representation, our approach outperforms prior methods by a significant margin both in terms of prediction quality and their ability to plan for downstream tasks, and also generalize well to novel environments. Code, pre-trained models, and more visualization results are available at our Website.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
As argued by Kenneth Craik, if an organism carries a model of external reality and its own possible actions within its head, it is able to react in a much fuller, safer and more competent manner to emergencies which face it (Craik, 1952). Indeed, building prediction models has been long studied in computer vision and intuitive physics. In computer vision, most approaches make predictions in pixel-space (Denton & Fergus, 2018; Lee et al., 2018; Ebert et al., 2018b; Jayaraman et al., 2019; Walker et al., 2016), which ends up capturing the optical flow (Walker et al., 2016) and is difficult to generalize to long-horizon. In intuitive physics, a common approach is to learn the dynamics directly in an abstracted state space of objects to capture Newtonian physics (Battaglia et al., 2016; Chang et al., 2016; Sanchez-Gonzalez et al., 2020). However, the states end up being detached from raw sensory perception. Unfortunately, these two extremes have barely been connected. In this paper, we argue for a middle-ground to treat images as a window into the world, i.e., objects exist but can only be accessed via images. Images are neither to be used for predicting pixels nor to be isolated from dynamics. We operationalize it by learning to extract a rich state representation directly from images and build dynamics models using the extracted state representations.
|
| 20 |
+
|
| 21 |
+
# It is difficult to make predictions, especially about the future — Niels Bohr
|
| 22 |
+
|
| 23 |
+
Contrary to Niels Bohr, predictions are, in fact, easy if made only for the short-term. Predictions that are indeed difficult to make and actually matter are the ones made over the long-term. Consider the example of “Three-cushion Billiards” in Figure 1. The goal is to hit the cue ball in such a way that it touches the other two balls and contacts the wall thrice before hitting the last ball. This task is extremely challenging even for human experts because the number of successful trajectories is very sparse. Do players perform classical Newtonian physics calculations to obtain the best action before each shot, or do they just memorize the solution by practicing through exponentially many configurations? Both extremes are not impossible, but often impractical. Players rather build a physical understanding by experience (McCloskey, 1983; Kubricht et al., 2017) and plan by making intuitive, yet accurate predictions in the long-term.
|
| 24 |
+
|
| 25 |
+
Learning such a long-term prediction model is arguably the “Achilles’ heel” of modern machine learning methods. Current approaches on learning physical dynamics of the world cleverly side-step the long-term dependency by re-planning at each step via model-predictive control (MPC) (Allgöwer & Zheng, 2012; Camacho & Alba, 2013). The common practice is to train short-term dynamical models (usually 1-step) in a simulator. However, small errors in short-term predictions can accumulate over time in MPC. Hence, in this work, we focus primarily on the long-term aspect of prediction by just considering environments, such as the three-cushion billiards example or the PHYRE (Bakhtin et al., 2019) in Figure 1, where an agent is allowed to take only one action in the beginning so as to preclude any scope of re-planning.
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: Two example of long-term dynamics prediction tasks. Left: three-cushion billiards. Right: PHYRE intuitive-physics dataset (Bakhtin et al., 2019). Our proposed approach makes accurate long-term predictions that do not necessarily align with the ground truth but provide strong signal for planning.
|
| 29 |
+
|
| 30 |
+
How to learn an accurate dynamics model has been a popular research topic for years. Recently, there are a series of work trying to represent video frames using object-centric representations (Battaglia et al., 2016; Watters et al., 2017; Chang et al., 2016; Janner et al., 2019; Ye et al., 2019; Kipf et al., 2020). However, those methods either operate in the state space, or ignore the environment information, both of which are not practical in real-world scenarios. In contrast, our objective is to build a data-driven prediction model that can both: (a) model long-term interactions over time to plan successfully for new instances, and (b) work from raw visual input in complex real-world environments. Therefore, the question we ask is: how to extract such an effective and flexible object representation and perform long-term predictions?
|
| 31 |
+
|
| 32 |
+
We propose Region Proposal Interaction Network (RPIN) which contains two key components. Firstly, we leverage the region of interests pooling (RoIPooling) operator (Girshick, 2015) to extract object features maps from the frame-level feature. Object feature extraction based on region proposals has achieved huge success in computer vision (Girshick, 2015; He et al., 2017; Dai et al., 2017; Gkioxari et al., 2019), and yet, surprisingly under-explored in the field of intuitive physics. By using RoIPooling, each object feature contains not only its own information but also the context of the environment. Secondly, we extend the Interaction Network and propose Convolutional Interaction Networks that perform interaction reasoning on the extracted RoI features. Interaction Networks is originally proposed in (Battaglia et al., 2016), where the interaction reasoning is conducted via MLPs. By changing MLPs to convolutions, we can effectively utilize the spatial information of an object and make accurate future prediction of object location and shapes changes.
|
| 33 |
+
|
| 34 |
+
Notably, our approach is simple, yet outperforms the state-of-the-art methods in both simulation and real datasets. In Section 5, we thoroughly evaluate our approach across four datasets to study scientific questions related to a) prediction quality, b) generalization to time horizons longer than training, c) generalization to unseen configurations, d) planning ability for downstream tasks. Our method reduces the prediction error by $7 5 \%$ in the complex PHYRE environment and achieves state-of-the-art performance on the PHYRE reasoning benchmark.
|
| 35 |
+
|
| 36 |
+
# 2 RELATED WORK
|
| 37 |
+
|
| 38 |
+
Physical Reasoning and Intuitive Physics. Learning models that can predict the changing dynamics of the scene is the key to building physical common-sense. Such models date back to “NeuroAnimator” (Grzeszczuk et al., 1998) for simulating articulated objects. Several methods in recent years have leveraged deep networks to build data-driven models of intuitive physics (Bhattacharyya et al., 2016; Ehrhardt et al., 2017; Fragkiadaki et al., 2015; Chang et al., 2016; Stewart & Ermon, 2017). However, these methods either require access to the underlying ground-truth state-space or do not scale to long-range due to absence of interaction reasoning. A more generic yet explicit approach has been to leverage graph neural networks (Scarselli et al., 2009) to capture interactions between entities in a scene (Battaglia et al., 2018; Chang et al., 2016). Closest to our approach are interaction models that scale to pixels and reason about object interaction (Watters et al., 2017; Ye et al., 2019). However, these approaches either reason about object crops with no context around or can only deal with a predetermined number and order of objects. A concurrent work (Girdhar et al., 2020) studies using prediction for physical reasoning, but their prediction model is either in the state space or in the pixel space.
|
| 39 |
+
|
| 40 |
+
Other common ways to measure physical understanding are to predict future judgments given a scene image, e.g., predicting the stability of a configuration (Groth et al., 2018; Jia et al., 2015; Lerer et al., 2016; Li et al., 2016a;b). Several hybrid methods take a data-driven approach to estimate Newtonian parameters from raw images (Brubaker et al., 2009; Wu et al., 2016; Bhat et al., 2002; Wu et al., 2015), or model Newtonian physics via latent variable to predict motion trajectory in images (Mottaghi et al., 2016a;b; Ye et al., 2018). An extreme example is to use an actual simulator to do inference over objects (Hamrick et al., 2011). The reliance on explicit Newtonian physics makes them infeasible on real-world data and un-instrumented settings. In contrast, we take into account the context around each object via RoIPooling and explicitly model their interaction with each other or with the environment without relying on Newtonian physics, and hence, easily scalable to real videos for long-range predictions.
|
| 41 |
+
|
| 42 |
+
Video Prediction. Instead of modeling physics from raw images, an alternative is to treat visual reasoning as an image translation problem. This approach has been adopted in the line of work that falls under video prediction. The most common theme is to leverage latent-variable models for predicting future (Lee et al., 2018; Denton & Fergus, 2018; Babaeizadeh et al., 2017). Predicting pixels is difficult so several methods leverage auxiliary information like back/fore-ground (Villegas et al., 2017a; Tulyakov et al., 2017; Vondrick et al., 2016), optical flow (Walker et al., 2016; Liu et al., 2017), appearance transformation (Jia et al., 2016; Finn et al., 2016; Chen et al., 2017; Xue et al., 2016), etc. These inductive biases help in a short interval but do not capture long-range behavior as needed in several scenarios, like playing billiards, due to lack of explicit reasoning. Some approaches can scale to relative longer term but are domain-specific, e.g., pre-defined human-pose space (Villegas et al., 2017b; Walker et al., 2017). However, our goal is to model long-term interactions not only for prediction but also to facilitate planning for downstream tasks.
|
| 43 |
+
|
| 44 |
+
Learning Dynamics Models. Unlike video prediction, dynamics models take actions into account for predicting the future, also known as forward models (Jordan & Rumelhart, 1992). Learning these forward dynamics models from images has recently become popular in robotics for both specific tasks (Wahlström et al., 2015; Agrawal et al., 2016; Oh et al., 2015; Finn et al., 2016) and exploration (Pathak et al., 2017; Burda et al., 2019). In contrast to these methods where a deep network directly predicts the whole outcome, we leverage our proposed region-proposal interaction module to capture each object trajectories explicitly to learn long-range forward dynamics as well as video prediction models.
|
| 45 |
+
|
| 46 |
+
Planning via Learned Models. Leveraging models to plan is the standard approach in control for obtaining task-specific behavior. Common approach is to re-plan after each action via Model Predictive Control (Allgöwer & Zheng, 2012; Camacho & Alba, 2013; Deisenroth & Rasmussen, 2011). Scaling the models and planning in a high dimensional space is a challenging problem. With deep learning, several approaches shown promising results on real-world robotic tasks (Finn et al., 2016; Finn & Levine, 2017; Agrawal et al., 2016; Pathak et al., 2018). However, the horizon of these approaches is still very short, and replanning in long-term drifts away in practice. Some methods try to alleviate this issue via object modeling (Janner et al., 2019; Li et al., 2019) or skip connections (Ebert et al., 2018a) but assume the models are trained with state-action pairs. In contrast to prior works where a short-range dynamic model is unrolled in time, we learn our long-range models from passive data and then couple them with short-range forward models to infer actions during planning.
|
| 47 |
+
|
| 48 |
+
# 3 REGION PROPOSAL INTERACTION NETWORKS
|
| 49 |
+
|
| 50 |
+
Our model takes $N$ video frames and the corresponding object bounding boxes as inputs, and outputs the objects’ bounding boxes and masks for the future $T$ timesteps. The overall model structure is illustrated in Figure 2.
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
Figure 2: Our Region Proposal Interaction Network. Given $N$ frames as inputs, we forward them to an encoder network, and then extract the foreground object features with RoIPooling (different colors represent different instances). We then perform interaction reasoning on top of the region proposal features (gray box on the bottom right). We predict each future object feature based on the previous $k$ time steps. We then estimate the object location from each object feature.
|
| 54 |
+
|
| 55 |
+
For each frame, we first extract the image features using a ConvNet. Then we apply RoIPooling (Girshick, 2015; He et al., 2017) to obtain the object-centric visual features. These features are then forwarded to our Convolutional Interaction Networks (CIN) to perform objects’ interaction reasoning and used to predict future object bounding boxes and masks. The whole pipeline is trained end-to-end by minimizing the loss between the predicted outputs and the ground-truth.
|
| 56 |
+
|
| 57 |
+
# 3.1 OBJECT-CENTRIC REPRESENTATION
|
| 58 |
+
|
| 59 |
+
We apply the houglass network (Newell et al., 2016) to extract the image features. Given an input RGB image $I \in \breve { \mathbb { R } } ^ { 3 \times H \times W }$ , the hourglass network firstly downsample the input via one 2-strided convolution and 2-strided max pooling layers, and then refine the representation by a U-Net-like encoder-decoder modules (Ronneberger et al., 2015). The hourglass network provides features with a large receptive field and a fine spatial resolution (4 times smaller than the input image), both of which are crucial to accurately model object-object and object-environment interactions. We denote the number of output channels of the feature map as $d$ .
|
| 60 |
+
|
| 61 |
+
On top of this feature map, we use RoIPooling (Girshick, 2015) to extract a $d \times h \times w$ objectcentric features. RoIPooling takes the feature map and a object bounding box as input. The region corresponding to the bounding box on the feature map is cropped and resize to a fixed spatial size (denoted as $h \times w$ ). We use $\boldsymbol { x } _ { i } ^ { t }$ to represent the feature at $t$ -th timestep for the $i$ -th object. Such feature representation differs from previous method in two perspectives: 1) It is extracted from image features with a large receptive field, which gives plenty of context information around the object. 2) The feature representation is a 3-dimensional feature map rather than a single vector representation. It can represent the objects’ shapes while the vector representation cannot because the spatial dimension is flattened.
|
| 62 |
+
|
| 63 |
+
# 3.2 CONVOLUTIONAL INTERACTION NETWORKS
|
| 64 |
+
|
| 65 |
+
To better utilize the spatial information of our object feature map, we propose Convolutional Interaction Networks, an extension of Interaction Network operators on 3-dimensional tensors. In this section, we first briefly review the original Interaction Network (IN) (Battaglia et al., 2016; Watters et al., 2017) and introduce the proposed Convolutional Interaction Networks (CIN).
|
| 66 |
+
|
| 67 |
+
The original interaction network is a general-purpose data-driven method to model and predict physical dynamics. It takes the feature vectors of $m$ objects at timestep $t$ : $X = \{ x _ { 1 } ^ { t } , x _ { 2 } ^ { t } , . . . , x _ { m } ^ { \hat { t } } \mid x _ { i } ^ { t } \in \bar { \mathbb { R } } ^ { d } \}$ and performs object reasoning $f _ { O }$ as well as relational reasoning $f _ { R }$ on these features. Specifically, the updated rule of object features can be described as:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\begin{array} { r l } & { e _ { i } ^ { t } = f _ { A } \big ( f _ { O } ( x _ { i } ^ { t } ) + \sum _ { j \neq i } f _ { R } ( x _ { i } ^ { t } , x _ { j } ^ { t } ) \big ) , } \\ & { z _ { i } ^ { t } = f _ { Z } ( x _ { i } ^ { t } , e _ { i } ^ { t } ) , } \\ & { x _ { i } ^ { t + 1 } = f _ { P } \big ( z _ { i } ^ { t } , z _ { i } ^ { t - 1 } , \dots , z _ { i } ^ { t - k } \big ) . } \end{array}
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
In the above equation, $f _ { A }$ is the function to calculate the effect of both of object reasoning and relational reasoning results. And $f _ { Z }$ is used to combine the original object state and the reasoning effect. Finally, $f _ { P }$ is used to do future state predictions based on one or more previous object states. In IN, $f _ { O , R , A , Z , P }$ are instantiated by a fully-connected layer with learnable weights.
|
| 74 |
+
|
| 75 |
+
Convolutional Interaction Networks. The input of CIN is $m$ object feature maps at timestep $t$ : $X = \{ x _ { 1 } ^ { t } , x _ { 2 } ^ { t } , . . . , x _ { m } ^ { t } | x _ { i } ^ { t } \in \mathbb { R } ^ { d \times h \times w } \}$ . The high-level update rule is the same as IN, but the key difference is that we use convolution to instantiate $f _ { O , R , A , Z , P }$ . Such instantiation is crucial to utilize the spatial information encoded in our object feature map and to effectively reason future object states. Specifically, we have
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\begin{array} { c c } { f _ { R } ( x _ { i } ^ { t } , x _ { j } ^ { t } ) = W _ { R } * [ x _ { i } ^ { t } , x _ { j } ^ { t } ] } & { f _ { O } ( x _ { i } ^ { t } ) = W _ { O } * x _ { i } ^ { t } } \\ { f _ { A } ( x _ { i } ^ { t } ) = W _ { A } ^ { T } * x _ { i } ^ { t } } & { f _ { Z } ( x _ { i } ^ { t } , e _ { i } ^ { t } ) = W _ { Z } * [ x _ { i } ^ { t } , e _ { i } ^ { t } ] } \\ { f _ { P } ( z _ { i } ^ { t } , z _ { i } ^ { t - 1 } , . . . , z _ { i } ^ { t - k } ) = W _ { P } * [ z _ { i } ^ { t } , z _ { i } ^ { t - 1 } , . . . , z _ { i } ^ { t - k } ] } \end{array}
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
One can plug the functions in Equation 1 for better understanding the operations. In the above equations, $^ *$ denotes the convolution operator, and $[ \cdot , \cdot ]$ denotes concatenation along the channel dimension. $W _ { R } , W _ { Z } \in \mathbb { R } ^ { d \times 2 d \times 3 \times 3 }$ , $W _ { O } , W _ { A } \in \mathbb { R } ^ { d \times d \times 3 \times 3 }$ , $W _ { P } \in \mathbb { R } ^ { d \times ( k d ) \times 3 \times 3 }$ are learnable weights of the convolution kernels with kernel size $3 \times 3$ . We also add ReLU activation after each of the convolutional operators.
|
| 82 |
+
|
| 83 |
+
# 3.3 LEARNING REGION PROPOSAL INTERACTION NETWORKS (RPIN)
|
| 84 |
+
|
| 85 |
+
Our model predicts the future bounding box and (optionally) masks of each object. Given the predicted feature $\boldsymbol { x } _ { i } ^ { t + 1 }$ , we use a simple two layer MLP decoder to estimate its bounding boxes coordinates and masks. The bounding box decoder takes a flattened object feature map as input. It firstly projects it to $d$ dimensional vector, and outputs 4-d vector, representing the center location and size of the box. The mask decoder is of the same architecture but has $2 1 \times 2 1$ output channels, representing a $2 1 \times 2 1$ binary masks inside the corresponding bounding boxes. We use the $\ell ^ { 2 }$ loss for bounding box predictions. For mask prediction, we use spatial cross-entropy loss which sums the cross-entropy values of a $2 1 \times 2 1$ predicted positions. The objective can be written as:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
L _ { p } = \sum _ { t = 1 } ^ { T } \lambda _ { t } \sum _ { i = 1 } ^ { n } \Big ( \| \hat { B } _ { i } ^ { t + 1 } - B _ { i } ^ { t + 1 } \| _ { 2 } ^ { 2 } + C E ( \hat { M } _ { i } ^ { t + 1 } , M _ { i } ^ { t + 1 } ) \Big ) .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
We use discounted loss during training (Watters et al., 2017) to mitigate the effect of inaccurate prediction at early training stage and $\lambda _ { t }$ is the discounted factor.
|
| 92 |
+
|
| 93 |
+
# 4 EXPERIMENTAL SETUP
|
| 94 |
+
|
| 95 |
+
Datasets. We evaluate our method’s prediction performance on four different datasets, and demonstrate the ability to perform downstream physical reasoning and planning tasks on two of them. We briefly introduce the four datasets below. The full dataset details are in the appendix.
|
| 96 |
+
|
| 97 |
+
PHYRE: We use the BALL-tier of the PHYRE benchmark (Bakhtin et al., 2019). In this dataset, we set $T = 5$ . We treat all of the moving balls or jars as objects and other static bodies as background. The benchmark provides two evaluation settings: 1) within task generalization (PHYRE-W), where the testing environments contain the same object category but different sizes and positions; 2) cross task generalization (PHYRE-C), where environments containing objects and context never present during training. We report prediction using the official fold 0 and the physical reasoning performance averaged on 10 folds.
|
| 98 |
+
|
| 99 |
+
ShapeStacks (SS): This dataset contains multiple stacked objects (cubes, cylinders, or balls) (Ye et al., 2019). In this dataset, we set $T = 1 5$ . We evaluate all baselines and our methods follow the protocol of (Ye et al., 2019) with uncertainty estimation incorporated (see Appendix for detail).
|
| 100 |
+
|
| 101 |
+
Real World Billiards (RealB): We collect “Three-cushion Billiards” videos from professional games with different viewpoints downloaded from YouTube. There are 62 training videos with 18, 306 frames, and 5 testing videos with 1, 995 frames. The bounding box annotations are from an offthe-shelf ResNet-101 FPN detector (Lin et al., 2017) pretrained on COCO (Lin et al., 2014) and fine-tuned on a subset of 30 images from our dataset. We manually filtered out wrong detections. In this dataset, we set $T = 2 0$ .
|
| 102 |
+
|
| 103 |
+
Simulation Billiards (SimB): We create a simulated billiard environment with three different colored balls with a radius 2 are randomly placed in a $6 4 \times 6 4$ image. At starting point, one ball is moving with a randomly sampled velocity. We generate 1,000 video sequences for training and 1,000 video sequences for testing, with 100 frames per sequence. We will also evaluate the ability to generalize to more balls and different sized balls in the experiment section. In this dataset, we set $T = 2 0$ .
|
| 104 |
+
|
| 105 |
+
For PHYRE and SS, it is possible to infer the future from just the initial configuration. So we set $N = 1$ in these two datasets. For SimB and RealB, the objects are moving in a flat table so we cannot infer the future trajectories based on a single image. Therefore in this setting, we set $N = 4$ to infer the velocity/acceleration of objects. We set $k = N$ in all the dataset because we only have access to $N$ features when we make prediction at $t = N + 1$ . We predict object masks for PHYRE and ShapeStacks, and only predict bounding boxes for Billiard datasets.
|
| 106 |
+
|
| 107 |
+
Baselines. There are a large amount of work studying how to estimate objects’ states and predict their dynamics from raw image inputs. They fall into the following categories:
|
| 108 |
+
|
| 109 |
+
VIN: Instead of using object-centric spatial pooling to extract object features, it use a ConvNet to globally encode an image to a fixed $d \times m$ dimensional vector. Different channels of the vector is assigned to different objects (Kipf et al., 2020; Watters et al., 2017). This approach requires specifying a fixed number of objects and a fixed mapping between feature channels and object identity, which make it impossible to generalize to different number of objects and different appearances.
|
| 110 |
+
|
| 111 |
+
Object Masking (OM): This approach takes one image and $m$ object bounding boxes or masks as input (Wu et al., 2017; Veerapaneni et al., 2019; Janner et al., 2019). For each proposal, only the pixels inside object proposals are kept while others are set to 0, leading to $m$ masked images. This approach assumes no background information is needed thus fails to predict accurate trajectories in complex environments such as PHYRE. And it also cost $m$ times computational resources.
|
| 112 |
+
|
| 113 |
+
CVP: The object feature is extracted by cropping the object image patch and forwarding it to an encoder (Ye et al., 2019; Yi et al., 2020). Since the object features are directly extracted from the raw image patches, the context information is also ignored. We re-implement CVP’s feature extraction method within our framework. We show we can reproduce their results in Section A.2.
|
| 114 |
+
|
| 115 |
+
5 EVALUATION RESULTS: PREDICTION, GENERALIZATION, AND PLANNING
|
| 116 |
+
|
| 117 |
+
We organize this section and analyze our results by discussing four scientific questions related to the prediction quality, generalization ability across time & environment configurations, and the ability to plan actions for downstream tasks.
|
| 118 |
+
|
| 119 |
+
# 5.1 HOW ACCURATE IS THE PREDICTED DYNAMICS?
|
| 120 |
+
|
| 121 |
+
To evaluate how well the world dynamics is modeled, we first report the average prediction errors on the test split, over the same time-horizon as which model is trained on, i.e., $t \in [ 0 , T _ { \mathrm { t r a i n } } ]$ . The prediction error is calculated by the squared $\ell _ { 2 }$ distance between predicted object center location and the ground-truth object centers. The results are shown in Table 1 (left half).
|
| 122 |
+
|
| 123 |
+
Firstly, we show the effectiveness of our proposed RoI Feature by comparing Table 1 VIN, OM, CVP, and Ours (IN). These four entries use the same backbone network and interaction network modules and only visual encoder is changed. Among them, VIN cannot even be trained on PHYRE-W since it cannot handle varying number of objects. The OM method performs slightly better than other baselines since it also explicitly models objects by instance masking. For CVP, it cannot produce reasonable results on all of the datasets except on the SS dataset. The reason is that in PHYRE and billiard environments, cropped images are unaware of environment information and the relative position and pose of different objects, making it impossible to make accurate predictions. In SS, since the object size is large and objects are very close to each other, the cropped image regions already provide enough context. In contrast, our RoI Feature can implicitly encode the context and environment information and it performs much better than all baselines. In the very challenging PHYRE dataset, the prediction error is only $1 / 4$ of the best baseline. In the other three easier datasets, the gap is not as large since the environment is less complicated, but our method still achieves
|
| 124 |
+
|
| 125 |
+
Table 1: We compare our method with different baselines on all four datasets. The left part shows the prediction error when rollout timesteps is the same as training time. The right part shows the generalization ability to longer horizon unseen during training. The error is scaled by 1,000. Our method has significantly improvements on all of the datasets
|
| 126 |
+
|
| 127 |
+
<table><tr><td rowspan="2">method</td><td rowspan="2">visual encoder</td><td colspan="3">t ∈ [0,Ttrain]</td><td rowspan="2"></td><td colspan="3">t ∈[Ttrain,2 × Ttrain]</td></tr><tr><td>PHYRE-W</td><td>sS RealB</td><td>SimB</td><td>PHYRE-W ss</td><td>RealB</td><td>SimB</td></tr><tr><td>VIN</td><td>Global Encoding</td><td>N.A.</td><td>2.47</td><td>1.02</td><td>3.89</td><td>N.A.</td><td>7.77 5.11</td><td>29.51</td></tr><tr><td>OM</td><td>Masked Image</td><td>6.45</td><td>3.01</td><td>0.59 3.48</td><td>25.72</td><td>9.51</td><td>3.23</td><td>28.87</td></tr><tr><td>CVP</td><td>Cropped Image</td><td>60.12</td><td>2.84</td><td>3.57</td><td>80.01</td><td>79.11 7.72</td><td>6.63</td><td>108.56</td></tr><tr><td>Ours (IN)</td><td>RoI Feature</td><td>1.50</td><td>1.85</td><td>0.37</td><td>3.01</td><td>12.45 4.89</td><td>2.72</td><td>27.88</td></tr><tr><td>Ours (CIN)</td><td>RoI Feature</td><td>1.31</td><td>1.03</td><td>0.30</td><td>2.55</td><td>11.10 4.73</td><td>2.34</td><td>25.77</td></tr></table>
|
| 128 |
+
|
| 129 |
+
<table><tr><td>method</td><td>visual encoder</td><td>PHYRE-C SS-4 SimB-5</td></tr><tr><td>VIN</td><td>Global Encoding</td><td>N.A. N.A. N.A.</td></tr><tr><td>OM</td><td>Masked Image</td><td>50.28 17.02 59.70</td></tr><tr><td>CVP</td><td>Cropped Image</td><td>99.26 16.88 113.39</td></tr><tr><td>Ours (IN)</td><td>RoI Feature</td><td>10.98 15.02 24.42</td></tr><tr><td>Ours (CIN)</td><td>RoI Feature</td><td>9.22 14.61 22.38</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Table 2: The ability to generalize to novel environments. We show the average prediction error for $t \in [ 0 , 2 \times T _ { \mathrm { t r a i n } } ]$ . Our method achieves significantly better results compared to previous methods. The error is scaled by 1,000. Our method generalizes much better than other baselines.
|
| 132 |
+
|
| 133 |
+
more than $10 \%$ improvements. These results clearly demonstrates the advantage of using rich state representations.
|
| 134 |
+
|
| 135 |
+
Secondly, we show that the effectiveness of our proposed Convolutional Interaction Network by comparing Table 1 Ours (IN) and Ours (CIN). With every other components the same, changing the vector-form representation to spatial feature maps and use convolution to model the interactions can further improve the performance by $10 \% { \sim } 4 0 \%$ . This result shows our convolutional interaction network could better utilize the spatial information encoded in the object feature map.
|
| 136 |
+
|
| 137 |
+
# 5.2 DOES LEARNED MODEL GENERALIZE TO LONGER HORIZON THAN TRAINING?
|
| 138 |
+
|
| 139 |
+
Generalize to longer horizons is a challenging task. In this section we compare the performance of predicting trajectories longer than training time. In Table 1 (right half), we report the prediction error for $t \in [ \bar { T } _ { \mathrm { t r a i n } } , 2 \times T _ { \mathrm { t r a i n } } ]$ . The results in this setting are consistent with what we found in Section 5.1. Our method still achieves the best performance against all baselines. Specifically, for all datasets except SimB, we reduce the error by more than $30 \%$ percent. In SimB, the improvement is not as significant because the interaction with environment only includes bouncing off the boundaries (see Figure 4 (c) and (d)). Meanwhile, changing IN to CIN further improve the performance. This again validates our hypothesis that the key to making accurate long-term feature prediction is the rich state representation extracted from an image.
|
| 140 |
+
|
| 141 |
+
# 5.3 DOES LEARNED MODEL GENERALIZE TO UNSEEN CONFIGURATIONS?
|
| 142 |
+
|
| 143 |
+
The general applicability of RoI Feature has been extensively verified in the computer vision community. As one of the benefits, our method can generalize to novel environments configurations without any modifications or online training. We test such a claim by testing on several novel environments unseen during training. Specifically, we construct 1) simulation billiard dataset contains 5 balls with radius 2 (SimB-5); 2) PHYRE-C where the test tasks are not seen during training; 3) ShapeStacks with 4 stacked blocks (SS-4). The results are shown in Table 2.
|
| 144 |
+
|
| 145 |
+
Since VIN needs a fixed number of objects as input, it cannot generalize to a different number of objects, thus we don’t report its performance on SimB-5, PHYRE-C, and SS-4. In the SimB-5 and PHYRE-C setting, where generalization ability to different numbers and different appearances is required, our method reduce the prediction error by $7 5 \%$ . In SS-4, the improvement is not as significant as the previous two because cropped image may be enough on this simpler dataset as mentioned above.
|
| 146 |
+
|
| 147 |
+
Table 3: PHYRE Planning results. RAND stands for a score function with random policy. We show that our method achieves state-ofthe-art on both within-task generalization as well as cross-task generalization.
|
| 148 |
+
|
| 149 |
+
<table><tr><td></td><td>Within</td><td>Cross</td></tr><tr><td>RAND</td><td>13.7±0.5</td><td>13.0±5.0</td></tr><tr><td>DQN</td><td>77.6±1.1</td><td>36.8±9.7</td></tr><tr><td>Ours</td><td>85.2±0.7</td><td>42.2±7.1</td></tr></table>
|
| 150 |
+
|
| 151 |
+
Table 4: Simulation Billiards planning results. To make a fair comparison, all of baselines and our methods are using the original interaction network and only the visual encoding method is changing. RAND stands for a policy taking random actions.
|
| 152 |
+
|
| 153 |
+
<table><tr><td></td><td>Target State Error</td><td>Hitting Accuracy</td></tr><tr><td>RAND</td><td>36.91</td><td>9.50%</td></tr><tr><td>CVP</td><td>29.84</td><td>20.3%</td></tr><tr><td>VIN</td><td>9.11</td><td>51.2%</td></tr><tr><td>OM</td><td>8.75</td><td>54.5%</td></tr><tr><td>Ours</td><td>7.62</td><td>57.2%</td></tr></table>
|
| 154 |
+
|
| 155 |
+
# 5.4 HOW WELL CAN THE LEARNED MODEL BE USED FOR PLANNING ACTIONS?
|
| 156 |
+
|
| 157 |
+
The advantage of using a general purpose task-agnostic prediction model is that it can help us do downstream planning and reasoning tasks. In this section, we evaluate our prediction model in the recently proposed challenging PHYRE benchmark (Bakhtin et al., 2019) and simulation billiards planning tasks.
|
| 158 |
+
|
| 159 |
+
PHYRE. We use the B-tier of the environment. In this task, we need to place one red ball at a certain location such that the green ball touches another blue/purple object (see figure 1 right for an example). Bakhtin et al. (2019) trains a classification network whose inputs are the first image and a candidate action, and outputs whether the action leads to success. Such a method does not utilize the dynamics information. In contrast, we can train a classifier on top of the predicted objects’ features so that it can utilize dynamics information and makes more accurate classification.
|
| 160 |
+
|
| 161 |
+
During training, we use the same prediction model as described in previous sections except for $T _ { \mathrm { t r a i n } } = 1 0$ , and then attach an extra classifier on the objects’ features. Specifically, we concatenate each object’s features at the 0th, 3rd, 6th, and 9th timestep and then pass it through two fullyconnected layers to get a feature trajectory for each object. Then we take the average of all the objects’ features and pass it through one fully-connected layer to get a score indicating whether this placement solve the task. We minimize the cross-entropy loss between the score and the ground-truth label indicating whether the action is a success. Note that different from previous work (Bakhtin et al., 2019; Girdhar et al., 2020), our model does not need to convert the input image to the 7-channel segmentation map since object information is already utilized by our object-centric representation. During testing, We enumerate the first 10,000 actions from the pre-computed action set in Bakhtin et al. (2019) and render the red ball on the initial image as our prediction model’s input. Our final output is an sorted action list according to the model’s output score.
|
| 162 |
+
|
| 163 |
+
We report the AUCCESS metric on the official 10 folds of train/test splits for both within-task generalization and cross-task generalization setting. The results are in Table 3. Our method achieves about 8 points improvement over the strong DQN baseline (Bakhtin et al., 2019) in the withintask generalization setting. On the more challenging setting of cross-task generalization where the environments may not be seen during training, our method is 6 points higher than DQN.
|
| 164 |
+
|
| 165 |
+
SimB Planning. We consider two tasks in the SimB environment: 1) Billiard Target State. Given an initial and final configuration after 40 timesteps, the goal is to find one action that will lead to the target configuration. We report the smallest distances between the trajectory between timestep 35-45 and the final position. 2) Billiard Hitting. Given the initial configurations, the goal is to find an action that can hit the other two balls within 50 timesteps.
|
| 166 |
+
|
| 167 |
+
We firstly train a forward model taken image and action as input, to predict the first 4 object positions and render it to image. After that the rendered images are passed in our prediction model. We score each action according to the similarity between the generated trajectory and the goal state. Then the action with the highest score is selected. The results are shown in Table 4. Our results achieves best performance on all tasks. The full planning algorithm and implementation details are included in the appendix.
|
| 168 |
+
|
| 169 |
+

|
| 170 |
+
Figure 3: We show the qualitative comparisons between our method and other baselines in the PHYRE benchmark. Our model can accurately infer objects’ interactions and collisions with the environment over a long-range (10s), while the baseline methods cannot (the balls sometimes penetrates other objects). In this visualization, only the moving objects’ location and masks are predicted (the color is taken from the simulator). Static environment parts (with black color) are rendered from the initial image.
|
| 171 |
+
|
| 172 |
+

|
| 173 |
+
Figure 4: We show the qualitative results of our predicted trajectories in the other three (RealB, SimB, and SS) datasets. Our model could produce accurate and plausible predictions on different scenarios.
|
| 174 |
+
|
| 175 |
+
# 5.5 QUALITATIVE RESULTS
|
| 176 |
+
|
| 177 |
+
In figure 3, we show the qualitative prediction results both for our method as well as the OM and CVP baselines. In figure 4, we compare our prediction and ground-truth on the other three datasets. More results and videos are available at our Website.
|
| 178 |
+
|
| 179 |
+
# 6 CONCLUSIONS
|
| 180 |
+
|
| 181 |
+
In this paper, we leverage the modern computer vision techniques to propose Region Proposal Interaction Networks for physical interaction reasoning with visual inputs. We show that our general, yet simple method achieves a significant improvement and can generalize across both simulation and real-world environments for long-range prediction and planning. We believe this method may serve as a good benchmark for developing future methods in the field of learning intuitive physics, as well as their application to real-world robotics.
|
| 182 |
+
|
| 183 |
+
# ACKNOWLEDGEMENT
|
| 184 |
+
|
| 185 |
+
This work is supported in part by DARPA MCS and DARPA LwLL. We would like to thank the members of BAIR for fruitful discussions and comments.
|
| 186 |
+
|
| 187 |
+
REFERENCES
|
| 188 |
+
Pulkit Agrawal, Ashvin V Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. In NeurIPS, 2016. 3
|
| 189 |
+
Frank Allgöwer and Alex Zheng. Nonlinear model predictive control. Birkhäuser, 2012. 1, 3
|
| 190 |
+
Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. ICLR, 2017. 3
|
| 191 |
+
Anton Bakhtin, Laurens van der Maaten, Justin Johnson, Laura Gustafson, and Ross Girshick. Phyre: A new benchmark for physical reasoning. In NeurIPS, 2019. 2, 5, 8, 15, 16
|
| 192 |
+
Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In NeurIPS, 2016. 1, 2, 4
|
| 193 |
+
Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv, 2018. 3
|
| 194 |
+
Kiran S Bhat, Steven M Seitz, Jovan Popovic, and Pradeep K Khosla. Computing the physical ´ parameters of rigid-body motion from video. In ECCV, 2002. 3
|
| 195 |
+
Apratim Bhattacharyya, Mateusz Malinowski, Bernt Schiele, and Mario Fritz. Long-term image boundary extrapolation. arXiv, 2016. 2
|
| 196 |
+
Marcus A Brubaker, Leonid Sigal, and David J Fleet. Estimating contact dynamics. In ICCV. IEEE, 2009. 3
|
| 197 |
+
Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A. Efros. Large-scale study of curiosity-driven learning. In ICLR, 2019. 3
|
| 198 |
+
Eduardo F Camacho and Carlos Bordons Alba. Model predictive control. Springer Science & Business Media, 2013. 1, 3
|
| 199 |
+
Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. ICLR, 2016. 1, 2, 3
|
| 200 |
+
Baoyang Chen, Wenmin Wang, and Jinzhuo Wang. Video imagination from a single image with transformation generation. In ACMMM Workshop, 2017. 3
|
| 201 |
+
Kenneth James Williams Craik. The nature of explanation. CUP Archive, 1952. 1
|
| 202 |
+
Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. In ICCV, 2017. 2
|
| 203 |
+
Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In ICML, 2011. 3
|
| 204 |
+
Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, 2018. 1, 3
|
| 205 |
+
Frederik Ebert, Sudeep Dasari, Alex X Lee, Sergey Levine, and Chelsea Finn. Robustness via retrying: Closed-loop robotic manipulation with self-supervised learning. arXiv, 2018a. 3
|
| 206 |
+
Frederik Ebert, Chelsea Finn, Sudeep Dasari, Annie Xie, Alex Lee, and Sergey Levine. Visual foresight: Model-based deep reinforcement learning for vision-based robotic control. arXiv, 2018b. 1
|
| 207 |
+
|
| 208 |
+
Sebastien Ehrhardt, Aron Monszpart, Niloy J Mitra, and Andrea Vedaldi. Learning a physical long-term predictor. arXiv, 2017. 2
|
| 209 |
+
|
| 210 |
+
Chelsea Finn and Sergey Levine. Deep visual foresight for planning robot motion. In ICRA, 2017. 3
|
| 211 |
+
|
| 212 |
+
Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NeurIPS, 2016. 3
|
| 213 |
+
|
| 214 |
+
Katerina Fragkiadaki, Pulkit Agrawal, Sergey Levine, and Jitendra Malik. Learning visual predictive models of physics for playing billiards. ICLR, 2015. 2, 15
|
| 215 |
+
|
| 216 |
+
Rohit Girdhar, Laura Gustafson, Aaron Adcock, and Laurens van der Maaten. Forward prediction for physical reasoning. arXiv, 2020. 3, 8
|
| 217 |
+
|
| 218 |
+
Ross Girshick. Fast R-CNN. In ICCV, 2015. 2, 4
|
| 219 |
+
|
| 220 |
+
Georgia Gkioxari, Jitendra Malik, and Justin Johnson. Mesh R-CNN. In ICCV, 2019. 2
|
| 221 |
+
|
| 222 |
+
Oliver Groth, Fabian Fuchs, Ingmar Posner, and Andrea Vedaldi. Shapestacks: Learning vision-based physical intuition for generalised object stacking. In ECCV, 2018. 3
|
| 223 |
+
|
| 224 |
+
Radek Grzeszczuk, Demetri Terzopoulos, and Geoffrey Hinton. Neuroanimator: Fast neural network emulation and control of physics-based models. In SIGGRAPH, 1998. 2
|
| 225 |
+
|
| 226 |
+
Jessica Hamrick, Peter Battaglia, and Joshua B Tenenbaum. Internal physics models guide probabilistic judgments about object dynamics. In COGSCI, 2011. 3
|
| 227 |
+
|
| 228 |
+
Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask R-CNN. In ICCV, 2017. 2, 4
|
| 229 |
+
|
| 230 |
+
Michael Janner, Sergey Levine, William T Freeman, Joshua B Tenenbaum, Chelsea Finn, and Jiajun Wu. Reasoning about physical interactions with object-oriented prediction and planning. ICLR, 2019. 2, 3, 6
|
| 231 |
+
|
| 232 |
+
Dinesh Jayaraman, Frederik Ebert, Alexei A Efros, and Sergey Levine. Time-agnostic prediction: Predicting predictable video frames. In ICLR, 2019. 1
|
| 233 |
+
|
| 234 |
+
Xu Jia, Bert De Brabandere, Tinne Tuytelaars, and Luc V Gool. Dynamic filter networks. In NeurIPS, 2016. 3
|
| 235 |
+
|
| 236 |
+
Zhaoyin Jia, Andrew C Gallagher, Ashutosh Saxena, and Tsuhan Chen. 3d reasoning from blocks to stability. PAMI, 2015. 3
|
| 237 |
+
|
| 238 |
+
Michael I Jordan and David E Rumelhart. Forward models: Supervised learning with a distal teacher. Cognitive science, 1992. 3
|
| 239 |
+
|
| 240 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv, 2014. 15
|
| 241 |
+
|
| 242 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. ICLR, 2014. 14
|
| 243 |
+
|
| 244 |
+
Thomas Kipf, Elise van der Pol, and Max Welling. Contrastive learning of structured world models. ICLR, 2020. 2, 6
|
| 245 |
+
|
| 246 |
+
James R Kubricht, Keith J Holyoak, and Hongjing Lu. Intuitive physics: Current research and controversies. Trends in cognitive sciences, 2017. 1
|
| 247 |
+
|
| 248 |
+
Alex X Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. arXiv, 2018. 1, 3
|
| 249 |
+
|
| 250 |
+
Adam Lerer, Sam Gross, and Rob Fergus. Learning physical intuition of block towers by example. In ICML, 2016. 3
|
| 251 |
+
|
| 252 |
+
Wenbin Li, Seyedmajid Azimi, Aleš Leonardis, and Mario Fritz. To fall or not to fall: A visual approach to physical stability prediction. arXiv, 2016a. 3
|
| 253 |
+
|
| 254 |
+
Wenbin Li, Aleš Leonardis, and Mario Fritz. Visual stability prediction and its application to manipulation. AAAI, 2016b. 3
|
| 255 |
+
|
| 256 |
+
Yunzhu Li, Jiajun Wu, Jun-Yan Zhu, Joshua B Tenenbaum, Antonio Torralba, and Russ Tedrake. Propagation networks for model-based control under partial observation. In ICRA, 2019. 3
|
| 257 |
+
|
| 258 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. 5
|
| 259 |
+
|
| 260 |
+
Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, 2017. 5
|
| 261 |
+
|
| 262 |
+
Ziwei Liu, Raymond A Yeh, Xiaoou Tang, Yiming Liu, and Aseem Agarwala. Video frame synthesis using deep voxel flow. In ICCV, 2017. 3
|
| 263 |
+
|
| 264 |
+
Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv, 2016. 15
|
| 265 |
+
|
| 266 |
+
Michael McCloskey. Intuitive physics. Scientific american, 1983. 1
|
| 267 |
+
|
| 268 |
+
Roozbeh Mottaghi, Hessam Bagherinezhad, Mohammad Rastegari, and Ali Farhadi. Newtonian scene understanding: Unfolding the dynamics of objects in static images. In CVPR, 2016a. 3
|
| 269 |
+
|
| 270 |
+
Roozbeh Mottaghi, Mohammad Rastegari, Abhinav Gupta, and Ali Farhadi. “what happens if...” learning to predict the effect of forces in images. In ECCV, 2016b. 3
|
| 271 |
+
|
| 272 |
+
Alejandro Newell, Kaiyu Yang, and Jia Deng. Stacked hourglass networks for human pose estimation. In ECCV, 2016. 4, 14
|
| 273 |
+
|
| 274 |
+
Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in atari games. In NeurIPS, 2015. 3
|
| 275 |
+
|
| 276 |
+
Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. ICML, 2017. 3
|
| 277 |
+
|
| 278 |
+
Deepak Pathak, Parsa Mahmoudieh, Guanghao Luo, Pulkit Agrawal, Dian Chen, Yide Shentu, Evan Shelhamer, Jitendra Malik, Alexei A Efros, and Trevor Darrell. Zero-shot visual imitation. In ICLR, 2018. 3
|
| 279 |
+
|
| 280 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICCAI, 2015. 4
|
| 281 |
+
|
| 282 |
+
Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, and Peter W Battaglia. Learning to simulate complex physics with graph networks. arXiv, 2020. 1
|
| 283 |
+
|
| 284 |
+
Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Network, 2009. 3
|
| 285 |
+
|
| 286 |
+
Russell Stewart and Stefano Ermon. Label-free supervision of neural networks with physics and domain knowledge. In AAAI, 2017. 2
|
| 287 |
+
|
| 288 |
+
Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. CVPR, 2017. 3
|
| 289 |
+
|
| 290 |
+
Rishi Veerapaneni, John D Co-Reyes, Michael Chang, Michael Janner, Chelsea Finn, Jiajun Wu, Joshua B Tenenbaum, and Sergey Levine. Entity abstraction in visual model-based reinforcement learning. In CoRL, 2019. 6
|
| 291 |
+
|
| 292 |
+
Ruben Villegas, Jimei Yang, Seunghoon Hong, Xunyu Lin, and Honglak Lee. Decomposing motion and content for natural video sequence prediction. ICLR, 2017a. 3
|
| 293 |
+
|
| 294 |
+
Ruben Villegas, Jimei Yang, Yuliang Zou, Sungryull Sohn, Xunyu Lin, and Honglak Lee. Learning to generate long-term future via hierarchical prediction. ICML, 2017b. 3
|
| 295 |
+
|
| 296 |
+
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NeurIPS, 2016. 3
|
| 297 |
+
|
| 298 |
+
Niklas Wahlström, Thomas B Schön, and Marc Peter Deisenroth. From pixels to torques: Policy learning with deep dynamical models. ICML, 2015. 3
|
| 299 |
+
Jacob Walker, Carl Doersch, Abhinav Gupta, and Martial Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In ECCV, 2016. 1, 3
|
| 300 |
+
Jacob Walker, Kenneth Marino, Abhinav Gupta, and Martial Hebert. The pose knows: Video forecasting by generating pose futures. In ICCV, 2017. 3
|
| 301 |
+
Nicholas Watters, Daniel Zoran, Theophane Weber, Peter Battaglia, Razvan Pascanu, and Andrea Tacchetti. Visual interaction networks: Learning a physics simulator from video. In NeurIPS, 2017. 2, 3, 4, 5, 6
|
| 302 |
+
Jiajun Wu, Ilker Yildirim, Joseph J Lim, Bill Freeman, and Josh Tenenbaum. Galileo: Perceiving physical object properties by integrating a physics engine with deep learning. In NeurIPS, 2015. 3
|
| 303 |
+
Jiajun Wu, Joseph J Lim, Hongyi Zhang, Joshua B Tenenbaum, and William T Freeman. Physics 101: Learning physical object properties from unlabeled videos. In BMVC, 2016. 3
|
| 304 |
+
Jiajun Wu, Erika Lu, Pushmeet Kohli, Bill Freeman, and Josh Tenenbaum. Learning to see physics via visual de-animation. In NeurIPS, 2017. 6
|
| 305 |
+
Tianfan Xue, Jiajun Wu, Katherine Bouman, and Bill Freeman. Visual dynamics: Probabilistic future frame synthesis via cross convolutional networks. In NeurIPS, 2016. 3
|
| 306 |
+
Tian Ye, Xiaolong Wang, James Davidson, and Abhinav Gupta. Interpretable intuitive physics model. ECCV, 2018. 3
|
| 307 |
+
Yufei Ye, Maneesh Singh, Abhinav Gupta, and Shubham Tulsiani. Compositional video prediction. ICCV, 2019. 2, 3, 5, 6, 14, 15
|
| 308 |
+
Kexin Yi, Chuang Gan, Yunzhu Li, Pushmeet Kohli, Jiajun Wu, Antonio Torralba, and Joshua B Tenenbaum. Clevrer: Collision events for video representation and reasoning. In ICLR, 2020. 6
|
| 309 |
+
|
| 310 |
+
# A IMPLEMENTATION DETAILS
|
| 311 |
+
|
| 312 |
+
# A.1 NETWORK ARCHITECTURE DETAILS
|
| 313 |
+
|
| 314 |
+
Backbone Networks: We use the same backbone network for our method and all the baselines (VIN, OM, CVP). We choose the hourglass network (Newell et al., 2016) as the image feature extractor. Given an input image, the hourglass network firstly applies a $7 \times 7$ stride-2 convolution, three residual blocks with channel dimension $d / 4$ , and a stride-2 max pooling on it. Then this intermediate feature representation is fed into one hourglass modules. In the hourglass module, the feature maps are downsampled with 3 stride-2 residual blocks and then up-sampled with nearest neighbor interpolation. The dimensions of both the input channel and the output channel of each residual block are $d$ . For SimB, we use $d = 6 4$ since the visual information in this environment is relatively simple. For RealB, PHYRE, and ShapeStacks, $d = 2 5 6$ . We use batch normalization before each convolutional layer in the backbone network. The resulting feature map size is $d \times \frac { H } { 4 } \times \frac { W } { 4 }$ , where $H$ , $W$ is the input image size and 4 is the spatial feature stride of the hourglass network.
|
| 315 |
+
|
| 316 |
+
The output features are transformed to object-centric representations differently for our method and each of the baseline methods:
|
| 317 |
+
|
| 318 |
+
VIN: The resulting feature map is forwarded to 4 convolutional layers with stride 2 and a spatial global average pooling layer to get a $d$ dimensional feature vector. This feature vector is transformed to $d \times m$ by one fully-connected layer. This feature will be reshaped to $m$ vectors with $d$ channel dimensional to represent each object. This representation is refined by two $d \times d$ fully-connected layers and passed to the (convolutional) interaction network.
|
| 319 |
+
|
| 320 |
+
M and CVP: The output feature map is of shape $m \times d \times \textstyle { \frac { H } { 4 } } \times \frac { W } { 4 }$ because this method produce $m$ masked (or cropped) images as input. The resulting feature map is forwarded to 4 convolutional layers with stride 2 and a spatial global average pooling layer to get a $d$ dimensional feature vector and the output feature is of size $m \times d$ , representing the features of $m$ objects. This representation is refined by two $d \times d$ fully-connected layers and passed to the (convolutional) interaction network.
|
| 321 |
+
|
| 322 |
+
# A.2 UNCERTAINTY MODELING.
|
| 323 |
+
|
| 324 |
+
Only in the shapestack datasets, we also incorporate uncertainty estimation follows (Ye et al., 2019), by modeling the latent distribution using a variational auto-encoder (Kingma & Welling, 2014). For the complete details, we refer the reader to (Ye et al., 2019). Here we only give a summary: we build an encoder $h$ which takes the image feature from first $\mathcal { F } ^ { 0 }$ and last frame $\check { \mathcal { F } } ^ { T }$ of a video sequence as the input. The output of $h$ is a distribution parameter, denoted by $h ( \mathbf { u } | \mathcal { F } ^ { 0 } , \mathcal { F } ^ { T } )$ . Given a particular sample from such distribution, we recover the latent variable by feeding them into a one-layer LSTM and merge into the object feature $\ v x _ { i } ^ { t }$ . In this case, our pipeline is trained with an additional loss that minimize the KL divergence between the predicted distribution and normal distribution (Kingma & Welling, 2014).
|
| 325 |
+
|
| 326 |
+
During inference, we sample 100 trajectories for each test image and report the minimum of them. This setting is the same as the original CVP paper $\mathrm { Y e }$ et al. (2019). Our implementation gets $5 . 2 8 \times 1 0 ^ { - 3 }$ squared $\ell _ { 2 }$ distance for $T \in [ 0 , T _ { \mathrm { t r a i n } } ]$ while the original paper report $6 . 6 9 \times 1 0 ^ { - 3 }$ .
|
| 327 |
+
|
| 328 |
+
# A.3 DATASET DETAILS
|
| 329 |
+
|
| 330 |
+
SimB: To get the initial velocity, the magnitude (number of pixels moved per timestep) is sampled from [2, 3, 4, 5, 6] and the direction is sampled from $\{ 6 i \pi , i = 0 , 1 , \ldots , 1 1 \}$ .
|
| 331 |
+
|
| 332 |
+
RealB: We found that the bounding box prediction results are accurate enough to serve as the groundtruth. After running the detector, we also manually go through the dataset and filter out images with incorrect detections.
|
| 333 |
+
|
| 334 |
+
ShapeStacks: There are 1,320 training videos and 296 testing videos, with 32 frames per video. Only objects’ center positions provided. Following (Ye et al., 2019), we assume the object bounding box is square and of size $7 0 \times 7 0$ .
|
| 335 |
+
|
| 336 |
+
PHYRE: For within task generalization (PHYRE-W), the training set contains 80 templates for each of the 25 task. The testing set contains the remaining 20 templates from each task. For cross task generalization (PHYRE-C), the training set contains 100 templates from 20 tasks while the test set contains 100 templates from the remaining 5 tasks. For each template, we randomly sample a maximum 100 success and 400 failure actions to collect the trajectories to train our model. The image sequence is temporally downsampled by 60.
|
| 337 |
+
|
| 338 |
+
For our physical reasoning experiments in section 5.4, we train the model using 400 successful actions and 1600 failure actions per template. We use the validation set to select hyper-parameters first, and then do training on the union of train and validation sets and report the final results in the test set.
|
| 339 |
+
|
| 340 |
+
# A.4 HYPERPARAMETERS
|
| 341 |
+
|
| 342 |
+
We use Adam optimizer Kingma & Ba (2014) with cosine decay Loshchilov & Hutter (2016) to train our networks. The default input frames is $N = 4$ except $N = 1$ for ShapeStacks and PHYRE. We set $d$ to be 256 except for simulation billiard $d$ is 64. During training, $T$ (denoted as $T _ { \mathrm { t r a i n . } }$ ) is set to be 20 for SimB and RealB, 5 for PHYRE, and 15 for fair comparison with Ye et al. (2019). The discounted factor $\lambda _ { t }$ is set to be $\begin{array} { r } { \big ( \frac { \mathrm { c u r r e n t \_ i t e r } } { \mathrm { m a x \_ i t e r } } \big ) ^ { t } } \end{array}$ .
|
| 343 |
+
|
| 344 |
+
Simulation Billiards. The image size is $6 4 \times 6 4$ . We train the model for 100K iterations with a learning rate $2 \times 1 0 ^ { - 3 }$ , weight decay $\mathrm { 1 \check { \times } 1 0 ^ { - 6 } }$ , and batch size 200.
|
| 345 |
+
|
| 346 |
+
Real World Billiards. The image is resized to $1 9 2 \times 6 4$ . We train the model for 240K iterations with a learning rate $1 \times 1 0 ^ { - 4 }$ , weight decay $1 \times 1 0 ^ { - 6 }$ , and batch size 20.
|
| 347 |
+
|
| 348 |
+
PHYRE. The image is resized to $1 2 8 \times 1 2 8$ . We train the model for 150K iterations with a learning rate $2 \times 1 0 ^ { - 4 }$ , weight decay $3 \times 1 0 ^ { - 7 }$ , and batch size 20.
|
| 349 |
+
|
| 350 |
+
ShapeStacks. The image is resized to $2 2 4 \times 2 2 4$ . We train the model for 25K iterations with a learning rate $2 \times 1 0 ^ { - 4 }$ , no weight decay (the same as Ye et al. (2019)), and batch size 40. In this dataset, we apply uncertainty modeling. The loss weight of KL-divergence is $3 \times 1 0 ^ { - 5 }$ . During inference, following Ye et al. (2019), we randomly sample 100 outputs from our model, and select the best (in terms of the distance to ground-truth) of them as our model’s output.
|
| 351 |
+
|
| 352 |
+
# B PLANNING DETAILS
|
| 353 |
+
|
| 354 |
+
Given an initial state (represented by an image) and a goal, we aim to produce an action that can lead to the goal from the initial state. Our planning algorithm works in a similar way as visual imagination Fragkiadaki et al. (2015): Firstly, we select a candidate action a from a candidate action set $\mathcal { A }$ . Then we generate the input images $\mathcal { T }$ . For SimB, we train a forward model take the initial image and the action embedding to generate object positions for the next 3 steps. Then we use the simulator to generate the 3 images. For PHYRE, we convert the action to the red ball using the simulator and get the initial image. After that, we run our model described in section 5.4 and the score of each action is simply the classifier’s output. We then select the action with the max score.
|
| 355 |
+
|
| 356 |
+
We introduce the action set for each task in section B.1, and how to design distance function in B.2.
|
| 357 |
+
A summary of our algorithm is in Algorithm 1.
|
| 358 |
+
|
| 359 |
+
# B.1 CANDIDATE ACTION SETS
|
| 360 |
+
|
| 361 |
+
For simulation billiard, the action is 3 dimensional. The first two dimensions stand for the direction of the force. The last dimension stands for the magnitude of the force. During doing planning, we enumerate over 5 different magnitudes and 12 different angles, leading to 60 possible actions. All of the initial condition is guaranteed to have a solution.
|
| 362 |
+
|
| 363 |
+
For PHYRE, the action is also 3 dimensional. The first two dimensions stand for the location placing the red ball. The last dimension stands for the radius of the ball. Following (Bakhtin et al., 2019), we use the first 10k actions provided by the benchmark.
|
| 364 |
+
|
| 365 |
+
# B.2 DISTANCE FUNCTION
|
| 366 |
+
|
| 367 |
+
Init-End State Error. Denote the given target location of $m$ objects as $y \in R ^ { m \times 2 }$ . We use the following distance function, which measures the distance between the final rollout location and the
|
| 368 |
+
|
| 369 |
+
target location:
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
D = \sum _ { i = 1 } ^ { m } \sum _ { j = 1 } ^ { 2 } ( \hat { p } _ { T , i , j } - y _ { i , j } ) ^ { 2 }
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
Hitting Accuracy. Denote the given initial location of $m$ objects as $x \in R ^ { m \times 2 }$ . We apply force at the object $i ^ { \prime }$ . We use the following distance function, which prefer the larger moving distance for objects other than $i ^ { \prime }$ :
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
D = - \operatorname* { m i n } _ { i } \sum _ { \substack { i = 1 , i \neq i ^ { \prime } } } ^ { m } \sum _ { j = 1 } ^ { 2 } ( \hat { p } _ { T , i , j } - x _ { i , j } ) ^ { 2 }
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
PHYRE task. Since we already train a classifier to classify whether the predicted trajectory will lead to a successful solution of the current task, during test time we can directly use it to classify whether the current action will lead to a successful solution. The distance function is just the negative output score.
|
| 382 |
+
|
| 383 |
+
# B.3 PLANNING ALGORITHM
|
| 384 |
+
|
| 385 |
+
# Algorithm 1: Planning Algorithm for Simulated Billiard and PHYRE
|
| 386 |
+
|
| 387 |
+
Input: candidate actions $\begin{array} { r } { \boldsymbol { \mathcal { A } } = \{ \mathbf { a } _ { i } \} } \end{array}$ , initial state $x$ , end state $y$ (optional)
|
| 388 |
+
Output: action $\mathbf { a } ^ { * }$
|
| 389 |
+
for a in $\mathcal { A }$ do $\mathcal { T } = \mathrm { S i m u l a t i o n } ( x , \mathbf { a } )$ ; $\hat { p } =$ PredictionModel $( \mathcal { T } )$ ; calculate $D$ according to task as in B.2; if $D < D ^ { * }$ then $D ^ { * } = D$ ; $a ^ { * } = a$ ; end
|
| 390 |
+
end
|
| 391 |
+
|
| 392 |
+
# C PHYRE 10 FOLD RESULTS
|
| 393 |
+
|
| 394 |
+
To enable future work to compare with our method, we provide AUCCESS scores for all folds in Table 5. The number of RAND and DQN is taken from Bakhtin et al. (2019).
|
| 395 |
+
|
| 396 |
+
Table 5: The AUCCESS scores for each of evaluated fold.
|
| 397 |
+
|
| 398 |
+
<table><tr><td rowspan="2">setting</td><td rowspan="2">method</td><td colspan="10">fold id</td></tr><tr><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr><tr><td rowspan="3">B (within)</td><td>RAND</td><td>13.44</td><td>14.01</td><td>13.79</td><td>13.80</td><td>12.75</td><td>13.34</td><td>13.95</td><td>14.30</td><td>13.36</td><td>14.33</td></tr><tr><td>DQN</td><td>76.82 79.72</td><td></td><td>78.22</td><td>75.86</td><td>77.03</td><td>78.42</td><td>78.01</td><td>77.34</td><td>78.04</td><td>76.87</td></tr><tr><td>Ours</td><td>85.49</td><td>86.57</td><td>85.58</td><td>84.11</td><td>85.30</td><td>85.18</td><td>84.78</td><td>84.32</td><td>85.71</td><td>85.17</td></tr><tr><td rowspan="3">B (cross)</td><td>RAND</td><td>11.78</td><td>12.42</td><td>18.18</td><td>12.42</td><td>3.81</td><td>22.50</td><td>11.73</td><td>13.29</td><td>8.94</td><td>14.60</td></tr><tr><td>DQN</td><td>43.69 30.96 43.05 43.91 22.77</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>44.40 34.53 39.20 18.98 46.46</td></tr><tr><td>Ours</td><td>50.86 36.58 55.44 38.34 37.11 47.23 3.23 47.19 32.23 38.76</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
md/train/eaAM_bdW0Q/eaAM_bdW0Q.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Robust Deep Reinforcement Learning through Adversarial Loss
|
| 2 |
+
|
| 3 |
+
Tuomas Oikarinen∗ UC San Diego CSE
|
| 4 |
+
|
| 5 |
+
Wang Zhang MIT MechE
|
| 6 |
+
|
| 7 |
+
Alexandre Megretski MIT EECS
|
| 8 |
+
|
| 9 |
+
Tsui-Wei Weng UC San Diego HDSI
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Recent studies have shown that deep reinforcement learning agents are vulnerable to small adversarial perturbations on the agent’s inputs, which raises concerns about deploying such agents in the real world. To address this issue, we propose RADIAL-RL, a principled framework to train reinforcement learning agents with improved robustness against $l _ { p }$ -norm bounded adversarial attacks. Our framework is compatible with popular deep reinforcement learning algorithms and we demonstrate its performance with deep Q-learning, A3C and PPO. We experiment on three deep RL benchmarks (Atari, MuJoCo and ProcGen) to show the effectiveness of our robust training algorithm. Our RADIAL-RL agents consistently outperform prior methods when tested against attacks of varying strength and are more computationally efficient to train. In addition, we propose a new evaluation method called Greedy Worst-Case Reward (GWC) to measure attack agnostic robustness of deep RL agents. We show that GWC can be evaluated efficiently and is a good estimate of the reward under the worst possible sequence of adversarial attacks. All code used for our experiments is available at https://github.com/tuomaso/radial_rl_v2.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Deep learning has achieved enormous success on a variety of challenging domains, ranging from computer vision [1], natural language processing [2] to reinforcement learning (RL) [3, 4]. Nevertheless, the existence of adversarial examples [5] indicates that deep neural networks (DNNs) are not as robust and trustworthy as we would expect, as small and often imperceptible perturbations can result in misclassifications of state-of-the-art DNNs. Unfortunately, adversarial attacks have also been shown possible in deep reinforcement learning, where adversarial perturbations in the observation space and/or action space can cause arbitrarily bad performance of deep RL agents [6, 7, 8]. As deep RL agents are deployed in many safety critical applications such as self-driving cars and robotics, it is of crucial importance to develop robust training algorithms (a.k.a. defense algorithms) such that the resulting trained agents are robust against adversarial (and non-adversarial) perturbation.
|
| 18 |
+
|
| 19 |
+
Many heuristic defenses have been proposed to improve robustness of DNNs against adversarial attacks for image classification tasks, but they often fail against stronger adversarial attack algorithms. For example, [9] showed that 13 such defense methods (recently published at prestigious conferences) can all be broken by more advanced attacks. One emerging alternative to heuristic defenses is defense algorithms 2 based on robustness verification or certification bounds [10, 11, 12, 13]. These algorithms produce robustness certificates such that for any perturbations within the specified $\ell _ { p }$ - norm distance , the trained DNN will produce consistent classification results on given data points. Representative works along this line include [11] and [14], where the learned models can have much higher certified accuracies by including the robustness verification bounds in the loss function with proper training schedule, even if the verifier produces loose robustness certificates [14] for models without robust training (a.k.a. nominal models). Here, the certified accuracy is calculated as the percentage of the test images that are guaranteed to be classified correctly under a given perturbation magnitude $\epsilon$ .
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Screenshots of our RADIAL framework promoting robustness of deep RL agents while the standard deep RL agents without robust training are vulnerable to adversarial attacks.
|
| 23 |
+
|
| 24 |
+
However, most of the defense algorithms are developed for classification tasks. Few defense algorithms have been designed for deep RL agents perhaps due to the additional challenges in RL that are not present in classification tasks, including credit assignment and lack of a stationary training set. To bridge this gap, in this paper we present the RADIAL(Robust ADversarIAl Loss)-RL framework to train robust deep RL agents. We show that RADIAL can improve the robustness of deep RL agents by using carefully designed adversarial loss functions based on robustness verification bounds. Our contributions are listed below:
|
| 25 |
+
|
| 26 |
+
• We propose a novel robust deep RL framework, RADIAL-RL, which can be applied to different types of deep RL algorithms. We demonstrate RADIAL on three popular RL algorithms, DQN [3], A3C [15] and PPO [16].
|
| 27 |
+
We demonstrate the superior performance of RADIAL agents on both Atari games and continuous control tasks in MuJoCo: our agents are $2 - 1 0 \times$ more computationally efficient to train than [17] and can resist up to $5 \times$ stronger adversarial perturbations better than existing works [18, 17].
|
| 28 |
+
�� We also evaluate the effects of robust training on the ability of agents to generalize to new levels using the ProcGen benchmark, and show that our training also increases robustness on unseen levels, reaching high rewards even against $\epsilon = 5 / 2 5 5$ PGD-attacks.
|
| 29 |
+
• We propose a new evaluation method, Greedy Worst-Case Reward (GWC), for efficiently (in linear time) evaluating RL agent performance under attack of strongest adversaries (i.e. worst-case perturbation) on discrete action environments.
|
| 30 |
+
|
| 31 |
+
# 2 Related work and background
|
| 32 |
+
|
| 33 |
+
# 2.1 Adversarial attacks in Deep RL
|
| 34 |
+
|
| 35 |
+
The topic of adversarial examples in supervised learning tasks has been extensively studied, especially for DNN classifiers [5, 19]. More recently, [6, 7, 8] showed that deep RL agents are also vulnerable to adversarial perturbations, including adversarial perturbations on agents’ observations and actions [6, 7, 8], mis-specification on the environment [20], adversarial disruptions on the agents [21] and other adversarial agents [22]. For a review of different attack and defense settings in RL see Ilahi et al. [23].
|
| 36 |
+
|
| 37 |
+
In this paper, we focus on $\ell _ { p }$ -norm adversarial perturbations on agents’ observations since this threat model is adopted by many of the existing works investigating adversarial robustness of deep RL [6, 7, 8, 24, 25, 26, 27, 18, 17]. However, our framework is not limited to $\ell _ { p }$ -norm perturbation and in fact can be easily extended to semantic perturbations (e.g. rotations, color/brightness changes, etc) for vision-based deep RL agents (e.g. atari games) by leveraging the techniques proposed in [28].
|
| 38 |
+
|
| 39 |
+
# 2.2 Formal verification and robust training for Deep RL
|
| 40 |
+
|
| 41 |
+
Robustness certification methods for DNN classifiers [12] have been applied in the deep RL setting: for example, [27] propose a policy of choosing the action with highest certified lower bound Q-value during execution, and [24] derived tighter robustness certificate for neural network policies under persistent adversarial perturbations in the system. These works study the robustness with fixed neural networks, while our work is focused on training neural networks that produce more robust RL policies.
|
| 42 |
+
|
| 43 |
+
The idea of adversarial training has been applied to deep RL to defend against adversarial attacks [25, 26]; however, these approaches often have much higher computational cost than standard training. While previous work such as [21] have also trained robust agents under different threat models from ours, we will not be comparing against them as they have different goals and evaluation methods.
|
| 44 |
+
|
| 45 |
+
The most relevant literature to our work are two robust training methods for deep Q-learning agents [18, 17]. RS-DQN [18] decouples the DQN agent into a policy and student networks, which enables leveraging additional constraints on the student DQN without strongly affecting learning of the correct Q-function, whereas SA-DQN [17] adds a hinge loss regularizer to encourage the DQN agents to follow their original actions when there are perturbations in the observation space. [17] also propose SA-PPO and SA-DDPG for training robust RL-agents in continuous control. In contrast, in RADIAL, we leverage the in-expensive robustness verification bounds to carefully design regularizers discouraging potentially overlapping actions of deep RL agents. As demonstrated in the Sec 4, our RADIAL agents outperform [18, 17] under various strength of adversarial attacks, while being $2 { - } 1 0 \times$ more computationally efficient to train than [17]. Moreover, we introduce a novel metric to evaluate agent performance against worst possible adversary that is not investigated in [18, 17].
|
| 46 |
+
|
| 47 |
+
# 2.3 Basics of Deep Reinforcement Learning
|
| 48 |
+
|
| 49 |
+
Markov Decision Process with parameters $( S , { \mathcal { A } } , { \mathcal { P } } , { \mathcal { R } } , \gamma , s _ { 0 } )$ is used to characterize the environments in this paper, where $s$ is a set of states, $\mathcal { A }$ is a set of the available actions, $\mathcal { P } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mathbb { R }$ defines the transition probabilities, and $\mathcal { R } : \mathcal { S } \times \mathcal { A } \to \mathbb { R }$ is the scalar reward function, $s _ { 0 }$ is the initial state distribution and $\gamma$ is the discount factor. RL algorithms aim at learning a possibly stochastic policy $\pi : \mathcal { S } \times \mathcal { A } \to \mathbb { R }$ describing the probability of taking an action $a$ given state $s$ . The goal of a policy is to maximize the cumulative time discounted reward of an episode $\textstyle \sum _ { t } \gamma ^ { t } r _ { t }$ , where $t$ is the timestep and $r _ { t } , a _ { t }$ and $s _ { t }$ are reward, action and state at timestep $t$ .
|
| 50 |
+
|
| 51 |
+
Deep Q-networks (DQN) [3]. An action-value function $Q ( s , a )$ describes the expected cumulative rewards given current state $s$ and action $a$ . In Q-learning, a policy $\pi$ is constructed by taking the action with highest $Q$ -value. The optimal $Q$ function, denoted as $Q ^ { * } ( s , a )$ , satisfies the Bellman Optimality Equations $\begin{array} { r } { Q ^ { * } ( s , a ) = r + \gamma \mathbb { E } _ { ( s ^ { \prime } \mid s , a ) } \left[ \operatorname* { m a x } _ { a ^ { \prime } } Q ^ { * } ( s ^ { \prime } , a ^ { \prime } ) \right] } \end{array}$ , where $s ^ { \prime }$ is the next state and $r$ is reward. The essence of DQN is to use neural networks to approximate the $Q ^ { * } ( s , a )$ and the networks can be trained by minimizing the loss $\begin{array} { r } { \mathcal L ( \theta ) = \mathbb { E } _ { ( s , a , s ^ { \prime } , r ) } \left[ ( r + \gamma \operatorname* { m a x } _ { a ^ { \prime } } Q ( s ^ { \prime } , a ^ { \prime } ; \theta ) - Q ( s , a ; \theta ) ) ^ { 2 } \right] } \end{array}$ . The two baseline works on robust training for RL agents [18, 17] use more advanced versions than vanilla
|
| 52 |
+
|
| 53 |
+
DQN including Dueling-DQN [29] and Double-DQN [30]. Double-DQN uses two Q-networks to evaluate target value $Q _ { \mathrm { t a r g e t } }$ and the one being trained $Q \mathrm { { a c t o r } }$ , with $\theta _ { \mathrm { a c t o r } }$ being optimized by minimizing the loss ${ \mathcal { L } } ( \theta _ { \mathrm { a c t o r } } )$ :
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\mathcal { L } ( \theta _ { \mathrm { a c t o r } } ) = \mathbb { E } _ { ( s , a , s ^ { \prime } , r ) } \Big [ ( r + \gamma \operatorname* { m a x } _ { a ^ { \prime } } Q _ { \mathrm { t a r g e t } } ( s ^ { \prime } , a ^ { \prime } ; \theta _ { \mathrm { t a r g e t } } ) - Q _ { \mathrm { a c t o r } } ( s , a ; \theta _ { \mathrm { a c t o r } } ) ) ^ { 2 } \Big ] .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
Dueling-DQN improves DQN by splitting Q-values into the value of the state $V _ { Q } ( s )$ and advantage $A _ { Q } ( s , a )$ calculated by different output layers such that $Q ( s , a ) = V _ { Q } ( s ) + A _ { Q } ( \stackrel { . } { s } , \stackrel { . } { a } )$ .
|
| 60 |
+
|
| 61 |
+
Asynchronous Advantage Actor Critic (A3C) [15]. A3C uses neural networks to learn a policy function $\pi ( a | s ; \theta )$ and a state-value function $V ( s ; \theta _ { v } )$ . Here the policy network $\pi ( a | s ; \theta )$ determines which action to take, and value function evaluates how good each state is. To update the network $( \theta , \theta _ { v } )$ antage function, with hyperparam $A _ { t }$ ,r s defined as . The networ $A _ { t } ( s _ { t } , a _ { t } ; \theta , \theta _ { v } ) \ =$ $\begin{array} { r } { \sum _ { i = 0 } ^ { k - 1 } \gamma ^ { i } r _ { t + i } + \gamma ^ { k } V ( s _ { t + k } ; \theta _ { v } ) - V ( s _ { t } ; \theta _ { v } ) } \end{array}$ $k$ $( \theta , \theta _ { v } )$ are learned by minimizing the following loss function:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\begin{array} { r } { \boldsymbol { \mathcal { L } } ( \boldsymbol { \theta } , \boldsymbol { \theta } _ { v } ) = \mathbb { E } _ { ( s _ { t } , a _ { t } , r _ { t } ) } \left[ \boldsymbol { A } _ { t } ^ { 2 } - \boldsymbol { A } _ { t } \log \pi ( \boldsymbol { a } _ { t } ) - \boldsymbol { \beta } \boldsymbol { \mathcal { H } } ( \boldsymbol { \pi } ) \right] , } \end{array}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where the first term optimizes the value function, second optimizes policy function and last term encourages exploration by rewarding high entropy $\mathcal { H }$ of the policy with scaling parameter $\beta$ .
|
| 68 |
+
|
| 69 |
+
Proximal Policy Optimization (PPO) [16]. PPO is a critic based policy-gradient method similar to A3C, that works for off-policy updates unlike A3C.
|
| 70 |
+
|
| 71 |
+
PPO uses the clipping function on the ratio of action probabilities to constrain the difference between new and old policy. The resulting objective function is
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathcal { L } ( \theta ) = \mathbb { E } _ { ( s _ { t } , a _ { t } , r _ { t } ) } \left[ - \operatorname* { m i n } ( \frac { \pi ( a _ { t } | s _ { t } ; \theta ) } { \pi ( a _ { t } | s _ { t } ; \theta _ { \mathrm { o l d } } ) } A _ { t } , \mathrm { c l i p } ( \frac { \pi ( a _ { t } | s _ { t } ; \theta ) } { \pi ( a _ { t } | s _ { t } ; \theta _ { \mathrm { o l d } } ) } , 1 - \eta , 1 + \eta ) A _ { t } ) \right] ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $\eta$ is a hyper-parameter and $A _ { t }$ is an estimate of the advantage function at timestep $t$ . In addition, PPO usually includes a term minimizes loss of the value function and rewarding entropy of the policy similar to A3C.
|
| 78 |
+
|
| 79 |
+
# 3 A Robust Deep RL framework with adversarial loss
|
| 80 |
+
|
| 81 |
+
In this section, we propose RADIAL (Robust ADversarIAl Loss)-RL, a principled framework for training deep RL agents robust against adversarial attacks. RADIAL designs adversarial loss functions by leveraging existing neural network robustness formal verification bounds. We first introduce the key idea of RADIAL and then elucidate a few ways to formulate adversarial loss for the three classical deep reinforcement learning algorithms, DQN, A3C and PPO in Sections 3.1, 3.2 and 3.3. In Section 3.4, we propose a novel evaluation metric, Greedy Worst-Case Reward (GWC), to efficiently assess agent’s robustness against input perturbations.
|
| 82 |
+
|
| 83 |
+
Main idea. The training loss of the RADIAL framework, $\mathcal { L } _ { \mathrm { R A D I A L } }$ , consists of two terms:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\mathcal { L } _ { \mathrm { R A D I A L } } = \kappa \mathcal { L } _ { \mathrm { n o m } } + ( 1 - \kappa ) \mathcal { L } _ { \mathrm { a d v } } ,
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where ${ \mathcal { L } } _ { \mathrm { n o m } }$ denotes the nominal loss function such as Eqs. (1)-(3) for nominal (standard) deep RL agents, and ${ \mathcal { L } } _ { \mathrm { a d v } }$ denotes the adversarial loss which we will design carefully to account for adversarial perturbations. $\kappa$ is a hyperparameter controlling the trade-off between standard performance and robust performance with value between 0 and 1, and note that standard RL training algorithms have $\kappa = 1$ throughout the full training process. Here we propose two principled approaches to construct ${ \mathcal { L } } _ { \mathrm { a d v } }$ both via the neural network robustness certification bounds [14, 12, 13, 11, 31, 32, 33, 34]:
|
| 90 |
+
|
| 91 |
+
#1. Construct an strict upper bound of the perturbed standard loss (Eq (9), (10), (7)); #2. Design a regularizer to minimize overlap between output bounds of actions with large difference in outcome (Eq (5), (6)).
|
| 92 |
+
|
| 93 |
+
The Approach #1 is well-motivated as minimizing a strict upper bound of the perturbed standard loss usually also decreases the true perturbed standard loss, which indicates the policy should perform well under adversarial perturbations. Alternatively, Approach $\# 2$ is motivated by the idea that we want to avoid choosing a significantly worse action because of a small input perturbation.
|
| 94 |
+
|
| 95 |
+
The foundation of both Approach #1 and $\# 2$ lies in the robustness formal verification tools to derive output bounds of neural networks under input perturbations. Specifically, for a given neural network, suppose $z _ { i } ( x )$ is the activation of the $i$ th layer of a neural network with input $x$ . The goal of a robustness verification algorithm is to compute layer-wise lower and upper bounds of the neural network, denoted as $\underline { { z } } _ { i } ( x , \epsilon )$ and $\overline { { z } } _ { i } ( x , \epsilon )$ , such that $\underline { { z } } _ { i } ( x , \epsilon ) \leq z _ { i } ( x + \delta ) \leq \overline { { z _ { i } } } ( x , \epsilon )$ , for any additive input perturbation $\delta$ on $x$ with $| | \delta | | _ { p } \leq \epsilon$ . We will apply robustness verification algorithms on the Q-networks (for DQN) or policy networks (for A3C and PPO) to get layer-wise output bounds of $Q$ and $\pi$ . These output bounds can be used to calculate an upper bound of the original loss function under worst-case adversarial perturbation ${ \mathcal { L } } _ { \mathrm { a d v } }$ for Approach #1. Similarly, the layer-wise bound is used to minimize the overlap of output intervals as proposed in Approach $\# 2$ . For the purpose of training efficiency, IBP [14] is used to compute the layer-wise bounds for the neural networks, but other differentiable certification methods [12, 13, 11, 31, 32, 33] could be applied directly (albeit may incur additional computation cost). Our experiments focus on $p = \infty$ to compare with baselines but the methodology works for general $p$ .
|
| 96 |
+
|
| 97 |
+
# 3.1 RADIAL-DQN
|
| 98 |
+
|
| 99 |
+
For Dueling-DQN, the advantage function $A _ { Q }$ is used to decide which action to take and the value function $V _ { Q }$ is only important for training. Hence, we only need to make $A _ { Q }$ robust and the Q function is lower and upper bounded by $\underline { { Q } } ( s , a , \epsilon ) = V _ { Q } ( s ) + \underline { { A _ { Q } } } ( s , a , \epsilon )$ and $\overline { { { Q } } } ( s , a , \epsilon ) = V _ { Q } ( s ) + \overline { { { A _ { Q } } } } ( s , a , \epsilon )$ with $\epsilon$ -bounded perturbations to input $s$ . In RADIAL we proposde two approaches to derive the adversarial loss ${ \mathcal { L } } _ { \mathrm { a d v } }$ ; however, due to the space constraints, we describe the approach that has better empirical performance in the main text, and leave the other in the Appendix.
|
| 100 |
+
|
| 101 |
+
For DQN, we find that Approach $\# 2$ performs better. The goal of Approach #2 is to minimize the weighted overlap of activation bounds for different actions (Fig. 2). The idea is to minimize only what is necessary for robust performance, overlap. If there is no overlap, the original action’s Q-value is guaranteed to be higher than others even under perturbation, so the agent won’t change it’s behavior under perturbation. However not all overlap is equally important. If two actions have a very similar $\mathrm { Q }$ -value, overlap is acceptable, as taking a different but equally good action under perturbation is not a problem. To address this we added weighting by $Q _ { \mathrm { d i f f } }$ , which helps by multiplying overlaps with similar Q-values by a small number and overlaps with different Q-values by a large number.
|
| 102 |
+
|
| 103 |
+
The final loss loss function is as follows:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\mathcal { L } _ { \mathrm { a d v } } ( \theta _ { \mathrm { a c t o r } } , \epsilon ) = \mathbb { E } _ { ( s , a , s ^ { \prime } , r ) } [ \sum _ { y } Q _ { \mathrm { d i f f } } ( s , y ) \cdot O v l ( s , y , \epsilon ) ]
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
Q _ { \mathrm { d i f f } } ( s , y ) = \operatorname* { m a x } ( 0 , Q ( s , a ) - Q ( s , y ) ) , \quad O v l ( s , y , \epsilon ) = \operatorname* { m a x } ( 0 , \overline { { Q } } ( s , y , \epsilon ) - \underline { { Q } } ( s , a , \epsilon ) + \eta )
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
$\eta = 0 . 5 \cdot Q _ { \mathrm { d i f f } } ( s , y )$ and $a$ is the action taken. Here $O v l$ represents the overlap between the bounds of two actions (grey region in Fig 2). To promote additional robustness, the network is incentivized to have a margin $\eta$ (rather than simply no overlaps). We set $\eta = 0 . 5 \cdot Q _ { \mathrm { d i f f } }$ to have it be half of the maximum margin attainable. See Appendix $\mathrm { F }$ for experiments and discussion on the importance of this choice for margin. Note that $Q _ { \mathrm { d i f f } }$ is treated as a constant (no gradient) for the optimization. Eq. (5) reduces to zero when $\epsilon = 0$ .
|
| 116 |
+
|
| 117 |
+
# 3.2 RADIAL-A3C
|
| 118 |
+
|
| 119 |
+
In A3C, as the value network $V$ and entropy $\mathcal { H }$ are only used to help training, we will use the unperturbed form of the approximated advantage $A _ { t } \big ( s _ { t } , a _ { t } ; \theta , \theta _ { v } \big )$ and entropy $\mathcal { H }$ and focus on designing a robust policy network $\pi$ in RADIAL-A3C. As the Approach $\# 2$ is more effective in our experiments, we focus on describing Approach $\# 2$ here and leave Approach #1 in the Appendix $\mathbf { B }$ . The idea of Approach $\# 2$ for A3C is very similar to DQN, except that the $\mathrm { Q }$ -values are replaced by a combination of the policy outputs $\pi$ and the pen-ultimate layer of the policy networks $z$ (before the softmax layer):
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\mathcal { L } _ { \mathrm { a d v } } ( \theta _ { \mathrm { a c t o r } } , \epsilon ) = \mathbb { E } _ { ( s , a , s ^ { \prime } , r ) } [ \sum _ { y } \pi _ { \mathrm { d i f f } } ( s , y ) \cdot O v l ( s , y , \epsilon ) ]
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 2: Visualizing $L _ { \mathrm { a d v } }$ for RADIAL-DQN (Approach #2) in a simple case with 2 actions.
|
| 127 |
+
|
| 128 |
+
# Algorithm 1: Greedy Worst-Case Reward
|
| 129 |
+
|
| 130 |
+
$\overline { { R = 0 } }$
|
| 131 |
+
while $s _ { t }$ not terminal do 1. Calculate $\pi _ { i } ( s _ { t } , \theta )$ , $\underline { { \pi } } _ { i } ( s _ { t } , \epsilon ; \theta )$ and $\overline { { \pi } } _ { i } ( s _ { t } , \epsilon ; \theta )$ for each action $i$ 2. Calculate set of possible actions $\Gamma : = \{ i | \overline { { \pi } } _ { i } \geq \operatorname* { m a x } _ { j } ( \underline { { \pi } } _ { j } ) \}$ 3. Take the "worst" action $k$ out of the possible actions, $k = \mathrm { a r g m i n } _ { i \in \Gamma } ( \pi _ { i } ( s _ { t } , \theta ) )$ . Observe $r _ { t }$ and $s _ { t + 1 }$ and update $R \gets R + r _ { t }$ 4. $t = t + 1$
|
| 132 |
+
end
|
| 133 |
+
return $R$
|
| 134 |
+
|
| 135 |
+
with $\pi _ { \operatorname { d i f f } } ( s , y ) = \operatorname* { m a x } ( 0 , \pi ( s , a ) - \pi ( s , y ) )$ and $O v l ( s , y , \epsilon ) = \operatorname* { m a x } ( 0 , \overline { { z } } ( s , y , \epsilon ) - \underline { { z } } ( s , a , \epsilon ) + \eta )$ Where $\eta = 0 . 5 \cdot z _ { \mathrm { d i f f } } ( s , y )$ and $z _ { \mathrm { d i f f } } ( s , y ) = \operatorname* { m a x } ( 0 , z ( s , a ) - z ( s , y ) )$ .
|
| 136 |
+
|
| 137 |
+
# 3.3 RADIAL-PPO
|
| 138 |
+
|
| 139 |
+
For RADIAL-PPO, we use Approach #1 as Approach $\# 2$ does not work for continuous actions(discussion in Appendix C). In RADIAL-PPO, we only calculate bounds over current policy output, because the experiences are generated by sampling from unperturbed old policy, and value function/advantage are only used during training. The intuition for Approach #1 is to derive an upper bound of the RHS of Eqn. 3 which will always hold.
|
| 140 |
+
|
| 141 |
+
$\forall s _ { t } \in S , \forall | | \delta | | _ { p } \leq \epsilon \ ; \mathcal { L } ( \theta , s _ { t } + \delta ) \leq \mathcal { L } _ { \mathrm { a d v } } ( \theta , s _ { t } , \epsilon )$ . Minimizing this upper bound will then also decrease the loss under perturbation. In practice optimizing this loss function results in increasing the lower bound of the probability of taking good actions $( A _ { t } \geq 0 )$ ), and decreasing the upper bound of the probability to take bad actions $( A _ { t } < 0 )$ ).
|
| 142 |
+
|
| 143 |
+
The mathematical definition of ${ \mathcal { L } } _ { \mathrm { a d v } }$ is the following:
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
\mathcal { L } _ { \mathrm { a d v } } ( \theta , \epsilon ) = \mathbb { E } _ { ( s _ { t } , a _ { t } , r _ { t } ) } \left[ - \operatorname* { m i n } ( \frac { \hat { \pi } ( a _ { t } | s _ { t } , \epsilon ; \theta ) } { \pi ( a _ { t } | s _ { t } ; \theta _ { \mathrm { o l d } } ) } A _ { t } , \mathrm { c l i p } ( \frac { \hat { \pi } ( a _ { t } | s _ { t } , \epsilon ; \theta ) } { \pi ( a _ { t } | s _ { t } ; \theta _ { \mathrm { o l d } } ) } , 1 - \eta , 1 + \eta ) A _ { t } ) \right] .
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
The worst-case policy is defined as:
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
\hat { \pi } ( a _ { t } | s _ { t } , \epsilon ; \theta ) = \left\{ \frac { \pi ( a _ { t } | s _ { t } , \epsilon ; \theta ) , \ \mathrm { i f } \ A _ { t } \geq 0 } { \pi ( a _ { t } | s _ { t } , \epsilon ; \theta ) , \ \mathrm { o t h e r w i s e } } \right.
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
For our continuous control experiments, the output of our policy are the parameters $\mu , \Sigma$ of a Gaussian, with covariance being diagonal and independent of input state $s$ . We can define bounds on distance $d$ :
|
| 156 |
+
|
| 157 |
+
d $\begin{array} { r l } & { \mathfrak { l } ( a _ { t } , s _ { t } , \epsilon ) = \operatorname* { m a x } _ { \mu \in \{ \underline { { \mu } } , \vec { \mu } \} } ( a _ { t } - \mu ) ^ { T } \Sigma ^ { - 1 } ( a _ { t } - \mu ) , \underline { { d } } ( a _ { t } , s _ { t } , \epsilon ) = \operatorname* { m i n } _ { \mu \in [ \underline { { \mu } } , \vec { \mu } ] } ( a _ { t } - \mu ) ^ { T } \Sigma ^ { - 1 } ( a _ { t } - \mu ) } \\ & { \mathrm { ~ h e n ~ } \overline { { \pi } } ( a _ { t } | s _ { t } , \epsilon ; \theta ) = \frac { e ^ { - \frac { d } { d } / 2 } } { ( ( 2 \pi ) ^ { k } \operatorname* { d e t } \Sigma ) ^ { 0 . 5 } } \mathrm { ~ a n d ~ } \underline { { \pi } } ( a _ { t } | s _ { t } , \epsilon ; \theta ) = \frac { e ^ { - \overline { { d } } / 2 } } { ( ( 2 \pi ) ^ { k } \operatorname* { d e t } \Sigma ) ^ { 0 . 5 } } \cdot \mathrm { ~ W h e r e ~ } k \mathrm { ~ i s ~ t h e ~ n u m b e r ~ o f ~ } } \end{array}$ dimensions in the action space.
|
| 158 |
+
|
| 159 |
+
For discrete action, $\pi$ is a categorical distribution over possible actions, where $\overline { { \pi } } ( a _ { t } )$ is the upper bound of the policy network $\pi$ at $a _ { t }$ -th output. This can be computed from the upper bound of $a _ { t }$ -th logit(output before softmax) and lower bound of other logits by applying softmax.
|
| 160 |
+
|
| 161 |
+
# 3.4 New efficient evaluation metric: Greedy Worst-Case Reward
|
| 162 |
+
|
| 163 |
+
The goal of training RL agents robust against input perturbations is to ensure that the agents could still perform well under any (bounded) adversarial perturbations. This can be translated into maximizing the worst-case reward $R _ { w c }$ , which is the reward under worst possible sequence of adversarial attacks.
|
| 164 |
+
|
| 165 |
+
We define $R _ { w c }$ as follows: $\begin{array} { r } { R _ { w c } = \operatorname* { m i n } _ { | | \delta _ { t } | | _ { p } \leq \epsilon } \mathbb { E } _ { \tau } [ R ( \tau ) ] } \end{array}$ with trajectory $\tau = ( s _ { 0 } , a _ { 0 } , . . . , s _ { T } , a _ { T } )$ where $a _ { t } , s _ { t } , r _ { t }$ are drawn from $\pi ( s _ { t } + \delta _ { t } ) , { \mathcal { P } } ( s _ { t - 1 } , a _ { t - 1 } ) ,$ $\mathscr { R } ( s _ { t - 1 } , a _ { t - 1 } )$ respectively, and $R ( \tau ) =$ $\textstyle \sum _ { t } r _ { t }$ . One idea is to evaluate every possible trajectory $\tau$ to find which one produces the minimal reward. However $R _ { w c }$ is practically impossible to evaluate, as finding the worst perturbations $\delta _ { t }$ of a set of possible actions $a _ { t }$ for each state $s _ { t }$ is NP-hard, and the amount of trajectories to evaluate grows exponentially with respect to trajectory length $T$ , which is hard to compute. One possible way to avoid finding worst-case perturbations directly is to use certified output bounds [12, 13, 11, 31, 32, 33], which produces a superset of all possible actions under worst-case perturbations and hence the resulting total accumulative reward is a lower bound of $R _ { w c }$ . We name this reward as Absolute Worst-Case Reward (AWC). Note that AWC is a lower bound of $R _ { w c }$ when both the policy and environment are deterministic.
|
| 166 |
+
|
| 167 |
+
However, AWC still requires evaluating an exponential amount of possible action sequences, which is computationally expensive. To overcome this limitation, we propose an alternative evaluation method called Greedy Worst-Case Reward (GWC) in Algorithm 1, which approximates the desired $R _ { w c }$ and can be computed efficiently with a linear complexity of total timesteps $T$ . The idea of GWC is to avoid evaluating exponential numbers of trajectories and use a simple heuristic to approximate $R _ { w c }$ by choosing the action with lowest Q-value (or the probability of action taken for A3C) greedily at each state. We show in Fig 4 (in Appendix E) that GWC is often close to AWC while being much faster to evaluate (linear complexity of total time steps). Discussion about metrics used in baseline works [17, 18] and full description of the algorithm for computing AWC is in Appendix D.
|
| 168 |
+
|
| 169 |
+
# 4 Experimental results
|
| 170 |
+
|
| 171 |
+
Environments and setup To have a fair comparison with baseline works [17, 18], we experiment on the same Atari-2600 environment [35] and same 4 games used in [17, 18]. Different from [17, 18], we further evaluate our algorithm on a more challenging ProcGen [36] benchmark, which allows us to test generalization abilities of the agent. Note that both Atari-games and ProcGen [36] benchmark have high dimensional pixel inputs and discrete action spaces. To compare our RL agents with continuous actions with [17], we use the MuJoCo environment which simulates robotic control and has relatively low-dimensional inputs and a continuous action space. Full training details and hyperparameter settings are available in Appendix H.
|
| 172 |
+
|
| 173 |
+
Evaluation. We evaluate the performance of our agents with a total of 3 metrics: (a) total reward under 10-steps $l _ { \infty }$ -PGD untargeted attack applied on every frame, (b) GWC and (c) Action Certification Rate (ACR)[17]. For Atari games the result of Approach #2 for RADIAL-agents are in Table 1, and the results of Approach #1 are in Appendix I. Note that A3C and PPO take actions stochastically during training but we set them to deterministically choose the action that has the highest probability during evaluation.
|
| 174 |
+
|
| 175 |
+
# 4.1 Atari results
|
| 176 |
+
|
| 177 |
+
Table 1 shows that RADIAL-DQN outperforms or matches all the baselines on all four games against $\epsilon = 1 / 2 5 5$ PGD-attacks with the same evaluation method in [17]. The result suggests that RADIAL can train a robust policy against $\epsilon = 1 / 2 5 5$ adversarial perturbations without sacrificing nominal performance. In fact, our robust RADIAL agents consistently outperform the baselines on all the evaluation metrics, with significant margin in RoadRunner. In addition to better rewards, our RADIAL-DQN is roughly $6 \times$ faster to train than [17]. Experimentally if we include the standard training process, our total run time is only 17 hours compared to SA-DQN’s 35 hours on our hardware. RADIAL-A3C also achieves high rewards under adversarial attacks and beats the baselines on 2/4 tasks despite the games likely being chosen by previous work because they are easy for Q-learning agents. As shown in Table 1 (A3C is excluded because it did not learn Freeway), RADIAL-A3C reaches slightly lower nominal rewards than RADIAL-DQN but shows more robust performance against large perturbations, even outperforming RADIAL-DQN against $\epsilon = 5 / 2 5 5$ PGD attacks on RoadRunner. This shows RADIAL works well for very different types of RL algorithms.
|
| 178 |
+
|
| 179 |
+
One interesting finding is that our A3C baseline actually performed well against small PGD-attacks even without robust training (the standard DQN models all perform terribly at $\epsilon = 1 / 2 5 5$ while A3C has comparable or even better performance than the robust trained SA-DQN or RS-DQN.) We believe this is due to two main factors: (a) the network architecture is slightly different from DQN and uses Max-pooling layers, which naturally makes it more resistant against many small changes to input; (b) A3C training is more stochastic, so it is more resistant to occasional random actions caused by the untargeted attack.
|
| 180 |
+
|
| 181 |
+
<table><tr><td></td><td>Model/metric</td><td>Nominal</td><td></td><td>PGD attack</td><td></td><td>GWC</td><td>ACR</td></tr><tr><td></td><td>E</td><td>0</td><td>1/255</td><td>3/255</td><td>5/255</td><td>1/255</td><td>1/255</td></tr><tr><td colspan="8">BankHeist</td></tr><tr><td colspan="8">Baselines:</td></tr><tr><td>Standard</td><td>DQN[17] A3C</td><td>1325.5±5.7 1109.0±21.4</td><td>29.5±2.4 1102.5±49.4</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0±0.0 0.5±0.5</td><td>0.000 0.000</td></tr><tr><td>Robust</td><td>RS-DQN[18]</td><td>238.66</td><td>190.67</td><td>534.5±58.2 N/A</td><td>115.0±27.8 N/A</td><td>N/A</td><td>N/A</td></tr><tr><td></td><td>SA-DQN[17]</td><td>1237.6±1.7</td><td>1237.0±2.0</td><td>1213.0±2.5</td><td>1130.0±29.1</td><td>1196.5±9.4</td><td>0.976</td></tr><tr><td colspan="8">Our Methods:</td></tr><tr><td></td><td>RADIAL-DQN</td><td>1349.5±1.7</td><td>1349.5±1.7</td><td>1348±1.7</td><td>1182.5±43.3</td><td>1344.5±1.8</td><td>0.981</td></tr><tr><td></td><td>RADIAL-A3C</td><td>1036.5±23.4</td><td>975±22.2</td><td>949±19.5</td><td>712±46.4</td><td>851.5±2.9</td><td>0.718</td></tr><tr><td colspan="8">Freeway Baselines:</td></tr><tr><td colspan="8"></td></tr><tr><td>Standard</td><td>DQN[17]</td><td>33.9±0.07</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.000</td></tr><tr><td>Robust</td><td>RS-DQN[18]</td><td>32.93</td><td>32.53</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td></td><td>SA-DQN [17]</td><td>30.0±0.0</td><td>30.0±0.0</td><td>30.05±0.05</td><td>27.65±0.22</td><td>30.0±0.0</td><td>1.000</td></tr><tr><td colspan="8">Our Methods:</td></tr><tr><td></td><td>RADIAL-DQN</td><td>33.2±0.19</td><td>33.35±0.16</td><td>33.4±0.13</td><td>29.1±0.17</td><td>33.25±0.24</td><td>0.998</td></tr><tr><td colspan="8">Pong Baselines:</td></tr><tr><td colspan="8"></td></tr><tr><td>Standard</td><td>DQN[17]</td><td>21.0±0.0</td><td>-21.0±0.0</td><td>-21.0±0.0</td><td>-20.85±0.08</td><td>-21.0±0.0</td><td>0.000</td></tr><tr><td>Robust</td><td>A3C</td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td>-17.85±0.33</td><td>-21.0±0.0</td><td>0.000</td></tr><tr><td></td><td>RS-DQN[18] SA-DQN[17]</td><td>19.73 21.0±0.0</td><td>18.13 21.0±0.0</td><td>N/A 21.0±0.0</td><td>N/A -19.75±0.1</td><td>N/A 21.0±0.0</td><td>N/A 1.000</td></tr><tr><td colspan="8">Our Methods:</td></tr><tr><td></td><td></td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td></td></tr><tr><td></td><td>RADIAL-DQN RADIAL-A3C</td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td>21.0±0.0</td><td>0.894 0.755</td></tr><tr><td colspan="8">RoadRunner</td></tr><tr><td colspan="8">Standard</td></tr><tr><td></td><td>DQN[17] A3C</td><td>43390±973 34420±604</td><td>0.0±0.0 31040±2173</td><td>0.0±0.0 3025±317</td><td>0.0±0.0 350±93</td><td>0.0±0.0 0.0±0.0</td><td>0.000 0.000</td></tr><tr><td>Robust</td><td>RS-DQN[18]</td><td>12106.67</td><td>5753.33</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td></td><td>SA-DQN [17]</td><td>45870±1380</td><td>44300±1753</td><td>20170±1822</td><td>3350±335</td><td>0.0±0.0</td><td>0.602</td></tr><tr><td colspan="8">Our Methods:</td></tr><tr><td></td><td>RADIAL-DQN</td><td>44495±1165</td><td>44445±1148</td><td>39560±1621</td><td>23820±942</td><td>45770±1622</td><td>0.994</td></tr><tr><td></td><td>RADIAL-A3C</td><td>34825±981</td><td>31960±933</td><td>29920±1496</td><td>31545±1480</td><td>31885±1912</td><td>0.923</td></tr></table>
|
| 182 |
+
|
| 183 |
+
Table 1: We report the mean reward of 20 runs as well as the standard error of the mean(sem). Best result boldfaced, results within a sem of the best result underlined. RADIAL-DQN outperforms all the baselines. All the robust models are trained with $\epsilon = 1 / 2 5 5$ . RS-DQN results are N/A besides 1/255 PGD as the authors have not released code or models.
|
| 184 |
+
|
| 185 |
+
Another interesting observation in our experiments across different algorithms and environments is that sometimes applying an attack or increasing the magnitude of PGD-attack increases the reward achieved. We note that this phenomenon is not unreasonable since the PGD attack is designed to simply change original actions of RL agent; it is possible and often even likely that original trajectory was not the best possible one and a different trajectory can give higher reward. We observed this phenomenon on Freeway for both SA-DQN and RADIAL-DQN (Table 1), and for RADIAL-PPO on CoinRun and Jumper (Table 2). We believe this indicates the weakness of untargeted PGD-attacks and highlights room for improvement of attacks on RL-policies.
|
| 186 |
+
|
| 187 |
+
# 4.2 ProcGen Results
|
| 188 |
+
|
| 189 |
+
We report our results on 3 environments on the ProcGen benchmark [36] in Table 2. To our best knowledge, it is the first evaluation of robustness of RL-agents trained on ProcGen. All our agents were trained for 25M steps on the easy setting, trained on 200 different levels and evaluated on the full distribution. We used the IMPALA-CNN architecture [36], which is a significantly larger than the ones in our Atari experiments, but our algorithm and training setup can still successfully scale to this more complex setting. We notice like A3C, the original PPO-policy is already quite robust against small PGD-attacks, but RADIAL-PPO has even better robustness to much stronger attacks. Next, we use the train/evaluation split in levels to study whether our robust training generalizes to new environments. We observe that RADIAL training increases robustness consistently on both training and evaluation set, and the gap between training and evaluation results is often smaller for RADIAL-PPO. The results in Table 2 uses a deterministic version of the policy and the result of stochastic policy is reported in Appendix I.
|
| 190 |
+
|
| 191 |
+
<table><tr><td>Env:</td><td>Model</td><td>Dist</td><td>Nominal</td><td>e=1/255 PGD</td><td>e=3/255PGD</td><td>e=5/255 PGD</td></tr><tr><td rowspan="4">Fruitbot</td><td>PPO</td><td>Train</td><td>30.20±0.23</td><td>25.72 ± 0.33</td><td>15.56 ± 0.38</td><td>8.79 ± 0.35</td></tr><tr><td rowspan="2">RADIAL-PPO</td><td>Eval</td><td>26.09 ± 0.33</td><td>22.53 ± 0.38</td><td>13.51 ± 0.39</td><td>8.51 ± 0.35</td></tr><tr><td>Train</td><td>28.03±0.24</td><td>27.93 ± 0.25</td><td>27.84 ± 0.26</td><td>27.50 ± 0.26</td></tr><tr><td></td><td>Eval</td><td>26.08 ± 0.29</td><td>26.06 ± 0.30</td><td>25.87 ± 0.30</td><td>25.81 ± 0.30</td></tr><tr><td rowspan="4">Coinrun</td><td rowspan="2">PPO</td><td>Train</td><td>8.31± 0.12</td><td>6.36± 0.15</td><td>4.19 ± 0.16</td><td>3.32 ±0.15</td></tr><tr><td>Eval</td><td>6.65 ± 0.15</td><td>5.22 ± 0.16</td><td>3.58 ± 0.15</td><td>3.36 ± 0.15</td></tr><tr><td rowspan="2">RADIAL-PPO</td><td>Train</td><td>7.12 ±0.14</td><td>7.10 ±0.14</td><td>7.19 ± 0.14</td><td>7.34± 0.14</td></tr><tr><td>Eval</td><td>6.66 ± 0.15</td><td>6.71 ± 0.15</td><td>6.71 ± 0.15</td><td>6.67 ± 0.15</td></tr><tr><td rowspan="4">Jumper</td><td>PPO</td><td>Train</td><td>8.69± 0.11</td><td>6.61 ± 0.15</td><td>4.50 ± 0.16</td><td>3.42 ± 0.15</td></tr><tr><td rowspan="2">RADIAL-PPO</td><td>Eval</td><td>4.22 ± 0.16</td><td>3.90 ± 0.15</td><td>3.10 ± 0.15</td><td>3.15 ± 0.15</td></tr><tr><td>Train</td><td>6.59 ± 0.15</td><td>6.70 ± 0.15</td><td>6.55 ± 0.15</td><td>6.83 ± 0.15</td></tr><tr><td></td><td>Eval</td><td>3.85 ± 0.15</td><td>3.93 ± 0.15</td><td>3.75 ± 0.15</td><td>3.59 ± 0.15</td></tr></table>
|
| 192 |
+
|
| 193 |
+
Table 2: Results on the ProcGen environments. Each model was evaluated for 1000 episodes on the training/evaluation set. Reported means together with standard error of the mean.
|
| 194 |
+
|
| 195 |
+
Table 3: We report the results of reward (mean $\pm$ standard error of the mean) for each agent in MuJoCo continuous control tasks. Agents are trained for 4096k steps and evaluated for 50 episodes on the evaluation set. Results within standard error of the mean from best result underlined.
|
| 196 |
+
|
| 197 |
+
<table><tr><td>Environment</td><td>Model</td><td>Nominal e=0</td><td>e = 0.0375</td><td>Attack (MAD) e= 0.075</td><td>∈=0.15</td></tr><tr><td rowspan="3">Walker2D (etrain = 0.075)</td><td>PPO</td><td>3635.3±50.7</td><td>1968.5±90.6</td><td>1283.1±61.9</td><td>670.3±31.9</td></tr><tr><td>SA-PPO [17]</td><td>3776.4±186.0</td><td>3923.6±189.9</td><td>3263.7±228.1</td><td>3652.1±203.3</td></tr><tr><td>RADIAL-PPO</td><td>5251.6±10.4</td><td>5108.4±67.9</td><td>4474.7±140.6</td><td>3895.3±128.3</td></tr><tr><td rowspan="3">Hopper (etrain = 0.075)</td><td>PPO</td><td>2740.7±125.8</td><td>2034.4±126.9</td><td>1524.2±146.3</td><td>969.9±90.1</td></tr><tr><td>SA-PPO [17]</td><td>3585.0±56.4</td><td>3364.7±93.9</td><td>3165.1±107.1</td><td>2248.3±124.7</td></tr><tr><td>RADIAL-PPO</td><td>3737.5±4.4</td><td>3684.9±27.4</td><td>3252.1±101.9</td><td>2498.9±130.0</td></tr><tr><td rowspan="3">Half Cheetah (etrain = 0.15)</td><td>PPO</td><td>5566.0±8.7</td><td>5517.8±8.8</td><td>5179.3±64.7</td><td>1483.6±193.4</td></tr><tr><td>SA-PPO [17]</td><td>4175.0±29.9</td><td>4168.8±29.9</td><td>4178.5±35.3</td><td>4173.1±31.8</td></tr><tr><td>RADIAL-PPO</td><td>4724.3±10.6</td><td>4629.7±36.9</td><td>4480.0±66.9</td><td>4008.5±119.5</td></tr></table>
|
| 198 |
+
|
| 199 |
+
# 4.3 MuJoCo Results
|
| 200 |
+
|
| 201 |
+
In Table 3 we show our results on 3 environments from MuJoCo [37] and comparison with vanilla PPO method and SA-PPO [17] convex relaxation approach. We directly use the implementation from [17]. We train $4 0 9 6 \mathrm { k \Omega }$ steps for all 3 environments, whereas [17] uses roughly 2000k for Walker2D and Hopper. For each environment, we compare the performance under MAD attacks [17] with different . For Walker2D, we use training $\epsilon = 0 . 0 7 5$ instead of $\epsilon = 0 . 0 5$ from [17] for better comparison under different attacks. For Walker2D and Hopper, RADIAL-PPO outperforms SA-PPO [17] in both natural testing and robust testing. Interesting, for Half-Cheetah, we found this environment is naturally robust (even better than robust trained agents) against attack up to $\scriptstyle \epsilon = 0 . 0 7 5$ .
|
| 202 |
+
|
| 203 |
+
# 4.4 Evaluating GWC
|
| 204 |
+
|
| 205 |
+
We show empirically that GWC is indeed a good approximation of AWC reward. We compare GWC and action certification rate (ACR) against the Absolute Worst-Case Reward (AWC) on a small scale experiments on reaching the first reward within 80 frames on Freeway due to the exponential complexity of AWC. Figure is available in Appendix D. GWC is the ratio of $+ 1$ rewards as measured by GWC, while AWC uses depth first search to compute the percentage of $+ 1$ rewards using Algorithm 2 (i.e. where all possible sequences of actions get at least $+ 1$ reward). For the episodes that we evaluated, GWC matched AWC perfectly for $\epsilon \in \{ 1 . 0 , 1 . 2 , 1 . 5 \}$ . Since AWC is a lower bound of GWC, for $\epsilon \in \{ 1 . 3 , 1 . 4 \}$ GWC matched AWC on 37/40 episodes, while overestimating on the $3 / 4 0$ ACR (as used in [17]) did not show as strong of a correlation with AWC. As evident in Table 1, GWC is a better indicator for the robust performance than ACR – this is the case for Freeway and Pong where SA-DQN has higher action certification rates but RADIAL-DQN has higher GWC and PGD rewards. Together these results give faith in GWC being a good evaluation method.
|
| 206 |
+
|
| 207 |
+
# 5 Conclusions and Future works
|
| 208 |
+
|
| 209 |
+
We have shown that using the proposed RADIAL framework can significantly improve the robustness of deep RL agents against adversarial perturbations based on robustness verification bounds – our robustly trained agents reach very good performance against even $5 \times$ larger perturbations than previous state of the art, and in the meantime are much more computationally efficient to train. In addition, we have presented a new evaluation method, Greedy Worst-Case Reward, as a good surrogate of the worst-case reward to evaluate deep RL agent’s performance under adversarial input perturbations. Future works include extending our framework to defend against semantic perturbations such as contrast and brightness changes, which are more realistic on the vision-based RL agents (e.g. self-driving car, vision-based robots).
|
| 210 |
+
|
| 211 |
+
# 6 Limitations and Potential negative impact
|
| 212 |
+
|
| 213 |
+
An important limitation of our work and one that may cause negative impact in the future is that our work addresses only a specific axis of robustness, robustness against $l _ { p }$ -norm bounded perturbations. While there are ways to extend this, for example to semantic perturbation [28], other axes like robustness to changing environment conditions are not addressed by our method. We want to highlight common terms used in this field like certified defense and robustness may sound very convincing to a non-expert, but insufficient understanding of the limits of current robust training methods and overly relying on them presents pressing potential for negative social impact.
|
| 214 |
+
|
| 215 |
+
# Acknowledgement
|
| 216 |
+
|
| 217 |
+
The authors would like to thank anonymous reviewers for valuable feedback to improve the manuscript. The authors thank MIT-IBM Watson AI lab and the MIT SuperUROP program for support in this work. T. Oikarinen and T.-W. Weng are supported by National Science Foundation under Grant No. 2107189.
|
| 218 |
+
|
| 219 |
+
# References
|
| 220 |
+
|
| 221 |
+
[1] A. Krizhevsky, “Learning multiple layers of features from tiny images,” 2009.
|
| 222 |
+
[2] S. Lai, L. Xu, K. Liu, and J. Zhao, “Recurrent convolutional neural networks for text classification,” in Twenty-ninth AAAI conference on artificial intelligence, 2015.
|
| 223 |
+
[3] V. Mnih, K. Kavukcuoglu, D. Silver, A. Graves, I. Antonoglou, D. Wierstra, and M. Riedmiller, “Playing atari with deep reinforcement learning,” arXiv preprint arXiv:1312.5602, 2013.
|
| 224 |
+
[4] T. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra, “Continuous control with deep reinforcement learning.,” in ICLR 2016.
|
| 225 |
+
[5] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus, “Intriguing properties of neural networks,” in 2nd International Conference on Learning Representations, ICLR 2014.
|
| 226 |
+
[6] S. Huang, N. Papernot, I. Goodfellow, Y. Duan, and P. Abbeel, “Adversarial attacks on neural network policies,” arXiv preprint arXiv:1702.02284, 2017.
|
| 227 |
+
[7] Y.-C. Lin, Z.-W. Hong, Y.-H. Liao, M.-L. Shih, M.-Y. Liu, and M. Sun, “Tactics of adversarial attack on deep reinforcement learning agents,” in Proceedings of the 26th International Joint Conference on Artificial Intelligence, pp. 3756–3762, 2017.
|
| 228 |
+
[8] T.-W. Weng, K. D. Dvijotham, J. Uesato, K. Xiao, S. Gowal, R. Stanforth, and P. Kohli, “Toward evaluating robustness of deep reinforcement learning with continuous control,” ICLR 2020.
|
| 229 |
+
[9] F. Tramer, N. Carlini, W. Brendel, and A. Madry, “On adaptive attacks to adversarial example defenses,” Advances in Neural Information Processing Systems, vol. 33, 2020.
|
| 230 |
+
[10] A. Raghunathan, J. Steinhardt, and P. Liang, “Certified defenses against adversarial examples,” ICLR 2018.
|
| 231 |
+
[11] J. Z. Kolter and E. Wong, “Provable defenses against adversarial examples via the convex outer adversarial polytope,” ICML 2018.
|
| 232 |
+
[12] L. Weng, H. Zhang, H. Chen, Z. Song, C.-J. Hsieh, L. Daniel, D. Boning, and I. Dhillon, “Towards fast computation of certified robustness for relu networks,” in International Conference on Machine Learning, pp. 5276–5285, PMLR, 2018.
|
| 233 |
+
[13] G. Singh, T. Gehr, M. Mirman, M. Püschel, and M. Vechev, “Fast and effective robustness certification,” in NeurIPS 2018.
|
| 234 |
+
[14] S. Gowal, K. Dvijotham, R. Stanforth, R. Bunel, C. Qin, J. Uesato, R. Arandjelovic, T. Mann, and P. Kohli, “On the effectiveness of interval bound propagation for training verifiably robust models,” arXiv preprint arXiv:1810.12715, 2018.
|
| 235 |
+
[15] V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu, “Asynchronous methods for deep reinforcement learning,” in International conference on machine learning, pp. 1928–1937, PMLR, 2016.
|
| 236 |
+
[16] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, “Proximal policy optimization algorithms,” arXiv preprint arXiv:1707.06347, 2017.
|
| 237 |
+
[17] H. Zhang, H. Chen, C. Xiao, B. Li, M. Liu, D. S. Boning, and C.-J. Hsieh, “Robust deep reinforcement learning against adversarial perturbations on state observations,” in NeurIPS 2020.
|
| 238 |
+
[18] M. Fischer, M. Mirman, S. Stalder, and M. Vechev, “Online robustness training for deep reinforcement learning,” arXiv preprint arXiv:1911.00887, 2019.
|
| 239 |
+
[19] I. J. Goodfellow, J. Shlens, and C. Szegedy, “Explaining and harnessing adversarial examples,” ICLR 2015.
|
| 240 |
+
[20] D. J. Mankowitz, N. Levine, R. Jeong, A. Abdolmaleki, J. T. Springenberg, Y. Shi, J. Kay, T. Hester, T. Mann, and M. Riedmiller, “Robust reinforcement learning for continuous control with model misspecification,” in International Conference on Learning Representations, 2020.
|
| 241 |
+
[21] L. Pinto, J. Davidson, R. Sukthankar, and A. Gupta, “Robust adversarial reinforcement learning,” in Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2817– 2826, JMLR. org, 2017.
|
| 242 |
+
[22] A. Gleave, M. Dennis, C. Wild, N. Kant, S. Levine, and S. Russell, “Adversarial policies: Attacking deep reinforcement learning,” in International Conference on Learning Representations, 2020.
|
| 243 |
+
[23] I. Ilahi, M. Usama, J. Qadir, M. U. Janjua, A. Al-Fuqaha, D. T. Huang, and D. Niyato, “Challenges and countermeasures for adversarial attacks on deep reinforcement learning,” IEEE Transactions on Artificial Intelligence, 2021.
|
| 244 |
+
[24] Y.-S. Wang, T.-W. Weng, and L. Daniel, “Verification of neural network control policy under persistent adversarial perturbation,” arXiv preprint arXiv:1908.06353, 2019.
|
| 245 |
+
[25] J. Kos and D. Song, “Delving into adversarial attacks on deep policies,” arXiv preprint arXiv:1705.06452, 2017.
|
| 246 |
+
[26] A. Pattanaik, Z. Tang, S. Liu, G. Bommannan, and G. Chowdhary, “Robust deep reinforcement learning with adversarial attacks,” in Proceedings of the 17th International Conference on Autonomous Agents and MultiAgent Systems, pp. 2040–2042, 2018.
|
| 247 |
+
[27] B. Lütjens, M. Everett, and J. P. How, “Certified adversarial robustness for deep reinforcement learning,” in Conference on Robot Learning, pp. 1328–1337, PMLR, 2020.
|
| 248 |
+
[28] J. Mohapatra, P.-Y. Chen, S. Liu, L. Daniel, et al., “Towards verifying robustness of neural networks against semantic perturbations,” CVPR 2020.
|
| 249 |
+
[29] Z. Wang, T. Schaul, M. Hessel, H. Hasselt, M. Lanctot, and N. Freitas, “Dueling network architectures for deep reinforcement learning,” in International conference on machine learning, pp. 1995–2003, PMLR, 2016.
|
| 250 |
+
[30] H. Van Hasselt, A. Guez, and D. Silver, “Deep reinforcement learning with double q-learning,” in Proceedings of the AAAI conference on artificial intelligence, vol. 30, 2016.
|
| 251 |
+
[31] S. Wang, K. Pei, J. Whitehouse, J. Yang, and S. Jana, “Efficient formal safety analysis of neural networks,” in Advances in Neural Information Processing Systems, pp. 6367–6377, 2018.
|
| 252 |
+
[32] H. Zhang, T.-W. Weng, P.-Y. Chen, C.-J. Hsieh, and L. Daniel, “Efficient neural network robustness certification with general activation functions,” in Advances in neural information processing systems, pp. 4939–4948, 2018.
|
| 253 |
+
[33] A. Boopathy, T.-W. Weng, P.-Y. Chen, S. Liu, and L. Daniel, “Cnn-cert: An efficient framework for certifying robustness of convolutional neural networks,” in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 33, pp. 3240–3247, 2019.
|
| 254 |
+
[34] V. Tjeng, K. Y. Xiao, and R. Tedrake, “Evaluating robustness of neural networks with mixed integer programming,” in International Conference on Learning Representations, 2018.
|
| 255 |
+
[35] M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling, “The arcade learning environment: An evaluation platform for general agents,” Journal of Artificial Intelligence Research, vol. 47, p. 253–279, Jun 2013.
|
| 256 |
+
[36] K. Cobbe, C. Hesse, J. Hilton, and J. Schulman, “Leveraging procedural generation to benchmark reinforcement learning,” in International conference on machine learning, pp. 2048–2056, PMLR, 2020.
|
| 257 |
+
[37] E. Todorov, T. Erez, and Y. Tassa, “Mujoco: A physics engine for model-based control,” in 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033, 2012.
|
| 258 |
+
[38] H. Zhang, H. Chen, C. Xiao, S. Gowal, R. Stanforth, B. Li, D. Boning, and C.-J. Hsieh, “Towards stable and efficient training of verifiably robust neural networks,” in International Conference on Learning Representations, 2020.
|
| 259 |
+
[39] D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” in ICLR 2015.
|
md/train/fLnsj7fpbPI/fLnsj7fpbPI.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PettingZoo: A Standard API for Multi-Agent Reinforcement Learning
|
| 2 |
+
|
| 3 |
+
J. K. Terry∗ † j.k.terry@swarmlabs.com
|
| 4 |
+
|
| 5 |
+
Benjamin Black∗ † benjamin.black@swarmlabs.com
|
| 6 |
+
|
| 7 |
+
Nathaniel Grammel† ngrammel@umd.edu
|
| 8 |
+
|
| 9 |
+
Mario Jayakumar† mariojay@umd.edu
|
| 10 |
+
|
| 11 |
+
Ananth Hari‡ ahari1@umd.edu
|
| 12 |
+
|
| 13 |
+
Ryan Sullivan∗ † ryan.sullivan@swarmlabs.com
|
| 14 |
+
|
| 15 |
+
Luis Santos§ lss@umd.edu
|
| 16 |
+
|
| 17 |
+
Rodrigo Perez ¶ rlazcano@umd.edu
|
| 18 |
+
|
| 19 |
+
Caroline Horsch∗ † caroline.horsch@swarmlabs.com
|
| 20 |
+
|
| 21 |
+
Clemens Dieffendahl k dieffendahl@campus.tu-berlin.de
|
| 22 |
+
|
| 23 |
+
Niall L. Williams† niallw@umd.edu
|
| 24 |
+
|
| 25 |
+
Yashas Lokesh† yashloke@umd.edu
|
| 26 |
+
|
| 27 |
+
Praveen Ravi† pravi@umd.edu
|
| 28 |
+
|
| 29 |
+
# Abstract
|
| 30 |
+
|
| 31 |
+
This paper introduces the PettingZoo library and the accompanying Agent Environment Cycle (“AEC”) games model. PettingZoo is a library of diverse sets of multi-agent environments with a universal, elegant Python API. PettingZoo was developed with the goal of accelerating research in Multi-Agent Reinforcement Learning (“MARL”), by making work more interchangeable, accessible and reproducible akin to what OpenAI’s Gym library did for single-agent reinforcement learning. PettingZoo’s API, while inheriting many features of Gym, is unique amongst MARL APIs in that it’s based around the novel AEC games model. We argue, in part through case studies on major problems in popular MARL environments, that the popular game models are poor conceptual models of games commonly used in MARL and accordingly can promote confusing bugs that are hard to detect, and that the AEC games model addresses these problems.
|
| 32 |
+
|
| 33 |
+
# 1 Introduction
|
| 34 |
+
|
| 35 |
+
Multi-Agent Reinforcement Learning (MARL) has been behind many of the most publicized achievements of modern machine learning — AlphaGo Zero [Silver et al., 2017], OpenAI Five [OpenAI, 2018], AlphaStar [Vinyals et al., 2019]. These achievements motivated a boom in MARL research, with Google Scholar indexing 9,480 new papers discussing multi-agent reinforcement learning in 2020 alone. Despite this boom, conducting research in MARL remains a significant engineering challenge. A large part of this is because, unlike single agent reinforcement learning which has OpenAI’s Gym, no de facto standard API exists in MARL for how agents interface with environments. This makes the reuse of existing learning code for new purposes require substantial effort, consuming researchers’ time and preventing more thorough comparisons in research. This lack of a standardized API has also prevented the proliferation of learning libraries in MARL. While a massive number of Gym-based single-agent reinforcement learning libraries or code bases exist (as a rough measure 669 pip-installable packages depend on it at the time of writing GitHub [2021]), only 5 MARL libraries with large user bases exist [Lanctot et al., 2019, Weng et al., 2020, Liang et al., 2018, Samvelyan et al., 2019, Nota, 2020]. The proliferation of these Gym based learning libraries has proved essential to the adoption of applied RL in fields like robotics or finance and without them the growth of applied MARL is a significantly greater challenge. Motivated by this, this paper introduces the PettingZoo library and API, which was created with the goal of making research in MARL more accessible and serving as a multi-agent version of Gym.
|
| 36 |
+
|
| 37 |
+
Prior to PettingZoo, the numerous single-use MARL APIs almost exclusively inherited their design from the two most prominent mathematical models of games in the MARL literature—Partially Observable Stochastic Games (“POSGs”) and Extensive Form Games (“EFGs”). During our development, we discovered that these common models of games are not conceptually clear for multi-agent games implemented in code and cannot form the basis of APIs that cleanly handle all types of multi-agent environments.
|
| 38 |
+
|
| 39 |
+
To solve this, we introduce a new formal model of games, Agent Environment Cycle (“AEC”) games that serves as the basis of the PettingZoo API. We argue that this model is a better conceptual fit for games implemented in code. and is uniquely suitable for general MARL APIs. We then prove that any AEC game can be represented by the standard POSG model, and that any POSG can be represented by an AEC game. To illustrate the importance of the AEC games model, this paper further covers two case studies of meaningful bugs in popular MARL implementations. In both cases, these bugs went unnoticed for a long time. Both stemmed from using confusing models of games, and would have been made impossible by using an AEC games based API.
|
| 40 |
+
|
| 41 |
+
The PettingZoo library can be installed via pip install pettingzoo, the documentation is available at https://www.pettingzoo.ml, and the repository is available at https://github.com/ Farama-Foundation/PettingZoo.
|
| 42 |
+
|
| 43 |
+
# 2 Background and Related Works
|
| 44 |
+
|
| 45 |
+
Here we briefly survey the state of modeling and APIs in MARL, beginning by briefly looking at Gym’s API (Figure 1). This API is the de facto standard in single agent reinforcement learning, has largely served as the basis for subsequent multi-agent APIs, and will be compared to later.
|
| 46 |
+
|
| 47 |
+
import gym
|
| 48 |
+
env $=$ gym.make(’CartPole-v0’)
|
| 49 |
+
observation $=$ env.reset()
|
| 50 |
+
for _ in range(1000): action $=$ policy(observation) observation, reward, done, info $=$ env.step(action)
|
| 51 |
+
from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
|
| 52 |
+
env $=$ MultiAgentCartPole()
|
| 53 |
+
observation $=$ env.reset()
|
| 54 |
+
for _ in range(1000): actions $=$ policies(agents, observation) observation, rewards, dones, infos $=$ env.step(actions)
|
| 55 |
+
|
| 56 |
+
The Gym API is a fairly straightforward Python API that borrows from the POMDP conceptualization of RL. The API’s simplicity and conceptual clarity has made it highly influential, and it naturally accompanying the pervasive POMDP model that’s used as the pervasive mental and mathematical model of reinforcement learning [Brockman et al., 2016]. This makes it easier for anyone with an understanding of the RL framework to understand Gym’s API in full.
|
| 57 |
+
|
| 58 |
+
# 2.1 Partially Observable Stochastic Games and RLlib
|
| 59 |
+
|
| 60 |
+
Multi-agent reinforcement learning does not have a universal mental and mathematical model like the POMDP model in single-agent reinforcement learning. One of the most popular models is the partially observable stochastic game (“POSG”). This model is very similar to, and strictly more general than, multi-agent MDPs [Boutilier, 1996], Dec-POMDPs [Bernstein et al., 2002], and Stochastic (“Markov”) games [Shapley, 1953]). In a POSG, all agents step together, observe together, and are rewarded together. The full formal definition is presented in Appendix C.1
|
| 61 |
+
|
| 62 |
+
This model of simultaneous stepping naturally translates into Gym-like APIs, where the actions, observations, rewards, and so on are lists or dictionaries of individual values for agents. This design choice has become the standard for MARL outside of strictly turn-based games like poker, where simultaneous stepping would be a poor conceptual fit [Lowe et al., 2017, Zheng et al., 2017, Gupta et al., 2017, Liu et al., 2019, Liang et al., 2018, Weng et al., 2020]. One example of this is shown in Figure 2 with the multi-agent API in RLlib [Liang et al., 2018], where agent-keyed dictionaries of actions, observations and rewards are passed in a simple extension of the Gym API.
|
| 63 |
+
|
| 64 |
+
This model has made it much easier to apply single agent RL methods to multi-agent settings. However, there are two immediate problems with this model:
|
| 65 |
+
|
| 66 |
+
1. Supporting strictly turn-based games like chess requires constantly passing dummy actions for non-acting agents (or using similar tricks).
|
| 67 |
+
2. Changing the number of agents for agent death or creation is very awkward, as learning code has to cope with lists suddenly changing sizes.
|
| 68 |
+
|
| 69 |
+
# 2.2 OpenSpiel and Extensive Form Games
|
| 70 |
+
|
| 71 |
+
In the cases of strictly turn based games where POSG models are poorly suited (e.g. Chess), MARL researchers generally mathematically model the games as Extensive Form Games (“EFG”). The EFG represents games as a tree, explicitly representing every possible sequence of actions as a root to leaf path in the tree. Stochastic aspects of a game (or MARL environment) are captured by adding a “Nature” player (sometimes also called “Chance”) which takes actions according to some given probability distribution. For a full definition of EFGs, we refer the reader to Osborne and Rubinstein [1994] or Appendix C.2. OpenSpiel [Lanctot et al., 2019], a major library with a large collection of classical board and card games for MARL bases their API off of the EFG paradigm, the API of which is shown in Figure 3.
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 3: An example of the basic usage of OpenSpiel
|
| 75 |
+
|
| 76 |
+
The EFG model has been successfully used for solving problems involving theory of mind with methods like game theoretic analysis and tree search. However, for application in general MARL problems, three immediate concerns arise with the EFG model:
|
| 77 |
+
|
| 78 |
+
1. The model, and the corresponding API, is very complex compared to that of POSGs, and isn’t suitable for beginners the way Gym is—this environment API is much more complicated than Gym’s API or RLLib’s POSG API for example. Furthermore, due to the complexity of the EFG model, reinforcement learning researchers don’t ubiquitously use it as a mental model of games in the same way that they use the POSG or POMDP model. 2. The formal definition only includes rewards at the end of games, while reinforcement learning often requires frequent rewards. While this is possible to work around in the API implementation, it is not ideal.
|
| 79 |
+
|
| 80 |
+
3. The OpenSpiel API does not handle continuous actions (a common and important case in RL), though this was a choice that is not inherent to the EFG model.
|
| 81 |
+
|
| 82 |
+
It’s also worth briefly noting that some simple strictly turn based games are modeled with the single-agent Gym API, with the environment alternating which agent is controlled, [Ha, 2020]. This approach is unable to reasonably scale beyond two agents due to the difficulties of handling changes in agent order (e.g. Uno), agent death, and agent creation.
|
| 83 |
+
|
| 84 |
+
# 3 PettingZoo Design Goals
|
| 85 |
+
|
| 86 |
+
Our development of PettingZoo both as a general library and an API centered around the following goals.
|
| 87 |
+
|
| 88 |
+
# 3.1 Be like Gym
|
| 89 |
+
|
| 90 |
+
In PettingZoo, we wanted to leverage Gym’s ubiquity, simplicity and universality. This created two concrete goals for us:
|
| 91 |
+
|
| 92 |
+
• Make the API look and feel like Gym, and relatedly make the API pythonic and simple • Include numerous reference implementations of games with the main package
|
| 93 |
+
|
| 94 |
+
Reusing as many design metaphors from Gym as possible will help its massive existing user base to almost instantly understand PettingZoo’s API. Similarly, for an API to become standardized, it must support a large collection of useful environments to attract users and for adoption to begin, similar to what Gym did.
|
| 95 |
+
|
| 96 |
+
# 3.2 Be a Universal API
|
| 97 |
+
|
| 98 |
+
If there is to be a Gym-like API for MARL, it has to be able to support all use cases and types of environments. Accordingly, several technically difficult cases exist that have to be carefully considered:
|
| 99 |
+
|
| 100 |
+
• Environments with large numbers of agents
|
| 101 |
+
• Environments with agent death and creation
|
| 102 |
+
• Environments where different agents can be chosen to participate in each episode
|
| 103 |
+
• Learning methods that require access to specialty low level features
|
| 104 |
+
|
| 105 |
+
Two related softer design goals for universal design are ensuring the API is simple enough for beginners to easily use, and making the API easily changeable if the direction of research in the field dramatically changes.
|
| 106 |
+
|
| 107 |
+
# 4 Case Studies of Problems With The POSG Model in MARL
|
| 108 |
+
|
| 109 |
+
To supplement the description of the problems with the POSG models described in Section 2.1, we overview problems with basing APIs around these models that could theoretically occur in software games, and then examine real cases of those problems occurring in popular MARL environments. We specifically focus on POSGs here because EFG based APIs are extraordinarily rare (OpenSpiel is the only major one), while POSG based ones are almost universal.
|
| 110 |
+
|
| 111 |
+
# 4.1 POSGs Don’t Allow Access To Information You Should Have
|
| 112 |
+
|
| 113 |
+
Another problem with modeling environments using simultaneous actions in the POSG model is that all of an agent’s rewards (from all sources) are summed and returned all at once. In a multi-agent game though, this combined reward is often the composite reward from the actions of other agentss and the environment. Similarly, you might want to be able to attribute the source of this reward for various learning reasons, or for debugging purposes to find out the origin of your rewards. However, in thinking about reward origins, having all rewards emitted at once proves to be very confusing because rewards from different sources are all combined. Accessing this information via an API modeled after a POSG requires deviating from the model. This would come in the form of returning a 2D array of rewards instead of a list, which would be difficult to standardize and inconvenient for learning code to parse.
|
| 114 |
+
|
| 115 |
+
A notable case where this caused an issue in practice is in the popular pursuit gridworld environment from Gupta et al. [2017], shown in Figure 4. In it, 8 red controllable pursuer must work together to surround and capture 30 randomly moving blue evaders. The action space of each pursuer is discrete (cardinal directions or do nothing), and the observation space is a $7 \times 7$ box centered around a pursuer (depicted by the orange box). When an evader is surrounded on all sides by pursuers or the game boundaries, each contributing pursuer gets a reward of 5.
|
| 116 |
+
|
| 117 |
+

|
| 118 |
+
Figure 4: The pursuit environment from Gupta et al. [2017].
|
| 119 |
+
|
| 120 |
+
In pursuit, pursuers move first, and then evaders move randomly, before it’s determined if an evader is captured and rewards are emitted. Thus an evader that “should have” been captured is not actually captured. Having the evaders move second isn’t a bug, it’s just way of adding complexity to the classic genre of pursuer/evader multi-agent environments [Vidal et al., 2002], and is representative of real problems. When pursuit is viewed as an AEC game, we’re forced to attribute rewards to individual steps, and the breakdown becomes pursuers receiving deterministic rewards from surrounding the evader, and then random reward due to the evader moving after. Removing this random component of the reward (the part caused by the evaders action after the pursuers had already moved), should then lead to superior performance. In this case the problem was so innocuous that fixing it required switching two lines of code where their order made no obvious difference. We experimentally validate this performance improvement in Appendix A.1, showing that on average this change resulted in up to a $22 \%$ performance in the expected reward of a learned policy.
|
| 121 |
+
|
| 122 |
+
Bugs of this family could easily happen in almost any MARL environment, and analyzing and preventing them is made much easier when using the POSG model. Because every agent’s rewards are summed together in the POSG model, this specific problem when looking at the code was extraordinarily non-obvious, whereas when forced to attribute the reward of individual agents this becomes clear. Moreover if an existing environment had this problem, by exposing the actual sources of rewards to learning code researchers are able to remove differing sources of reward to more easily find and remove bugs like this, and in principle learning algorithms could be developed that automatically differently weighted different sources of reward.
|
| 123 |
+
|
| 124 |
+
# 4.2 POSGs Based APIs Are Not Conceptually Clear For Games Implemented In Code
|
| 125 |
+
|
| 126 |
+
Introducing race conditions is a very easy mistake to make in MARL code in practice, and this occurs because simultaneous models of multi-agent games are not representative of how game code normally executes. This stems from a very common scenario in multi-agent environments where two agents are able to take conflicting actions (i.e. moving into the same space). This discrepancy has to be resolved by the environment (i.e. collision handling); which we call “tie-breaking.”
|
| 127 |
+
|
| 128 |
+
Consider an environment with two agents, Alice and Bob, in which Alice steps first and tie-breaking is biased in Alice’s favor. If such an environment were assumed to have simultaneous actions, then observations for both agents would be taken before either acted, causing the observation Bob acts on to no longer be an accurate representation of the environment if a conflict with biased tie-breaking occurs. For example, if both agents tried to step into the same square and Alice got the square because she was first in the list, Bob’s observation before acting was effectively inaccurate and the environment was not truly parallel. This behavior is a true race condition—the result of stepping through the environment can inadvertently differ depending on the internal resolution order of agent actions.
|
| 129 |
+
|
| 130 |
+
In any environment that’s even slightly complex, a tremendous number of instances where tie-breaking must be handled will typically occur. In any cases where a single one is missed, the environment will have race conditions that your code will attempt to learn. While finding these will always be important, a valuable tool to mitigate these possibilities is to use an API that treats each agent as acting sequentially, returning new observations afterwards. This entirely prevents the opportunity for introducing race conditions. Moreover, this entire problem stems from the fact that using APIs that model agents as updating sequentially for software MARL environments generally makes more conceptual sense than modeling the updates as simultaneous—unless the authors of environments use very complex parallelization, the environments will actually be updated one agent at a time. It is worth mentioning that this race condition cannot occur in an environment simulated in the physical world with continuous time or a simulated environment with a sufficient amount of observation delay (though most actively researched environment in MARL do not currently have any observation delay).
|
| 131 |
+
|
| 132 |
+
In Appendix A.1 we go through a case study of a race condition like this happening in the open source implementation of the social sequential dilemma game environments [Vinitsky et al., 2019]. These are popular multi-agent grid world environments intended to study emergent behaviors for various forms of resource management, and has imperfect tie-breaking in a case where two agents try to act on resources in the same grid while using a simultaneous API. This bug in particular illustrates how extraordinarily difficult making all tie-breaking truly unbiased is in practice even for fairly simple environments. We defer this to the appendix as explaining the specific origin requires a large amount of exposition and diagrams about the rules of the environment.
|
| 133 |
+
|
| 134 |
+
# 5 The Agent Environment Cycle Games Model
|
| 135 |
+
|
| 136 |
+
Motivated by the problems with applying the POSG and EFG models to MARL APIs, we developed the Agent Environment Cycle (“AEC”) Game. In this model, agents sequentially see their observation, agents take actions, rewards are emitted from the other agents, and the next agent to act is chosen. This is effectively a sequentially stepping form of the POSG model.
|
| 137 |
+
|
| 138 |
+
Modeling multi-agent environments sequentially for APIs has numerous benefits:
|
| 139 |
+
|
| 140 |
+
• It allows for clearer attribution of rewards to different origins, allowing for various learning improvements, as described in Section 4.1.
|
| 141 |
+
• It prevents developers adding confusing and easy-to-introduce race conditions, as described in Section 4.2.
|
| 142 |
+
• It more closely models how computer games are executed in code, as described in Section 4.2.
|
| 143 |
+
• It formally allows for rewards after every step as is required in RL, but is not generally a part of the EFG model, as discussed in Section 2.2.
|
| 144 |
+
• It is simple enough to serve as a mental model, especially for beginners, unlike the EFG model as discussed in Section 2.2 and illustrated in the definition in Appendix C.2.
|
| 145 |
+
• Changing the number of agents for agent death or creation is less awkward, as learning code does not have to account for lists constantly changing sizes, as discussed in Section 2.1.
|
| 146 |
+
• It is the least bad option for a universal API, compared to simultaneous stepping, as alluded to in Section 2.1. Simultaneous stepping requires the use of no-op actions if not all agents can act which are very difficult to deal with, whereas sequentially stepping agents that could all act simultaneously and queuing up their actions is not especially inconvenient.
|
| 147 |
+
|
| 148 |
+
In Appendix C.3 we mathematically formalize the AEC games model, however understanding the formalism in full is not essential to understanding the paper. In Appendix D we further prove that for every AEC game an equivalent POSG exists and that for every POSG an equivalent AEC game exists. This shows that the AEC games model is as powerful a model as the most common current model of multi-agent environments.
|
| 149 |
+
|
| 150 |
+
One additional conceptual feature of the AEC games model exists that we have not previously discussed because it does not usually play a role in APIs (see Section 6.4). In the AEC games model, we deviate from the POSG model by introducing the “environment” agent, which is analogous to the Nature agent from EFGs. When this agent acts in the model it indicates the updating of the environment itself, realizing and reacting to submitting agent actions. This allows for a more comprehensive attribution of rewards, causes of agent death, and discussion of games with strange updating rules and race conditions. An example of the transitions for Chess is shown in Figure 5, which serves as the inspiration for the name “agent environment cycle”.
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 5: The AEC diagram of Chess
|
| 154 |
+
|
| 155 |
+
# 6 API Design
|
| 156 |
+
|
| 157 |
+
# 6.1 Basic API
|
| 158 |
+
|
| 159 |
+
The PettingZoo API is shown in Figure 6, and the strong similarities to the Gym API (Figure 1) should be obvious — each agent provides an action to a step function and receives observation, reward, done, info as the return values. The observation and state spaces also use the the exact same space objects as Gym. The render and close methods also function identically to Gym’s, showing a current visual frame representing the environment to the screen whenever called. The reset method similarly has identical function to Gym — it resets the environment to a starting configuration after being played through. PettingZoo really only has two deviations from the regular Gym API — the last and agent_iter methods and the corresponding iteration logic.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 6: An example of the basic usage of Pettingzoo
|
| 163 |
+
|
| 164 |
+
# 6.2 The agent_iter Method
|
| 165 |
+
|
| 166 |
+
The agent_iter method is a generator method of an environment that returns the next agent that the environment will be acting upon. Because the environment is providing the next agent to act, this cleanly abstracts away any issues surrounding changing agent orders, agent generation, and agent death. This generation also parallels the functionality of the next agent function from the AEC games model. This method, combined with one agent acting at once, allows for the support of every conceivable variation of the set of agents changing.
|
| 167 |
+
|
| 168 |
+
# 6.3 The last Method
|
| 169 |
+
|
| 170 |
+
An odd aspect of multi-agent environments is that from the perspective of one agent, the other agents are part of the environment. Whereas in the single agent case the observation and rewards can be given immediately, in the multi-agent case an agent has to wait for all other agents to act before it’s observation, reward, done and info can be fully determined. For this reason, these values are given by the last method, and they can then be passed into a policy to choose an action. Less robust implementations would not allow for features like changing agent orders (like the reverse card in Uno).
|
| 171 |
+
|
| 172 |
+
# 6.4 Additional API Features
|
| 173 |
+
|
| 174 |
+
The agents attribute is a list of all agents in the environment, as strings. The rewards, dones, infos attributes are agent-keyed dictionaries for each attribute (note that the rewards are the instantaneous ones resulting from the most recent action). These allow access to agent properties at all points on a trajectory, regardless of which is selected. The action_space(agent) and observation_space(agent) functions return the static action and observation spaces respectively for the agent given as an argument. The observe(agent) method provides the observation for a single agent by passing its name as an argument, which can be useful if you need to observe an agent in an unusual context. The state method is an optional method returns the global state of an environment, as is required for centralized critic methods. The agent_selection method returns the agent that can currently be acted upon per agent_iter.
|
| 175 |
+
|
| 176 |
+
The motivation for allowing access to all these lower level pieces of information is to let researchers to attempt novel, unusual experiments. The space of multi-agent RL has not yet been comprehensively explored, and there are many perfectly plausible reasons you might want access to other agents rewards, observations, and so on. For an API to be universal in an emerging field, it inherently has to allow access to all the information researchers could plausibly want. For this reason we allow access to a fairly straightforward set of lower level attributes and methods in addition to the standard higher level API. As we outline in Section 6.5, we’ve structured PettingZoo in a way such that including these low-level features doesn’t introduce engineering overhead in creating environments, as discussed further in the documentation website.
|
| 177 |
+
|
| 178 |
+
To handle environments where different agents can be present on each reset of an environment, PettingZoo has an optional possible_agents attribute which lists all the agents that might exist in an environment at any point. Environments which generate arbitrary numbers or types of agents will not define a possible_agents list, requiring the user to check for new agents being instantiated as the environment runs. After resetting the environment, the agents attribute becomes accessible and lists all agents that are currently active. For similar reasons, num_agents, rewards, dones, infos, and agent_selection are not available until after a reset.
|
| 179 |
+
|
| 180 |
+
To handle cases where environments need to have environment agents as per the formal AEC Games model, the standard is to put it into the agents with the name env and have it take None as it’s action. We do not require this for all environments by default as it’s rarely used and makes the API more cumbersome, but this is an important feature for certain edge cases in research. This connects to the formal model in that, when this feature is not used, the environment actor from the formal model and the agent actor that acted before it are merged together.
|
| 181 |
+
|
| 182 |
+
# 6.5 Environment Creation and the Parallel API
|
| 183 |
+
|
| 184 |
+
PettingZoo environments actually only expose the reset, seed, step, observe, render, and close base methods and the agents, rewards, dones, infos, state and agent_iter base attributes. These are then wrapped to add the last method. Only having environments implement primitive methods makes creating new environments simpler, and reduces code duplication. This has the useful side effect of allowing all PettingZoo environments to be easily changed to an alternative API by simply writing a new wrapper. We’ve actually already done this for the default environments and added an additional “parallel API” to them that’s almost identical to the RLlib POSG-based API via a wrapper. We added this secondary API because in environments with very large numbers of agents, this can improve runtime by reducing the number of Python function calls.
|
| 185 |
+
|
| 186 |
+
# 7 Default Environments
|
| 187 |
+
|
| 188 |
+
Similar to Gym’s default environments, PettingZoo includes 63 environments. Half of the included environment classes (MPE, MAgent, and SISL), despite their popularity, existed as unmaintained “research grade” code, have not been available for installation via pip, and have required large amounts of maintenance to run at all before our cleanup and maintainership. We additionally included multiplayer Atari games from Terry and Black [2020], Butterfly environments which are original and of our own creation, and popular classic board and card game environments. All default environments included are surveyed in depth in Appendix B.
|
| 189 |
+
|
| 190 |
+
# 8 Adoption
|
| 191 |
+
|
| 192 |
+
In it’s relatively short lifespan, PettingZoo has already achieved a meaningful amount of adoption. It is supported by the following learning libraries: The Autonomous Learning Library [Nota, 2020], AI-Traineree [Laszuk, 2020], PyMARL (ongoing) [Samvelyan et al., 2019], RLlib [Liang et al., 2018], Stable Baselines 2 [Hill et al., 2018] and Stable Baselines 3 [Raffin et al., 2019], similar libraries such as CleanRL [Huang et al., 2020] (through SuperSuit [Terry et al., 2020b]), and Tianshou (ongoing) [Weng et al., 2020]. Perhaps more significantly than any of this, PettingZoo is already being used to teach in both graduate and undergraduate reinforcement learning classes all over the world.
|
| 193 |
+
|
| 194 |
+
# 9 Conclusion
|
| 195 |
+
|
| 196 |
+
This paper introduces PettingZoo, a Python library of many diverse multi-agent reinforcement learning environments under one simple API, akin to a multi-agent version of OpenAI’s Gym library, and introduces the agent environment cycle game model of multi-agent games.
|
| 197 |
+
|
| 198 |
+
Given the importance of multi-agent reinforcement learning, we believe that PettingZoo is capable of democratizing the field similar to what Gym previously did for single agent reinforcement learning, making it accessible to university scale research and to non-experts. As evidenced by it’s early adoption into numerous MARL libraries and courses, PettingZoo is moving in the direction of accomplishing this goal.
|
| 199 |
+
|
| 200 |
+
We’re aware of one notable limitation of the PettingZoo API. Games with significantly more than 10,000 agents (or potential agents) will have meaningful performance issues because you have to step each agent at once. Efficiently updating environments like this, and inferencing with the associated policies, requires true parallel support which almost certainly should be done in a language other than Python. Because of this, we view this as a practically acceptable limitation.
|
| 201 |
+
|
| 202 |
+
We see three directions for future work. The first is additions of more interesting environments under our API (possibly from the community, as has happened with Gym). The second direction we envision is a service to allow different researchers’ agents to play against each other in competitive games, leveraging the standardized API and environment set. Finally, we envision the development of procedurally generated multi-agent environments to test how well methods generalize, akin to the Gym procgen environments [Cobbe et al., 2019].
|
| 203 |
+
|
| 204 |
+
# Acknowledgements
|
| 205 |
+
|
| 206 |
+
Justin Terry was supported during part of this work by the QinetiQ Fundamental Machine Learning Fellowship. Thank you to Kyle Sang for their contributions to the documentation website. Thank you Rohan Potdar and Sang Hyun Son for their contributions to the Butterfly benchmarks. Thank you to Deepthi Raghunandan and Christian Clauss for their contributions to testing and continuous integration. Thank you to the PettingZoo community for the numerous bug reports and contributions to the package, especially Ross Allen and their group.
|
| 207 |
+
|
| 208 |
+
# References
|
| 209 |
+
|
| 210 |
+
Nolan Bard, Jakob N. Foerster, Sarath Chandar, Neil Burch, Marc Lanctot, H. Francis Song, Emilio Parisotto, Vincent Dumoulin, Subhodeep Moitra, Edward Hughes, Iain Dunning, Shibl Mourad, Hugo Larochelle, Marc G. Bellemare, and Michael Bowling. The hanabi challenge: A new frontier for AI research. CoRR, abs/1902.00506, 2019. URL http://arxiv.org/abs/1902.00506. Daniel S. Bernstein, Robert Givan, Neil Immerman, and Shlomo Zilberstein. The complexity of decentralized control of markov decision processes. Mathematics of Operations Research, 27(4): 819–840, 2002. doi: 10.1287/moor.27.4.819.297. URL https://doi.org/10.1287/moor.27. 4.819.297.
|
| 211 |
+
|
| 212 |
+
Craig Boutilier. Planning, learning and coordination in multiagent decision processes. In Proceedings of the 6th conference on Theoretical aspects of rationality and knowledge, pages 195–210. Morgan Kaufmann Publishers Inc., 1996.
|
| 213 |
+
|
| 214 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
|
| 215 |
+
|
| 216 |
+
Y. Chen, M. Zhou, Ying Wen, Y. Yang, Y. Su, W. Zhang, Dell Zhang, J. Wang, and Han Liu. Factorized q-learning for large-scale multi-agent systems. In DAI ’19, 2019.
|
| 217 |
+
|
| 218 |
+
Karl Cobbe, Christopher Hesse, Jacob Hilton, and John Schulman. Leveraging procedural generation to benchmark reinforcement learning. arXiv preprint arXiv:1912.01588, 2019.
|
| 219 |
+
|
| 220 |
+
GitHub. openai/gym dependents, 2021. URL https://web.archive.org/web/ 20210527224052/https://github.com/openai/gym/network/dependents? dependent_type $=$ PACKAGE.
|
| 221 |
+
|
| 222 |
+
Jayesh K Gupta, Maxim Egorov, and Mykel Kochenderfer. Cooperative multi-agent control using deep reinforcement learning. In International Conference on Autonomous Agents and Multiagent Systems, pages 66–83. Springer, 2017.
|
| 223 |
+
|
| 224 |
+
David Ha. Slime volleyball gym environment. https://github.com/hardmaru/ slimevolleygym, 2020.
|
| 225 |
+
|
| 226 |
+
Ashley Hill, Antonin Raffin, Maximilian Ernestus, Adam Gleave, Anssi Kanervisto, Rene Traore, Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, and Yuhuai Wu. Stable baselines. https://github.com/ hill-a/stable-baselines, 2018.
|
| 227 |
+
|
| 228 |
+
Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado Van Hasselt, and David Silver. Distributed prioritized experience replay. arXiv preprint arXiv:1803.00933, 2018.
|
| 229 |
+
|
| 230 |
+
Shengyi Huang, Rousslan Dossa, and Chang Ye. Cleanrl: High-quality single-file implementation of deep reinforcement learning algorithms. https://github.com/vwxyzjn/cleanrl/, 2020.
|
| 231 |
+
|
| 232 |
+
Edward Hughes, Joel Z Leibo, Matthew Phillips, Karl Tuyls, Edgar Dueñez-Guzman, Antonio García Castañeda, Iain Dunning, Tina Zhu, Kevin McKee, Raphael Koster, et al. Inequity aversion improves cooperation in intertemporal social dilemmas. In Advances in neural information processing systems, pages 3326–3336, 2018.
|
| 233 |
+
|
| 234 |
+
Marc Lanctot, Edward Lockhart, Jean-Baptiste Lespiau, Vinícius Flores Zambaldi, Satyaki Upadhyay, Julien Pérolat, Sriram Srinivasan, Finbarr Timbers, Karl Tuyls, Shayegan Omidshafiei, Daniel Hennes, Dustin Morrill, Paul Muller, Timo Ewalds, Ryan Faulkner, János Kramár, Bart De Vylder, Brennan Saeta, James Bradbury, David Ding, Sebastian Borgeaud, Matthew Lai, Julian Schrittwieser, Thomas W. Anthony, Edward Hughes, Ivo Danihelka, and Jonah Ryan-Davis. Openspiel: A framework for reinforcement learning in games. CoRR, abs/1908.09453, 2019. URL http://arxiv.org/abs/1908.09453.
|
| 235 |
+
|
| 236 |
+
Dawid Laszuk. Ai-traineree. https://github.com/laszukdawid/ai-traineree, 2020.
|
| 237 |
+
|
| 238 |
+
Joel Z Leibo, Vinicius Zambaldi, Marc Lanctot, Janusz Marecki, and Thore Graepel. Multi-agent reinforcement learning in sequential social dilemmas. arXiv preprint arXiv:1702.03037, 2017.
|
| 239 |
+
|
| 240 |
+
Eric Liang, Richard Liaw, Philipp Moritz, Robert Nishihara, Roy Fox, Ken Goldberg, Joseph E Gonzalez, Michael I Jordan, and Ion Stoica. Rllib: Abstractions for distributed reinforcement learning. arXiv preprint arXiv:1712.09381, 2017.
|
| 241 |
+
|
| 242 |
+
Eric Liang, Richard Liaw, Robert Nishihara, Philipp Moritz, Roy Fox, Ken Goldberg, Joseph E. Gonzalez, Michael I. Jordan, and Ion Stoica. RLlib: Abstractions for distributed reinforcement learning. In International Conference on Machine Learning (ICML), 2018.
|
| 243 |
+
|
| 244 |
+
Siqi Liu, Guy Lever, Josh Merel, Saran Tunyasuvunakool, Nicolas Heess, and Thore Graepel. Emergent coordination through competition. CoRR, abs/1902.07151, 2019. URL http://arxiv. org/abs/1902.07151.
|
| 245 |
+
|
| 246 |
+
Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actorcritic for mixed cooperative-competitive environments. Neural Information Processing Systems (NIPS), 2017.
|
| 247 |
+
|
| 248 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. nature, 518(7540):529–533, 2015.
|
| 249 |
+
|
| 250 |
+
Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1703.04908, 2017.
|
| 251 |
+
|
| 252 |
+
Chris Nota. The autonomous learning library. https://github.com/cpnota/ autonomous-learning-library, 2020.
|
| 253 |
+
|
| 254 |
+
OpenAI. Openai five. https://blog.openai.com/openai-five/, 2018.
|
| 255 |
+
|
| 256 |
+
Martin J Osborne and Ariel Rubinstein. A course in game theory. MIT press, 1994.
|
| 257 |
+
|
| 258 |
+
G. Palmer. Independent learning approaches: Overcoming multi-agent learning pathologies in team-games. 2020.
|
| 259 |
+
|
| 260 |
+
Stefanie Anna Baby Ling Li Ashwini Pokle. Analysis of emergent behavior in multi agent environments using deep reinforcement learning. 2018.
|
| 261 |
+
|
| 262 |
+
Antonin Raffin. Rl baselines3 zoo. https://github.com/DLR-RM/rl-baselines3-zoo, 2020.
|
| 263 |
+
|
| 264 |
+
Antonin Raffin, Ashley Hill, Maximilian Ernestus, Adam Gleave, Anssi Kanervisto, and Noah Dormann. Stable baselines3. https://github.com/DLR-RM/stable-baselines3, 2019.
|
| 265 |
+
|
| 266 |
+
Mikayel Samvelyan, Tabish Rashid, Christian Schröder de Witt, Gregory Farquhar, Nantas Nardelli, Tim G. J. Rudner, Chia-Man Hung, Philip H. S. Torr, Jakob N. Foerster, and Shimon Whiteson. The starcraft multi-agent challenge. CoRR, abs/1902.04043, 2019. URL http://arxiv.org/ abs/1902.04043.
|
| 267 |
+
|
| 268 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 269 |
+
|
| 270 |
+
L. S. Shapley. Stochastic games. Proceedings of the National Academy of Sciences, 39(10):1095– 1100, 1953. ISSN 0027-8424. doi: 10.1073/pnas.39.10.1095.
|
| 271 |
+
|
| 272 |
+
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
|
| 273 |
+
|
| 274 |
+
David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. nature, 550(7676):354–359, 2017.
|
| 275 |
+
|
| 276 |
+
Sriram Ganapathi Subramanian, P. Poupart, Matthew E. Taylor, and N. Hegde. Multi type mean field reinforcement learning. In AAMAS, 2020.
|
| 277 |
+
|
| 278 |
+
J K Terry, Nathaniel Grammel, Ananth Hari, Luis Santos, and Benjamin Black. Revisiting parameter sharing in multi-agent deep reinforcement learning. arXiv preprint arXiv:2005.13625, 2020a.
|
| 279 |
+
|
| 280 |
+
Justin K Terry and Benjamin Black. Multiplayer support for the arcade learning environment. arXiv preprint arXiv:2009.09341, 2020.
|
| 281 |
+
|
| 282 |
+
Justin K Terry, Benjamin Black, and Ananth Hari. Supersuit: Simple microwrappers for reinforcement learning environments. arXiv preprint arXiv:2008.08932, 2020b.
|
| 283 |
+
|
| 284 |
+
Justin K Terry, Benjamin Black, and Ananth Hari. Supersuit: Simple microwrappers for reinforcement learning environments. arXiv preprint arXiv:2008.08932, 2020c.
|
| 285 |
+
|
| 286 |
+
Justin K Terry, Nathaniel Grammel, Ananth Hari, Luis Santos, and Benjamin Black. Revisiting parameter sharing in multi-agent deep reinforcement learning. arXiv preprint arXiv:2005.13625, 2020d.
|
| 287 |
+
|
| 288 |
+
Gerald Tesauro. Temporal difference learning and td-gammon. Commun. ACM, 38(3):58–68, March 1995. ISSN 0001-0782. doi: 10.1145/203330.203343. URL https://doi.org/10.1145/ 203330.203343.
|
| 289 |
+
|
| 290 |
+
Rene Vidal, Omid Shakernia, H Jin Kim, David Hyunchul Shim, and Shankar Sastry. Probabilistic pursuit-evasion games: theory, implementation, and experimental evaluation. IEEE transactions on robotics and automation, 18(5):662–669, 2002.
|
| 291 |
+
|
| 292 |
+
Eugene Vinitsky, Natasha Jaques, Joel Leibo, Antonio Castenada, and Edward Hughes. An open source implementation of sequential social dilemma games. https://github.com/ eugenevinitsky/sequential_social_dilemma_games/, 2019. GitHub repository.
|
| 293 |
+
|
| 294 |
+
Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
|
| 295 |
+
|
| 296 |
+
Jiayi Weng, Minghao Zhang, Alexis Duburcq, Kaichao You, Dong Yan, Hang Su, and Jun Zhu. Tianshou. https://github.com/thu-ml/tianshou, 2020.
|
| 297 |
+
|
| 298 |
+
Daochen Zha, Kwei-Herng Lai, Yuanpu Cao, Songyi Huang, Ruzhe Wei, Junyu Guo, and Xia Hu. Rlcard: A toolkit for reinforcement learning in card games. arXiv preprint arXiv:1910.04376, 2019.
|
| 299 |
+
|
| 300 |
+
Lianmin Zheng, Jiacheng Yang, Han Cai, Weinan Zhang, Jun Wang, and Yong Yu. Magent: A many-agent reinforcement learning platform for artificial collective intelligence. arXiv preprint arXiv:1712.00600, 2017.
|
md/train/nzpLWnVAyah/nzpLWnVAyah.md
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ON THE STABILITY OF FINE-TUNING BERT: MISCONCEPTIONS, EXPLANATIONS, AND STRONG BASELINES
|
| 2 |
+
|
| 3 |
+
Marius Mosbach Spoken Language Systems (LSV) Saarland Informatics Campus, Saarland University mmosbach@lsv.uni-saarland.de
|
| 4 |
+
|
| 5 |
+
Maksym Andriushchenko Theory of Machine Learning Lab École polytechnique fédérale de Lausanne maksym.andriushchenko@epfl.ch
|
| 6 |
+
|
| 7 |
+
# Dietrich Klakow
|
| 8 |
+
|
| 9 |
+
Spoken Language Systems (LSV) Saarland Informatics Campus, Saarland University dietrich.klakow@lsv.uni-saarland.de
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
Fine-tuning pre-trained transformer-based language models such as BERT has become a common practice dominating leaderboards across various NLP benchmarks. Despite the strong empirical performance of fine-tuned models, fine-tuning is an unstable process: training the same model with multiple random seeds can result in a large variance of the task performance. Previous literature (Devlin et al., 2019; Lee et al., 2020; Dodge et al., 2020) identified two potential reasons for the observed instability: catastrophic forgetting and small size of the fine-tuning datasets. In this paper, we show that both hypotheses fail to explain the fine-tuning instability. We analyze BERT, RoBERTa, and ALBERT, fine-tuned on commonly used datasets from the GLUE benchmark, and show that the observed instability is caused by optimization difficulties that lead to vanishing gradients. Additionally, we show that the remaining variance of the downstream task performance can be attributed to differences in generalization where fine-tuned models with the same training loss exhibit noticeably different test performance. Based on our analysis, we present a simple but strong baseline that makes fine-tuning BERT-based models significantly more stable than the previously proposed approaches. Code to reproduce our results is available online: https://github.com/uds-lsv/bert-stable-fine-tuning.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Pre-trained transformer-based masked language models such as BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), and ALBERT (Lan et al., 2020) have had a dramatic impact on the NLP landscape in the recent year. The standard recipe for using such models typically involves training a pretrained model for a few epochs on a supervised downstream dataset, which is known as fine-tuning. While fine-tuning has led to impressive empirical results, dominating a large variety of English NLP benchmarks such as GLUE (Wang et al., 2019b) and SuperGLUE (Wang et al., 2019a), it is still poorly understood. Not only have fine-tuned models been shown to pick up spurious patterns and biases present in the training data (Niven and Kao, 2019; McCoy et al., 2019), but also to exhibit a large training instability: fine-tuning a model multiple times on the same dataset, varying only the random seed, leads to a large standard deviation of the fine-tuning accuracy (Devlin et al., 2019; Dodge et al., 2020).
|
| 18 |
+
|
| 19 |
+
Few methods have been proposed to solve the observed instability (Phang et al., 2018; Lee et al., 2020), however without providing a sufficient understanding of why fine-tuning is prone to such failure. The goal of this work is to address this shortcoming. More specifically, we investigate the following question:
|
| 20 |
+
|
| 21 |
+
Why is fine-tuning prone to failures and how can we improve its stability?
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Our proposed fine-tuning strategy leads to very stable results with very concentrated development set performance over 25 different random seeds across all three datasets on BERT. In particular, we significantly outperform the recently proposed approach of Lee et al. (2020) in terms of fine-tuning stability.
|
| 25 |
+
|
| 26 |
+
We start by investigating two common hypotheses for fine-tuning instability: catastrophic forgetting and small size of the fine-tuning datasets and demonstrate that both hypotheses fail to explain fine-tuning instability. We then investigate fine-tuning failures on datasets from the popular GLUE benchmark and show that the observed fine-tuning instability can be decomposed into two separate aspects: (1) optimization difficulties early in training, characterized by vanishing gradients, and (2) differences in generalization late in training, characterized by a large variance of development set accuracy for runs with almost equivalent training loss.
|
| 27 |
+
|
| 28 |
+
Based on our analysis, we present a simple but strong baseline for fine-tuning pre-trained language models that significantly improves the fine-tuning stability compared to previous works (Fig. 1). Moreover, we show that our findings apply not only to the widely used BERT model but also to more recent pre-trained models such as RoBERTa and ALBERT.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
The fine-tuning instability of BERT has been pointed out in various studies. Devlin et al. (2019) report instabilities when fine-tuning BERTLARGE on small datasets and resort to performing multiple restarts of fine-tuning and selecting the model that performs best on the development set. Recently, Dodge et al. (2020) performed a large-scale empirical investigation of the fine-tuning instability of BERT. They found dramatic variations in fine-tuning accuracy across multiple restarts and argue how it might be related to the choice of random seed and the dataset size.
|
| 33 |
+
|
| 34 |
+
Few approaches have been proposed to directly address the observed fine-tuning instability. Phang et al. (2018) study intermediate task training (STILTS) before fine-tuning with the goal of improving performance on the GLUE benchmark. They also find that their proposed method leads to improved fine-tuning stability. However, due to the intermediate task training, their work is not directly comparable to ours. Lee et al. (2020) propose a new regularization technique termed Mixout. The authors show that Mixout improves stability during fine-tuning which they attribute to the prevention of catastrophic forgetting.
|
| 35 |
+
|
| 36 |
+
Another line of work investigates optimization difficulties of pre-training transformer-based language models (Xiong et al., 2020; Liu et al., 2020). Similar to our work, they highlight the importance of the learning rate warmup for optimization. Both works focus on pre-training and we hence view them as orthogonal to our work.
|
| 37 |
+
|
| 38 |
+
# 3 BACKGROUND
|
| 39 |
+
|
| 40 |
+
# 3.1 DATASETS
|
| 41 |
+
|
| 42 |
+
We study four datasets from the GLUE benchmark (Wang et al., 2019b) following previous work studying instability during fine-tuning: CoLA, MRPC, RTE, and QNLI. Detailed statistics for each of the datasets can be found in Section 7.2 in the Appendix.
|
| 43 |
+
|
| 44 |
+
CoLA. The Corpus of Linguistic Acceptability (Warstadt et al., 2018) is a sentence-level classification task containing sentences labeled as either grammatical or ungrammatical. Fine-tuning on CoLA was observed to be particularly stable in previous work (Phang et al., 2018; Dodge et al., 2020; Lee et al., 2020). Performance on CoLA is reported in Matthew’s correlation coefficient (MCC).
|
| 45 |
+
|
| 46 |
+
MRPC. The Microsoft Research Paraphrase Corpus (Dolan and Brockett, 2005) is a sentence-pair classification task. Given two sentences, a model has to judge whether the sentences paraphrases of each other. Performance on MRPC is measured using the $F _ { 1 }$ score.
|
| 47 |
+
|
| 48 |
+
RTE. The Recognizing Textual Entailment dataset is a collection of sentence-pairs collected from a series of textual entailment challenges (Dagan et al., 2005; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009). RTE is the second smallest dataset in the GLUE benchmark and fine-tuning on RTE was observed to be particularly unstable (Phang et al., 2018; Dodge et al., 2020; Lee et al., 2020). Accuracy is used to measure performance on RTE.
|
| 49 |
+
|
| 50 |
+
QNLI. The Question-answering Natural Language Inference dataset contains sentence pairs obtained from SQuAD (Rajpurkar et al., 2016). Wang et al. (2019b) converted SQuAD into a sentence pair classification task by forming a pair between each question and each sentence in the corresponding paragraph. The task is to determine whether the context sentence contains the answer to the question, i.e. entails the answer. Accuracy is used to measure performance on QNLI.
|
| 51 |
+
|
| 52 |
+
# 3.2 FINE-TUNING
|
| 53 |
+
|
| 54 |
+
Unless mentioned otherwise, we follow the default fine-tuning strategy recommended by Devlin et al. (2019): we fine-tune uncased BERTLARGE (henceforth BERT) using a batch size of 16 and a learning rate of $2 \mathrm { e } { - } 5$ . The learning rate is linearly increased from 0 to $2 \mathrm { e } { - } 5$ for the first $1 0 \%$ of iterations—which is known as a warmup—and linearly decreased to 0 afterward. We apply dropout with probability $p = 0 . 1$ and weight decay with $\lambda = 0 . 0 1$ . We train for 3 epochs on all datasets and use global gradient clipping. Following Devlin et al. (2019), we use the AdamW optimizer (Loshchilov and Hutter, 2019) without bias correction.
|
| 55 |
+
|
| 56 |
+
We decided to not show results for BERTBASE since previous works observed no instability when fine-tuning BERTBASE which we also confirmed in our experiments. Instead, we show additional results on RoBERTaLARGE (Liu et al., 2019) and ALBERTLARGE-V2 (Lan et al., 2020) using the same fine-tuning strategy. We note that compared to BERT, both RoBERTa and ALBERT have slightly different hyperparameters. In particular, RoBERTa uses weight decay with $\lambda = 0 . 1$ and no gradient clipping, and ALBERT does not use dropout. A detailed list of all default hyperparameters for all models can be found in Section 7.3 of the Appendix. Our implementation is based on HuggingFace’s transformers library (Wolf et al., 2019) and is available online: https://github. com/uds-lsv/bert-stable-fine-tuning.
|
| 57 |
+
|
| 58 |
+
Fine-tuning stability. By fine-tuning stability we mean the standard deviation of the fine-tuning performance (measured, e.g., in terms of accuracy, MCC or $F _ { 1 }$ score) over the randomness of an algorithm. We follow previous works (Phang et al., 2018; Dodge et al., 2020; Lee et al., 2020) and measure fine-tuning stability using the development sets from the GLUE benchmark. We discuss alternative notions of stability in Section 7.1 in the Appendix.
|
| 59 |
+
|
| 60 |
+
Failed runs. Following Dodge et al. (2020), we refer to a fine-tuning run as a failed run if its accuracy at the end of training is less or equal to that of a majority classifier on the respective dataset. The majority baselines for all tasks are found in Section 7.2 in the Appendix.
|
| 61 |
+
|
| 62 |
+
# 4 INVESTIGATING PREVIOUS HYPOTHESES FOR FINE-TUNING INSTABILITY
|
| 63 |
+
|
| 64 |
+
Previous works on fine-tuning predominantly state two hypotheses for what can be related to finetuning instability: catastrophic forgetting and small training data size of the downstream tasks. Despite the ubiquity of these hypotheses (Devlin et al., 2019; Phang et al., 2018; Dodge et al., 2020; Lee et al., 2020), we argue that none of them has a causal relationship with fine-tuning instability.
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 2: Language modeling perplexity for three failed (a) and successful (b) fine-tuning runs of BERT on RTE where we replace the weights of the top- $k$ layers with their pre-trained values. We can observe that it is often sufficient to reset around 10 layers out of 24 to recover back the language modeling abilities of the pre-trained model. (c) shows the average training loss and development accuracy $_ { ( \pm 1 \mathrm { s t d } ) }$ for 10 failed fine-tuning runs on RTE. Failed fine-tuning runs lead to a trivial training loss suggesting an optimization problem.
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 3: Development set results on down-sampled MRPC, CoLA, and QNLI using the default fine-tuning scheme of BERT (Devlin et al., 2019). The leftmost boxplot in each sub-figure shows the development accuracy when training on the full training set.
|
| 71 |
+
|
| 72 |
+
# 4.1 DOES CATASTROPHIC FORGETTING CAUSE FINE-TUNING INSTABILITY?
|
| 73 |
+
|
| 74 |
+
Catastrophic forgetting (McCloskey and Cohen, 1989; Kirkpatrick et al., 2017) refers to the phenomenon when a neural network is sequentially trained to perform two different tasks, and it loses its ability to perform the first task after being trained on the second. More specifically, in our setup, it means that after fine-tuning a pre-trained model, it can no longer perform the original masked language modeling task used for pre-training. This can be measured in terms of the perplexity on the original training data. Although the language modeling performance of a pre-trained model correlates with its fine-tuning accuracy (Liu et al., 2019; Lan et al., 2020), there is no clear motivation for why preserving the original masked language modeling performance after fine-tuning is important.1
|
| 75 |
+
|
| 76 |
+
In the context of fine-tuning BERT, Lee et al. (2020) suggest that their regularization method has an effect of alleviating catastrophic forgetting. Thus, it is important to understand how exactly catastrophic forgetting occurs during fine-tuning and how it relates to the observed fine-tuning instability. To better understand this, we perform the following experiment: we fine-tune BERT on RTE, following the default strategy by Devlin et al. (2019). We select three successful and three failed fine-tuning runs and evaluate their masked language modeling perplexity on the test set of the WikiText-2 language modeling benchmark (Merity et al., 2016).2 We sequentially substitute the top- $k$ layers of the network varying $k$ from 0 (i.e. all layers are from the fine-tuned model) to 24 (i.e. all layers are from the pre-trained model). We show the results in Fig. 2 (a) and (b).
|
| 77 |
+
|
| 78 |
+
We can observe that although catastrophic forgetting occurs for the failed models (Fig. 2a) — perplexity on WikiText-2 is indeed degraded for $k = 0$ — the phenomenon is much more nuanced. Namely, catastrophic forgetting affects only the top layers of the network — in our experiments often around
|
| 79 |
+
|
| 80 |
+
10 out of 24 layers, and the same is however also true for the successfully fine-tuned models, except for a much smaller increase in perplexity.
|
| 81 |
+
|
| 82 |
+
Another important aspect of our experiment is that catastrophic forgetting typically requires that the model at least successfully learns how to perform the new task. However, this is not the case for the failed fine-tuning runs. Not only is the development accuracy equal to that of the majority classifier, but also the training loss on the fine-tuning task (here RTE) is trivial, i.e. close to $- \ln ( 1 / 2 )$ (see Fig. 2 (c)). This suggests that the observed fine-tuning failure is rather an optimization problem causing catastrophic forgetting in the top layers of the pre-trained model. We will show later that the optimization aspect is actually sufficient to explain most of the fine-tuning variance.
|
| 83 |
+
|
| 84 |
+
# 4.2 DO SMALL TRAINING DATASETS CAUSE FINE-TUNING INSTABILITY?
|
| 85 |
+
|
| 86 |
+
Having a small training dataset is by far the most commonly stated hypothesis for fine-tuning instability. Multiple recent works (Devlin et al., 2019; Phang et al., 2018; Lee et al., 2020; Zhu et al., 2020; Dodge et al., 2020; Pruksachatkun et al., 2020) that have observed BERT fine-tuning to be unstable relate this finding to the small number of training examples.
|
| 87 |
+
|
| 88 |
+
To test if having a small training dataset inherently leads to fine-tuning instability we perform the following experiment:3 we randomly sample 1,000 training samples from the CoLA, MRPC, and QNLI training datasets and fine-tune BERT using 25 different random seeds on each dataset. We compare two different settings: first, training for 3 epochs on the reduced training dataset, and second, training for the same number of iterations as on the full training dataset. We show the results in Fig. 3 and observe that training on less data does indeed affect the fine-tuning variance, in particular, there are many more failed runs. However, when we simply train for as many iterations as on the full training dataset, we almost completely recover the original variance of the fine-tuning performance. We also observe no failed runs on MRPC and QNLI and only a single failed run on CoLA which is similar to the results obtained by training on the full training set. Further, as expected, we observe that training on fewer samples affects the generalization of the model, leading to a worse development set performance on all three tasks.4
|
| 89 |
+
|
| 90 |
+
We conclude from this experiment, that the role of training dataset size per se is orthogonal to fine-tuning stability. What is crucial is rather the number of training iterations. As our experiment shows, the observed increase in instability when training with smaller datasets can rather be attributed to the reduction of the number of iterations (that changes the effective learning rate schedule) which, as we will show in the next section, has a crucial influence on the fine-tuning stability.
|
| 91 |
+
|
| 92 |
+
# 5 DISENTANGLING OPTIMIZATION AND GENERALIZATION IN FINE-TUNING INSTABILITY
|
| 93 |
+
|
| 94 |
+
Our findings in Section 4 detail that while both catastrophic forgetting and small size of the datasets indeed correlate with fine-tuning instability, none of them are causing it. In this section, we argue that the fine-tuning instability is an optimization problem, and it admits a simple solution. Additionally, we show that even though a large fraction of the fine-tuning instability can be explained by optimization, the remaining instability can be attributed to generalization issues where fine-tuning runs with the same training loss exhibit noticeable differences in the development set performance.
|
| 95 |
+
|
| 96 |
+
# 5.1 THE ROLE OF OPTIMIZATION
|
| 97 |
+
|
| 98 |
+
Failed fine-tuning runs suffer from vanishing gradients. We observed in Fig. 2c that the failed runs have practically constant training loss throughout the training (see Fig. 14 in the Appendix for a comparison with successful fine-tuning). In order to better understand this phenomenon, in Fig. 4 we plot the $\ell _ { 2 }$ gradient norms of the loss function with respect to different layers of BERT, for one failed and successful fine-tuning run. For the failed run we see large enough gradients only for the top layers and vanishing gradients for the bottom layers. This is in large contrast to the successful run. While we also observe small gradients at the beginning of training (until iteration 70), gradients start to grow as training continues. Moreover, at the end of fine-tuning, we observe gradient norms nearly $2 \times$ orders of magnitude larger than that of the failed run. Similar visualizations for additional layers and weights can be found in Fig. 10 in the Appendix. Moreover, we observe the same behavior also for RoBERTa and ALBERT models, and the corresponding figures can be found in the Appendix as well (Fig. 11 and 12).
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 4: Gradient norms (plotted on a logarithmic scale) of different layers on RTE for a failed and successful run of BERT fine-tuning. We observe that the failed run is characterized by vanishing gradients in the bottom layers of the network. Additional plots for other weight matrices can be found in the Appendix.
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 5: Box plots showing the fine-tuning performance of (a) BERT, (b) RoBERTa, (c) ALBERT for different learning rates $\alpha$ with and without bias correction (BC) on RTE. For BERT and ALBERT, having bias correction leads to more stable results and allows to train using larger learning rates. For RoBERTa, the effect is less pronounced but still visible.
|
| 105 |
+
|
| 106 |
+
Importantly, we note that the vanishing gradients we observe during fine-tuning are harder to resolve than the standard vanishing gradient problem (Hochreiter, 1991; Bengio et al., 1994). In particular, common weight initialization schemes (Glorot and Bengio, 2010; He et al., 2015) ensure that the pre-activations of each layer of the network have zero mean and unit variance in expectation. However, we cannot simply modify the weights of a pre-trained model on each layer to ensure this property since this would conflict with the idea of using the pre-trained weights.
|
| 107 |
+
|
| 108 |
+
Importance of bias correction in ADAM. Following Devlin et al. (2019), subsequent works on fine-tuning BERT-based models use the ADAM optimizer (Kingma and Ba, 2015). A subtle detail of the fine-tuning scheme of Devlin et al. (2019) is that it does not include the bias correction in ADAM. Kingma and Ba (2015) already describe the effect of the bias correction as to reduce the learning rate at the beginning of training. By rewriting the update equations of ADAM as follows, we can clearly see this effect of bias correction:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\begin{array} { l } { { \alpha _ { t } \alpha \cdot \sqrt { 1 - \beta _ { 2 } ^ { t } } / ( 1 - \beta _ { 1 } ^ { t } ) , } } \\ { { \theta _ { t } \theta _ { t - 1 } - \alpha _ { t } \cdot m _ { t } / ( \sqrt { v _ { t } } + \epsilon ) , } } \end{array}
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 7: 2D loss surfaces in the subspace spanned by $\delta _ { 1 } = \theta _ { f } - \theta _ { p }$ and $\delta _ { 2 } = \theta _ { s } - \theta _ { p }$ on RTE, MRPC, and CoLA. $\theta _ { p } , \theta _ { f }$ , $\theta _ { s }$ denote the parameters of the pre-trained, failed, and successfully trained model, respectively.
|
| 116 |
+
|
| 117 |
+
Here $m _ { t }$ and $v _ { t }$ are biased first and second moment estimates respectively. Equation (1) shows that bias correction simply boils down to reducing the original step size $\alpha$ by a multiplicative factor $\sqrt { 1 - \beta _ { 2 } ^ { t } } / ( 1 - \beta _ { 1 } ^ { t } )$ which is significantly below 1 for the first iterations of training and approaches 1 as the number of training iterations $t$ increases (see Fig. 6). Along the same lines, You et al. (2020) explicitly remark that bias correction in ADAM has a similar effect to the warmup which is widely used in deep learning to prevent divergence early in training (He et al., 2016; Goyal et al., 2017; Devlin et al., 2019; Wong et al., 2020).
|
| 118 |
+
|
| 119 |
+

|
| 120 |
+
Figure 6: The bias correction term of ADAM ( $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ ).
|
| 121 |
+
|
| 122 |
+
The implicit warmup of ADAM is likely to be an important factor that contributed to its success. We argue that fine-tuning BERT-based language models is not an exception. In Fig. 5 we show the results of fine-tuning on RTE with and without bias correction for BERT, RoBERTa, and ALBERT models.5 We observe that there is a significant benefit in combining warmup with bias correction, particularly for BERT and ALBERT. Even though for RoBERTa fine-tuning is already more stable even without bias correction, adding bias correction gives an additional improvement.
|
| 123 |
+
|
| 124 |
+
Our results show that bias correction is useful if we want to get the best performance within 3 epochs, the default recommendation by Devlin et al. (2019). An alternative solution is to simply train longer with a smaller learning rate, which also leads to much more stable fine-tuning. We provide a more detailed ablation study in Appendix (Fig. 9) with analogous box plots for BERT using various learning rates, numbers of training epochs, with and without bias correction. Finally, concurrently to our work, Zhang et al. (2021) also make a similar observation about the importance of bias correction and longer training which gives further evidence to our findings.
|
| 125 |
+
|
| 126 |
+
Loss surfaces. To get further intuition about the fine-tuning failure, we provide loss surface visualizations (Li et al., 2018; Hao et al., 2019) of failed and successful runs when fine-tuning BERT. Denote by $\theta _ { p }$ , $\theta _ { f }$ , $\theta _ { s }$ the parameters of the pre-trained model, failed model, and successfully trained model, respectively. We plot a two-dimensional loss surface $f ( \alpha , \beta ) = \mathcal { L } ( \theta _ { p } + \alpha \delta _ { 1 } + \beta \delta _ { 2 } )$ in the subspace spanned by $\delta _ { 1 } = \theta _ { f } - \theta _ { p }$ and $\delta _ { 2 } = \theta _ { s } - \theta _ { p }$ centered at the weights of the pre-trained model $\theta _ { p }$ . Additional details are specified in Section 7.6 in the Appendix.
|
| 127 |
+
|
| 128 |
+
Contour plots of the loss surfaces for RTE, MRPC, and CoLA are shown in Fig. 7. They provide additional evidence to our findings on vanishing gradients: for failed fine-tuning runs gradient descent converges to a “bad” valley with a sub-optimal training loss. Moreover, this bad valley is separated from the local minimum (to which the successfully trained run converged) by a barrier (see also Fig. 13 in the Appendix). Interestingly, we observe a highly similar geometry for all three datasets providing further support for our interpretation of fine-tuning instability as a primarily optimization issue.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 8: Development set accuracy for multiple fine-tuning runs on RTE. The models for (a) are trained with 10 different seeds, and models for (b) are taken at the end of the training, and trained with different seeds and hyperparameters.
|
| 132 |
+
|
| 133 |
+
# 5.2 THE ROLE OF GENERALIZATION
|
| 134 |
+
|
| 135 |
+
We now turn to the generalization aspects of fine-tuning instability. In order to show that the remaining fine-tuning variance on the development set can be attributed to generalization, we perform the following experiment: we fine-tune BERT on RTE for 20 epochs and show the development set accuracy for 10 successful runs in Fig. 8a. Further, we show in Fig. 8b the development set accuracy vs. training loss of all BERT models fine-tuned on RTE for the full ablation study (shown in Fig. 9 in the Appendix), in total 450 models.
|
| 136 |
+
|
| 137 |
+
We find that despite achieving close to zero training loss overfitting is not an issue during fine-tuning. This is consistent with previous work (Hao et al., 2019), which arrived at a similar conclusion. Based on our results, we argue that it is even desirable to train for a larger number of iterations since the development accuracy varies considerably during fine-tuning and it does not degrade even when the training loss is as low as 10−5.
|
| 138 |
+
|
| 139 |
+
Combining these findings with results from the previous section, we conclude that the fine-tuning instability can be decomposed into two aspects: optimization and generalization. In the next section, we propose a simple solution addressing both issues.
|
| 140 |
+
|
| 141 |
+
# 6 A SIMPLE BUT HARD-TO-BEAT BASELINE FOR FINE-TUNING BERT
|
| 142 |
+
|
| 143 |
+
As our findings in Section 5 show, the empirically observed instability of fine-tuning BERT can be attributed to vanishing gradients early in training as well as differences in generalization late in training. Given the new understanding of fine-tuning instability, we propose the following guidelines for fine-tuning transformer-based masked language models on small datasets:
|
| 144 |
+
|
| 145 |
+
• Use small learning rates with bias correction to avoid vanishing gradients early in training.
|
| 146 |
+
• Increase the number of iterations considerably and train to (almost) zero training loss.
|
| 147 |
+
|
| 148 |
+
This leads to the following simple baseline scheme: we fine-tune BERT using ADAM with bias correction and a learning rate of 2e−5. The training is performed for 20 epochs, and the learning rate is linearly increased for the first $1 0 \%$ of steps and linearly decayed to zero afterward. All other hyperparameters are kept unchanged. A full ablation study on RTE testing various combinations of the changed hyperparameters is presented in Section 7.4 in the Appendix.
|
| 149 |
+
|
| 150 |
+
Results. Despite the simplicity of our proposed fine-tuning strategy, we obtain strong empirical performance. Table 1 and Fig. 1 show the results of fine-tuning BERT on RTE, MRPC, and CoLA. We compare to the default strategy of Devlin et al. (2019) and the recent Mixout method from Lee et al. (2020). First, we observe that our method leads to a much more stable fine-tuning performance on all three datasets as evidenced by the significantly smaller standard deviation of the final performance. To further validate our claim about the fine-tuning stability, we run Levene’s test (Levene, 1960) to check the equality of variances for the distributions of the final performances on each dataset. For all three datasets, the test results in a p-value less than 0.001 when we compare the variances between our method and the method achieving the second smallest variance. Second, we also observe that our method improves the overall fine-tuning performance: in Table 1 we achieve a higher mean value on all datasets and also comparable or better maximum performance on MRPC and CoLA respectively.
|
| 151 |
+
|
| 152 |
+
Table 1: Standard deviation, mean, and maximum performance on the development set of RTE, MRPC, and CoLA when fine-tuning BERT over 25 random seeds. Standard deviation: lower is better, i.e. fine-tuning is more stable. ? denotes significant difference $\mathit { p } < 0 . 0 0 1 $ ) when compared to the second smallest standard deviation.
|
| 153 |
+
|
| 154 |
+
<table><tr><td>Approach</td><td colspan="3">RTE</td><td colspan="3">MRPC</td><td colspan="3">CoLA</td></tr><tr><td></td><td>std</td><td>mean</td><td>max</td><td>std</td><td>mean</td><td>max</td><td>std</td><td>mean</td><td>max</td></tr><tr><td>Devlin et al. (2019)</td><td>4.5</td><td>50.9</td><td>67.5</td><td>3.9</td><td>84.0</td><td>91.2</td><td>25.6</td><td>45.6</td><td>64.6</td></tr><tr><td>Lee et al. (2020)</td><td>7.9</td><td>65.3</td><td>74.4</td><td>3.8</td><td>87.8</td><td>91.8</td><td>20.9</td><td>51.9</td><td>64.0</td></tr><tr><td>Ours</td><td>2.7*</td><td>67.3</td><td>71.1</td><td>0.8*</td><td>90.3</td><td>91.7</td><td>1.8*</td><td>62.1</td><td>65.3</td></tr></table>
|
| 155 |
+
|
| 156 |
+
Finally, we note that we suggest to increase the number of fine-tuning iterations only for small datasets, and thus the increased computational cost of our proposed scheme is not a problem in practice. Moreover, we think that overall our findings lead to more efficient fine-tuning because of the significantly improved stability which effectively reduces the number of necessary fine-tuning runs.
|
| 157 |
+
|
| 158 |
+
# 7 CONCLUSIONS
|
| 159 |
+
|
| 160 |
+
In this work, we have discussed the existing hypotheses regarding the reasons behind fine-tuning instability and proposed a new baseline strategy for fine-tuning that leads to significantly improved fine-tuning stability and overall improved results on commonly used datasets from the GLUE benchmark.
|
| 161 |
+
|
| 162 |
+
By analyzing failed fine-tuning runs, we find that neither catastrophic forgetting nor small dataset sizes sufficiently explain fine-tuning instability. Instead, our analysis reveals that fine-tuning instability can be characterized by two distinct problems: (1) optimization difficulties early in training, characterized by vanishing gradients, and (2) differences in generalization, characterized by a large variance of development set accuracy for runs with almost equivalent training performance.
|
| 163 |
+
|
| 164 |
+
Based on our analysis, we propose a simple but strong baseline strategy for fine-tuning BERT which outperforms the previous works in terms of fine-tuning stability and overall performance.
|
| 165 |
+
|
| 166 |
+
# ACKNOWLEDGMENTS
|
| 167 |
+
|
| 168 |
+
We thank Anna Khokhlova for her help with the language modeling experiments, Cheolhyoung Lee and Jesse Dodge for providing us with details of their works, and Badr Abdullah and Aditya Mogadala for their helpful comments on a draft of this paper.
|
| 169 |
+
|
| 170 |
+
This work was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 232722074 – SFB 1102.
|
| 171 |
+
|
| 172 |
+
# REFERENCES
|
| 173 |
+
|
| 174 |
+
Roy Bar-Haim, Ido Dagan, Bill Dolan, Lisa Ferro, and Danilo Giampiccolo. 2006. The second pascal recognising textual entailment challenge. Proceedings of the Second PASCAL Challenges Workshop on Recognising Textual Entailment.
|
| 175 |
+
|
| 176 |
+
Yoshua Bengio, Patrice Simard, and Paolo Frasconi. 1994. Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 5(2):157–166.
|
| 177 |
+
|
| 178 |
+
Luisa Bentivogli, Ido Dagan, Hoa Trang Dang, Danilo Giampiccolo, and Bernardo Magnini. 2009. The fifth pascal recognizing textual entailment challenge. In Proceedings of the Second Text Analysis Conference (TAC 2009).
|
| 179 |
+
|
| 180 |
+
Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The pascal recognising textual entailment challenge. In Proceedings of the First International Conference on Machine Learning Challenges: Evaluating Predictive Uncertainty Visual Object Classification, and Recognizing Textual Entailment, MLCW’05, page 177–190, Berlin, Heidelberg. Springer-Verlag.
|
| 181 |
+
|
| 182 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.
|
| 183 |
+
|
| 184 |
+
Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. 2020. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305.
|
| 185 |
+
|
| 186 |
+
William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005).
|
| 187 |
+
|
| 188 |
+
Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. 2007. The third pascal recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, RTE ’07, page 1–9, USA. Association for Computational Linguistics.
|
| 189 |
+
|
| 190 |
+
Xavier Glorot and Yoshua Bengio. 2010. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 249–256.
|
| 191 |
+
|
| 192 |
+
Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. 2017. Accurate, large minibatch sgd: Training imagenet in 1 hour.
|
| 193 |
+
|
| 194 |
+
Yaru Hao, Li Dong, Furu Wei, and Ke Xu. 2019. Visualizing and understanding the effectiveness of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pages 4143–4152, Hong Kong, China. Association for Computational Linguistics.
|
| 195 |
+
|
| 196 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2015. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034.
|
| 197 |
+
|
| 198 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778.
|
| 199 |
+
|
| 200 |
+
Sepp Hochreiter. 1991. Untersuchungen zu dynamischen neuronalen netzen. Diploma, Technische Universität München, 91(1).
|
| 201 |
+
|
| 202 |
+
Tushar Khot, Ashish Sabharwal, and Peter Clark. 2018. Scitail: A textual entailment dataset from science question answering.
|
| 203 |
+
|
| 204 |
+
Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In International Conference on Learning Representations.
|
| 205 |
+
|
| 206 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, and et al. 2017. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114(13):3521–3526.
|
| 207 |
+
|
| 208 |
+
Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. Albert: A lite bert for self-supervised learning of language representations. In International Conference on Learning Representations.
|
| 209 |
+
|
| 210 |
+
Cheolhyoung Lee, Kyunghyun Cho, and Wanmo Kang. 2020. Mixout: Effective regularization to finetune large-scale pretrained language models. In International Conference on Learning Representations.
|
| 211 |
+
|
| 212 |
+
Howard Levene. 1960. Robust tests for equality of variances. Contributions to probability and statistics: Essays in honor of Harold Hotelling, pages 278–292.
|
| 213 |
+
|
| 214 |
+
Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. 2018. Visualizing the loss landscape of neural nets. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems 31, pages 6389–6399. Curran Associates, Inc.
|
| 215 |
+
|
| 216 |
+
Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. 2020. On the variance of the adaptive learning rate and beyond. In International Conference on Learning Representations.
|
| 217 |
+
|
| 218 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692.
|
| 219 |
+
|
| 220 |
+
Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In International Conference on Learning Representations.
|
| 221 |
+
|
| 222 |
+
Michael McCloskey and Neal J Cohen. 1989. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pages 109–165. Elsevier.
|
| 223 |
+
|
| 224 |
+
R. Thomas McCoy, Junghyun Min, and Tal Linzen. 2020. BERTs of a feather do not generalize together: Large variability in generalization across models with similar test set performance. In Proceedings of the Third BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, pages 217–227, Online. Association for Computational Linguistics.
|
| 225 |
+
|
| 226 |
+
Tom McCoy, Ellie Pavlick, and Tal Linzen. 2019. Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3428–3448, Florence, Italy. Association for Computational Linguistics.
|
| 227 |
+
|
| 228 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2016. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843.
|
| 229 |
+
|
| 230 |
+
Timothy Niven and Hung-Yu Kao. 2019. Probing neural network comprehension of natural language arguments. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4658–4664, Florence, Italy. Association for Computational Linguistics.
|
| 231 |
+
|
| 232 |
+
Jason Phang, Thibault Févry, and Samuel R Bowman. 2018. Sentence encoders on stilts: Supplementary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088.
|
| 233 |
+
|
| 234 |
+
Yada Pruksachatkun, Jason Phang, Haokun Liu, Phu Mon Htut, Xiaoyi Zhang, Richard Yuanzhe Pang, Clara Vania, Katharina Kann, and Samuel R. Bowman. 2020. Intermediate-task transfer learning with pretrained language models: When and why does it work? In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5231–5247, Online. Association for Computational Linguistics.
|
| 235 |
+
|
| 236 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383–2392, Austin, Texas. Association for Computational Linguistics.
|
| 237 |
+
|
| 238 |
+
Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. 2019a. Superglue: A stickier benchmark for general-purpose language understanding systems. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 3266–3280. Curran Associates, Inc.
|
| 239 |
+
|
| 240 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019b. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations.
|
| 241 |
+
|
| 242 |
+
Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. 2018. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471.
|
| 243 |
+
|
| 244 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. 2019. Transformers: State-of-theart natural language processing. arXiv preprint arXiv:1910.03771.
|
| 245 |
+
|
| 246 |
+
Eric Wong, Leslie Rice, and J. Zico Kolter. 2020. Fast is better than free: Revisiting adversarial training. In International Conference on Learning Representations.
|
| 247 |
+
|
| 248 |
+
Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tie-Yan Liu. 2020. On layer normalization in the transformer architecture. arXiv preprint arXiv:2002.04745.
|
| 249 |
+
|
| 250 |
+
Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. 2020. Large batch optimization for deep learning: Training bert in 76 minutes. In International Conference on Learning Representations.
|
| 251 |
+
|
| 252 |
+
Tianyi Zhang, Felix Wu, Arzoo Katiyar, Kilian Q Weinberger, and Yoav Artzi. 2021. Revisiting few-sample BERT fine-tuning. In International Conference on Learning Representations.
|
| 253 |
+
|
| 254 |
+
Chen Zhu, Yu Cheng, Zhe Gan, Siqi Sun, Tom Goldstein, and Jingjing Liu. 2020. Freelb: Enhanced adversarial training for natural language understanding. In International Conference on Learning Representations.
|
| 255 |
+
|
| 256 |
+
# APPENDIX
|
| 257 |
+
|
| 258 |
+
# 7.1 ALTERNATIVE NOTIONS OF STABILITY
|
| 259 |
+
|
| 260 |
+
Here, we elaborate on other possible definitions of fine-tuning stability. The definition that we use throughout the paper follows the previous work (Phang et al., 2018; Dodge et al., 2020; Lee et al., 2020). For example, while Dodge et al. (2020) do not directly define fine-tuning stability, they report and analyze the standard deviation of the validation performance (e.g., see Section 4.1 of their paper). Along the same lines, an earlier work of Phang et al. (2018), which studies the influence of intermediate fine-tuning, discusses the variance of the validation performance (see Section 4: Results, paragraph Fine-Tuning Stability therein) and shows the standard deviation over multiple random seeds in Figure 1.
|
| 261 |
+
|
| 262 |
+
For simplicity, let us assume that the performance metric is accuracy and we have two classes. Let $A$ be a randomized fine-tuning algorithm that produces a classifier $f _ { A }$ , and let us denote data points as $( x , y ) \sim \mathcal { D }$ where $\mathcal { D }$ is the data-generating distribution. Our definition of fine-tuning stability can be formalized as follows:
|
| 263 |
+
|
| 264 |
+
$$
|
| 265 |
+
S _ { \mathrm { o u r s } } ( A ) = \mathrm { V a r } _ { A } \left[ \mathrm { E } _ { x , y } \left[ \mathbb { 1 } _ { f _ { A } ( x ) = y } \right] \right] = \mathrm { V a r } _ { A } \left[ \mathrm { A c c u r a c y } ( f _ { A } ) \right] .
|
| 266 |
+
$$
|
| 267 |
+
|
| 268 |
+
This definition directly measures the variance of the performance metric and aims to answer the question: If we perform fine-tuning multiple times, how large will the difference in performance be?
|
| 269 |
+
|
| 270 |
+
An alternative definition of fine-tuning stability that could be considered is per-point stability where the expectation and variance are interchanged:
|
| 271 |
+
|
| 272 |
+
$$
|
| 273 |
+
S _ { \mathrm { p e r - p o i n t } } ( A ) = \mathrm { E } _ { x , y } \left[ \mathrm { V a r } _ { A } \left[ \mathbb { 1 } _ { f _ { A } ( x ) = y } \right] \right] .
|
| 274 |
+
$$
|
| 275 |
+
|
| 276 |
+
This definition captures a different notion of stability. Namely, it captures stability per data point by measuring how much the classifiers $f _ { A }$ differ on the same point $x$ given label $y$ . Studying the per-point fine-tuning stability can be useful to better understand the properties of fine-tuned models and we refer to McCoy et al. (2020) for a study in this direction.
|
| 277 |
+
|
| 278 |
+
# 7.2 TASK STATISTICS
|
| 279 |
+
|
| 280 |
+
Statistics for each of the datasets studied in this paper are shown in Table 2. All datasets are publicly available. The GLUE datasets can be downloaded here: https://github.com/nyu-mll/ jiant. SciTail is available at https://github.com/allenai/scitail.
|
| 281 |
+
|
| 282 |
+
Table 2: Dataset statistics and majority baselines.
|
| 283 |
+
|
| 284 |
+
<table><tr><td></td><td>RTE</td><td>MRPC</td><td>CoLA</td><td>QNLI</td><td>SciTail</td></tr><tr><td>Training</td><td>2491</td><td>3669</td><td>8551</td><td>104744</td><td>23596</td></tr><tr><td>Development</td><td>278</td><td>409</td><td>1043</td><td>5464</td><td>1304</td></tr><tr><td>Majority baseline</td><td>0.53</td><td>0.75</td><td>0.0</td><td>0.50</td><td>0.63</td></tr><tr><td>Metric</td><td>Acc.</td><td>F1 score</td><td>MCC</td><td>Acc.</td><td>Acc.</td></tr></table>
|
| 285 |
+
|
| 286 |
+
# 7.3 HYPERPARAMETERS
|
| 287 |
+
|
| 288 |
+
Hyperparameters for BERT, RoBERTa, and ALBERT used for all our experiments are shown in Table 3.
|
| 289 |
+
|
| 290 |
+
# 7.4 ABLATION STUDIES
|
| 291 |
+
|
| 292 |
+
Figure 9 shows the results of fine-tuning on RTE with different combinations of learning rate, number of training epochs, and bias correction. We make the following observations:
|
| 293 |
+
|
| 294 |
+
• When training for only 3 epochs, disabling bias correction clearly hurts performance. • With bias correction, training with larger learning rates is possible. • Combining the usage of bias correction with training for more epochs leads to the best performance.
|
| 295 |
+
|
| 296 |
+

|
| 297 |
+
Figure 9: Full ablation of fine-tuning BERT on RTE. For each setting, we vary only the number of training steps, learning rate, and usage of bias correction (BC). All other hyperparameters are unchanged. We fine-tune 25 models for each setting. $\star$ shows the setting which we recommend as a new baseline fine-tuning strategy.
|
| 298 |
+
|
| 299 |
+
Table 3: Hyperparameters used for fine-tuning.
|
| 300 |
+
|
| 301 |
+
<table><tr><td>Hyperparam</td><td>BERT</td><td>RoBERTa</td><td>ALBERT</td></tr><tr><td>Epochs</td><td>3,10,20</td><td>3</td><td>3</td></tr><tr><td>Learning rate</td><td>le-5-5e-5</td><td>le-5-3e-5</td><td>le-5-3e-5</td></tr><tr><td>Learning rate schedule</td><td>warmup-linear</td><td>warmup-linear</td><td>warmup-linear</td></tr><tr><td>Warmup ratio</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Batch size</td><td>16</td><td>16</td><td>16</td></tr><tr><td>Adam e</td><td>1e-6</td><td>1e-6</td><td>1e-6</td></tr><tr><td>Adam β1</td><td>0.9</td><td>0.9</td><td>0.9</td></tr><tr><td>Adam β2</td><td>0.999</td><td>0.98</td><td>0.999</td></tr><tr><td>Adam bias correction</td><td>{True,False}</td><td>{True, False}</td><td>{True,False}</td></tr><tr><td>Dropout</td><td>0.1</td><td>0.1</td><td>1</td></tr><tr><td>Weight decay</td><td>0.01</td><td>0.1</td><td>1</td></tr><tr><td>Clipping gradient norm</td><td>1.0</td><td>1</td><td>1.0</td></tr><tr><td>Number of random seeds</td><td>25</td><td>25</td><td>25</td></tr></table>
|
| 302 |
+
|
| 303 |
+
# 7.5 ADDITIONAL GRADIENT NORM VISUALIZATIONS
|
| 304 |
+
|
| 305 |
+
We provide additional visualizations for the vanishing gradients observed when fine-tuning BERT, RoBERTa, and ALBERT in Figures 10, 11, 12. Note that for ALBERT besides the pooler and classification layers, we plot only the gradient norms of a single hidden layer (referred to as layer0) because of weight sharing.
|
| 306 |
+
|
| 307 |
+
Gradient norms and MLM perplexity. We can see from the gradient norm visualizations for BERT in Figures 4 and 10 that the gradient norm of the pooler and classification layer remains large. Hence, even though the gradients on most layers of the model vanish, we still update the weights on the top layers. In fact, this explains the large increase in MLM perplexity for the failed models which is shown in Fig. 2a. While most of the layers do not change as we continue training, the top layers of the network change dramatically.
|
| 308 |
+
|
| 309 |
+
# 7.6 LOSS SURFACES
|
| 310 |
+
|
| 311 |
+
For Fig. 7, we define the range for both $\alpha$ and $\beta$ as $[ - 1 . 5 , 1 . 5 ]$ and sample 40 points for each axis. We evaluate the loss on 128 samples from the training dataset of each task using all model parameters, including the classification layer. We disabled dropout for generating the surface plots.
|
| 312 |
+
|
| 313 |
+
Fig. 13 shows contour plots of the total gradient norm. We can again see that the point to which the failed model converges to $( \theta _ { f } )$ is separated from the point the successful model converges to $( \theta _ { s } )$ by a barrier. Moreover, on all the three datasets we can clearly see the valley around $\theta _ { f }$ with a small gradient norm.
|
| 314 |
+
|
| 315 |
+
# 7.7 TRAINING CURVES
|
| 316 |
+
|
| 317 |
+
Fig. 14 shows training curves for 10 successful and 10 failed fine-tuning runs on RTE. We can clearly observe that all 10 failed runs have a common pattern: throughout the training, their training loss stays close to that at initialization. This implies an optimization problem and suggests to reconsider the optimization scheme.
|
| 318 |
+
|
| 319 |
+
# 7.8 ADDITIONAL FINE-TUNING RESULTS
|
| 320 |
+
|
| 321 |
+
We report additional fine-tuning results on the SciTail dataset (Khot et al., 2018) in Table 4 to demonstrate that our findings generalize to datasets from other domains.
|
| 322 |
+
|
| 323 |
+
Due to its comparatively large size (28k training samples) fine-tuning on SciTail with the Devlin et al. (2019) scheme is already very stable even when trained for 3 epochs. This is comparable to what we find for QNLI in Section 4.1. When applying our fine-tuning scheme to SciTail, the results are very close to that of Devlin et al. (2019). On the other hand, when training on a smaller subset of SciTail (1k training samples) we can clearly see the same results as also observed in Fig. 3 for MRPC, CoLA, and QNLI, i.e. using more training iterations improves the fine-tuning stability.
|
| 324 |
+
|
| 325 |
+

|
| 326 |
+
Figure 10: Gradient norms (plotted on a logarithmic scale) of additional weight matrices of BERT fine-tuned on RTE. Corresponding layer names are in the captions. We show gradient norms corresponding to a single failed and single successful, respectively.
|
| 327 |
+
|
| 328 |
+

|
| 329 |
+
Figure 11: Gradient norms (plotted on a logarithmic scale) of additional weight matrices of RoBERTa fine-tuned on RTE. Corresponding layer names are in the captions. We show gradient norms corresponding to a single failed and single successful, respectively.
|
| 330 |
+
|
| 331 |
+

|
| 332 |
+
Figure 12: Gradient norms (plotted on a logarithmic scale) of additional weight matrices of ALBERT fine-tuned on RTE. Corresponding layer names are in the captions. We show gradient norms corresponding to a single failed and single successful, respectively.
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 13: 2D gradient norm surfaces in the subspace spanned by $\delta _ { 1 } = \theta _ { f } - \theta _ { p }$ and $\delta _ { 2 } = \theta _ { s } - \theta _ { p }$ for BERT fine-tuned on RTE, MRPC and CoLA. $\theta _ { p } , \theta _ { f }$ , $\theta _ { s }$ denote the parameters of the pre-trained, failed, and successfully trained model, respectively.
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 14: The test accuracy and training loss of (a) 10 successful runs with our fine-tuning scheme and (b) 10 failed runs with fine-tuning scheme Devlin on RTE. Solid line shows the mean, error bars show $\pm 1 \mathrm { s t d }$ .
|
| 339 |
+
|
| 340 |
+
Table 4: Standard deviation, mean, and maximum performance on the development set of SciTail when finetuning BERT over 25 random seeds. Standard deviation: lower is better, i.e. fine-tuning is more stable.
|
| 341 |
+
|
| 342 |
+
<table><tr><td rowspan="2">Approach</td><td colspan="3">SciTail</td></tr><tr><td>std</td><td>mean</td><td>max</td></tr><tr><td>Devlin et al. (2019),full train set, 3 epochs</td><td>0.4</td><td>95.1</td><td>96.0</td></tr><tr><td>Devlin et al. (2019),1k samples,3 epochs</td><td>17.9</td><td>69.8</td><td>89.4</td></tr><tr><td>Devlin et al. (2019),1k samples,71 epochs</td><td>0.9</td><td>87.5</td><td>89.1</td></tr><tr><td>Ours, full train set</td><td>0.6</td><td>95.1</td><td>96.8</td></tr></table>
|
| 343 |
+
|
| 344 |
+
We conclude from this experiment that our findings and guidelines generalize to datasets from other domains as well. This gives further evidence that the observed instability is not a property of any particular dataset but rather a result of too few training iterations based on the common fine-tuning practice of using a fixed number of epochs (and not iterations) independently of the training data size.
|
md/train/r1Chut9xl/r1Chut9xl.md
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# INFERENCE & INTROSPECTION IN DEEP GENERATIVE MODELS OF SPARSE DATA
|
| 2 |
+
|
| 3 |
+
Rahul G. Krishnan New York University rahul@cs.nyu.edu
|
| 4 |
+
|
| 5 |
+
Matthew Hoffman Adobe Research matthoffm@adobe.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Deep generative models such as deep latent Gaussian models (DLGMs) are powerful and popular density estimators. However, they have been applied almost exclusively to dense data such as images; DLGMs are rarely applied to sparse, high-dimensional integer data such as word counts or product ratings. One reason is that the standard training procedures find poor local optima when applied to such data. We propose two techniques that alleviate this problem, significantly improving our ability to fit DLGMs to sparse, high-dimensional data. Having fit these models, we are faced with another challenge: how to use and interpret the representation that we have learned? To that end, we propose a method that extracts distributed representations of features via a simple linearization of the model.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Deep latent Gaussian models (DLGMs, a.k.a. variational autoencoders; Rezende et al., 2014; Kingma et al., 2014) have led a resurgence in the use of deep generative models for density estimation. DLGMs assume that observed vectors $x$ are generated by applying a nonlinear transformation (defined by a neural network with parameters $\theta$ ) to a vector of Gaussian random variables $z$ .
|
| 14 |
+
|
| 15 |
+
Learning in DLGMs proceeds by approximately maximizing the average marginal likelihood $p ( x ) \equiv$ $\begin{array} { r } { \int _ { z } p ( z ) \bar { p ( x | z ) } d z } \end{array}$ of the observations $x$ . Computing the true marginal likelihood is intractable, so we resort to variational expectation-maximization (Bishop, 2006), an approximation to maximumlikelihood estimation. To learn the parameters $\theta$ of the generative model, the procedure needs to find a distribution $q ( z | x )$ that approximates the posterior distribution $p ( z | x )$ of the latent vector $z$ given the observations $x$ . In the past, such $q$ distributions were fit using iterative optimization procedures (e.g., Hoffman et al., 2013). But Rezende et al. (2014) and Kingma et al. (2014) showed that $q ( z | x )$ can be parameterized by a feedforward “inference network” with parameters $\phi$ , speeding up learning. This inference network is trained jointly with the generative model; as training proceeds, the inference network learns to approximate posterior inference on the generative model, and the generative model improves itself using the output of the inference network.
|
| 16 |
+
|
| 17 |
+
Embedded within this procedure, however, lies a potential problem: both the inference network and the generative model are initialized randomly. Early on in learning, the inference network’s $q ( z | x )$ distributions will be poor approximations to the true posterior $p ( z | x )$ , and the gradients used to update the parameters of the generative model will therefore be poor approximations to the gradients of the true log-likelihood $\log p ( x )$ . Previous stochastic variational inference methods (Hoffman et al., 2013) were slower, but suffered less from this problem since for every data-point, a set of variational parameters was optimized within the inner loop of learning. In this work, we investigate blending the two methodologies for learning models of sparse data. In particular, we use the parameters predicted by the inference network as an initialization and optimize them further during learning. When modeling high-dimensional sparse data, we show that updating the local variational parameters yields generative models with better held-out likelihood, particularly for deeper generative models.
|
| 18 |
+
|
| 19 |
+
What purpose is served by fitting bigger, deeper, more powerful generative models? Breiman (2001) argues that statistical discriminative modeling falls into two schools of thought: the data modeling culture and the algorithmic modeling culture. The former advocates the use of predictive models that assume interpretable, mechanistic processes while the latter advocates the use of black box techniques with an emphasis on prediction accuracy. Breiman’s arguments also ring true about the divide between deep generative models with complex conditional distributions and simpler, more interpretable statistical models. Consider a classic model such as Latent Dirichlet Allocation (Blei et al., 2003). It is outperformed in held-out likelihood (Miao et al., 2016) by deeper generative models and assumes a simple probabilistic process for data generation that is unlikely to hold in reality. Yet, its generative semantics lend it a distinct advantage: interpretability. The word-topic matrix in the model allows practitioners to read off what the model has learned about the data. Is there a natural way to interpret the generative model when the conditional distributions are parameterized by a deep neural network?
|
| 20 |
+
|
| 21 |
+
Our second contribution is to introduce a simple, easy to implement method to interpret what is being learned by generative models such as DLGMs whose conditional probabilities are parameterized by deep neural networks. Our hope is to narrow the perceived gulf between a complex generative model’s representational power and its interpretability. We use the Jacobian of the conditional distribution with respect to latent variables in the Bayesian network to form embeddings (or Jacobian vectors) of the observations. We investigate the properties of the Jacobian vectors obtained from deeper, more non-linear generative models.
|
| 22 |
+
|
| 23 |
+
# 2 BACKGROUND
|
| 24 |
+
|
| 25 |
+
Generative Model: We consider learning in generative models of the form shown in Figure 1. We observe a set of $D$ word count vectors $x _ { 1 : D }$ , where $x _ { d v }$ denotes the number of times that word index $v \in \{ 1 , \ldots , V \}$ appears in document $d$ . We assume we are given the total number of words per document $\begin{array} { r } { N _ { d } \equiv \sum _ { v } x _ { d v } } \end{array}$ , and that $x _ { d }$ was generated via the following generative process:
|
| 26 |
+
|
| 27 |
+
$$
|
| 28 |
+
\mathbf { \Psi } _ { d } \sim { \mathcal { N } } ( 0 , I ) ; \ { \gamma } ( z _ { d } ) \equiv \mathrm { M L P } ( z _ { d } ; \theta ) ; \ \mu ( z _ { d } ) \equiv \frac { \exp \{ \gamma ( z _ { d } ) \} } { \sum _ { v } \exp \{ \gamma ( z _ { d } ) _ { v } \} } ; \ x _ { d } \sim \mathrm { M u l t i n o m i a l } ( \mu ( z _ { d } ) , N _ { d } ) .
|
| 29 |
+
$$
|
| 30 |
+
|
| 31 |
+
That is, we draw a Gaussian random vector, pass it through a multilayer perceptron (MLP) with parameters $\theta$ , pass the resulting vector through the softmax (a.k.a. multinomial logistic) function, and sample $N _ { d }$ times from the resulting distribution over the vocabulary.1
|
| 32 |
+
|
| 33 |
+
Variational Learning: For ease of exposition notation we drop the subscript on $x _ { d }$ to form $x$ referring to a single data point. We need to approximate the intractable posterior distribution $p ( z | x )$ during learning. Using the well-known variational principle, we can obtain the lower bound on the log marginal likelihood of the data (or $\mathcal { L } ( x ; \theta , \phi ) )$ in Eq. 2. where the inequality is by Jensen’s inequality.
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
\begin{array} { r } { \log p ( x ; \theta ) \geq \underset { q _ { \phi } ( z | x ) } { \mathbb { E } } \left[ \log p _ { \theta } ( x | z ) ) \right] - \mathrm { K L } \big ( q _ { \phi } ( z | x ) | | p ( z ) \big ) = \mathcal { L } ( x ; \theta , \phi ) , } \end{array}
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
We leverage an inference network or recognition network (Hinton et al., 1995), a neural network which approximates the intractable posterior, during learning. This is a parametric conditional distribution that is optimized to perform inference. Kingma $\&$ Welling (2014); Rezende et al. (2014) use a neural net (with parameters $\phi$ ) to parameterize $q _ { \phi } ( z | x )$ . The challenge in the resulting optimization problem is that the lower bound (2) includes an expectation w.r.t. $q _ { \phi } ( z | x )$ , which implicitly depends on the network parameters $\phi$ . This difficulty is overcome by using stochastic backpropagation.
|
| 40 |
+
|
| 41 |
+
With a normal distribution as our variational approximation we have that $q _ { \phi } ( z | x ) \sim$ $\mathcal { N } \left( \mu _ { \phi } ( x ) , \Sigma _ { \phi } ( x ) \right)$ . $\mu _ { \phi } ( x ) , \Sigma _ { \phi } ( x )$ are functions of the observation $x$ , and we denote by $\psi ( x ) : = { \frac { } { } }$ $\{ \mu _ { \phi } ( x ) , \Sigma _ { \phi } ( x ) \}$ the local variational parameters predicted by the inference network. A simple transformation allows one to obtain unbiased Monte Carlo estimates of the gradients of $\mathbb { E } _ { q _ { \phi } ( z | x ) } [ \log p _ { \theta } ( x | z ) ) ]$ with respect to $\phi$ . If we assume the prior $p ( z )$ is also normally distributed, the KL and its gradients may be obtained analytically. Throughout this paper we will use $\theta$ to denote the parameters of the generative model, and $\phi$ to denote the parameters of the inference network.
|
| 42 |
+
|
| 43 |
+
# 3 METHODOLOGY
|
| 44 |
+
|
| 45 |
+
Inference with Global Information: Sparse data typically exhibits long tails and learning in the presence of rare features is challenging. Inference networks learn to regress to the optimal posterior parameters for every data point and global information about the relative frequencies of the individual features in the training distribution may present valuable information during learning.
|
| 46 |
+
|
| 47 |
+
The simplest way to incorporate first order statistics across the training data into the inferential process is to condition on tf-idf (Baeza-Yates et al., 1999) features instead of the raw-counts. tf-idf is one of the most widely used techniques in information retrieval. In the context of building bag-of-words representations for documents, tf-idf re-weight features to increase the influence of rarer words while decreasing the influence of common words appearing in all documents. The tf-idf-transformed word-count vector is $\begin{array} { r } { \tilde { x } _ { d v } \equiv x _ { d v } \log \frac { D } { \sum _ { d ^ { \prime } } \operatorname* { m i n } \{ x _ { d ^ { \prime } v } , 1 \} } } \end{array}$ . After applying transform, the resulting vector $\tilde { x }$ is normalized by its L2 norm. It’s worthwhile to note that leveraging first-order statistics for inference is difficult in the traditional paradigm of tracking variational parameters for each data point but is easy with inference networks.
|
| 48 |
+
|
| 49 |
+
Optimizing Local Variational Parameters: The inference network initially comprises a randomly initialized neural network. The predictions of the inference network early in optimization are suboptimal variational parameters used to derive gradients of the parameters of the generative model. This induces noise and bias to the gradients used to update the parameters of the generative model; this noise and bias may push the generative model towards a poor local optimum. Previous work has suggested that deep neural networks (which form the conditional probability distributions $p _ { \theta } ( x | z ) )$ are sensitive to initialization (Glorot & Bengio, 2010; Larochelle et al., 2009).
|
| 50 |
+
|
| 51 |
+
To avoid these issues, we only use the local variational parameters $\psi ( x )$ predicted by the inference network to initialize an iterative optimizer that maximizes the ELBO with respect to $\psi$ ; we use the optimized variational parameters $\hat { \psi ( x ) }$ to derive gradients for the generative model. We then train the inference network using stochastic backpropagation and gradient descent, holding the parameters of the generative model $\theta$ fixed. Our procedure is detailed in Algorithm 1.
|
| 52 |
+
|
| 53 |
+
Algorithm 1 Pseudocode for Learning: We evaluate expectations in $\mathcal { L } ( x )$ (see Eq. 2) using a single sample from the variational distribution and aggregate gradients across mini-batches. $M = 1$ corresponds to performing no additional optimization to the variational parameters We update $\theta , \psi ( x ) , \phi$ using stochastic gradient descent with adaptive learning rates $\eta _ { \theta } , \eta _ { \psi ( x ) } , \eta _ { \phi }$ obtained via ADAM (Kingma & Ba, 2015)
|
| 54 |
+
|
| 55 |
+
Inputs: Dataset $\mathcal { D } : = [ x _ { 1 } , \dots , x _ { D } ] ,$ , Inference Model: $q _ { \phi } ( z | x )$ , Generative Model: $p _ { \theta } ( x | z ) , p ( z )$
|
| 56 |
+
while notConverged() do 1. Sample datapoint: $x \sim \mathcal { D }$ 2. Estimate local variational parameters $\psi ( x ) _ { 1 }$ using $q _ { \phi } ( z | x )$ 3. Estimate $\begin{array} { r } { \psi ( x ) _ { M } \approx \hat { \psi ( x ) } = \arg \operatorname* { m a x } _ { \psi ( x ) } \mathcal { L } ( x ; \theta ; \psi ( x ) ) } \end{array}$ via SGD as: $\begin{array} { r } { m = 1 , \dots , M , \psi ( x ) _ { m + 1 } = \psi ( x ) _ { m } + \eta _ { \psi ( x ) } \frac { \partial \mathcal { L } ( x ; \theta , \psi ( x ) _ { m } ) } { \partial \psi ( x ) _ { m } } } \end{array}$ 4. Update $\theta$ as: $\theta \gets \theta + \eta _ { \theta } \nabla _ { \theta } \mathcal { L } ( x ; \theta , \psi ( x ) _ { M } )$ 5. Update $\phi$ as: $\phi \phi + \eta _ { \phi } \nabla _ { \phi } \mathcal { L } ( x ; \theta , \psi ( x ) )$
|
| 57 |
+
end while
|
| 58 |
+
|
| 59 |
+
Introspection: Linear models are inherently interpretable. Consider linear regression, factor analysis (Spearman, 1904), and latent Dirichlet allocation (LDA; Blei et al., 2003), which (standardizing notation) assume the following relationships:
|
| 60 |
+
|
| 61 |
+
Regression: $\mathbb { E } [ y | x ] = W x + b$ ; Factor Analysis: $x \sim \mathcal { N } ( 0 , I )$ ; $\mathbb { E } [ y | x ] = W x + b ;$ Latent Dirichlet Allocation: $\begin{array} { r } { x \sim \mathrm { D i r i c h l e t } ( \alpha ) ; \quad \mathbb { E } [ y | x ] = W x } \end{array}$ .
|
| 62 |
+
|
| 63 |
+
In each case, we need only inspect the parameter matrix $W$ to answer the question “what happens to $y$ if we increase $x _ { k }$ a little?” The answer is clear— $y$ moves in the direction of the $k$ th row of $W$ We can ask this question differently and get the same answer: “what is the derivative ∂E[y|x] ?” The answer is simply the parameter matrix $W$ .
|
| 64 |
+
|
| 65 |
+
For models as in $\mathrm { F i g ~ 1 }$ , the variability in the training data is assumed to be due to the single latent state $z$ . The relationship between latent variables $z$ and observations $x$ cannot be quickly read off of the parameters $\theta$ . But we can still ask what happens if we perturb $z$ by some small $d z$ —this is simply the directional derivative ∂E[x|z]∂z dz. We can interpret this Jacobian matrix in much the same way we would a factor loading matrix, with two main differences. First, the Jacobian matrix ∂E[x|z]∂z varies with z—the interpretation of z may change significantly depending on context. Second, DLGMs exhibit rotational symmetry—the prior on $z$ is rotationally symmetric, and the MLP can apply arbitrary rotations to $z$ before applying any nonlinearities, so a priori there is no “natural” set of basis vectors for $z$ . For a given Jacobian matrix, however, we can find the most significant directions via a singular value decomposition (SVD).
|
| 66 |
+
|
| 67 |
+
Jacobian Vectors: We present our method to generate embeddings from Bayesian networks of the form Figure 1. We consider three variants of Jacobian embedding vectors, based on the unnormalized potentials from the MLP, logarithmic probabilities, and linear probabilities respectively:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\mathcal { I } ( z ) ^ { \mathrm { p o t } } = \frac { \partial \gamma ( z ) } { \partial z } \qquad \mathcal { I } ( z ) ^ { \mathrm { l o g } } = \frac { \partial \log \mu ( z ) } { \partial z } \qquad \mathcal { I } ( z ) ^ { \mathrm { p r o b } } = \frac { \partial \mu ( z ) } { \partial z }
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
For any $z$ , $\{ \mathcal { I } ( z ) ^ { \mathrm { l o g } } , \mathcal { I } ( z ) ^ { \mathrm { p o t } } , \mathcal { I } ( z ) ^ { \mathrm { p r o b } } \} \in \mathbb { R } ^ { V \times K }$ where $K$ is the latent dimension and $V$ is the dimensionality of the observations. It is this matrix that we use to form embeddings. We denote by $u _ { i }$ the Jacobian vector obtained from the row of the Jacobian matrix. When not referring to a particular variant, we use $\mathcal { I } ( z )$ to denote the Jacobian matrix. $\mathcal { I } ( z )$ is a function of $z$ leaving open the choice of where to evaluate this function. The semantics of our generative model suggest a natural choice: $\mathcal { T } _ { \mathrm { m e a n } } : = \mathbb { E } _ { p ( z ) } [ \mathcal { T } ( z ) ]$ . This set of embeddings captures the variation in the output distribution with respect to the latent state across the prior distribution of the generative model. Additionally, one may also evaluate the Jacobian at the approximate posterior corresponding to an observation $x$ . We study how this may be used to obtain contextual word-vectors.
|
| 74 |
+
|
| 75 |
+
In frameworks that support automatic differentiation (e.g., Theano; Theano Development Team, 2016), $\mathcal { I } ( z )$ is readily available and we estimate $\mathcal { I } _ { \bf m e a n }$ via Monte-Carlo sampling from the prior.
|
| 76 |
+
|
| 77 |
+
Deriving Jacobian Vectors: For simplicity, we derive the functional form of the Jacobian in a linear model i.e where $\gamma ( z _ { d } ) = W z _ { d }$ (c.f Eq 1). We drop the subscript $d$ and denote by $\gamma _ { i } ( z )$ , the ith element of the vector $\gamma ( z )$ .
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
p ( x _ { i } = 1 | z ) = { \frac { \exp ( \gamma _ { i } ( z ) ) } { \sum _ { j } \exp ( \gamma _ { j } ( z ) ) } } \qquad { \mathrm { a n d } } \quad \gamma _ { i } ( z ) = w _ { i } ^ { T } z
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
For linear models, $\nabla _ { z } \gamma _ { i } ( z ) = w _ { i }$ directly corresponds to $\mathcal { I } ( z ) ^ { \mathrm { p o t } }$ . Noting that $\nabla _ { z } \exp ( \gamma _ { i } ( z ) ) =$ $\exp ( \gamma _ { i } ( z ) ) \nabla _ { z } \gamma _ { i } ( z )$ and $\begin{array} { r } { \dot { \nabla } _ { z } \sum _ { j } \exp ( \gamma _ { j } ( z ) ) = \sum _ { j } \exp ( \gamma _ { j } ( z ) ) \dot { \nabla } _ { z } \gamma _ { j } ( z ) } \end{array}$ , we estimate $\mathcal { I } ( z ) ^ { \mathrm { p r o b } }$ as:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { l l l } { \displaystyle \nabla _ { z } p ( x _ { i } = 1 | z ) = \nabla _ { z } \frac { \exp ( \gamma _ { i } ( z ) ) } { \sum _ { j } \exp ( \gamma _ { j } ( z ) ) } = \frac { \sum _ { j } \exp ( \gamma _ { j } ( z ) ) \nabla _ { z } \exp ( \gamma _ { i } ( z ) ) - \exp ( \gamma _ { i } ( z ) ) \nabla _ { z } \sum _ { j } \exp ( \gamma _ { j } ( z ) ) } { ( \sum _ { j } \exp ( \gamma _ { j } ( z ) ) ) ^ { 2 } } } \\ { \displaystyle } & { \qquad = \frac { \sum _ { j } \exp ( \gamma _ { j } ( z ) ) \exp ( \gamma _ { i } ( z ) ) w _ { i } - \exp ( \gamma _ { i } ( z ) ) \sum _ { j } \exp ( \gamma _ { j } ( z ) ) w _ { j } } { ( \sum _ { j } \exp ( \gamma _ { j } ( z ) ) ) ^ { 2 } } } \\ { \displaystyle } & { \qquad = p ( x _ { i } = 1 | z ) w _ { i } - p ( x _ { i } = 1 | z ) \sum _ { j } p ( x _ { j } = 1 | z ) w _ { j } } \\ { \displaystyle } & { \qquad = p ( x _ { i } = 1 | z ) ( w _ { i } - \sum _ { j } p ( x _ { j } = 1 | z ) w _ { j } ) } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
Similarly, we may compute $\mathcal { I } ( z ) ^ { \mathrm { l o g } }$ :
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\nabla _ { z } \log p ( x _ { i } = 1 | z ) = w _ { i } - \sum _ { j } p ( x _ { j } = 1 | z ) w _ { j } = \sum _ { j } p ( x _ { j } = 1 | z ) ( w _ { i } - w _ { j } )
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
Denoting a word-pair vector as $w _ { i } - w _ { j }$ , where $w _ { i } , w _ { j }$ are columns of the matrix $W$ . If we define the set of all word-pair vectors as $s$ , then Eq 5 captures the idea that the vector representation for a word $i$ lies in the convex hull of $s$ . Furthermore, the word vector’s location in $\mathrm { C O N V } ( S )$ is determined by the likelihood of the pairing word $( x _ { j } )$ under the model $p ( x _ { j } = 1 | z )$ .
|
| 96 |
+
|
| 97 |
+
When we use a non-linear conditional probability distribution $\mathcal { I } ( z ) ^ { \mathrm { l o g } }$ becomes: $\nabla _ { z } \log p ( x _ { i } = $ $\begin{array} { r } { 1 | z ) = \sum _ { j } p ( x _ { j } = 1 | z ) ( \nabla _ { z } \gamma _ { i } ( z ) - \nabla _ { z } \hat { \gamma _ { j } } ( z ) ) } \end{array}$ where $\nabla _ { z } \gamma _ { i } ( z )$ is a non-linear function of $z$ . To the best of our knowledge, Jacobian Vectors and their properties have not been studied.
|
| 98 |
+
|
| 99 |
+
# 4 RELATED WORK
|
| 100 |
+
|
| 101 |
+
Learning in Deep Generative Models: Salakhutdinov & Larochelle (2010) optimize the local variational parameters obtained from an inference network when learning deep Boltzmann machines. For DLGMs, Hjelm et al. (2016) also consider the optimization of the local variational parameters, though their exposition focuses on deriving an importance-sampling-based bound to use during learning in deep generative models with discrete latent variables. Their experimental results suggest the procedure does not improve performance much on the binarized MNIST dataset. This is consistent with our experience—we found that our secondary optimization procedure helped more when modeling sparse, high-dimensional text data than when modeling MNIST.
|
| 102 |
+
|
| 103 |
+
Leveraging Gradient Information: The algorithmic procedure for obtaining Jacobian Vectors that we propose resembles that used to derive Fisher Score features. For an data point $X$ under a parameteric distribution $p ( X ; \theta )$ , the Fisher scores is defined as $U _ { X } = \nabla _ { \boldsymbol { \theta } } \log p ( \bar { X } ; \boldsymbol { \theta } )$ . Jaakkola & Haussler (2007) similarly use $U _ { X }$ to form a kernel function for subsequent use in a discriminative classifier. The intuition behind such methods is to note that the derivative of the log-probability with respect to the parameters of the generative model encodes all the variability in the input under the generative process. We rely on a related intuition, although our motivations are different; we are interested in characterizing isolated features such as words, not vector observations such as documents. Also, we consider Jacobians with respect to per-observation latent variables $z$ , rather than globally shared parameters $\theta$ .
|
| 104 |
+
|
| 105 |
+
In the context of discriminative modeling, (Erhan et al., 2009) use gradient information to study the patterns with which neurons are activated in a deep neural networks while (Wang et al., 2016) use the spectra of the Jacobian to study the complexity of the functions learned by neural networks.
|
| 106 |
+
|
| 107 |
+
Introspection via Embeddings: Landauer et al. (1998) proposed latent semantic analysis, one of the earliest works to create vector space representations of documents. Bengio et al. (2003); Mikolov & Dean (2016) propose log-linear models to create word-representations from document corpora in an unsupervised fashion. Rudolph et al. (2016) describe a family of models to create contextual embeddings where the conditional distributions that lie in the exponential family. Finally, Choi et al. (2016) propose a variant of Word2Vec to create representations of diagnosis codes from temporal Electronic Health Record data. The models above explicitly condition the probability of a word on its nearby context. In contrast, our model models the probability of a word as it appears in the document (or rather, conditioned on its global context). Augmenting the generative model in Figure 1 to incorporate local context is a possible direction for future work.
|
| 108 |
+
|
| 109 |
+
Miao et al. (2016) learn a shallow log-linear model on text data and obtain embeddings for words from the weight matrix that parameterize their generative model. Li et al. (2016) propose a modification to LDA that explicitly models representations for word in addition to modeling the word-topic structure.
|
| 110 |
+
|
| 111 |
+
# 5 EVALUATION
|
| 112 |
+
|
| 113 |
+
Text Data: We study the effect of further optimization of the variational parameters and inference with tf-idf features on the two datasets of varying size: the smaller 20Newsgroups (Lang, 2008) (train/valid/test: 10768/500/7505, V : 2000) and the larger RCV2 (Lewis et al., 2004) dataset (train/valid/test: 789414/5000/10000, V : 10000). We follow the preprocessing procedure defined in (Miao et al., 2016) for both datasets. We also train models on the Wikipedia corpus used in (Huang et al., 2012). We remove stop words, words appearing less than ten times in the dataset. and select our vocabulary to comprise the union of the top 20000 words in the corpus, the words in the WordSim353 (Finkelstein et al., 2001) and the words in the Stanford Contextual Word Similarity Dataset (SCWS) (Huang et al., 2012). The resulting dataset is of size train/valid: 1212781/1000 and V :20253.
|
| 114 |
+
|
| 115 |
+
EHR Data: We train shallow and deep generative models on a dataset constructed from Electronic Medical Records. The dataset comprises 185000 patients where each patient’s data across time was aggregated to create a bag-of-diagnosis-codes representation of the patient. The vocabulary comprises four different kinds of medical diagnosis codes: ICD9 (diagnosis), LOINC (laboratory tests), NDC (prescription medication), CPT (procedures). For a single patient, we have 51321 diagnosis codes.
|
| 116 |
+
|
| 117 |
+
Training Procedure: On all datasets, we train shallow log-linear models $( \gamma ( z ) = W z + b )$ and deeper three-layer DLGMs $( \gamma ( z ) = \mathrm { M L P } ( z ; \theta ) )$ . We vary the number of secondary optimization steps $M = 1 , 1 0 0$ (cf. Algorithm 1) to study the effect of optimization on $\psi ( x )$ with ADAM (Kingma & Ba, 2015). We use a mini-batch size of 500, a learning rate of 0.01 for $\psi ( x )$ and 0.0008 for $\theta , \phi$ . The inference network was fixed to a two-layer MLP whose intermediate hidden layer $h ( x )$ was used to parameterize the mean and diagonal log-variance $\mu ( x ) , \log { \Sigma ( x ) }$ . To evaluate the quality of the learned generative models, we report an upper bound on perplexity (Mnih & Gregor, 2014) given by $\begin{array} { r } { \exp ( - \frac { 1 } { N } \sum _ { i } \frac { 1 } { N _ { i } } \log p ( x _ { i } ) ) } \end{array}$ where $\log p ( x _ { i } )$ is replaced by $\operatorname { E q } 2$ . The notation 3-M100-tfidf indicates a model where the MLP parameterizing $\gamma ( z )$ has three hidden layers, the local variational parameters are updated 100 times before an update of $\theta$ and tf-idf features were used in the inference network.
|
| 118 |
+
|
| 119 |
+
Improving Learning: Table 1 depicts our results on 20newsgroups and RCV2. On the smaller dataset, we find that the deeper models overfit quickly and are outperformed by shallow generative models. On the larger datasets, the deeper models’ capacity is more readily utilized yielding better generalization. The use of tf-idf features always helps learning on smaller datasets. On larger datasets, the benefits are smaller when we also optimize $\psi ( x )$ . Finally, the optimization of the local variational parameters appears to help most on the larger datasets. To investigate how this occurs, we plot the held-out likelihood versus epochs. For models trained on the larger RCV2 (Figure 2a) and Wikipedia (Figure 2b) datasets, the larger deep generative models converge to better solutions (and in fewer passes through the data) with the additional optimization of $\psi ( x )$ .
|
| 120 |
+
|
| 121 |
+
To study the effect of investigate where optimizing $\psi ( x )$ is particularly effective on, we train a three layer model on different subsets of the Wikipedia dataset. The subsets are created by selecting the top $K$ most frequently occurring features in the data. Our rationale is that by holding everything fixed and varying the level of sparsity (datasets with smaller values of $K$ are less sparse) in the data, we can begin to understand when our method is most helpful. On held-out data, we compute the difference between the perplexity when the model is trained with $M = 1$ (denoted $P _ { M 1 , }$ ) and $M = 1 0 0$ (denoted $P _ { M 1 0 0 . }$ ) and compute the relative decrease in perplexity obtained as $\frac { P _ { M 1 } - P _ { M 1 0 0 } } { P _ { M 1 0 0 } }$ The results are depicted in Figure 2c where we see that our method improves learning as a function of the dimensionality of the data.
|
| 122 |
+
|
| 123 |
+
In Table 5 in the supplementary material, we study the effect of varying the parameters of the inference network. There, we perform a small grid search over the hidden dimension and the number of layers in the inference network and find that optimizing the variational parameters continues to produces models with lower overall perplexity.
|
| 124 |
+
|
| 125 |
+
Jacobian Vectors: Our first avenue for introspection into the learned generative model is using log-singular values of the Jacobian matrix. Since the Jacobian matrix precisely encodes how sensitive the outputs are with respect to the inputs, the log-singular value spectrum of this matrix directly captures the amount of variance in the data explained by the latent space. Said differently, we can read off the number of active units in the DLGM or VAE by counting the number of log-singular values larger than zero. Furthermore, this method of introspection depends only on the parameters of the generative model. In Figure 2d, 2e, we see that for larger models continuing to optimize the variational parameters allows us to learn models that use many more of the available latent dimensions. This suggests that, when fit to text data, DLGMs may be particularly susceptible to the overpruning phenomenon noted by Burda et al. (2015). In Figure 2, the lower held-out perplexity and the increased utilization of the latent space suggest that the continued optimization of the variational parameters yields more powerful generative models.
|
| 126 |
+
|
| 127 |
+
We investigate how the Jacobian matrix may be used for model introspection by studying the qualitative properties of $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { l o g } }$ on DLGMs (of type “3-M100-tfidf”) trained on two, diverse sets of data. We form a Monte Carlo estimate of $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { l o g } }$ using 400 samples. The cosine distance is used to define neighbors of words in the embedding space of the Jacobian and spectral clustering (Von Luxburg, 2007) is used to form clusters.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Model</td><td>K</td><td>20News</td><td>RCV1-v2</td></tr><tr><td>LDA</td><td>50</td><td>1091</td><td rowspan="4">1437 1142 988</td></tr><tr><td>LDA</td><td>200</td><td>1058</td></tr><tr><td>RSM</td><td>50</td><td>953</td></tr><tr><td>SBN fDARN</td><td>50 50</td><td>909 784 917 724</td></tr><tr><td>fDARN</td><td>200</td><td>一</td><td>598</td></tr><tr><td>NVDM</td><td>50</td><td>836</td><td>563</td></tr><tr><td>NVDM</td><td>200</td><td>852</td><td>550</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Table 1: Test Perplexity: Left: Baselines Results on the 20newsgroups and RCV1-v2 dataset Legend: LDA (Blei et al., 2003), Replicated Softmax (RSM) (Hinton & Salakhutdinov, 2009), Sigmoid Belief Networks (SBN) and Deep Autoregressive Networks (DARN) (Mnih & Gregor, 2014), Neural Variational Document Model (Miao et al., 2016). $K$ denotes the latent dimension in our notation. Right: DLGMs on text data with $K = 1 0 0$ We vary the features presented to the inference network $q _ { \phi } ( z | x )$ during learning between: normalized count vectors $\textstyle ( { \frac { x } { \sum _ { i = 1 } ^ { V } x _ { i } } }$ , denoted “norm”) and normalized tf-idf (denoted “tf-idf”) features.
|
| 132 |
+
|
| 133 |
+
<table><tr><td rowspan="2">DLGM</td><td colspan="3">20News RCV1-v2</td></tr><tr><td>M1 M100</td><td>M1</td><td>M11</td></tr><tr><td>1-M1-norm 1-M100-norm</td><td>964 1182</td><td>816 831 866</td><td>498 479 485 453</td></tr><tr><td>3-M1-norm 3-M100-norm</td><td>1040 1341</td><td>408</td><td>360</td></tr><tr><td></td><td>894</td><td>378</td><td>329</td></tr><tr><td>1-M1-tfidf</td><td>895</td><td>785 475</td><td>453</td></tr><tr><td>1-M100-tfidf</td><td>917</td><td>792</td><td>480 451</td></tr><tr><td>3-M1-tfidf</td><td></td><td></td><td></td></tr><tr><td></td><td>1027</td><td>852 391</td><td>346</td></tr><tr><td>3-M100-tfidf</td><td></td><td>377</td><td></td></tr><tr><td></td><td>1029</td><td>833</td><td>327</td></tr></table>
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 2: Mechanics of Learning: Validation Perplexity and Log-singular Values of $\mathcal { T } _ { m e a n } ^ { l o g }$ : Best viewed in color. For the RCV2 and Wikipedia (large) datasets, we visualize the validation perplexity as a function of epochs. The solid lines indicate the validation perplexity for $M = 1$ and the dotted lines indicate $M = 1 0 0$ . The $\mathbf { X }$ -axis is not directly comparable on running times since larger values of $M$ take longer during training. We find that learning with $\dot { M } = \bar { 1 } 0 0$ takes approximately 15 times as long per mini-batch of size 500 on the text datasets. Figure $2 \mathrm { c }$ compares relative differences in the final held-out perplexity, denoted $P$ , between models trained using $M = 1$ and $M = 1 0 0$ . On the $\mathbf { X }$ -axis, we vary the number of features used in the dataset. Figure 2d, 2e depict the sorted log singular values of $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { l o g } }$ .
|
| 137 |
+
|
| 138 |
+
In Table 2a, we visualize some of the nearest neighbors of words using $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { l o g } }$ obtained from models trained on the Wikipedia dataset. The neighbors are semantically sensible. Instead of evaluating the Jacobian at $L$ points $z _ { 1 : L } \sim p ( z )$ , one may instead evaluate it at $z _ { 1 : L } \sim q ( z | x )$ for some $x$ . In Table 2b, we select three polysemous query words alongside “context words” that disambiguate the query’s meaning. For each word-context pair, we create a document comprising a subset of words in the the (a) Word Embeddings (Nearest Neighbors): We visualize nearest neighbors of word embeddings. We exclude plurals of the query and other words in the neighborhood.
|
| 139 |
+
|
| 140 |
+
<table><tr><td rowspan=1 colspan=1>Query</td><td rowspan=1 colspan=1>Neighborhood</td></tr><tr><td rowspan=1 colspan=1>intelligence</td><td rowspan=1 colspan=1>espionage,secrecy,interrogation, counterterrorism</td></tr><tr><td rowspan=1 colspan=1>zen</td><td rowspan=1 colspan=1>dharma,buddhism,buddhas,meditation,yoga</td></tr><tr><td rowspan=1 colspan=1>artificial</td><td rowspan=1 colspan=1>artificially,molecules,synthetic,soluble</td></tr><tr><td rowspan=1 colspan=1>military</td><td rowspan=1 colspan=1>civilian,armys,commanders,infantry</td></tr></table>
|
| 141 |
+
|
| 142 |
+
(b) Word Embeddings (Polysemy): We visualize the nearest neighbors under the Jacobian vector induced by the posterior distribution of a document created based on the context word.
|
| 143 |
+
|
| 144 |
+
<table><tr><td rowspan=1 colspan=1>Word</td><td rowspan=1 colspan=1>Context</td><td></td></tr><tr><td rowspan=1 colspan=1>crane</td><td rowspan=1 colspan=1>constructionbird</td><td rowspan=1 colspan=1>lifting,usaaf,spanned, crushed, lifterected, parkland,locally, farmland,causeway</td></tr><tr><td rowspan=1 colspan=1>bank</td><td rowspan=1 colspan=1>rivermoney</td><td rowspan=1 colspan=1>watershed, footpath,confluence,drains,tributarybanking,government, bankers,comptroller, fiscal</td></tr><tr><td rowspan=1 colspan=1>fires</td><td rowspan=1 colspan=1>burnlayoff</td><td rowspan=1 colspan=1>ignition,combustion, engines,fuel, enginethunderstorm,grassy,surrounded,walkway, burning</td></tr></table>
|
| 145 |
+
|
| 146 |
+
(c) Medical Embeddings (Nearest Neighbors): We evaluate nearest neighbors of selected diagnosis, drug and procedure codes (ignoring duplicates and shortening some code names). Metformin, Glimepiride, Pioglitazone and Avandia are diabetic drugs. A contour meter is an instrument to track blood glucose. Advair, Albuterol, Proventil and Spiriva are prescribed to patients with chronic obstructive pulmonary disease (COPD)
|
| 147 |
+
|
| 148 |
+
<table><tr><td rowspan=1 colspan=1>Code</td><td rowspan=1 colspan=1>Neighboring Codes</td></tr><tr><td rowspan=1 colspan=1>Metformin</td><td rowspan=1 colspan=1>Glimepiride,Avandia,ContourMeter,Pioglitazone</td></tr><tr><td rowspan=1 colspan=1>Spiriva (Bronchodilator)</td><td rowspan=1 colspan=1>Advair,Albuterol,Proventil</td></tr><tr><td rowspan=1 colspan=1>Asbestosis</td><td rowspan=1 colspan=1>Exposure To Asbestos,Coal Workers'Pneumoconiosis,Ct Scan Chest</td></tr></table>
|
| 149 |
+
|
| 150 |
+
Table 2: Qualitative evaluation of Jacobian Vectors : In Table 2a and 2b, we evaluate the embeddings of words. In Table 8b and 2c we evaluate embeddings of medical diagnosis codes.
|
| 151 |
+
|
| 152 |
+
<table><tr><td>Models</td><td>Spearman ρ ×100</td></tr><tr><td>Huang (S)</td><td>58.6</td></tr><tr><td>Huang (M)</td><td>65.7</td></tr><tr><td>C&W</td><td>57</td></tr><tr><td>tf-idf-S</td><td>26.3</td></tr><tr><td>Pruned tf-idf-S</td><td>62.5</td></tr><tr><td>Pruned tf-idf-M</td><td>60.5</td></tr><tr><td>1-M1 7prob Jmean</td><td>61.7</td></tr><tr><td>3-M100 Jmreb 7prob</td><td>59.5</td></tr></table>
|
| 153 |
+
|
| 154 |
+
(b) SCWS: (S) denotes a single prototype approach versus (M) that denotes a multiprototype approach (that leverages context)
|
| 155 |
+
|
| 156 |
+
Table 3: Semantic Similarity in Words: The baseline results are taken from (Huang et al., 2012). C&W uses embeddings from the language model of (Collobert & Weston, 2008). Glove corresponds to embeddings by (Pennington et al., 2014). The learning algorithm for our embeddings does not use local context.
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Models</td><td>Spearman ρ ×100</td></tr><tr><td>Huang(G)</td><td>22.8</td></tr><tr><td>Huang</td><td>71.3</td></tr><tr><td>Glove</td><td>75.9</td></tr><tr><td>C&W</td><td>55.3</td></tr><tr><td>ESA</td><td>75</td></tr><tr><td>Tiered Pruned tf-idf</td><td>76.9</td></tr><tr><td>1-M1 7prob Jmean</td><td>69.7</td></tr><tr><td>3-M100Jmeab 7prob</td><td>59.6</td></tr></table>
|
| 159 |
+
|
| 160 |
+
(a) WordSim353: “G” denotes the model in Huang et al. learned only with global context in the document.
|
| 161 |
+
|
| 162 |
+
context’s Wikipedia page. Then, we use the learned inference network to perform posterior inference to evaluate $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { l o g } }$ at the corresponding $q ( z | x )$ . This yields a set of contextual Jacobian vectors. We display the nearest neighbors for each word under different contextual Jacobian vectors and find that, while not always perfect, they capture different contextually relevant semantics. The take-away here is that by combining posterior inference in this Bayesian network with our methodology of introspecting the model, one obtains different context-specific representations for the observations despite not having been trained to capture this explicitly.
|
| 163 |
+
|
| 164 |
+
In Table 8b (appendix), we visualize clusters formed from the embeddings of medical diagnosis codes to find that they exhibit topical coherence. In Table 2c, the nearest neighbors of drugs include other drugs prescribed in conjunction with or as a replacement for the query drug. For diagnosis codes such as “Asbestosis”, the nearest neighbors are symptoms and procedures associated with the disease. Finally, for a qualitative evaluation of Jacobian vectors obtained from a model trained on movie ratings, we refer the reader to the appendix.
|
| 165 |
+
|
| 166 |
+
Table 4: Medical Relatedness Measure: Evaluating the quality of embedding using medical (NDF-RT and CCS) ontologies. Each column corresponds to a measure of how well the embedding space is amenable to performing analogical reasoning (NDF-RT) or clusters meaningfully (CCS). A higher number is better. SCUIs corresponds to the application of the method developed by (Choi et al., 2016) on data released by (Finlayson et al., 2014). The learning algorithm for our embeddings does not use local context.
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Models</td><td>MRMNDF-RT (May Treat)</td><td>MRMNDF-RT (May Prevent)</td><td>MRMccs (Fine Grained)</td><td>MRMccs (Coarse Grained)</td></tr><tr><td>(De Vine et al., 2014)</td><td>53.21</td><td>57.14</td><td>22.63</td><td>24.56</td></tr><tr><td>(Choi et al., 2016)</td><td>59.40</td><td>55.71</td><td>44.80</td><td>47.43</td></tr><tr><td>SCUI</td><td>52.75</td><td>48.57</td><td>34.16</td><td>37.31</td></tr><tr><td></td><td>59.63</td><td>32.86</td><td>31.58</td><td>33.88</td></tr><tr><td>3-M100</td><td>60.32</td><td>38.57</td><td>37.77</td><td>40.87</td></tr></table>
|
| 169 |
+
|
| 170 |
+
The Semantics of Embeddings: We evaluate the vector space representations that we obtain from $\mathcal { I } _ { \mathbf { m e a n } }$ on benchmarks (such as WordSim353 (Finkelstein et al., 2001) and SCWS (Huang et al., 2012)) that attempt to measure the similarity of words. The algorithmically derived measure of similarity is compared to a human-annotated score (between one and ten) using the Spearman rank correlation. The models that we compare to primarily use local context, which yields a more precise signal about the meanings of particular words. Closest to us in terms of training procedure is (Huang (G)) in Table 3a, whose model we outperform. Finding ways to incorporate local context is fertile ground for future work on models tailor-made for extracting embeddings.
|
| 171 |
+
|
| 172 |
+
For medical codes, we follow the method in (Choi et al., 2016). The authors build two kinds of evaluations to estimate whether an embedding space of medical diagnosis codes captures medically related concepts well. $\mathbf { M R M } _ { \mathrm { N D F - R T } }$ (Medical Relatedness Measure under NDF-RT) leverages a database (NDF-RT) to evaluate how good an embedding space is at answering analogical queries between drugs and diseases such as uDiabetes ≈ uMetformin − ( $u _ { \mathrm { L u n g C a n c e r } } - u _ { \mathrm { T a r c e v a } } )$ . (Metformin is a diabetic drug and Tarceva is used in the treatment of lung cancer). The evaluation $\mathbf { ( M R M _ { C C S } ) }$ measures if the neighborhood of the diagnosis codes is medically coherent using a predefined medical ontology (CCS) as ground truth. The number computed may be thought of as a measure of precision, where a higher number is better. We refer the reader to the appendix for additional details.
|
| 173 |
+
|
| 174 |
+
Table 4 details the results on evaluating the medical embeddings. Once again, the baselines we compare (Choi et al., 2016) are variants of Word2Vec that maximize the likelihood of the diagnosis codes conditioned on carefully crafted contexts. Our method performs comparably to the baselines, even though it relies exclusively on global context and was not designed with this task in mind. This setting depicts an instance where Jacobian vectors resulting from a deeper, better-trained model outperform those from a shallow model, highlighting the importance of a method of interpretation agnostic to the structure of the conditional probability functions in the generative model.
|
| 175 |
+
|
| 176 |
+
Between the three choices of Jacobian vectors, we found that all three perform comparably on the word similarity evaluation with $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { p r o b } }$ slightly outperforming the others. On the medical data, with we found similar results aside from a few cases where $\mathcal { T } _ { \mathbf { m e a n } } ^ { \mathrm { p r o b } }$ did not perform well. For deeper models, we found that optimizing $\psi ( x )$ improved the quality of the obtained Jacobian vectors on text and medical data. The full versions of Tables 3 and 4 can be found in the appendix.
|
| 177 |
+
|
| 178 |
+
# 6 DISCUSSION
|
| 179 |
+
|
| 180 |
+
We explored techniques to improve inference and learning in deep generative models of sparse non-negative data. We also developed and explored a novel, simple, yet effective method to interpret the structure of the non-linear generative model via embeddings obtained from the Jacobian matrix relating latent variables to observations. The embeddings are evaluated qualitatively and quantitatively, and were seen to exhibit interesting semantic structure across a variety of domains. Studying the effects of varying the priors on the latent variables, conditioning on context, and varying the neural architectures that parameterize the conditional distributions suggest avenues for blending ideas from generative modeling and Bayesian inference into building more powerful embeddings for data.
|
| 181 |
+
|
| 182 |
+
# REFERENCES
|
| 183 |
+
|
| 184 |
+
Ricardo Baeza-Yates, Berthier Ribeiro-Neto, et al. Modern information retrieval, volume 463. ACM press New York, 1999.
|
| 185 |
+
|
| 186 |
+
Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. JMLR, 2003.
|
| 187 |
+
|
| 188 |
+
C. Bishop. Pattern Recognition and Machine Learning. Springer New York., 2006.
|
| 189 |
+
|
| 190 |
+
David M Blei, Andrew Y Ng, and Michael I Jordan. Latent dirichlet allocation. JMLR, 2003.
|
| 191 |
+
|
| 192 |
+
Leo Breiman. Statistical modeling: The two cultures. Statistical Science, 2001.
|
| 193 |
+
|
| 194 |
+
Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. In ICLR, 2015.
|
| 195 |
+
|
| 196 |
+
Youngduck Choi, Chill Yi-I Chiu, and David Sontag. Learning low-dimensional representations of medical concepts. In AMIA, 2016.
|
| 197 |
+
|
| 198 |
+
Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In ICML, 2008.
|
| 199 |
+
|
| 200 |
+
Lance De Vine, Guido Zuccon, Bevan Koopman, Laurianne Sitbon, and Peter Bruza. Medical semantic similarity with a neural language model. In CIKM, 2014.
|
| 201 |
+
|
| 202 |
+
Dumitru Erhan, Yoshua Bengio, Aaron Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. 2009.
|
| 203 |
+
|
| 204 |
+
Lev Finkelstein, Evgeniy Gabrilovich, Yossi Matias, Ehud Rivlin, Zach Solan, Gadi Wolfman, and Eytan Ruppin. Placing search in context: The concept revisited. In WWW, 2001.
|
| 205 |
+
|
| 206 |
+
Samuel G Finlayson, Paea LePendu, and Nigam H Shah. Building the graph of medicine from millions of clinical narratives. Scientific data, 2014.
|
| 207 |
+
|
| 208 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In AISTATS, 2010.
|
| 209 |
+
|
| 210 |
+
Geoffrey E Hinton and Ruslan R Salakhutdinov. Replicated softmax: an undirected topic model. In NIPS, 2009.
|
| 211 |
+
|
| 212 |
+
Geoffrey E Hinton, Peter Dayan, Brendan J Frey, and Radford M Neal. The” wake-sleep” algorithm for unsupervised neural networks. Science, 1995.
|
| 213 |
+
|
| 214 |
+
R Devon Hjelm, Kyunghyun Cho, Junyoung Chung, Russ Salakhutdinov, Vince Calhoun, and Nebojsa Jojic. Iterative refinement of approximate posterior for training directed belief networks. In NIPS, 2016.
|
| 215 |
+
|
| 216 |
+
Matthew D Hoffman, David M Blei, Chong Wang, and John William Paisley. Stochastic variational inference. JMLR, 2013.
|
| 217 |
+
|
| 218 |
+
Eric H. Huang, Richard Socher, Christopher D. Manning, and Andrew Y. Ng. Improving Word Representations via Global Context and Multiple Word Prototypes. In ACL, 2012.
|
| 219 |
+
|
| 220 |
+
Tommi S Jaakkola and David Haussler. Exploiting generative models in discriminative classifiers. In NIPS, 2007.
|
| 221 |
+
|
| 222 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 223 |
+
|
| 224 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
|
| 225 |
+
|
| 226 |
+
Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In NIPS, 2014.
|
| 227 |
+
|
| 228 |
+
Thomas K Landauer, Peter W Foltz, and Darrell Laham. An introduction to latent semantic analysis. Discourse processes, 1998.
|
| 229 |
+
|
| 230 |
+
Ken Lang. The 20 newsgroups data set, 2008.
|
| 231 |
+
|
| 232 |
+
Hugo Larochelle, Yoshua Bengio, Jer´ ome Louradour, and Pascal Lamblin. Exploring strategies for ˆ training deep neural networks. JMLR, 2009.
|
| 233 |
+
|
| 234 |
+
David D Lewis, Yiming Yang, Tony G Rose, and Fan Li. RCV1: A new benchmark collection for text categorization research. JMLR, 2004.
|
| 235 |
+
|
| 236 |
+
Shaohua Li, Tat-Seng Chua, Jun Zhu, and Chunyan Miao. Generative topic embedding: a continuous representation of documents. In ACL, 2016.
|
| 237 |
+
|
| 238 |
+
Yishu Miao, Lei Yu, and Phil Blunsom. Neural variational inference for text processing. In ICML, 2016.
|
| 239 |
+
|
| 240 |
+
T Mikolov and J Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2016.
|
| 241 |
+
|
| 242 |
+
Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In ICML, 2014.
|
| 243 |
+
|
| 244 |
+
Netflix. Netflix prize data set. 2009.
|
| 245 |
+
|
| 246 |
+
Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
|
| 247 |
+
|
| 248 |
+
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
|
| 249 |
+
|
| 250 |
+
Maja R Rudolph, Francisco JR Ruiz, Stephan Mandt, and David M Blei. Exponential family embeddings. In NIPS, 2016.
|
| 251 |
+
|
| 252 |
+
Ruslan Salakhutdinov and Hugo Larochelle. Efficient learning of deep boltzmann machines. In AISTATS, 2010.
|
| 253 |
+
|
| 254 |
+
Charles Spearman. ” general intelligence,” objectively determined and measured. The American Journal of Psychology, 1904.
|
| 255 |
+
|
| 256 |
+
Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, 2016. URL http://arxiv.org/abs/1605.02688.
|
| 257 |
+
|
| 258 |
+
Ulrike Von Luxburg. A tutorial on spectral clustering. Statistics and computing, 2007.
|
| 259 |
+
|
| 260 |
+
Shengjie Wang, Matthai Plilipose, COM Matthew Richardson, COM Krzysztof Geras, Gregor Urban, and EDU Ozlem Aslan. Analysis of deep neural networks with the extended data jacobian matrix. In ICML, 2016.
|
| 261 |
+
|
| 262 |
+
# APPENDIX A RCV2: COMPLEXITY OF THE INFERENCE NETWORK
|
| 263 |
+
|
| 264 |
+
We study the effect of varying the inference network on the two-layer model trained with the RCV2 data. Folding fixed a three-layer DLGM with stochastic dimension 100 (same architecture as $3 - t f i d f$ in Table 1), we learn models on the RCV2 data using $M = 1$ , 100 (we evaluate and report bounds on perplexity using $M = 1 0 0$ ) and display the results in Table 5. When $M = 1$ (the standard procedure for training VAEs and DLGMs), increasing the number of layers in the inference network decreases the quality of the model learned. One possible explanation for this is that the already noisy gradients of the inference network must propagate along a longer path in a deeper inference network, slowing down learning of the parameters $\phi$ which in turn affects the quality of inference. In contrast, increasing hidden dimension of the inference network improves results. Generally, we obtain better results (in both train and validation error) with $M = 1 0 0$ than training with $M = 1$ across the various configurations of the inference network that we tried. Furthermore, we find that when $M = 1 0 0$ , the inference network architecture is less relevant and all models converge to approximately the same result suggesting that the procedure treats the output of the inference network as a crude initialization for the variational parameters and that the subsequent steps of optimization are primarily responsible for gains in learning.
|
| 265 |
+
|
| 266 |
+
Table 5: Train and Test Perplexity on RCV2: The tables herein show the train and held out bounds on perplexity obtained while varying the structure of the inference network. The top table depicts results for $M = 1$ and the bottom table for $M = 1 0 0$ . The values along the rows and columns depict different parameters for the inference network.
|
| 267 |
+
|
| 268 |
+
<table><tr><td rowspan="2"></td><td rowspan="2">Dimension</td><td colspan="2">1 layer</td><td colspan="2">2 layer</td><td colspan="2">3 layer</td></tr><tr><td>Train</td><td>Validate</td><td>Train</td><td>Validate</td><td>Train</td><td>Validate</td></tr><tr><td rowspan="4">M=1</td><td>100</td><td>337.01</td><td>351.26</td><td>357.28</td><td>371.37</td><td>390.00</td><td>407.15</td></tr><tr><td>400</td><td>322.94</td><td>340.45</td><td>331.36</td><td>347.95</td><td>338.09</td><td>355.64</td></tr><tr><td rowspan="2">Dimension</td><td>1 layer</td><td></td><td></td><td>2 layer</td><td></td><td>3 layer</td></tr><tr><td>Train</td><td>Validate</td><td>Train</td><td>Validate</td><td>Train</td><td>Validate</td></tr><tr><td rowspan="2">M=100</td><td>100</td><td>317.84</td><td>333.64</td><td>318.03</td><td>334.54</td><td>318.04</td><td>335.92</td></tr><tr><td>400</td><td>314.75</td><td>332.35</td><td>314.04</td><td>332.40</td><td>313.95</td><td>332.04</td></tr></table>
|
| 269 |
+
|
| 270 |
+
APPENDIX B NETFLIX: EMBEDDINGS FOR MOVIES
|
| 271 |
+
|
| 272 |
+
The Netflix dataset Netflix (2009) comprises movie ratings of 500, 000 users. We treat each user’s ratings as a document and model the numbers ascribed to each movie (from $1 - 5 )$ as counts drawn from the multinomial distribution parameterized as in Eq. 1. We train a three-layer DLGM on the dataset, evaluate $\mathcal { I } _ { \bf m e a n }$ with 100 samples and consider two distinct methods of evaluating the learned embeddings. We cluster the movie embeddings (using spectral clustering with cosine distance to obtain 100 clusters) and depict some of the clusters in Table 6a. We find that clusters exhibit coherent themes such as documentary films, horror and James Bond movies. Other clusters (not displayed) included multiple seasons of the same show such as Friends, WWE wrestling, and Pokemon. In Table 6b, we visualize the neighbors of some popular films. In the examples we visualize, the nearest neighbors include sequels, movies from the same franchise or, as in the case of 12 Angry Men, other dramatic classics.
|
| 273 |
+
|
| 274 |
+
To compare the effect of using a model to create embeddings versus using the raw data from a large dataset directly, we evaluated nearest neighbors of movies using a simple baseline. For a query movie, we found all users who gave the movie a rating of 3 or above (nominally, they watched and liked the movie). Then, for all those users, we computed the mean ratings they gave to every other movie in the vocabulary and ranked them based on the mean ratings. We display the top five movies obtained using this approach in Table 6. The query words are the same as in Table 6b. For most of the queries, the difference between the two is evident and we simply end up with popular, well-liked movies rather than relevant movies.
|
| 275 |
+
|
| 276 |
+
Cluster Name
|
| 277 |
+
Movies
|
| 278 |
+
|
| 279 |
+
<table><tr><td rowspan=1 colspan=1>DocumentaryFilms</td><td rowspan=1 colspan=1>Nature:Antarctica,Ken Burns’America:Empire of the Air,Travel the World byTrain:Africa,Deepak Chopra: The Way of the Wizard & Alchemy,The HistoryChannel Presents: Troy: Unearthing the Legend</td></tr><tr><td rowspan=1 colspan=1>Concerts</td><td rowspan=1 colspan=1>Neil Diamond: Greatest Hits Live,Meat Loaf: Bat Out of Hell, Ricky Martin:One Night Only,Beyonce: Live at Wembley,Enigma: MCMXC A.D, SarahBrightman: In Concert</td></tr><tr><td rowspan=1 colspan=1>Horror Movies</td><td rowspan=1 colspan=1>Halloween 5: The Revenge of Michael Myers, Halloween: H2O, Creepshow,Children of the Corn,Poltergeist,Friday the 13th: Part 3,The Omen, Cujo</td></tr><tr><td rowspan=1 colspan=1>JamesBond</td><td rowspan=1 colspan=1>ForYour Eyes Only,Goldfinger, The LivingDaylights,Thunderball, FromRussia With Love,Dr. No</td></tr><tr><td rowspan=1 colspan=2>Hindi Movies Seeta Aur Geeta,Gupt,Mann, Jeans, Coolie No.1,Mission Kashmir,Rangeela,Baazigar,Daud, Zakhm(a) Clustering Movie Embeddings:We display some of the clusters found from clustering the moviedings.The names were assigned based on salient features of movies in the cluster</td></tr></table>
|
| 280 |
+
|
| 281 |
+
Cluster Name
|
| 282 |
+
Movies
|
| 283 |
+
|
| 284 |
+
<table><tr><td>Superman II</td><td>Superman: The Movie, Superman II, Superman IV: The Quest for Peace, RoboCop,Batman Returns</td></tr><tr><td>Casablanca</td><td>Citizen Kane,The Treasure of the Sierra Madre,Working with Orson Welles,The Millionairess,Indiscretion of an American Wife,Doctor Zhivago</td></tr><tr><td>Bride of Chucky</td><td>Bride of Chucky,Leprechaun 3,Leprechaun, Wes Craven's New Night- mare,Child's Play 2: Chucky's Back</td></tr><tr><td>The Princess Bride</td><td>The Breakfast Club,Sixteen Candles,Groundhog Day,Beetlejuice, Stand by Me,Pretty in Pink</td></tr><tr><td>12 Angry Men</td><td>To Killä Mockingbird, Rear Window,Mr. Smith Goes to Washington, Inherit the Wind,Vertigo,The Maltese Falcon</td></tr><tr><td colspan="2">(b) Movie Neighbors: We visualize some of the closest neighbors found to movies whose title is displayed the column on the left</td></tr></table>
|
| 285 |
+
|
| 286 |
+
Movies
|
| 287 |
+
|
| 288 |
+
<table><tr><td>Superman II Casablanca</td><td>LOTR:The Two Towers,PotC:The Curse of theBlackPearl,Raiders of the Lost Ark,LOTR: The Fellowship of the Ring To Killa Mockingbird,The Usual Suspects,The Shawshank Redemption,</td></tr><tr><td></td><td>Citizen Kane,The Wizard of Oz</td></tr><tr><td>Bride of Chucky</td><td>The Matrix, Independence Day, The Silence of the Lambs,PotC: The Curse of the Black Pearl, The Sixth Sense</td></tr><tr><td>The Princess Bride</td><td>The Shawshank Redemption,Forrest Gump,LOTR: The Two Towers, LOTR:The Fellowship of the Ring,PotC: The Curse of the Black Pearl</td></tr><tr><td>12 Angry Men</td><td>LOTR: The Fellowship of the Ring,PotC: The Curse of the Black Pear, The Godfather,Forrest Gump,The Shawshank Redemption</td></tr></table>
|
| 289 |
+
|
| 290 |
+
(c) Movie Neighbors [Baseline]: We visualize some of the closest neighbors to a given query movie. We using a simple baseline that rates every movie based on average scores given by all the users who liked (rating greater than three) the query movie. LOTR (Lord of the Rings), PotC (Pirates of the Caribbean)
|
| 291 |
+
|
| 292 |
+
Table 6: Qualitative Evaluation of Movie Embeddings: We evaluate $\mathcal { T } _ { \mathrm { m e a n } } ^ { \mathrm { l o g } }$ using 100 Monte-Carlo samples to perform the evaluation in Tables 6a and 6b.
|
| 293 |
+
|
| 294 |
+
# APPENDIX C WIKIPEDIA: EMBEDDINGS FOR WORD
|
| 295 |
+
|
| 296 |
+
Table 7 is the full version of Table 3 in the main paper. We find that the three variants of the Jacobian vectors perform comparably across the board. The vectors obtained from shallow log-linear models appear to have the edge. The evaluation on the WordSim and SCWS datasets are done by computing the Spearman rank correlation between human annotated rankings between 1 and 10 and an algorithmically derived measures of word-pair similarity. We first compute the distances between all word pairs. Our measure of similarity is obtained by subtracting the distances from the maximal distance across all word pairs.
|
| 297 |
+
|
| 298 |
+
<table><tr><td>Models</td><td>Spearman ρ ×100</td></tr><tr><td>Huang(G)</td><td>22.8</td></tr><tr><td>Huang</td><td>71.3</td></tr><tr><td>Glove</td><td>75.9</td></tr><tr><td>C&W</td><td>55.3</td></tr><tr><td>ESA</td><td>75</td></tr><tr><td>Tiered Pruned tf-idf</td><td>76.9</td></tr><tr><td>1-M1 7log Jmean</td><td>65.8</td></tr><tr><td>1-M1 7prob Jmean</td><td>69.7</td></tr><tr><td>1-M1 7.pot</td><td>66.3</td></tr><tr><td>Jmean 1-M100 log</td><td>66.3</td></tr><tr><td>Jmean 1-M100 7prob</td><td></td></tr><tr><td>Jmean 7Pot</td><td>70.9</td></tr><tr><td>1-M100 Jmean</td><td>69.5</td></tr><tr><td>3-M1 log Jmean</td><td>45</td></tr><tr><td>3-M1 7prob Jmean</td><td>46.9</td></tr><tr><td>3-M1 7pot Jmean</td><td>43.9</td></tr><tr><td>3-M100 7log Jmean</td><td>59.6</td></tr><tr><td>3-M100 7prob Jmean</td><td>59.6</td></tr><tr><td>3-M100 7Pot Jmean</td><td>57.8</td></tr></table>
|
| 299 |
+
|
| 300 |
+
(a) WordSim353: “G” denotes the model in Huang et al. learned only with global context in the document.
|
| 301 |
+
|
| 302 |
+
<table><tr><td>Models</td><td>Spearman ρ ×100</td></tr><tr><td>Huang (S)</td><td>58.6</td></tr><tr><td>Huang (M)</td><td>65.7</td></tr><tr><td>C&W</td><td>57</td></tr><tr><td>tf-idf-S</td><td>26.3</td></tr><tr><td>Pruned tf-idf-S</td><td>62.5</td></tr><tr><td>Pruned tf-idf-M 7log</td><td>60.5</td></tr><tr><td>1-M1 Jmean 7prob</td><td>59.9</td></tr><tr><td>1-M1 Jmean</td><td>61.7</td></tr><tr><td>1-M1 7pot Jmean</td><td>60.4</td></tr><tr><td>1-M100 7log Jmean</td><td>58.1</td></tr><tr><td>1-M100 .7prob J mean</td><td>61.1</td></tr><tr><td>1-M100 7Pot Jmean</td><td>59.9</td></tr><tr><td>3-M1 7log</td><td>54.9</td></tr><tr><td>mean 3-M1 7prob</td><td>52.2</td></tr><tr><td>L mean 7pot</td><td></td></tr><tr><td>3-M1 mean</td><td>53.2</td></tr><tr><td>3-M100 7log Jmean</td><td>59.6</td></tr><tr><td>3-M100 .7prob Jmean</td><td>59.5</td></tr><tr><td>3-M100 7Pot Jmean</td><td>57.9</td></tr></table>
|
| 303 |
+
|
| 304 |
+
(b) SCWS: (S) denotes a single prototype approach versus (M) that denotes a multiprototype approach (that leverages context)
|
| 305 |
+
|
| 306 |
+
Table 7: Semantic Similarity in Words: The baseline results are taken from (Huang et al., 2012). C&W uses embeddings from the language model of (Collobert & Weston, 2008). Glove corresponds to embeddings by (Pennington et al., 2014). Three words: ‘y2k, insufflate, sincere’ from the evaluation datasets were not found in our vocabulary after pre-processing and not used in the evaluation
|
| 307 |
+
|
| 308 |
+
# APPENDIX D EHR DATA: EMBEDDINGS FOR DIAGNOSIS CODES
|
| 309 |
+
|
| 310 |
+
For EHR data in particular, the bag-of-diagnosis-codes assumption we make is a crude one since (1) we assume the temporal nature of the patient data is irrelevant, and (2) combining patient statistics over time renders it difficult for the generative model to disambiguate the correlations between codes that correspond to multiple diseases a patient may suffer from. Despite this, it is interesting that the Jacobian vectors still capture much of the meaningful structure among the diagnosis codes (c.f Table 2c, 8b). Here we provide additional details surrounding the evaluating of medical embeddings.
|
| 311 |
+
|
| 312 |
+
$\mathbf { M R M } _ { \mathbf { C C S } } ( V , G )$ : The Agency for Healthcare Research and Quality’s clinical classification software (CCS) collapses the hierarchical ICD9 diagnosis codes into clinically meaningful categories. The evaluation on CCS checks whether the nearest neighbors of a disease include other diseases related to it (if they are in the same category in the CCS). Using the ICD9 hierarchy, the authors further split the evaluation task into predicting neighbors of fine-grained and coarse grained diagnosis codes.
|
| 313 |
+
|
| 314 |
+
For a choice of granularity $G \in \{ \mathrm { { f i n e , c o a r s e } } \}$ , $V ( G ) \in V$ denotes the subset of ICD9 codes in the vocabulary. $\mathbb { I } _ { G } ( v ( i ) )$ is one if the $v$ ’s i’th nearest neighbor: $v ( i )$ is in the same group as $v$ according to $G$ .
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\mathbf { M R M } _ { \mathrm { C C S } } ( V , G ) = \frac { 1 } { | V ( G ) | } \sum _ { v \in V ( G ) } \sum _ { k = 1 } ^ { 4 0 } \frac { \mathbb { I } _ { G } ( v ( i ) ) } { \log _ { 2 } ( i + 1 ) }
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
$\mathbf { M R M } _ { \mathrm { N D F - R T } } ( V , R )$ : The other evaluation uses the National Drug File Reference Terminology (NDF-RT) to evaluate analogical reasoning. The NDF-RT provides two kinds of relationships $( R )$ between drugs and diseases: May-Treat (if the drug may be used to treat the disease) and May-Prevent. Given $\phi _ { A }$ as the embedding for a code $A$ , this test automates the evaluation of analogies such as $\underbrace { \phi _ { \mathrm { D i a b e t e s } } } _ { r } \approx \underbrace { \phi _ { \mathrm { M e t f o r m i n } } } _ { v } - \underbrace { ( \phi _ { \mathrm { L u n g ~ C a n c e r } } - \phi _ { \mathrm { T a r c e v a } } ) } _ { s }$ . Here $v$ is the query code and $s$ is a representation of the relationship we seek. (Metformin is a diabetic drug and Tarceva is used in the treatment of lung cancer.) The evaluation we perform reports a number proportional to the number of times the neighborhood of $v - s$ contains $r$ for the best value of $s$ (computed from the set of all valid drug-disease relationships in the datasets.)
|
| 321 |
+
|
| 322 |
+
Given $V ^ { * } \in V$ (concepts for which NDF-RT has at-least one substance with the given relation), $\mathbb { I } _ { R } \left( \cup _ { i = 1 } ^ { 4 0 } ( v - s ) ( i ) \right)$ is one if any of the medical concepts in the top-40 neighborhood of the selected medical concept $v$ satisfies relation $R$ .
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\mathsf { M R M } _ { \mathrm { N D F - R T } } ( V , R ) = \frac { 1 } { | V ^ { * } | } \sum _ { v \in V ^ { * } } \mathbb { I } _ { R } \left( \cup _ { i = 1 } ^ { 4 0 } ( v - s ) ( i ) \right)
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
In both cases the choice of 40 was adopted to maintain consistency with (Choi et al., 2016). The evaluation is conducted by taking the average result over all possible seeds $s$ and the best possible seed $s$ for a query.
|
| 329 |
+
|
| 330 |
+
Table 8a depicts two examples of using the learned embeddings in the Jacobian matrix to answer tasks queries related to drug-disease pairs. Table 8b depicts clusters found in medical diagnosis codes. Table 9 is the extended version of Table 4 in the main paper (where, for the comparison on NDF-RT, we depict the results obtained from the best choice of seed $s$ ).
|
| 331 |
+
|
| 332 |
+
<table><tr><td rowspan=1 colspan=1>Code 1</td><td rowspan=1 colspan=1>Code 2</td><td rowspan=1 colspan=1>Code 3</td><td rowspan=1 colspan=1>Neighborsof Result</td></tr><tr><td rowspan=1 colspan=1>Evoxac</td><td rowspan=1 colspan=1>Sicca Syndrome</td><td rowspan=1 colspan=1>Methotrexate</td><td rowspan=1 colspan=1>Rheumatoid Arthritis</td></tr><tr><td rowspan=1 colspan=1>Biliary Atresia</td><td rowspan=1 colspan=1>Kidney Transplant</td><td rowspan=1 colspan=1>Leg Varicosity w/ In-flammation</td><td rowspan=1 colspan=1>Ligation of angioaccessarteriovenous fistula</td></tr></table>
|
| 333 |
+
|
| 334 |
+
(a) Medical Analogies: We can perform analogical reasoning with embeddings of medical codes. If we know a drug used to treat a disease, we can use their relationship in vector space to find unknown drugs associated with a different disease. The queries are of the form Code $1 $ Code $2 \Longrightarrow$ Code $3 ?$ . Sicca syndrome or Sjogren’s disease is an immune disease treated with Evoxac and Methotrexate is commonly used to treat Rheumatoid Arthiritis. “ Leg Varicosity” denotes the presence of swollen veins under the skin. “Ligation of angioaccess arteriovenous fistula” denotes the tying of passage between an artery and a vein.
|
| 335 |
+
|
| 336 |
+
(b) Medical Embeddings (Clustering): We visualize some topical clusters of diagnosis codes.
|
| 337 |
+
|
| 338 |
+
<table><tr><td rowspan=1 colspan=1>Label</td><td rowspan=1 colspan=1>Diagnosis Codes</td></tr><tr><td rowspan=1 colspan=1>Thrombosis</td><td rowspan=1 colspan=1>HxVenous Thrombosis, Compression Of Vein,Renal Vein Thrombosis</td></tr><tr><td rowspan=1 colspan=1>Occular Atrophy</td><td rowspan=1 colspan=1>Optic Atrophy,RetinaLayer Separation, Chronic Endophthalmitis</td></tr><tr><td rowspan=1 colspan=1>Drug Use</td><td rowspan=1 colspan=1>Opioid Dependence,Alcohol Abuse-Continuous,Hallucinogen Dep</td></tr></table>
|
| 339 |
+
|
| 340 |
+
Table 9: Medical Relatedness Measure: Evaluated using the NDF-RT and CCS ontologies. For the evaluation on NDF-RT, there is a choice of $s$ (Eq 7) to be made. The results are reported both by averaging across all pairs of drugs-diseases used to form $s$ (avg-seed) and the best drug-disease pair (max-seed). SCUIs corresponds to the application of the method developed by (Choi et al., 2016) on data released by (Finlayson et al., 2014)
|
| 341 |
+
|
| 342 |
+
<table><tr><td>Models</td><td>MRMNDF-RT (May Treat)</td><td>MRMNDF-RT (May Prevent)</td><td>MRMccs (Fine Grained)</td><td>MRMccs (Coarse Grained)</td></tr><tr><td>(De Vine et al.,2014)</td><td>31.34/53.21</td><td>34.47/57.14</td><td>22.63</td><td>24.56</td></tr><tr><td>(Choi et al., 2016)</td><td>36.62/59.40</td><td>28.02/55.71</td><td>44.80</td><td>47.43</td></tr><tr><td>SCUI</td><td>34.89/52.75</td><td>30.95/48.57</td><td>34.16</td><td>37.31</td></tr><tr><td>1-M1 7log Jmean</td><td>4.08/54.36</td><td>19.90/34.29</td><td>30.82</td><td>34.04</td></tr><tr><td>1-M1 .7prob Jmean</td><td>33.87/56.19</td><td>22.41/34.29</td><td>31.76</td><td>35.07</td></tr><tr><td>1-M1 7pot Jmean</td><td>27.45/59.63</td><td>15.02/32.86</td><td>31.58</td><td>33.88</td></tr><tr><td>1-M100 7log Jmean</td><td>33.32/54.82</td><td>19.02/35.71</td><td>33.04</td><td>35.78</td></tr><tr><td>1-M100 .7prob Jmean</td><td>30.70/53.90</td><td>21.66 /34.29</td><td>32.86</td><td>35.66</td></tr><tr><td>1-M100</td><td>28.49/55.73</td><td>15.56/31.43</td><td>32.87</td><td>35.09</td></tr><tr><td>3-M1 7log Jmean</td><td>33.21/52.29</td><td>23.84/42.86</td><td>32.80</td><td>37.58</td></tr><tr><td>3-M1</td><td>12.12/30.28</td><td>7.62 /17.14</td><td>23.42</td><td>26.85</td></tr><tr><td>3-M1 7pot Jmean</td><td>33.30/51.61</td><td>23.47/41.43</td><td>33.02</td><td>37.84</td></tr><tr><td>3-M100 7log Jmean</td><td>37.00/61.47</td><td>23.70/42.86</td><td>37.54</td><td>40.52</td></tr><tr><td>3-M100 7prob Jmean</td><td>9.79/21.33</td><td>4.39 / 11.43</td><td>7.82</td><td>8.60</td></tr><tr><td>3-M100</td><td>36.11/60.32</td><td>22.26/38.57</td><td>37.77</td><td>40.87</td></tr></table>
|
md/train/r1YNw6sxg/r1YNw6sxg.md
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING VISUAL SERVOING WITH DEEP FEATURES AND FITTED Q-ITERATION
|
| 2 |
+
|
| 3 |
+
Alex X. Lee†, Sergey Levine†, Pieter Abbeel‡†§
|
| 4 |
+
|
| 5 |
+
† UC Berkeley, Department of Electrical Engineering and Computer Sciences
|
| 6 |
+
‡ OpenAI
|
| 7 |
+
§ International Computer Science Institute
|
| 8 |
+
{alexlee gk,svlevine,pabbeel}@cs.berkeley.edu
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Visual servoing involves choosing actions that move a robot in response to observations from a camera, in order to reach a goal configuration in the world. Standard visual servoing approaches typically rely on manually designed features and analytical dynamics models, which limits their generalization capability and often requires extensive application-specific feature and model engineering. In this work, we study how learned visual features, learned predictive dynamics models, and reinforcement learning can be combined to learn visual servoing mechanisms. We focus on target following, with the goal of designing algorithms that can learn a visual servo using low amounts of data of the target in question, to enable quick adaptation to new targets. Our approach is based on servoing the camera in the space of learned visual features, rather than image pixels or manually-designed keypoints. We demonstrate that standard deep features, in our case taken from a model trained for object classification, can be used together with a bilinear predictive model to learn an effective visual servo that is robust to visual variation, changes in viewing angle and appearance, and occlusions. A key component of our approach is to use a sample-efficient fitted Q-iteration algorithm to learn which features are best suited for the task at hand. We show that we can learn an effective visual servo on a complex synthetic car following benchmark using just 20 training trajectory samples for reinforcement learning. We demonstrate substantial improvement over a conventional approach based on image pixels or hand-designed keypoints, and we show an improvement in sample-efficiency of more than two orders of magnitude over standard model-free deep reinforcement learning algorithms. Videos are available at http://rll.berkeley.edu/visual_servoing.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Visual servoing is a classic problem in robotics that requires moving a camera or robot to match a target configuration of visual features or image intensities. Many robot control tasks that combine perception and action can be posed as visual servoing, including navigation (DeSouza & Kak, 2002; Chen et al., 2006), where a robot must follow a desired path; manipulation, where the robot must servo an end-effector or a camera to a target object to grasp or manipulate it (Malis et al., 1999; Corke, 1993; Hashimoto, 1993; Hosoda & Asada, 1994; Kragic & Christensen, 2002); and various other problems, as surveyed in Hutchinson et al. (1996). Most visual servoing methods assume access to good geometric image features (Chaumette & Hutchinson, 2006; Collewet et al., 2008; Caron et al., 2013) and require knowledge of their dynamics, which are typically obtained from domain knowledge about the system. Using such hand-designed features and models prevents exploitation of statistical regularities in the world, and requires manual engineering for each new system.
|
| 17 |
+
|
| 18 |
+
In this work, we study how learned visual features, learned predictive dynamics models, and reinforcement learning can be combined to learn visual servoing mechanisms. We focus on target following, with the goal of designing algorithms that can learn a visual servo using low amounts of data of the target in question, so as to be easy and quick to adapt to new targets. Successful target following requires the visual servo to tolerate moderate variation in the appearance of the target, including changes in viewpoint and lighting, as well as occlusions. Learning invariances to all such distractors typically requires a considerable amount of data. However, since a visual servo is typically specific to a particular task, it is desirable to be able to learn the servoing mechanism very quickly, using a minimum amount of data. Prior work has shown that the features learned by large convolutional neural networks on large image datasets, such as ImageNet classification (Deng et al., 2009), tend to be useful for a wide range of other visual tasks (Donahue et al., 2014). We explore whether the usefulness of such features extends to visual servoing.
|
| 19 |
+
|
| 20 |
+
To answer this question, we propose a visual servoing method that uses pre-trained features, in our case obtained from the VGG network (Simonyan & Zisserman, 2014) trained for ImageNet classification. Besides the visual features, our method uses an estimate of the feature dynamics in visual space by means of a bilinear model. This allows the visual servo to predict how motion of the robot’s camera will affect the perceived feature values. Unfortunately, servoing directly on the high-dimensional features of a pre-trained network is insufficient by itself to impart robustness on the servo: the visual servo must not only be robust to moderate visual variation, but it must also be able to pick out the target of interest (such as a car that the robot is tasked with following) from irrelevant distractor objects. To that end, we propose a sample-efficient fitted Q-iteration procedure that automatically chooses weights for the most relevant visual features. Crucially, the actual servoing mechanism in our approach is extremely simple, and simply seeks to minimize the Euclidean distance between the weighted feature values at the next time step and the target. The form of the servoing policy in our approach leads to an analytic and tractable linear approximator for the Qfunction, which leads to a computationally efficient fitted Q-iteration algorithm. We show that we can learn an effective visual servo on a complex synthetic car following benchmark using just 20 training trajectory samples for reinforcement learning. We demonstrate substantial improvement over a conventional approach based on image pixels or hand-designed keypoints, and we show an improvement in sample-efficiency of more than two orders of magnitude over standard model-free deep reinforcement learning algorithms.
|
| 21 |
+
|
| 22 |
+
The environment for the synthetic car following benchmark is available online as the package $\mathrm { C i t y S i m } 3 \mathrm { D } ^ { \mathrm { 1 } }$ , and the code to reproduce our method and experiments is also available online2. Supplementary videos of all the test executions are available on the project’s website3.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
Visual servoing is typically (but not always) performed with calibrated cameras and carefully designed visual features. Ideal features for servoing should be stable and discriminative, and much of the work on visual servoing focuses on designing stable and convergent controllers under the assumption that such features are available (Espiau et al., 2002; Mohta et al., 2014; Wilson et al., 1996). Some visual servoing methods do not require camera calibration (Jagersand et al., 1997; Yoshimi & Allen, 1994), and some recent methods operate directly on image intensities (Caron et al., 2013), but generally do not use learning to exploit statistical regularities in the world and improve robustness to distractors.
|
| 27 |
+
|
| 28 |
+
Learning is a relatively recent addition to the repertoire of visual servoing tools. Several methods have been proposed that apply ideas from reinforcement learning to directly acquire visual servoing controllers (Lampe & Riedmiller, 2013; Sadeghzadeh et al., 2015). However, such methods have not been demonstrated under extensive visual variation, and do not make use of state-of-the-art convolutional neural network visual features. Though more standard deep reinforcement learning methods (Lange et al., 2012; Mnih et al., 2013; Levine et al., 2016; Lillicrap et al., 2015) could in principle be applied to directly learn visual servoing policies, such methods tend to require large numbers of samples to learn task-specific behaviors, making them poorly suited for a flexible visual servoing algorithm that can be quickly repurposed to new tasks (e.g. to following a different object).
|
| 29 |
+
|
| 30 |
+
Instead, we propose an approach that combines learning of predictive models with pre-trained visual features. We use visual features trained for ImageNet (Deng et al., 2009) classification, though any pre-trained features could in principle be applicable for our method, so long as they provide a suitable degree of invariance to visual distractors such as lighting, occlusion, and changes in viewpoint. Using pre-trained features allows us to avoid the need for large amounts of experience, but we must still learn the policy itself. To further accelerate this process, we first acquire a predictive model that allows the visual servo to determine how the visual features will change in response to an action. General video prediction is an active research area, with a number of complex but data-hungry models proposed in recent years (Oh et al., 2015; Watter et al., 2015; Mathieu et al., 2015; Xue et al., 2016; Lotter et al., 2016; Jia et al., 2016; Walker et al., 2016; Vondrick et al., 2016).
|
| 31 |
+
|
| 32 |
+
However, we observe that convolutional response maps can be interpreted as images and, under mild assumptions, the dynamics of image pixels during camera motion can be well approximated by means of a bilinear model (Censi & Murray, 2015). We therefore train a relatively simple bilinear model for short-term prediction of visual feature dynamics, which we can use inside a very simple visual servo that seeks to minimize the error between the next predicted feature values and a target image.
|
| 33 |
+
|
| 34 |
+
Unfortunately, simply training predictive models on top of pre-trained features is insufficient to produce an effective visual servo, since it weights the errors of distractor objects the same amount as the object of interest. We address this challenge by using an efficient Q-iteration algorithm to train the weights on the features to maximize the servo’s long-horizon reward. This method draws on ideas from regularized fitted Q-iteration (Gordon, 1995; Ernst et al., 2005; Farahmand et al., 2009) and neural fitted Q-iteration (Riedmiller, 2005) to develop a sample-efficient algorithm that can directly estimate the expected return of the visual servo without the use of any additional function approximator.
|
| 35 |
+
|
| 36 |
+
# 3 PROBLEM STATEMENT
|
| 37 |
+
|
| 38 |
+
Let $\mathbf { y } _ { t }$ be a featurization of the camera’s observations $\mathbf { x } _ { t }$ and let $\mathbf { y } _ { \ast }$ be some given goal feature map. For the purposes of this work, we define visual servoing as the problem of choosing controls $\mathbf { u } _ { t }$ for a fixed number of discrete time steps $t$ as to minimize the error $\| \mathbf { y } _ { * } - \mathbf { y } _ { t } \|$ .
|
| 39 |
+
|
| 40 |
+
We use a relatively simple gradient-based servoing policy that uses one-step feature dynamics, $f : \{ \mathbf { y } _ { t } , \mathbf { u } _ { t } \} \mathbf { y } _ { t + 1 }$ . The policy chooses the control that minimizes the distance between the goal feature map and the one-step prediction:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\pi ( \mathbf { x } _ { t } , \mathbf { x } _ { * } ) = \arg \operatorname* { m i n } _ { \mathbf { u } } \left\| \mathbf { y } _ { * } - f ( \mathbf { y } _ { t } , \mathbf { u } ) \right\| ^ { 2 } .
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
Learning this policy amounts to learning the robot dynamics and the distance metric $\lVert \cdot \rVert$
|
| 47 |
+
|
| 48 |
+
To learn the robot dynamics, we assume that we have access to a dataset of paired observations and controls $\mathbf { x } _ { t } , \mathbf { u } _ { t } , \mathbf { x } _ { t + 1 }$ . This data is relatively easy to obtain as it involves collecting a stream of the robot’s observations and controls. We use this dataset to learn a general visual dynamics model that can be used for any task.
|
| 49 |
+
|
| 50 |
+
To learn the distance metric, we assume that the robot interacts with the world and collects tuples of the form $\mathbf { x } _ { t } , \mathbf { u } _ { t } , c _ { t } , \mathbf { x } _ { t + 1 } , \mathbf { x } _ { * }$ . At every time step during learning, the robot observes $\mathbf { x } _ { t }$ and takes action $\mathbf { u } _ { t }$ . After the transition, the robot observes $\mathbf { x } _ { t + 1 }$ and receives an immediate cost $c _ { t }$ . This cost is task-specific and it quantifies how good that transition was in order to achieve the goal. At the beginning of each trajectory, the robot is given a goal observation $\mathbf { x } _ { * }$ , and it is the same throughout the trajectory. We define the goal feature map to be the featurization of the goal observation. We learn the distance metric using reinforcement learning and we model the environment as a Markov Decision Process (MDP). The state of the MDP is the tuple of the current observation and the episode’s target observation, $\mathbf { s } _ { t } = ( \mathbf { x } _ { t } , \mathbf { x } _ { * } )$ , the action $\mathbf { u } _ { t }$ is the discrete-time continuous control of the robot, and the cost function maps the states and action $\left( \mathbf { s } _ { t } , \mathbf { u } _ { t } , \mathbf { s } _ { t + 1 } \right)$ to a scalar cost $c _ { t }$ .
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
Figure 1: Multiscale bilinear model. The function $h$ maps images $\mathbf { x }$ to feature maps $\mathbf { y } ^ { ( 0 ) }$ , the operator $d$ downsamples the feature maps $\mathbf { y } ^ { ( l - 1 ) }$ to $\mathbf { y } ^ { ( l ) }$ , and the bilinear function $f ^ { ( l ) }$ predicts the next feature $\hat { \mathbf { y } } ^ { ( l ) }$ . The number of channels for each feature map is $n _ { c }$ , regardless of the scale $l$ .
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 2: Dilated VGG-16 network. The intermediate feature maps drawn in a lighter shade are outputs of maxpooling layers. The features maps in the conv4 and conv5 blocks are outputs of dilated convolutions with dilation factors of 2 and 4, respectively.
|
| 57 |
+
|
| 58 |
+
# 4 VISUAL FEATURES DYNAMICS
|
| 59 |
+
|
| 60 |
+
We learn a multiscale bilinear model to predict the visual features of the next frame given the current image from the robot’s camera and the action of the robot. An overview of the model is shown in Figure 1. The learned dynamics can then be used for visual servoing as described in Section 5.
|
| 61 |
+
|
| 62 |
+
# 4.1 VISUAL FEATURES
|
| 63 |
+
|
| 64 |
+
We consider both pixels and semantic features for the visual representation. We define the function $h$ to relate the image $\mathbf { x }$ and its feature ${ \bf y } = h \left( { \bf x } \right)$ . Our choice of semantic features are derived from the VGG-16 network (Simonyan & Zisserman, 2014), which is a convolutional neural network trained for large-scale image recognition on the ImageNet dataset (Deng et al., 2009). Since spatial invariance is undesirable for servoing, we remove some of the max-pooling layers and replace the convolutions that followed them with dilated convolutions, as done by Yu & Koltun (2015). The modified VGG network is shown in Figure 2. We use the model weights of the original VGG-16 network, which are publicly available as a Caffe model (Jia et al., 2014). The features that we use are the outputs of some of the intermediate convolutional layers, that have been downsampled to a $3 2 \times 3 2$ resolution (if necessary) and standarized with respect to our training set.
|
| 65 |
+
|
| 66 |
+
We use multiple resolutions of these features for servoing. The idea is that the high-resolution representations have detailed local information about the scene, while the low-resolution representations have more global information available through the image-space gradients. The features at level $l$ of the multiscale pyramid are denoted as $\mathbf { y } ^ { ( l ) }$ . The features at each level are obtained from the features below through a downsampling operator $d ( \mathbf { y } ^ { ( l - 1 ) } ) = \mathbf { y } ^ { ( l ) }$ that cuts the resolution in half.
|
| 67 |
+
|
| 68 |
+
# 4.2 BILINEAR DYNAMICS
|
| 69 |
+
|
| 70 |
+
The features conditioned $\mathbf { y } _ { t } ^ { ( l ) }$ are usede action predict the corresponding level’s fe, according to a prediction function $\mathbf { y } _ { t + 1 } ^ { ( l ) }$ t time step,. We use a $\mathbf { u } _ { t }$ $f ^ { ( l ) } ( \mathbf { y } _ { t } ^ { ( l ) } , \mathbf { u } _ { t } ) = \hat { \mathbf { y } } _ { t + 1 } ^ { ( l ) }$ bilinear model to represent these dynamics, motivated by prior work (Censi & Murray, 2015). In order to servo at different scales, we learn a bilinear dynamics model at each scale. We consider two variants of the bilinear model in previous work in order to reduce the number of model parameters.
|
| 71 |
+
|
| 72 |
+
The first variant uses fully connected dynamics as in previous work but models the dynamics of each channel independently. When semantic features are used, this model interprets the feature maps as being abstract images with spatial information within a channel and different entities or factors of variation across different channels. This could potentially allow the model to handle moving objects, occlusions, and other complex phenomena.
|
| 73 |
+
|
| 74 |
+
The fully connected bilinear model is quite large, so we propose a bilinear dynamics that enforces sparsity in the parameters. In particular, we constrain the prediction to depend only on the features that are in its local spatial neighborhood, leading to the following locally connected bilinear model:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\hat { \mathbf { y } } _ { t + 1 , c } ^ { ( l ) } = \mathbf { y } _ { t , c } ^ { ( l ) } + \sum _ { j } \left( W _ { c , j } ^ { ( l ) } * \mathbf { y } _ { t , c } ^ { ( l ) } + B _ { c , j } ^ { ( l ) } \right) \mathbf { u } _ { t , j } + \left( W _ { c , 0 } ^ { ( l ) } * \mathbf { y } _ { t , c } ^ { ( l ) } + B _ { c , 0 } ^ { ( l ) } \right) .
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
The parameters are the 4-dimensional tensor $W _ { c , j } ^ { ( l ) }$ and the matrix $B _ { c , j } ^ { ( l ) }$ for each channel $c$ , scale $l$ , and control coordinate $j$ . The last two terms are biases that allow to model action-independent visual changes, such as moving objects. The $^ *$ is the locally connected operator, which is like a convolution but with untied filter weights4.
|
| 81 |
+
|
| 82 |
+
# 4.3 TRAINING VISUAL FEATURE DYNAMICS MODELS
|
| 83 |
+
|
| 84 |
+
The loss that we use for training the bilinear dynamics is the sum of the losses of the predicted features at each level, $\textstyle \sum _ { l = 0 } ^ { L } \ell ^ { ( l ) }$ , where the loss for each level $l$ is the squared \`-2 norm between the predicted features and the actual features of that level, $\boldsymbol { \ell } ^ { ( l ) } = \| \mathbf { y } _ { t + 1 } ^ { ( l ) } - \hat { \mathbf { y } } _ { t + 1 } ^ { ( l ) } \| ^ { 2 }$ .
|
| 85 |
+
|
| 86 |
+
We optimize for the dynamics while keeping the feature representation fixed. This is a supervised learning problem, which we solve with ADAM (Kingma & Ba, 2014). The training set, consisting of triplets $\mathbf { x } _ { t } , \mathbf { u } _ { t } , \mathbf { x } _ { t + 1 }$ , was obtained by executing a hand-coded policy that moves the robot around the target with some Gaussian noise.
|
| 87 |
+
|
| 88 |
+
# 5 LEARNING VISUAL SERVOING WITH REINFORCEMENT LEARNING
|
| 89 |
+
|
| 90 |
+
We propose to use a multiscale representation of semantic features for servoing. The challenge when introducing multiple scales and multi-channel feature maps for servoing is that the features do not necessarily agree on the optimal action when the goal is unattainable or the robot is far away from the goal. To do well, it’s important to use a good weighing of each of the terms in the objective. Since there are many weights, it would be impractically time-consuming to set them by hand, so we resort to learning. We want the weighted one-step lookahead objective to encourage good longterm behavior, so we want this objective to correspond to the state-action value function $Q$ . So we propose a method for learning the weights based on fitted Q-iteration.
|
| 91 |
+
|
| 92 |
+
# 5.1 SERVOING WITH WEIGHTED MULTISCALE FEATURES
|
| 93 |
+
|
| 94 |
+
Instead of attempting to build an accurate predictive model for multi-step planning, we use the simple greedy servoing method in Equation (1), where we minimize the error between the target and predicted features for all the scales. Typically, only a few objects in the scene are relevant, so the errors of some channels should be penalized more than others. Similarly, features at different scales might need to be weighted differently. Thus, we use a weighting $\mathbf { w } _ { c } ^ { ( l ) } \geq 0$ per channel $c$ and scale $l$ :
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\pi ( \mathbf { x } _ { t } , \mathbf { x } _ { * } ) = \arg \operatorname* { m i n } _ { \mathbf { u } } \sum _ { c } \sum _ { l = 0 } ^ { L } \frac { \mathbf { w } _ { c } ^ { ( l ) } } { | \mathbf { y } _ { \cdot , c } ^ { ( l ) } | } \left\| \mathbf { y } _ { * , c } ^ { ( l ) } - f _ { c } ^ { ( l ) } \left( \mathbf { y } _ { t , c } ^ { ( l ) } , \mathbf { u } \right) \right\| _ { 2 } ^ { 2 } + \sum _ { j } \lambda _ { j } \mathbf { u } _ { j } ^ { 2 } ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $| \cdot |$ denotes the cardinality operator and the constant $^ 1 / | \mathbf { y } _ { \cdot , c } ^ { ( l ) } |$ normalizes the feature errors by its spatial resolution. We also use a separate weight $\lambda _ { j }$ for each control coordinate $j$ . This optimization can be solved efficiently since the dynamics is linear in the controls (see Appendix A).
|
| 101 |
+
|
| 102 |
+
# 5.2 Q-FUNCTION APPROXIMATION FOR THE WEIGHTED SERVOING POLICY
|
| 103 |
+
|
| 104 |
+
We choose a Q-value function approximator that can represent the servoing objective such that the greedy policy with respect to the Q-values results in the policy of Equation (3). In particular, we use a function approximator that is linear in the weight parameters $\pmb { \theta } ^ { \top } = \left[ \mathbf { w } ^ { \top } \quad \lambda ^ { \top } \right]$ :
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\begin{array} { r l } & { Q _ { \theta , b } ( \mathbf { s } _ { t } , \mathbf { u } ) = \phi ( \mathbf { s } _ { t } , \mathbf { u } ) ^ { \top } \pmb \theta + b , \quad \phi \left( \mathbf { s } _ { t } , \mathbf { u } \right) ^ { \top } = \left[ \left[ \frac { 1 } { \left| \mathbf { y } _ { \cdot , c } ^ { ( l ) } \right| } \left\| \mathbf { y } _ { \ast , c } ^ { ( l ) } - f _ { c } ^ { ( l ) } \left( \mathbf { y } _ { t , c } ^ { ( l ) } , \mathbf { u } \right) \right\| _ { 2 } ^ { 2 } \right] _ { c , l } ^ { \top } \quad \left[ \mathbf { u } _ { j } ^ { 2 } \right] _ { j } ^ { \top } \right] . } \end{array}
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
We denote the state of the MDP as $\mathbf { s } _ { t } = ( \mathbf { x } _ { t } , \mathbf { x } _ { * } )$ and add a bias $b$ to the Q-function. The servoing policy is then simply $\begin{array} { r } { \pi _ { \pmb { \theta } } ( \mathbf { s } _ { t } ) = \arg \operatorname* { m i n } _ { \mathbf { u } } Q _ { \pmb { \theta } , b } ( \mathbf { s } _ { t } , \mathbf { u } ) } \end{array}$ . For reinforcement learning, we optimized for the weights $\pmb { \theta }$ but kept the feature representation and its dynamics fixed.
|
| 111 |
+
|
| 112 |
+
# 5.3 LEARNING THE Q-FUNCTION WITH FITTED Q-ITERATION
|
| 113 |
+
|
| 114 |
+
Reinforcement learning methods that learn a Q-function do so by minimizing the Bellman error:
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
\left. Q \left( \mathbf { s } _ { t } , \mathbf { u } _ { t } \right) - \left( c _ { t } + \gamma \operatorname* { m i n } _ { \mathbf { u } } Q \left( \mathbf { s } _ { t + 1 } , \mathbf { u } \right) \right) \right. _ { 2 } ^ { 2 } .
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
In fitted Q-iteration, the agent iteratively gathers a dataset according to an exploration policy, and then minimizes the B $\{ \mathbf { s } _ { t } ^ { ( i ) } , \mathbf { u } _ { t } ^ { ( i ) } , c _ { t } ^ { ( i ) } , \mathbf { s } _ { t + 1 } ^ { ( i ) } \} _ { i } ^ { N }$ of data $N$ samples. We use the term sampling iteration to refer to each iteration $j$ of this procedure. At the beginning of each sampling iteration, the current policy with added Gaussian noise is used as the exploration policy.
|
| 121 |
+
|
| 122 |
+
It is typically hard or unstable to optimize for both Q-functions that appear in the Bellman error of Equation (4), so it is usually optimized by iteratively optimizing the current Q-function while keeping the target Q-function constant. However, we notice that for a given state, the action that minimizes its Q-values is the same for any non-negative scaling $\alpha$ of $\pmb \theta$ and for any bias $b$ . Thus, to speed up the optimization of the Q-function, we first set $\alpha ^ { ( k - \frac { 1 } { 2 } ) }$ and $b ^ { ( k - \frac { 1 } { 2 } ) }$ by jointly solving for $\alpha$ and $b$ of both the current and target Q-function:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\operatorname* { m i n } _ { \boldsymbol { \alpha } \geq 0 , b } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left\| Q _ { \boldsymbol { \alpha } \boldsymbol { \theta } ^ { ( k - 1 ) } , b } \left( \mathbf { s } _ { t } ^ { ( i ) } , \mathbf { u } _ { t } ^ { ( i ) } \right) - \left( c _ { t } ^ { ( i ) } + \gamma \operatorname* { m i n } _ { \mathbf { u } } Q _ { \boldsymbol { \alpha } \boldsymbol { \theta } ^ { ( k - 1 ) } , b } \left( \mathbf { s } _ { t + 1 } ^ { ( i ) } , \mathbf { u } \right) \right) \right\| _ { 2 } ^ { 2 } + \nu \left\| \boldsymbol { \theta } \right\| _ { 2 } ^ { 2 } .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
This is similar to how, in policy evaluation, state values can be computed by solving a linear system. We regularize the parameters with an \`-2 penalty, weighted by $\nu \geq 0$ . We use the term $F Q I$ iteration to refer to each iteration $k$ of optimizing the Bellman error, and we use the notation $\left( k - { \frac { 1 } { 2 } } \right)$ to denote an intermediate step between iterations $\left( k { - } 1 \right)$ and (k). The parameters $\pmb \theta$ can then be updated with $\pmb { \theta } ^ { ( k - \frac { 1 } { 2 } ) } = \alpha ^ { ( k - \frac { 1 } { 2 } ) } \pmb { \dot { \theta } } ^ { ( k - 1 ) }$ . Then, we update $\pmb \theta ^ { ( k ) }$ and $b ^ { ( k ) }$ by optimizing for $\pmb { \theta }$ and $b$ of the current Q-function while keeping the parameters of the target Q-function fixed:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\operatorname* { m i n } _ { \theta \geq 0 , b } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left\| Q _ { \theta , b } \left( \mathbf { s } _ { t } ^ { ( i ) } , \mathbf { u } _ { t } ^ { ( i ) } \right) - \left( c _ { t } ^ { ( i ) } + \gamma \operatorname* { m i n } _ { \mathbf { u } } Q _ { \theta ^ { ( k - \frac { 1 } { 2 } ) } , b ^ { ( k - \frac { 1 } { 2 } ) } } \left( \mathbf { s } _ { t + 1 } ^ { ( i ) } , \mathbf { u } \right) \right) \right\| _ { 2 } ^ { 2 } + \nu \left\| \theta \right\| _ { 2 } ^ { 2 } .
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
A summary of the algorithm used to learn the feature weights is shown in Algorithm 1.
|
| 135 |
+
|
| 136 |
+
# Algorithm 1 FQI with initialization of policy-independent parameters
|
| 137 |
+
|
| 138 |
+
<table><tr><td colspan="2">1: procedure FQ1(0(0), Texploration, V)</td></tr><tr><td>2:</td><td>for s = 1,..., S do sampling iterations</td></tr><tr><td>3:</td><td>ut (i) V using exploration policy N(π(o), gexploration) ,</td></tr><tr><td>4:</td><td>for k =1,...,K do FQI iterations</td></tr><tr><td>5:</td><td>Fit q(𝑘-)and b(k-¹) using (5)</td></tr><tr><td>6:</td><td>0(k-)←a(𝑘-)θ(k-1)</td></tr><tr><td>7:</td><td>Fit 0(k) and b(k) using (6)</td></tr><tr><td>8:</td><td>0(0)←0(K)</td></tr></table>
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 3: Cars used to learn the dynamics and the feature weights. They were also used in some of the test experiments.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 4: Novel cars used only in the test experiments. They were never seen during training or validation.
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 5: Costs of test executions using various feature dynamics models, where the feature weights are optimized with FQI. We test on cars that were used during learning (left plot) and on novel cars that were only used at test time (right plot). The reported values are the mean and standard error across 100 trajectories, of up to 100 time steps each. The policies based on pixel intensities use either fully connected or locally connected dynamics, whereas all the policies based on VGG features use locally connected dynamics. The policies based on deeper VGG features generally achieve better performance, except for the deepest feature representation, VGG conv5 3, which is not as suitable for approximating Q-values. The policies based on pixel intensities and VGG conv5 3 features perform worse on the novel cars. However, VGG features conv1 2 through conv4 3 achieve some degree of generalization on the novel cars.
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
|
| 151 |
+
# 6 EXPERIMENTS
|
| 152 |
+
|
| 153 |
+
We evaluate the performance of the model for visual servoing in a simulated environment. The simulated quadcopter is governed by rigid body dynamics. The robot has 4 degrees of freedom, corresponding to translation along three axis and yaw angle. This simulation is inspired by tasks in which an autonomous quadcopter flies above a city, with the goal of following some target object (e.g., a car).
|
| 154 |
+
|
| 155 |
+
# 6.1 LEARNING FEATURE DYNAMICS AND WEIGHTS WITH FQI
|
| 156 |
+
|
| 157 |
+
The dynamics for each of the features were trained using a dataset of 10000 samples (corresponding to 100 trajectories) with ADAM (Kingma & Ba, 2014). A single dynamics model was learned for each feature representation for all the training cars (Figure 3). This training set was generated by executing a hand-coded policy that navigates the quadcopter around a car for 100 time steps per trajectory, while the car moves around the city.
|
| 158 |
+
|
| 159 |
+
We used the proposed FQI algorithm to learn the weightings of the features and control regularizer. At every sampling iteration, the current policy was executed with Gaussian noise to gather data from 10 trajectories. All the trajectories in our experiments were up to 100 time steps long. The immediate cost received by the agent encodes the error of the target in image coordinates (details in Appendix B). Then, the parameters were iteratively updated by running $K = 1 0$ iterations of FQI. We ran the overall algorithm for only $S = 2$ sampling iterations and chose the parameters that achieved the best performance on 10 validation trajectories. These validation trajectories were obtained by randomly choosing 10 cars from the set of training cars and randomly sampling initial states, and executing the policy with the parameters of the current iteration. All the experiments share the same set of validation trajectories.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Table 1: Sample observations from test executions in our experiments with the novel cars, and the costs for each trajectory, for different feature dynamics. We use the weights learned by our FQI algorithm. In each row, we show the observations of every 10 steps and the last one. The first observation of each trajectory is used as the target observation. The trajectories shown here were chosen to reflect different types of behaviors. The servoing policy based on pixel feature dynamics can generally follow cars that can be discriminated based on RGB pixel intensities (e.g., a yellow car with a relatively uniform background). However, it performs poorly when distractor objects appear throughout the execution (e.g., a lamp) or when they appear in the target image (e.g., the crosswalk markings on the road). On the other hand, VGG conv4 3 features are able to discriminate the car from distractor objects and the background, and the feature weights learned by the FQI algorithm are able to leverage this. Additional sample executions with other feature dynamics can be found in Table 3 in the Appendix.
|
| 163 |
+
|
| 164 |
+
# 6.2 COMPARISON OF FEATURE REPRESENTATIONS FOR SERVOING
|
| 165 |
+
|
| 166 |
+
We compare the servoing performance for various feature dynamics models, where the weights are optimized with FQI. We execute the learned policies on 100 test trajectories and report the average cost of the trajectory rollouts on Figure 5. The cost of a single trajectory is the (undiscounted) sum of costs $c _ { t }$ . We test the policies with cars that were seen during training as well as with a set of novel cars (Figure 4), to evaluate the generalization of the learned dynamics and optimized policies.
|
| 167 |
+
|
| 168 |
+
The test trajectories were obtained by randomly sampling 100 cars (with replacement) from one of the two sets of cars, and randomly sampling initial states (which are different from the ones used for validation). For consistency and reproducibility, the same sampled cars and initial states were used across all the test experiments, and the same initial states were used for both sets of cars. These test trajectories were never used during the development of the algorithm or for choosing hyperparameters.
|
| 169 |
+
|
| 170 |
+
From these results, we notice that policies based on deeper VGG features, up to VGG conv4 3, generally achieve better performance. However, the deepest feature representation, VGG conv5 3, is not as suitable for approximating Q-values. We hypothesize that this feature might be too spatially invariant and it might lack the necessary spatial information to differentiate among different car positions. The policies based on pixel intensities and VGG conv5 3 features perform worse on the novel cars. However, VGG features conv1 2 through conv4 3 achieve some degree of generalization on the novel cars.
|
| 171 |
+
|
| 172 |
+
We show sample trajectories in Table 1. The policy based on pixel-intensities is susceptible to occlusions and distractor objects that appear in the target image or during executions. This is because distinguishing these occlusions and distractors from the cars cannot be done using just RGB features.
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 6: Comparison of costs on test executions of prior methods against our method based on VGG conv4 3 feature dynamics. These costs are from executions with the training cars; the costs are comparable when testing with the novel cars (Table 2). The first two methods use classical image-based visual servoing (IBVS) with feature points from an off-the-shelf keypoint detector and descriptor extractor (ORB features), and with feature points extracted from bounding boxes predicted by a state-of-the-art visual tracker (C-COT tracker), respectively. The third method trains a convolutional neural network (CNN) policy end-to-end with Trust Region Policy Optimization (TRPO). The other methods use the servoing policy based on VGG conv4 3 feature dynamics, either with unweighted features or weights trained with TRPO for either 2 or 50 iterations. In the case of unweighted features, we learned the weights $\boldsymbol { \lambda }$ and a single weight w with the cross entropy method (CEM). We report the number of training trajectories in parenthesis for the methods that require learning. For TRPO, we use a fixed number of training samples per iteration, whereas for CEM and FQI, we use a fixed number of training trajectories per iteration. We use a batch size of 4000 samples for TRPO, which means that at least 40 trajectories were used per iteration (since trajectories can terminate early, i.e. in less than 100 time steps).
|
| 176 |
+
|
| 177 |
+
# 6.3 COMPARISON OF WEIGHTINGS FROM OTHER OPTIMIZATION METHODS
|
| 178 |
+
|
| 179 |
+
We compare our policy using conv4 3 feature dynamics, with weights optimized by FQI, against policies that use these dynamics but with either no feature weighting or weights optimized by other algorithms.
|
| 180 |
+
|
| 181 |
+
For the case of no weighting, we use a single feature weight w but optimize the relative weighting of the controls $\boldsymbol { \lambda }$ with the cross entropy method (CEM) (De Boer et al., 2005). For the other cases, we learn the weights with Trust Region Policy Optimization (TRPO) (Schulman et al., 2015). Since the servoing policy is the minimizer of a quadratic objective (Equation (3)), we represent the policy as a neural network that has a matrix inverse operation at the output. We train this network for 2 and 50 sampling iterations, and use a batch size of 4000 samples per iteration. All of these methods use the same feature representation as ours, the only difference being how the weights w and $\boldsymbol { \lambda }$ are chosen.
|
| 182 |
+
|
| 183 |
+
We report the average costs of these methods on the right of Figure 6. In 2 sampling iterations, the policy learned with TRPO does not improve by much, whereas our policy learned with FQI significantly outperforms the other policies. The policy learned with TRPO improves further in 50 iterations; however, the cost incurred by this policy is still about one and a half times the cost of our policy, despite using more than 100 times as many trajectories.
|
| 184 |
+
|
| 185 |
+
# 6.4 COMPARISON TO PRIOR METHODS
|
| 186 |
+
|
| 187 |
+
We also consider other methods that do not use the dynamics-based servoing policy that we propose.
|
| 188 |
+
We report their average performance on the left of Figure 6.
|
| 189 |
+
|
| 190 |
+
For one of the prior methods, we train a convolutional neural network (CNN) policy end-to-end with TRPO. The policy is parametrized as a 5-layer CNN, consisting of 2 convolutional and 3 fullyconnected layers, with ReLU activations except for the output layer; the convolutional layers use
|
| 191 |
+
|
| 192 |
+
16 filters $4 \times 4$ , stride 2) each and the first 2 fully-connected layers use 32 hidden units each. The policy takes in raw pixel-intensities and outputs controls.
|
| 193 |
+
|
| 194 |
+
This policy achieves a modest performance (although still worse than the policies based on conv4 3 feature dynamics) but it requires significantly more training samples than any of the other learningbased methods. We also trained CNN policies that take in extracted VGG features (without any dynamics) as inputs, but they perform worse (see Table 4 in the Appendix). This suggests that given a policy parametrization that is expressive enough and given a large number of training samples, it is better to directly provide the raw pixel-intensity images to the policy instead of extracted VGG features. This is because VGG features are not optimized for this task and their representation loses some information that is useful for servoing.
|
| 195 |
+
|
| 196 |
+
The other two prior methods use classical image-based visual servoing (IBVS) (Chaumette & Hutchinson, 2006) with respect to Oriented FAST and Rotated BRIEF (ORB) feature points (Rublee et al., 2011), or feature points extracted from a visual tracker. For the former, the target features consist of only the ORB feature points that belong to the car, and this specifies that the car is relevant for the task. For the tracker-based method, we use the Continuous Convolution Operator Tracker (C-COT) (Danelljan et al., 2016) (the current state-of-the-art visual tracker) to get bounding boxes around the car and use the four corners of the box as the feature points for servoing. We provide the ground truth car’s bounding box of the first frame as an input to the C-COT tracker. For all of the IBVS methods, we provide the ground truth depth values of the feature points, which are used in the algorithm’s interaction matrix5.
|
| 197 |
+
|
| 198 |
+
The first method performs poorly, in part because ORB features are not discriminative enough for some of the cars, and the target feature points are sometimes matched to feature points that are not on the car. The tracker-based method achieves a relatively good performance. The gap in performance with respect to our method is in part due to the lack of car dynamics information in the IBVS model, whereas our method implicitly incorporates that in the learned feature dynamics. It is also worth noting that the tracker-based policy runs significantly slower than our method. The open-source implementation of the C-COT tracker6 runs at about $1 \mathrm { H z }$ whereas our policy based on conv4 3 features runs at about $1 6 \mathrm { H z }$ . Most of the computation time of our method is spent computing features from the VGG network, so there is room for speedups if we use a network that is less computationally demanding.
|
| 199 |
+
|
| 200 |
+
# 7 DISCUSSION
|
| 201 |
+
|
| 202 |
+
Manual design of visual features and dynamics models can limit the applicability of visual servoing approaches. We described an approach that combines learned visual features with learning predictive dynamics models and reinforcement learning to learn visual servoing mechanisms. Our experiments demonstrate that standard deep features, in our case taken from a model trained for object classification, can be used together with a bilinear predictive model to learn an effective visual servo that is robust to visual variation, changes in viewing angle and appearance, and occlusions. For control we propose to learn Q-values, building on fitted Q-iteration, which at execution time allows for one-step lookahead calculations that optimize long term objectives. Our method can learn an effective visual servo on a complex synthetic car following benchmark using just 20 training trajectory samples for reinforcement learning. We demonstrate substantial improvement over a conventional approach based on image pixels or hand-designed keypoints, and we show an improvement in sample-efficiency of more than two orders of magnitude over standard model-free deep reinforcement learning algorithms.
|
| 203 |
+
|
| 204 |
+
# ACKNOWLEDGEMENTS
|
| 205 |
+
|
| 206 |
+
This research was funded in part by the Army Research Office through the MAST program and the Berkeley DeepDrive consortium. Alex Lee was also supported by the NSF GRFP.
|
| 207 |
+
|
| 208 |
+
# REFERENCES
|
| 209 |
+
|
| 210 |
+
Herbert Bay, Tinne Tuytelaars, and Luc Van Gool. SURF: Speeded up robust features. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 404–417. Springer, 2006, 2006.
|
| 211 |
+
|
| 212 |
+
Guillaume Caron, Eric Marchand, and El Mustapha Mouaddib. Photometric visual servoing for omnidirectional cameras. Autonomous Robots, 35(2-3):177–193, 2013, 2013.
|
| 213 |
+
|
| 214 |
+
Andrea Censi and Richard M Murray. Bootstrapping bilinear models of simple vehicles. The International Journal of Robotics Research, 34(8):1087–1113, 2015, 2015.
|
| 215 |
+
|
| 216 |
+
Francois Chaumette and Seth Hutchinson. Visual servo control. I. Basic approaches. IEEE Robotics & Automation Magazine, 13(4):82–90, 2006, 2006.
|
| 217 |
+
|
| 218 |
+
Jian Chen, Warren E Dixon, M Dawson, and Michael McIntyre. Homography-based visual servo tracking control of a wheeled mobile robot. IEEE Transactions on Robotics, 22(2):406–415, 2006, 2006.
|
| 219 |
+
|
| 220 |
+
Christophe Collewet and Eric Marchand. Photometric visual servoing. IEEE Transactions on Robotics, 27(4):828–834, 2011, 2011.
|
| 221 |
+
|
| 222 |
+
Christophe Collewet, Eric Marchand, and Francois Chaumette. Visual servoing set free from image processing. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), pp. 81–86. IEEE, 2008, 2008.
|
| 223 |
+
|
| 224 |
+
Peter I Corke. Visual control of robot manipulators – A review. Visual servoing, 7:1–31, 1993, 1993.
|
| 225 |
+
|
| 226 |
+
Martin Danelljan, Andreas Robinson, Fahad Shahbaz Khan, and Michael Felsberg. Beyond correlation filters: Learning continuous convolution operators for visual tracking. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 472–488. Springer, 2016, 2016.
|
| 227 |
+
|
| 228 |
+
Pieter-Tjerk De Boer, Dirk P Kroese, Shie Mannor, and Reuven Y Rubinstein. A tutorial on the cross-entropy method. Annals of operations research, 134(1):19–67, 2005, 2005.
|
| 229 |
+
|
| 230 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009, 2009.
|
| 231 |
+
|
| 232 |
+
Guilherme N DeSouza and Avinash C Kak. Vision for mobile robot navigation: A survey. IEEE transactions on pattern analysis and machine intelligence, 24(2):237–267, 2002, 2002.
|
| 233 |
+
|
| 234 |
+
Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. DeCAF: A deep convolutional activation feature for generic visual recognition. In Proceedings of the International Conference on Machine Learning (ICML), volume 32, pp. 647–655, 2014, 2014.
|
| 235 |
+
|
| 236 |
+
Damien Ernst, Pierre Geurts, and Louis Wehenkel. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 6(Apr):503–556, 2005, 2005.
|
| 237 |
+
|
| 238 |
+
Bernard Espiau, Francois Chaumette, and Patrick Rives. A new approach to visual servoing in robotics. IEEE Transactions on Robotics and Automation, 8(3):313–326, 2002, 2002.
|
| 239 |
+
|
| 240 |
+
Amir Massoud Farahmand, Mohammad Ghavamzadeh, Csaba Szepesvari, and Shie Mannor. Reg- ´ ularized fitted Q-iteration for planning in continuous-space Markovian decision problems. In American Control Conference, 2009. ACC’09., pp. 725–730. IEEE, 2009, 2009.
|
| 241 |
+
|
| 242 |
+
John T Feddema and Owen Robert Mitchell. Vision-guided servoing with feature-based trajectory generation (for robots). IEEE Transactions on Robotics and Automation, 5(5):691–700, 1989, 1989.
|
| 243 |
+
|
| 244 |
+
Geoffrey J Gordon. Stable function approximation in dynamic programming. In Proceedings of the International Conference on Machine Learning (ICML), 1995, 1995.
|
| 245 |
+
|
| 246 |
+
Koichi Hashimoto. Visual servoing, volume 7. World scientific, 1993, 1993.
|
| 247 |
+
|
| 248 |
+
Koh Hosoda and Minoru Asada. Versatile visual servoing without knowledge of true Jacobian. In Intelligent Robots and Systems’ 94.’Advanced Robotic Systems and the Real World’, IROS’94. Proceedings of the IEEE/RSJ/GI International Conference on, volume 1, pp. 186–193. IEEE, 1994, 1994.
|
| 249 |
+
|
| 250 |
+
Seth Hutchinson, Gregory D Hager, and Peter I Corke. A tutorial on visual servo control. IEEE transactions on robotics and automation, 12(5):651–670, 1996, 1996.
|
| 251 |
+
|
| 252 |
+
Martin Jagersand, Olac Fuentes, and Randal Nelson. Experimental evaluation of uncalibrated visual servoing for precision manipulation. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), volume 4, pp. 2874–2880. IEEE, 1997, 1997.
|
| 253 |
+
|
| 254 |
+
Xu Jia, Bert De Brabandere, Tinne Tuytelaars, and Luc V Gool. Dynamic filter networks. In Advances in Neural Information Processing Systems (NIPS), pp. 667–675, 2016, 2016.
|
| 255 |
+
|
| 256 |
+
Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional architecture for fast feature embedding. In Proceedings of the 22nd ACM International Conference on Multimedia, pp. 675–678. ACM, 2014, 2014.
|
| 257 |
+
|
| 258 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014, 2014.
|
| 259 |
+
|
| 260 |
+
Danica Kragic and Henrik I Christensen. Survey on visual servoing for manipulation. Computational Vision and Active Perception Laboratory, Fiskartorpsv, 15, 2002, 2002.
|
| 261 |
+
|
| 262 |
+
Thomas Lampe and Martin Riedmiller. Acquiring visual servoing reaching and grasping skills using neural reinforcement learning. In Proceedings of the International Joint Conference on Neural Networks (IJCNN), pp. 1–8. IEEE, 2013, 2013.
|
| 263 |
+
|
| 264 |
+
Sascha Lange, Martin Riedmiller, and Arne Voigtlander. Autonomous reinforcement learning on raw visual input data in a real world application. In Proceedings of the International Joint Conference on Neural Networks (IJCNN), pp. 1–8. IEEE, 2012, 2012.
|
| 265 |
+
|
| 266 |
+
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(39):1–40, 2016, 2016.
|
| 267 |
+
|
| 268 |
+
Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. CoRR, abs/1509.02971, 2015, 2015.
|
| 269 |
+
|
| 270 |
+
William Lotter, Gabriel Kreiman, and David Cox. Deep predictive coding networks for video prediction and unsupervised learning. CoRR, abs/1605.08104, 2016, 2016.
|
| 271 |
+
|
| 272 |
+
David G Lowe. Distinctive image features from scale-invariant keypoints. International Journal of Computer Vision, 60(2):91–110, 2004, 2004.
|
| 273 |
+
|
| 274 |
+
Ezio Malis, Francois Chaumette, and Sylvie Boudet. 2 1/2 D visual servoing. IEEE Transactions on Robotics and Automation, 15(2):238–250, 1999, 1999.
|
| 275 |
+
|
| 276 |
+
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond ¨ mean square error. CoRR, abs/1511.05440, 2015, 2015.
|
| 277 |
+
|
| 278 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin A. Riedmiller. Playing Atari with deep reinforcement learning. CoRR, abs/1312.5602, 2013, 2013.
|
| 279 |
+
|
| 280 |
+
Kartik Mohta, Vijay Kumar, and Kostas Daniilidis. Vision-based control of a quadrotor for perching on lines. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), pp. 3130–3136. IEEE, 2014, 2014.
|
| 281 |
+
|
| 282 |
+
Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in Atari games. In Advances in Neural Information Processing Systems (NIPS), pp. 2863–2871, 2015, 2015.
|
| 283 |
+
|
| 284 |
+
Martin Riedmiller. Neural fitted Q iteration – First experiences with a data efficient neural reinforcement learning method. In European Conference on Machine Learning, pp. 317–328. Springer, 2005, 2005.
|
| 285 |
+
|
| 286 |
+
Ethan Rublee, Vincent Rabaud, Kurt Konolige, and Gary Bradski. ORB: An efficient alternative to SIFT or SURF. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), pp. 2564–2571. IEEE, 2011, 2011.
|
| 287 |
+
|
| 288 |
+
Mehdi Sadeghzadeh, David Calvert, and Hussein A Abdullah. Self-learning visual servoing of robot manipulator using explanation-based fuzzy neural networks and Q-learning. Journal of Intelligent & Robotic Systems, 78(1):83–104, 2015, 2015.
|
| 289 |
+
|
| 290 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael I Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the International Conference on Machine Learning (ICML), pp. 1889–1897, 2015, 2015.
|
| 291 |
+
|
| 292 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014, 2014.
|
| 293 |
+
|
| 294 |
+
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances in Neural Information Processing Systems (NIPS), pp. 613–621, 2016, 2016.
|
| 295 |
+
|
| 296 |
+
Jacob Walker, Carl Doersch, Abhinav Gupta, and Martial Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 835–851. Springer, 2016, 2016.
|
| 297 |
+
|
| 298 |
+
Manuel Watter, Jost Springenberg, Joschka Boedecker, and Martin Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in Neural Information Processing Systems (NIPS), pp. 2746–2754, 2015, 2015.
|
| 299 |
+
|
| 300 |
+
Lee E Weiss, Arthur C Sanderson, and Charles P Neuman. Dynamic sensor-based control of robots with visual feedback. IEEE Journal on Robotics and Automation, 3(5):404–417, 1987, 1987.
|
| 301 |
+
|
| 302 |
+
William J Wilson, Carol C Williams Hulls, and Graham S Bell. Relative end-effector control using cartesian position based visual servoing. IEEE Transactions on Robotics and Automation, 12(5): 684–696, 1996, 1996.
|
| 303 |
+
|
| 304 |
+
Tianfan Xue, Jiajun Wu, Katherine Bouman, and Bill Freeman. Visual dynamics: Probabilistic future frame synthesis via cross convolutional networks. In Advances in Neural Information Processing Systems (NIPS), pp. 91–99, 2016, 2016.
|
| 305 |
+
|
| 306 |
+
Billibon H Yoshimi and Peter K Allen. Active, uncalibrated visual servoing. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), pp. 156–161. IEEE, 1994, 1994.
|
| 307 |
+
|
| 308 |
+
Fisher Yu and Vladlen Koltun. Multi-scale context aggregation by dilated convolutions. CoRR, abs/1511.07122, 2015, 2015.
|
| 309 |
+
|
| 310 |
+
# A LINEARIZATION OF THE BILINEAR DYNAMICS
|
| 311 |
+
|
| 312 |
+
The optimization of Equation (3) can be solved efficiently by using a linearization of the dynamics,
|
| 313 |
+
|
| 314 |
+
$$
|
| 315 |
+
f _ { c } ^ { ( l ) } \left( \mathbf { y } _ { t , c } ^ { ( l ) } , \mathbf { u } \right) = f _ { c } ^ { ( l ) } \left( \mathbf { y } _ { t , c } ^ { ( l ) } , \bar { \mathbf { u } } \right) + J _ { t , c } ^ { ( l ) } \left( \mathbf { u } - \bar { \mathbf { u } } \right) = f _ { c } ^ { ( l ) } \left( \mathbf { y } _ { t , c } ^ { ( l ) } , \mathbf { 0 } \right) + J _ { t , c } ^ { ( l ) } \mathbf { u } ,
|
| 316 |
+
$$
|
| 317 |
+
|
| 318 |
+
where $J _ { t , c } ^ { ( l ) }$ is the Jacobian matrix with partial derivatives $\frac { \partial f _ { c } ^ { ( l ) } } { \partial \mathbf { u } } \left( \mathbf { y } _ { t , c } ^ { ( l ) } , \bar { \mathbf { u } } \right)$ and $\bar { \bf u }$ is the linearization point. Since the bilinear dynamics are linear with respect to the controls, this linearization is exact and the Jacobian matrix does not depend on $\bar { \bf u }$ . Without loss of generality, we set $\bar { \mathbf { u } } = \mathbf { 0 }$ .
|
| 319 |
+
|
| 320 |
+
Furthermore, the bilinear dynamics allows the Jacobian matrix to be computed efficiently by simply doing a forward pass through the model. For the locally bilinear dynamics of Equation (2), the $j$ -th column of the Jacobian matrix is given by
|
| 321 |
+
|
| 322 |
+
$$
|
| 323 |
+
\pmb { J } _ { t , c , j } ^ { ( l ) } = \frac { \partial f _ { c } ^ { ( l ) } } { \partial \mathbf { u } _ { j } } ( \mathbf { y } _ { t , c } ^ { ( l ) } , \mathbf { 0 } ) = \pmb { W } _ { c , j } ^ { ( l ) } * \mathbf { y } _ { t , c } ^ { ( l ) } + \pmb { B } _ { c , j } ^ { ( l ) } .
|
| 324 |
+
$$
|
| 325 |
+
|
| 326 |
+
# B SERVOING COST FUNCTION FOR REINFORCEMENT LEARNING
|
| 327 |
+
|
| 328 |
+
The goal of reinforcement learning is to find a policy that maximizes the expected sum of rewards, or equivalently, a policy that minimizes the expected sum of costs. The cost should be one that quantifies progress towards the goal. We define the cost function in terms of the position of the target object (in the camera’s local frame) after the action has been taken,
|
| 329 |
+
|
| 330 |
+
$$
|
| 331 |
+
\begin{array} { r } { c ( \mathbf { s } _ { t } , \mathbf { u } _ { t } , \mathbf { s } _ { t + 1 } ) = \left\{ \begin{array} { l l } { \sqrt { \left( \frac { \mathbf { p } _ { t + 1 } ^ { z } } { \mathbf { p } _ { t + 1 } ^ { z } } \right) ^ { 2 } + \left( \frac { \mathbf { p } _ { t + 1 } ^ { y } } { \mathbf { p } _ { t + 1 } ^ { z } } \right) ^ { 2 } + \left( \frac { 1 } { \mathbf { p } _ { t + 1 } ^ { z } } - \frac { 1 } { \mathbf { p } _ { t } ^ { z } } \right) ^ { 2 } } , } & { \mathrm { i f ~ } \vert \vert \mathbf { p } _ { t + 1 } \vert \vert _ { 2 } \geq \tau \mathrm { ~ a n d ~ c a r ~ i n ~ F O V } } \\ { \left( T - t + 1 \right) c ( \cdot , \cdot , \mathbf { s } _ { t } ) , } & { \mathrm { o t h e r w i s e } , } \end{array} \right. } \end{array}
|
| 332 |
+
$$
|
| 333 |
+
|
| 334 |
+
where $T$ is the maximum trajectory length. The episode terminates early if the camera is too close to the car (less than a distance $\tau$ ) or the car’s origin is outside the camera’s field of view (FOV). The car’s position at time $t$ is $\mathbf { p } _ { t } = \left( \mathbf { p } _ { t } ^ { x } , \mathbf { p } _ { t } ^ { y } , \mathbf { p } _ { t } ^ { z } \right)$ and the car’s target position is ${ \bf p } _ { * } = ( 0 , 0 , { \bf p } _ { * } ^ { z } )$ , both in the camera’s local frame ( $\mathbf { Z }$ -direction is forward). Our experiments use $T = 1 0 0$ and $\tau = 4 \mathrm { m }$ .
|
| 335 |
+
|
| 336 |
+
# C EXPERIMENT DETAILS
|
| 337 |
+
|
| 338 |
+
# C.1 TASK SETUP
|
| 339 |
+
|
| 340 |
+
The camera is attached to the vehicle slightly in front of the robot’s origin and facing down at an angle of $\pi / 6$ rad, similar to a commercial quadcopter drone. The robot has 4 degrees of freedom, corresponding to translation and yaw angle. Pitch and roll are held fixed.
|
| 341 |
+
|
| 342 |
+
In our simulations, the quadcopter follows a car that drives at $1 \mathrm { m } \mathrm { s } ^ { - 1 }$ along city roads during training and testing. The quadcopter’s speed is limited to within $1 0 \mathrm { m } \mathrm { s } ^ { - 1 }$ for each translational degree of freedom, and its angular speed is limited to within $\pi / 2 \mathrm { r a d s } ^ { - 1 }$ . The simulator runs at $1 0 \mathrm { H z }$ . For each trajectory, a car is chosen randomly from a set of cars, and placed randomly on one of the roads. The quadcopter is initialized right behind the car, in the desired relative position for following. The image observed at the beginning of the trajectory is used as the goal observation.
|
| 343 |
+
|
| 344 |
+
# C.2 LEARNING FEATURE DYNAMICS
|
| 345 |
+
|
| 346 |
+
The dynamics of all the features were trained using a dataset of 10000 triplets $\mathbf { x } _ { t } , \mathbf { u } _ { t } , \mathbf { x } _ { t + 1 }$ . The observations are $1 2 8 \times 1 2 8$ RGB images and the actions are 4-dimensional vectors of real numbers encoding the linear and angular (yaw) velocities. The actions are normalized to between $- 1$ and 1.
|
| 347 |
+
|
| 348 |
+
The training set was generated from 100 trajectories of a quadcopter following a car around the city with some randomness. Each trajectory was 100 steps long. Only 5 training cars were shown during learning. The generation process of each trajectory is as follows: First, a car is chosen at random from the set of available cars and it is randomly placed on one of the roads. Then, the quadcopter is placed at some random position relative to the car’s horizontal pose, which is the car’s pose that has been rotated so that the vertical axis of it and the world matches. This quadcopter position is uniformly sampled in cylindrical coordinates relative to the car’s horizontal pose, with heights in the interval $1 2 \mathrm { m }$ to $1 8 \mathrm { m }$ , and azimuthal angles in the interval $- \pi / 2$ rad to $\pi / 2$ rad (where the origin of the azimuthal angle is the back of the car). The radii and yaw angles are initialized so that the car is in the middle of the image. At every time step, the robot takes an action that moves it towards a target pose, with some additive Gaussian noise $( \sigma = 0 . 2$ ). The target pose is sampled according to the same procedure as the initial pose, and it is sampled once at the beginning of each trajectory.
|
| 349 |
+
|
| 350 |
+
We try the fully and locally connected dynamics for pixel intensities to better understand the performance trade-offs when assuming locally connected dynamics. We do not use the latter for the semantic features since they are too high-dimensional for the dynamics model to fit in memory. The dynamics models were trained with ADAM using 10000 iterations, a batch size of 32, a learning rate of 0.001, and momentums of 0.9 and 0.999, and a weight decay of 0.0005.
|
| 351 |
+
|
| 352 |
+
(a) Costs when using the set of cars seen during learning.
|
| 353 |
+
|
| 354 |
+
<table><tr><td rowspan="2">Feature Dynamics</td><td colspan="5">Policy Optimization Algorithm</td></tr><tr><td>unweighted feature dynamics + CEM (1500)</td><td>feature dynamics + CEM (3250)</td><td>feature dynamics + TRPO (≥ 80)</td><td>feature dynamics + TRPO (≥ 2000)</td><td>ours, feature dynamics + FQI (20)</td></tr><tr><td>pixel, FC</td><td>8.20 ± 0.66</td><td>7.77 ± 0.66</td><td>9.56 ± 0.62</td><td>8.03 ± 0.66</td><td>7.92 ± 0.67</td></tr><tr><td>pixel, LC</td><td>8.07± 0.74</td><td>7.13 ± 0.74</td><td>10.11 ± 0.60</td><td>7.97 ± 0.72</td><td>7.98 ± 0.77</td></tr><tr><td>VGG conv1_2</td><td>2.22 ± 0.38</td><td></td><td>2.06 ± 0.35</td><td>1.66 ± 0.31</td><td>1.89 ± 0.32</td></tr><tr><td>VGG conv2_2</td><td>2.40 ± 0.47</td><td></td><td>2.42 ± 0.47</td><td>1.89 ± 0.40</td><td>1.40 ± 0.29</td></tr><tr><td>VGG conv3_3</td><td>2.91 ± 0.52</td><td></td><td>2.87 ± 0.53</td><td>1.59 ± 0.42</td><td>1.56 ± 0.40</td></tr><tr><td>VGG conv4_3</td><td>2.70 ± 0.52</td><td></td><td>2.57 ± 0.49</td><td>1.69 ± 0.41</td><td>1.11 ± 0.29</td></tr><tr><td>VGG conv5_3</td><td>3.68 ± 0.47</td><td></td><td>3.69 ± 0.48</td><td>3.16 ± 0.48</td><td>2.49 ± 0.35</td></tr></table>
|
| 355 |
+
|
| 356 |
+
<table><tr><td rowspan="3">Feature</td><td colspan="5">Policy Optimization Algorithm</td></tr><tr><td>unweighted feature dynamics + CEM (1500)</td><td>feature dynamics + CEM (3250)</td><td>feature dynamics +TRPO (≥ 80)</td><td>feature dynamics + TRPO (≥ 2000)</td><td>ours, feature dynamics + FQI (20)</td></tr><tr><td>pixel,FC</td><td>8.84±0.68</td><td>8.66 ± 0.70</td><td>10.01 ± 0.62</td><td>8.75 ± 0.67</td><td>9.00 ± 0.70</td></tr><tr><td>pixel, LC</td><td>8.37 ± 0.75</td><td>7.17 ± 0.75</td><td>11.29 ± 0.57</td><td>8.25 ± 0.71</td><td>8.36 ± 0.79</td></tr><tr><td>VGG conv1_2</td><td>2.03 ± 0.43</td><td></td><td>1.79 ± 0.36</td><td>1.42 ± 0.33</td><td>1.78 ± 0.37</td></tr><tr><td>VGG conv2_2</td><td>2.01 ± 0.44</td><td></td><td>2.00 ± 0.45</td><td>1.26 ± 0.30</td><td>1.28 ± 0.30</td></tr><tr><td>VGG conv3_3</td><td>2.03 ± 0.47</td><td></td><td>2.08 ± 0.47</td><td>1.46 ± 0.37</td><td>1.04 ± 0.31</td></tr><tr><td>VGG conv4_3</td><td>2.40 ± 0.50</td><td></td><td>2.57 ± 0.53</td><td>1.48 ± 0.36</td><td>0.90 ± 0.26</td></tr><tr><td>VGG conv5_3</td><td>3.31 ± 0.45</td><td></td><td>3.55 ± 0.50</td><td>2.76 ± 0.42</td><td>2.56 ± 0.41</td></tr></table>
|
| 357 |
+
|
| 358 |
+
(b) Costs when using novel cars, none of which were seen during learning.
|
| 359 |
+
|
| 360 |
+
Table 2: Costs on test executions of the dynamics-based servoing policies for different feature dynamics and weighting of the features. The reported numbers are the mean and standard error across 100 test trajectories, of up to 100 time steps each. We test on executions with the training cars and the novel cars; for consistency, the novel cars follow the same route as the training cars. We compare the performance of policies with unweighted features or weights learned by other methods. For the case of unweighted feature dynamics, we use the cross entropy method (CEM) to learn the relative weights $\boldsymbol { \lambda }$ of the control and the single feature weight w. For the other cases, we learn the weights with CEM, Trust Region Policy Optimization (TRPO) for either 2 or 50 iterations, and our proposed FQI algorithm. CEM searches over the full space of policy parameters w and $\boldsymbol { \lambda }$ , but it was only ran for pixel features since it does not scale for high-dimensional problems. We report the number of training trajectories in parenthesis. For TRPO, we use a fixed number of training samples per iteration, whereas for CEM and FQI, we use a fixed number of training trajectories per iteration. We use a batch size of 4000 samples for TRPO, which means that at least 40 trajectories were used per iteration, since trajectories can terminate early, i.e. in less than 100 time steps.
|
| 361 |
+
|
| 362 |
+
# C.3 LEARNING WEIGHTING OF FEATURE DYNAMICS WITH REINFORCEMENT LEARNING
|
| 363 |
+
|
| 364 |
+
We use CEM, TRPO and FQI to learn the feature weighting and report the performance of the learned policies in Table 2. We use the cost function described in Appendix B, a discount factor of $\gamma = 0 . 9$ , and trajectories of up to 100 steps. All the algorithms used initial weights of $\mathbf { w } = 1$ and $\lambda = 1$ , and a Gaussian exploration policy with the current policy as the mean and a fixed standard deviation $\sigma _ { \mathrm { e x p l o r a t i o n } } = 0 . 2$ .
|
| 365 |
+
|
| 366 |
+
For the case of unweighted features, we use CEM to optimize for a single weight w and for the weights $\boldsymbol { \lambda }$ . For the case of weighted features, we use CEM to optimize for the full space of parameters, but we only do that for the pixel feature dynamics since CEM does not scale for highdimensional problems, which is the case for all the VGG features. Each iteration of CEM performs a certain number of noisy evaluations and selects the top $20 \%$ for the elite set. The number of noisy evaluations per iteration was 3 times the number of parameters being optimized. Each noisy evaluation used the average sum of costs of 10 trajectory rollouts as its evaluation metric. The parameters of the last iteration were used for the final policy. The policies with unweighted features dynamics and the policies with pixel features dynamics were trained for 10 and 25 iterations, respectively.
|
| 367 |
+
|
| 368 |
+

|
| 369 |
+
Table 3: Sample observations from test executions in our experiments, and the costs for each trajectory, for different feature dynamics. We use the weights learned by our FQI algorithm. This table follows the same format as Table 1. Some of the trajectories were shorter than 100 steps because of the termination condition (e.g. the car is no longer in the image). The first observation of each trajectory is used as the target observation. The trajectories shown in here were chosen to reflect different types of behaviors. In the first trajectory, the blue car turns abruptly to the right, making the view significantly different from the target observation. In the second trajectory, a distractor object (i.e. the lamp) shows up in the target image and an occluder object (i.e. the traffic light) appears through the execution. The policies based on deeper VGG features, up to VGG conv4 3, are generally more robust to the appearance changes between the observations and the target observation, which are typically caused by movements of the car, distractor objects, and occlusions.
|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
Figure 7: Costs of validation executions using various feature dynamics models, where the feature weights are optimized with FQI (left plot) or TRPO (right plot). The reported values are the mean and standard error across 10 validation trajectories, of up to 100 time steps each.
|
| 373 |
+
|
| 374 |
+
We use TRPO to optimize for the full space of parameters for each of the feature dynamics we consider in this work. We use a Gaussian policy, where the mean is the servoing policy of Equation (3) and the standard deviation is fixed to $\sigma _ { \mathrm { e x p l o r a t i o n } } = 0 . 2$ (i.e. we do not learn the standard deviation). Since the parameters are constrained to be non-negative, we parametrize the TRPO policies with $\sqrt { \mathbf { w } }$ and $\sqrt { \lambda }$ . We use a Gaussian baseline, where the mean is a 5-layer CNN, consisting of 2 convolutional and 3 fully connected layers, and a standard deviation that is initialized to 1. The convolutional layers use 16 filters $( 4 \times 4$ , stride 2) each, the first 2 fully-connected layers use 32 hidden units each, and all the layers except for the last one use ReLU activations. The input of the baseline network are the features (either pixel intensities or VGG features) corresponding to the feature dynamics being used. The parameters of the last iteration were used for the final policy. The policies are trained with TRPO for 50 iterations, a batch size of 4000 samples per iteration, and a step size of 0.01.
|
| 375 |
+
|
| 376 |
+
We use our proposed FQI algorithm to optimize for the weights $\mathbf { w } , \lambda$ , and surpass the other methods in terms of performance on test executions, sample efficiency, and overall computation efficiency7. The updates of the inner iteration of our algorithm are computationally efficient; since the data is fixed for a given sampling iteration, we can precompute $\phi \left( \mathbf { s } _ { t } , \mathbf { u } _ { t } \right)$ and certain terms of $\phi \left( \mathbf { s } _ { t + 1 } , \cdot \right)$ . The parameters that achieved the best performance on 10 validation trajectories were used for the final policy. The policies are trained with FQI for $S = 2$ sampling iterations, a batch size of 10 trajectories per sampling iteration, $K = 1 0$ inner iterations per sampling iteration, and a regularization coefficient of $\nu = 0 . 1$ . We found that regularization of the parameters was important for the algorithm to converge. We show sample trajectories of the resulting policies in Table 3.
|
| 377 |
+
|
| 378 |
+
The FQI algorithm often achieved most of its performance gain after the first iteration. We ran additional sampling iterations of FQI to see if the policies improved further. For each iteration, we evaluated the performance of the policies on 10 validation trajectories. We did the same for the policies trained with TRPO, and we compare the learning curves of both methods in Figure 7.
|
| 379 |
+
|
| 380 |
+
<table><tr><td>Observation Modality</td></tr><tr><td>ground truth car position 0.59 ± 0.24</td></tr><tr><td>3.23 ± 0.22</td></tr><tr><td>raw pixel-intensity images VGG conv1_2 features 7.45 ± 0.40</td></tr><tr><td>VGG conv2_2 features 13.38 ± 0.53</td></tr><tr><td>VGG conv3_3 features 10.02 ± 0.49</td></tr><tr><td></td></tr></table>
|
| 381 |
+
|
| 382 |
+
(a) Costs when using the set of cars seen during learning.
|
| 383 |
+
|
| 384 |
+
<table><tr><td>Observation Modality</td></tr><tr><td>ground truth car position 0.59 ± 0.24</td></tr><tr><td>raw pixel-intensity images 5.20 ± 0.40</td></tr><tr><td>VGG conv1_2 features 8.35 ± 0.44</td></tr><tr><td>VGG conv2_2 features 14.01 ± 0.47</td></tr><tr><td>VGG conv3_3 features 10.51 ± 0.65</td></tr></table>
|
| 385 |
+
|
| 386 |
+
(b) Costs when using a new set of cars, none of which were seen during learning.
|
| 387 |
+
|
| 388 |
+
Table 4: Costs on test executions of servoing policies that were trained end-to-end with TRPO. These policies take in different observation modalities: ground truth car position or image-based observations. This table follows the same format as Table 2. The mean of the first policy is parametrized as a 3-layer MLP, with tanh non-linearities except for the output layer; the first 2 fully connected layers use 32 hidden units each. For the other policies, each of their means is parametrized as a 5-layer CNN, consisting of 2 convolutional and 3 fullyconnected layers, with ReLU non-linearities except for the output layer; the convolutional layers use 16 filters $( 4 \times 4$ , stride 2) each and the first 2 fully-connected layers use 32 hidden units each. All the policies are trained with TRPO, a batch size of 4000 samples, 500 iterations, and a step size of 0.01. The car position observations are not affected by the appearance of the cars, so the test performance for that modality is the same regardless of which set of cars are used.
|
| 389 |
+
|
| 390 |
+
C.4 LEARNING END-TO-END SERVOING POLICIES WITH TRPO
|
| 391 |
+
|
| 392 |
+
We use TRPO to train end-to-end servoing policies for various observation modalities and report the performance of the learned policies in Table 4. The policies are trained with the set of training cars, and tested on both this set and on the set of novel cars. The observation modalities that we consider are ground truth car positions (relative to the quadcopter), images of pixel intensities from the quadcopter’s camera, and VGG features extracted from those images. Unlike our method and the other experiments, no feature dynamics are explicitly learned for these experiments.
|
| 393 |
+
|
| 394 |
+
We use a Gaussian policy, where the mean is either a multi-layer perceptron (MLP) or a convolutional neural net (CNN), and the standard deviation is initialized to 1. We also use a Gaussian baseline, which is parametrized just as the corresponding Gaussian policy (but no parameters are shared between the policy and the baseline). For the policy that takes in car positions, the mean is parametrized as a 3-layer MLP, with tanh non-linearities except for the output layer; the first 2 fully connected layers use 32 hidden units each. For the other policies, each of their means is parametrized as a 5-layer CNN, consisting of 2 convolutional and 3 fully-connected layers, with ReLU non-linearities except for the output layer; the convolutional layers use 16 filters $( 4 \times 4$ , stride 2) each and the first 2 fully-connected layers use 32 hidden units each.
|
| 395 |
+
|
| 396 |
+
The CNN policies would often not converge for several randomly initialized parameters. Thus, at the beginning of training, we tried multiple random seeds until we got a policy that achieved a relatively low cost on validation trajectories, and used the best initialization for training. The MLP policy did not have this problem, so we did not have to try multiple random initializations for it. All the policies are trained with a batch size of 4000 samples, 500 iterations, and a step size of 0.01. The parameters of the last iteration were used for the final policy.
|
| 397 |
+
|
| 398 |
+
Table 5: Costs on test executions when using classical image-based visual servoing (IBVS) with respect to feature points derived from bounding boxes and keypoints derived from hand-engineered features. Since there is no learning involved in this method, we only test with one set of cars: the cars that were used for training in the other methods. This table follows the same format as Table 2. This method has one hyperparameter, which is the gain for the control law. For each feature type, we select the best hyperparameter (shown in parenthesis) by validating the policy on 10 validation trajectories for gains between 0.05 and 2, in increments of 0.05. The servoing policies based on bounding box features achieve low cost, and even lower ones if ground truth car dynamics is used. However, servoing with respect to hand-crafted feature points is significantly worse than the other methods.
|
| 399 |
+
|
| 400 |
+
<table><tr><td colspan="3">Observation Modality (Feature Points)</td></tr><tr><td>corners of bounding box from C-COT tracker</td><td>(0.75)</td><td>1.70 ± 0.30</td></tr><tr><td>corners of ground truth bounding box</td><td>(0.75)</td><td>0.86 ± 0.25</td></tr><tr><td>corners of next frame's bounding box from C-COT tracker</td><td>(0.65)</td><td>1.46 ± 0.22</td></tr><tr><td>corners of next frame's ground truth bounding box</td><td>(0.65)</td><td>0.53 ± 0.05</td></tr><tr><td>SIFT feature points</td><td>(0.30)</td><td>14.47 ± 0.75</td></tr><tr><td>SURF feature points</td><td>(0.60)</td><td>)16.37±0.78</td></tr><tr><td>ORB feature points</td><td>(0.30)</td><td>4.41 ± 0.60</td></tr></table>
|
| 401 |
+
|
| 402 |
+
# C.5 CLASSICAL IMAGE-BASED VISUAL SERVOING
|
| 403 |
+
|
| 404 |
+
Traditional visual servoing techniques (Feddema & Mitchell, 1989; Weiss et al., 1987) use the image-plane coordinates of a set of points for control. For comparison to our method, we evaluate the servoing performance of feature points derived from bounding boxes and keypoints derived from hand-engineered features, and report the costs of test executions on Table 5.
|
| 405 |
+
|
| 406 |
+
We use bounding boxes from the C-COT tracker (Danelljan et al., 2016) (the current state-of-the-art visual tracker) and ground truth bounding boxes from the simulator. The latter is defined as the box that tightly fits around the visible portions of the car. We provide the ground truth bounding box of the first frame to the C-COT tracker to indicate that we want to track the car. We use the four corners of the box as the feature points for servoing to take into account the position and scale of the car in image coordinates.
|
| 407 |
+
|
| 408 |
+
We provide the ground truth depth values of the feature points for the interaction matrices. In classical image-based visual servoing, the control law involves the interaction matrix (also known as feature Jacobian), which is the Jacobian of the points in image space with respect to the camera’s control (see Chaumette & Hutchinson (2006) for details). The analytical feature Jacobian used in IBVS assumes that the target points are static in the world frame. This is not true for a moving car, so we consider a variant where the feature Jacobian incorporates the ground truth dynamics of the car. This amounts to adding a non-constant translation bias to the output of the dynamics function, where the translation is the displacement due to the car’s movement of the 3-dimensional point in the camera’s reference frame. Note that this is still not exactly equivalent to having the car being static since the roads have different slopes but the pitch and roll of the quadcopter is constrained to be fixed.
|
| 409 |
+
|
| 410 |
+
For the hand-crafted features, we consider SIFT (Lowe, 2004), SURF (Bay et al., 2006) and ORB (Rublee et al., 2011) keypoints. We filter out the keypoints of the first frame that does not belong to the car and use these as the target keypoints. However, we use all the keypoints for the subsequent observations.
|
| 411 |
+
|
| 412 |
+
The servoing policies based on bounding box features achieve low cost, and even lower ones if ground truth car dynamics is used. However, servoing with respect to hand-crafted feature points is significantly worse than the other methods. This is, in part, because the feature extraction and matching process introduces compounding errors. Similar results were found by Collewet & Marchand (2011), who proposed photometric visual servoing (i.e. servoing with respect to pixel intensities) and showed that it outperforms, by an order of magnitude, classical visual servoing that uses SURF features.
|
| 413 |
+
|
| 414 |
+
<table><tr><td rowspan="3">Observation Modality (Pose)</td><td colspan="3">Policy Variant</td></tr><tr><td>Use Rotation</td><td>Ignore Rotation</td></tr><tr><td>car pose</td><td>(1.55) 0.58 ±0.25</td><td>(1.90) 0.51 ±0.25</td></tr><tr><td>next frame's car pose</td><td>(1.00) 0.0059 ± 0.0020</td><td>(1.00) 0.0025 ± 0.0017</td></tr></table>
|
| 415 |
+
|
| 416 |
+
Table 6: Costs on test executions when using classical position-based visual servoing (PBVS). Since there is no learning involved in this method, we only test with one set of cars: the cars that were used for training in the other methods. This table follows the same format as Table 2. This method has one hyperparameter, which is the gain for the control law. For each condition, we select the best hyperparameter (shown in parenthesis) by validating the policy on 10 validation trajectories for gains between 0.05 and 2, in increments of 0.05. These servoing policies, which use ground truth car poses, outperforms all the other policies based on images. In addition, the performance is more than two orders of magnitude better if ground truth car dynamics is used.
|
| 417 |
+
|
| 418 |
+
# C.6 CLASSICAL POSITION-BASED VISUAL SERVOING
|
| 419 |
+
|
| 420 |
+
Position-based visual servoing (PBVS) techniques use poses of a target object for control (see Chaumette & Hutchinson (2006) for details). We evaluate the servoing performance of a few variants, and report the costs of test executions on Table 6.
|
| 421 |
+
|
| 422 |
+
Similar to our IBVS experiments, we consider a variant that uses the car pose of the next time step as a way to incorporate the ground truth car dynamics into the interaction matrix. Since the cost function is invariant to the orientation of the car, we also consider a variant where the policy only minimizes the translational part of the pose error.
|
| 423 |
+
|
| 424 |
+
These servoing policies, which use ground truth car poses, outperforms all the other policies based on images. In addition, the performance is more than two orders of magnitude better if ground truth car dynamics is used.
|
md/train/rJe10iC5K7/rJe10iC5K7.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UNSUPERVISED DISCOVERY OF PARTS, STRUCTURE, AND DYNAMICS
|
| 2 |
+
|
| 3 |
+
Zhenjia $\mathbf { X } \mathbf { u } ^ { * }$ MIT CSAIL, Shanghai Jiao Tong University
|
| 4 |
+
|
| 5 |
+
Zhijian Liu∗ MIT CSAIL
|
| 6 |
+
|
| 7 |
+
Chen Sun Google Research
|
| 8 |
+
|
| 9 |
+
Kevin Murphy Google Research
|
| 10 |
+
|
| 11 |
+
William T. Freeman MIT CSAIL, Google Research
|
| 12 |
+
|
| 13 |
+
Joshua B. Tenenbaum MIT CSAIL
|
| 14 |
+
|
| 15 |
+
Jiajun Wu MIT CSAIL
|
| 16 |
+
|
| 17 |
+
# ABSTRACT
|
| 18 |
+
|
| 19 |
+
Humans easily recognize object parts and their hierarchical structure by watching how they move; they can then predict how each part moves in the future. In this paper, we propose a novel formulation that simultaneously learns a hierarchical, disentangled object representation and a dynamics model for object parts from unlabeled videos. Our Parts, Structure, and Dynamics (PSD) model learns to, first, recognize the object parts via a layered image representation; second, predict hierarchy via a structural descriptor that composes low-level concepts into a hierarchical structure; and third, model the system dynamics by predicting the future. Experiments on multiple real and synthetic datasets demonstrate that our PSD model works well on all three tasks: segmenting object parts, building their hierarchical structure, and capturing their motion distributions.
|
| 20 |
+
|
| 21 |
+
# 1 INTRODUCTION
|
| 22 |
+
|
| 23 |
+
What makes an object an object? Researchers in cognitive science have made profound investigations into this fundamental problem; results suggest that humans, even young infants, recognize objects as continuous, integrated regions that move together (Carey, 2009; Spelke & Kinzler, 2007). Watching objects move, infants gradually build the internal notion of objects in their mind. The whole process requires little external supervision from experts.
|
| 24 |
+
|
| 25 |
+
Motion gives us not only the concept of objects and parts, but also their hierarchical structure. The classic study from Johansson (1973) reveals that humans recognize the structure of a human body from a few moving dots representing the keypoints on a human skeleton. This connects to the classic Gestalt theory in psychology (Koffka, 2013), which argues that human perception is holistic and generative, explaining scenes as a whole instead of in isolation. In addition to being unsupervised and hierarchical, our perception gives us concepts that are fully interpretable and disentangled. With an object-based representation, we are able to reason about object motion, predict what is going to happen in the near future, and imagine counterfactuals like “what happens if?” (Spelke & Kinzler, 2007)
|
| 26 |
+
|
| 27 |
+
How can we build machines of such competency? Would that be possible to have an artificial system that learns an interpretable, hierarchical representation with system dynamics, purely from raw visual data with no human annotations? Recent research in unsupervised and generative deep representation learning has been making progress along this direction: there have been models that efficiently explain multiple objects in a scene (Huang & Murphy, 2015; Eslami et al., 2016), some simultaneously learning an interpretable representation (Chen et al., 2016). Most existing models however either do not produce a structured, hierarchical object representation, or do not characterize system dynamics.
|
| 28 |
+
|
| 29 |
+
In this paper, we propose a novel formulation that learns an interpretable, hierarchical object representation and scene dynamics by predicting the future. Our model requires no human annotations, learning purely from unlabeled videos of paired frames. During training, the model sees videos of objects moving; during testing, it learns to recognize and segment each object and its parts, build their hierarchical structure, and model their motion distribution for future frame synthesis, all from a single image.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 1: Observing human moving, humans are able to perceive disentangled object parts, understand their hierarchical structure, and capture their corresponding motion fields (without any annotations).
|
| 33 |
+
|
| 34 |
+
Our model, named Parts, Structure, and Dynamics (PSD), learns to recognize the object parts via a layered image representation. PSD learns their hierarchy via a structural descriptor that composes low-level concepts into a hierarchical structure. Formulated as a fully differentiable module, the structural descriptor can be end-to-end trained within a neural network. PSD learns to model the system dynamics by predicting the future.
|
| 35 |
+
|
| 36 |
+
We evaluate our model in many possible ways. On real and synthetic datasets, we first examine its ability in learning the concept of objects and segmenting them. We then compute the likelihood that it correctly captures the hierarchical structure in the data. We finally validate how well it characterizes object motion distribution and predicts the future. Our system works well on all these tasks, with minimal input requirement (two frames during training, and one during testing). While previous state-of-the-art methods that jointly discover objects, relations, and predict future frames only work on binary images of shapes and digits, our PSD model works well on complex real-world RGB images and requires fewer input frames.
|
| 37 |
+
|
| 38 |
+
# 2 RELATED WORK
|
| 39 |
+
|
| 40 |
+
Our work is closely related to the research on learning an interpretable representation with a neural network (Hinton & Van Camp, 1993; Kulkarni et al., 2015b; Chen et al., 2016; Higgins et al., 2017; 2018). Recent papers explored using deep networks to efficiently explain an object (Kulkarni et al., 2015a; Rezende et al., 2016; Chen et al., 2018), a scene with multiple objects (Ba et al., 2015; Huang & Murphy, 2015; Eslami et al., 2016), or sequential data (Li & Mandt, 2018; Hsu et al., 2017). In particular, Chen et al. (2016) proposed to learn a disentangled representation without direct supervision. Wu et al. (2017) studied video de-animation, building an object-based, structured representation from a video. Higgins et al. (2018) learned an implicit hierarchy of abstract concepts from a few symbol-image pairs. Compared with these approaches, our model not only learns to explain observations, but also build a dynamics model that can be used for future prediction.
|
| 41 |
+
|
| 42 |
+
There have been also extensive research on hierarchical motion decomposition (Ross & Zemel, 2006; Ross et al., 2010; Grundmann et al., 2010; Xu et al., 2012; Flores-Mangas & Jepson, 2013; Jain et al., 2014; Ochs et al., 2014; Pérez-Rúa et al., 2016; Gershman et al., 2016; Esmaeili et al., 2018). These papers focus on segment objects or parts from videos and infer their hierarchical structure. In this paper, we propose a model that learns to not only segment parts and infer their structure, but also to capture each part’s dynamics for synthesizing possible future frames.
|
| 43 |
+
|
| 44 |
+
Physical scene understanding has attracted increasing attention in recent years (Fragkiadaki et al., 2016; Battaglia et al., 2016; Chang et al., 2017; Finn et al., 2016; Ehrhardt et al., 2017; Shao et al., 2014). Researchers have attempted to go beyond the traditional goals of high-level computer vision, inferring “what is where”, to capture the physics needed to predict the immediate future of dynamic scenes, and to infer the actions an agent should take to achieve a goal. Most of these efforts do not attempt to learn physical object representations from raw observations. Some systems emphasize learning from pixels but without an explicitly object-based representation (Fragkiadaki et al., 2016; Agrawal et al., 2016), which makes generalization challenging. Others learn a flexible model of the dynamics of object interactions, but assume a decomposition of the scene into physical objects and their properties rather than learning directly from images (Chang et al., 2017; Battaglia et al., 2016; Kipf et al., 2018). A few very recent papers have proposed to jointly learn a perception module and a dynamics model (Watters et al., 2017; Wu et al., 2017; van Steenkiste et al., 2018). Our model moves further by simultaneously discovering the hierarchical structure of object parts.
|
| 45 |
+
|
| 46 |
+
Another line of related work is on future state prediction in either image pixels (Xue et al., 2016; Mathieu et al., 2016; Lotter et al., 2017; Lee et al., 2018; Balakrishnan et al., 2018b) or object trajectories (Kitani et al., 2017; Walker et al., 2016). Some of these papers, including our model, draw insights from classical computer vision research on layered motion representations (Wang &
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 2: Knowing that the legs are part of human body, the legs’ motion can be decomposed as the sum of the body’s motion and the legs’ local motion.
|
| 50 |
+
|
| 51 |
+
Adelson, 1993). These papers often fail to model the object hierarchy. There has also been abundant research making use of physical models for human or scene tracking (Salzmann & Urtasun, 2011; Kyriazis & Argyros, 2013; Vondrak et al., 2013; Brubaker et al., 2009). Compared with these papers, our model learns to discover the hierarchical structure of object parts purely from visual observations, without resorting to prior knowledge.
|
| 52 |
+
|
| 53 |
+
# 3 FORMULATION
|
| 54 |
+
|
| 55 |
+
By observing objects move, we aim to learn the concept of object parts and their relationships. Take human body as an example (Figure 1). We want our model to parse human parts (e.g., torso, hands, and legs) and to learn their structure (e.g., hands and legs are both parts of the human body).
|
| 56 |
+
|
| 57 |
+
Formally, given a pair of images $\{ \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } \}$ , let $\mathcal { M }$ be the Lagrangian motion map (i.e. optical flow). Consider a system that learns to segment object parts and to capture their motions, without modeling their structure. Its goal is to find a segment decomposition of $\mathbf { \bar { \mathcal { I } } } _ { 1 } = \{ \mathcal { O } _ { 1 } , \mathcal { O } _ { 2 } , \ldots , \mathcal { O } _ { n } \}$ , where each segment $\mathcal { O } _ { k }$ corresponds to an object part with distinct motion. Let $\{ \mathcal { M } _ { 1 } ^ { \mathrm { g } } , \mathcal { M } _ { 2 } ^ { \mathrm { g } } , \ldots , \mathcal { M } _ { n } ^ { \mathrm { g } } \}$ be their corresponding motions.
|
| 58 |
+
|
| 59 |
+
Beyond that, we assume that these object parts form a hierarchical tree structure: each part $k$ has a parent $p _ { k }$ , unless itself is the root of a motion tree. Its motion $\mathcal { M } _ { k } ^ { \mathrm { g } }$ can therefore be decomposed into its parent’s motion $\mathcal { M } _ { p _ { k } } ^ { \mathrm { g } }$ and a local motion component $\mathcal { M } _ { k } ^ { 1 }$ within its parent’s reference frame. Specifically, $\mathcal { M } _ { k } ^ { \mathrm { g } } = \mathcal { M } _ { p _ { k } } ^ { \mathrm { g } } + \mathcal { M } _ { k } ^ { \mathrm { l } }$ , if $k$ is not a root. Here we make use of the fact that Lagrangian motion components $\mathcal { M } _ { k } ^ { 1 }$ and $\mathcal { M } _ { p _ { k } } ^ { \mathrm { g } }$ are additive.
|
| 60 |
+
|
| 61 |
+
Figure 2 gives an intuitive example: knowing that the legs are part of human body, the legs’ motion can be written as the sum of the body’s motion (e.g., moving to the left) and the legs’ local motion (e.g., moving to lower or upper left). Therefore, the objective of our model is, in addition to identifying the object components $\{ \mathcal { O } _ { k } \}$ , learning the hierarchical tree structure $\{ p _ { k } \}$ to effectively and efficiently explain the object’s motion.
|
| 62 |
+
|
| 63 |
+
Such an assumption makes it possible to decompose the complex object motions into simple and disentangled local motion components. Reusing local components along the hierarchical structure helps to reduce the description length of the motion map $\mathcal { M }$ . Therefore, such a decomposition should naturally emerge within a design with information bottleneck that encourages compact, disentangled representations. In the next section, we introduce the general philosophy behind our model design and the individual components within.
|
| 64 |
+
|
| 65 |
+
# 4 METHOD
|
| 66 |
+
|
| 67 |
+
In this section, we discuss our approach to learn the disentangled, hierarchical representation. Our model learns by predicting future motions and synthesizing future frames without manual annotations. Figure 3 shows an overview of our Parts, Structure, and Dynamics (PSD) model.
|
| 68 |
+
|
| 69 |
+
# 4.1 OVERVIEW
|
| 70 |
+
|
| 71 |
+
Motion can be decomposed in a layer-wise manner, separately modeling different object component’s movement (Wang & Adelson, 1993). Motivated by this, our model first decomposes the input frame $\mathcal { T } _ { 1 }$ into multiple feature maps using an image encoder (Figure 3c). Intuitively, these feature maps correspond to separate object components. Our model then performs convolutions (Figure 3d) on these feature maps using separate kernels obtained from a kernel decoder (Figure 3b), and synthesizes the local motions $\mathcal { M } _ { k } ^ { 1 }$ of separate object components with a motion decoder (Figure 3e). After that, our model employs a structural descriptor (Figure 3f) to recover the global motions $\mathcal { M } _ { k } ^ { \mathrm { g } }$ from local motions $\mathcal { M } _ { k } ^ { 1 }$ , and then compute the overall motion $\mathcal { M }$ . Finally, our model uses an image decoder (Figure 3g) to synthesize the next frame $\mathcal { T } _ { 2 }$ from the input frame $\mathcal { T } _ { 1 }$ and the overall motion $\mathcal { M }$ .
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 3: Our PSD model has seven components: (a) motion encoder; (b) kernel decoder; (c) image encoder; (d) cross convolution; (e) motion decoder; (f) structural descriptor; and (g) image decoder.
|
| 75 |
+
|
| 76 |
+
Our PSD model can be seen as a conditional variational autoencoder. During training, it employs an additional motion encoder (Figure 3a) to encode the motion into the latent representation $z$ ; during testing, it instead samples the representation $z$ from its prior distribution $p _ { z } ( z )$ , which is assumed to be a multivariate Gaussian distribution, where each dimension is i.i.d., zero-mean, and unit-variance. We emphasize the different behaviors of training and testing in Algorithm 1 and 2.
|
| 77 |
+
|
| 78 |
+
# Algorithm 1 Training PSD
|
| 79 |
+
|
| 80 |
+
# Algorithm 2 Evaluating PSD
|
| 81 |
+
|
| 82 |
+
<table><tr><td>Inputs: a pair of frames {I1,I2}. Outputs: reconstructed second frame I2.</td><td>Inputs: a single frame Il . Outputs: predicted future frame I2.</td></tr><tr><td>F = image_encoder(Ii).</td><td>F =image_encoder(I1).</td></tr><tr><td>M = optical_flow(I1,I2). (Zmean, Zvar)= motion_encoder(M).</td><td></td></tr><tr><td>Randomly sample z from N(zmean, Zvar).</td><td>Randomly sample z from N(0,1).</td></tr><tr><td>for k=1 to d do Kk =kernel_decoderk(zk).</td><td>for k = 1 to d do</td></tr><tr><td>Fk = cross_convolution(Fk,Kk).</td><td>Kk =kernel_decoderk(zk). Fk = cross_convolution(Fk,Kk).</td></tr><tr><td>Ml= motion_decoderk(Fk).</td><td>M = motion_decoderk(Fk).</td></tr><tr><td>end for</td><td>end for</td></tr><tr><td>{M} = structural_descriptor({Mk}, S). I2 = image_decoder(I1,∑d=1 M).</td><td>{M} = structural_descriptor({Mk},S). I2 = image_decoder(I1,∑d=1 M).</td></tr></table>
|
| 83 |
+
|
| 84 |
+
# 4.2 NETWORK STRUCTURE
|
| 85 |
+
|
| 86 |
+
We now introduce each component.
|
| 87 |
+
|
| 88 |
+
Dimensionality. The hyperparameter $d$ is set to 32, which determines the maximum number of objects we are able to deal with. During training, the variational loss encourages our model to use as few dimensions in the latent representation $z$ as possible, and consequently, there will be only a few dimensions learning useful representations, each of which correspond to one particular object, while all the other dimensions will be very close to the Gaussian noise.
|
| 89 |
+
|
| 90 |
+
Motion Encoder. Our motion encoder takes the flow field $\hat { \mathcal { M } }$ between two consecutive frames as input, with resolution of $1 2 8 \times 1 2 8$ . It applies seven convolutional layers with number of channels {16, 16, 32, 32, 64, 64, 64}, kernel sizes $5 \times 5$ , and stride sizes $2 \times 2$ . Between convolutional layers, there are batch normalizations (Ioffe & Szegedy, 2015), Leaky ReLUs (Maas et al., 2013) with slope 0.2. The output will have a size of $6 4 \times 1 \times 1$ . Then it is reshaped into a $d .$ -dimensional mean vector $z _ { \mathrm { m e a n } }$ and a $d$ -dimensional variance vector ${ \mathcal { Z } } _ { \mathrm { v a r } }$ . Finally, the latent motion representation $z$ is sampled from $\mathcal { N } ( z _ { \mathrm { m e a n } } , z _ { \mathrm { v a r } } )$ .
|
| 91 |
+
|
| 92 |
+
Kernel Decoder. Our kernel decoder consists of $d$ separate fully connected networks, decoding the latent motion representation $z$ to the convolutional kernels of size $d { \times } 5 { \times } 5$ . Therefore, each kernel corresponds to one dimension in the latent motion representation $z$ . Within each network, we make uses four fully connected layers with number of hidden units {64, 128, 64, 25}. In between, there are batch normalizations and ReLU layers.
|
| 93 |
+
|
| 94 |
+
Image Encoder. Our image encoder applies six convolutional layers to the image, with number of channels {32, 32, 64, 64, 32, 32}, kernel sizes $5 \times 5$ , two of which have strides sizes $2 \times 2$ . The output will be a 64-channel feature map. We then upsample the feature maps by $4 \times$ with nearest neighbor sampling, and finally, the resolution of feature maps will be $1 2 8 \times 1 2 8$ .
|
| 95 |
+
|
| 96 |
+
Cross Convolution. The cross convolution layer (Xue et al., 2016) applies the convolutional kernels learned by the kernel decoder to the feature maps learned by the image encoder. Here, the convolution operations are carried out in a channel-wise manner (also known as depth-wise separable convolutions in Chollet (2017)): it applies each of the $d$ convolutional kernels to its corresponding channel in the feature map. The output will be a $d$ -channel transformed feature map.
|
| 97 |
+
|
| 98 |
+
Motion Decoder. Our motion decoder takes the transformed feature map as input and estimates the $x$ -axis and $y$ -axis motions separately. For each axis, the network applies two $9 \times 9$ , two $5 \times 5$ and two $1 \times 1$ depthwise separable convolutional layers, all with 32 channels. We stack the outputs from two branches together. The output motion will have a size of $d \times 1 2 8 \times 1 2 8 \times 2$ . Note that the local motion $\mathcal { M } _ { k } ^ { 1 }$ is determined by $z _ { k }$ only.
|
| 99 |
+
|
| 100 |
+
Structural Descriptor. Our structural descriptor recovers the global motions $\{ \mathcal { M } _ { k } ^ { \mathrm { g } } \}$ from the local motions $\{ \mathcal { M } _ { k } ^ { 1 } \}$ and the hierarchical tree structure $\{ p _ { k } \}$ using
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\begin{array} { r l r } { { \mathcal { M } _ { k } ^ { \tt g } = \mathcal { M } _ { k } ^ { 1 } + \mathcal { M } _ { p _ { k } } ^ { \tt g } = \mathcal { M } _ { k } ^ { 1 } + ( \mathcal { M } _ { p _ { k } } ^ { 1 } + \mathcal { M } _ { p _ { p _ { k } } } ^ { \tt g } ) = \cdots } } \\ & { } & { = \mathcal { M } _ { k } ^ { 1 } + \sum _ { i \not = k } [ i \in P _ { k } ] \cdot \mathcal { M } _ { i } ^ { 1 } , \quad \mathrm { w h e r e ~ } P _ { k } \mathrm { ~ i s ~ t h e ~ s e t ~ o f ~ a n c e s t o r s ~ o f ~ } \mathcal { O } _ { k } . } \end{array}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
Then, we define the structural matrix $s$ as $S _ { i k } = [ i \in P _ { k } ]$ , where each binary indicator $s _ { i k }$ represents whether $\mathcal { O } _ { i }$ is an ancestor of $\mathcal { O } _ { k }$ . This is what we aim to learn, and it is shared across different data points. In practice, we relax the binary constraints on $s$ to $[ 0 , 1 ]$ to make this module differentiable: $S _ { i k } = \mathrm { s i g m o i d } ( { \mathcal W } _ { i k } )$ , where $\mathcal { W } _ { i k }$ are trainable parameters. Finally, the overall motion can be simply computed as $\begin{array} { r } { \mathcal { M } = \sum _ { k } \mathcal { M } _ { k } ^ { \mathrm { g } } } \end{array}$ .
|
| 107 |
+
|
| 108 |
+
Image Decoder. Given the input frame $\mathcal { T } _ { 1 }$ and the predicted overall motion $\mathcal { M }$ , we employ the U-Net (Ronneberger et al., 2015) as our image decoder to synthesize the future image frame $\mathcal { T } _ { 2 }$ .
|
| 109 |
+
|
| 110 |
+
# 4.3 TRAINING DETAILS
|
| 111 |
+
|
| 112 |
+
Our objective function $\mathcal { L }$ is a weighted sum over three separate components:
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\mathcal { L } = \mathcal { L } _ { \mathrm { r e c o n } } + \beta \cdot \mathcal { L } _ { \mathrm { r e g } } + \gamma \cdot \mathcal { L } _ { \mathrm { s t r u c t } } ,
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
The first component is the pixel-wise reconstruction loss, which enforces our model to accurately estimate the motion $\mathcal { M }$ and synthesize the future frame $\mathcal { T } _ { 2 }$ . We have $\mathcal { L } _ { \mathrm { r e c o n } } = \| \mathcal { M } - \hat { \mathcal { M } } \| _ { 2 } + \alpha$ · $\lVert \mathcal { I } _ { 2 } - \hat { \mathcal { I } } _ { 2 } \rVert _ { 2 }$ , where $\alpha$ is a weighting factor (which is set to $1 0 ^ { 3 }$ in our experiments).
|
| 119 |
+
|
| 120 |
+
The second component is the variational loss, which encourages our model to use as few dimensions in the latent representation $z$ as possible (Xue et al., 2016; Higgins et al., 2017). We have $\mathcal { L } _ { \mathrm { r e g } } = \mathcal { D } _ { \mathrm { K L } } \big ( \mathcal { N } ( z _ { \mathrm { m e a n } } , z _ { \mathrm { v a r } } ) \ | | \ p _ { z } ( z ) \big )$ , where $\mathcal { D } _ { \mathrm { K L } } ( \cdot \mid \mid \cdot )$ is the KL-divergence, and $p _ { z } ( z )$ is the prior distribution of the latent representation (which is set to normal distribution in our experiments).
|
| 121 |
+
|
| 122 |
+
The last component is the structural loss, which encourages our model to learn the hierarchical tree structure so that it helps the motions $\mathcal { M } ^ { 1 }$ be represented in an efficient way: $\begin{array} { r } { \mathcal { L } _ { \mathrm { s t r u c t } } = \sum _ { k = 1 } ^ { d } \| \mathcal { M } _ { k } ^ { 1 } \| _ { 2 } } \end{array}$ Note that we apply the structural loss on local motion fields, not on the structural matrix. In this way, the structural loss serves as a regularization, encouraging the motion field to have small values.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 4: Results of synthesizing future frames (a-e) and learning hierarchical structure (f) on shapes
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 5: Results of segmenting different shapes (b) and learning hierarchical tree structure (c) on a dataset with more shapes.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 6: Results of synthesizing future frames (a-e) and learning hierarchical structure (f) on digits.
|
| 132 |
+
|
| 133 |
+
We implement our PSD model in PyTorch (Paszke et al., 2017). Optimization is carried out using ADAM (Kingma & Ba, 2015) with $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ . We use a fixed learning rate of $1 0 ^ { - 3 }$ and mini-batch size of 32. We propose the two-stage optimization schema, which first learns the disentangled and then learns the hierarchical representation.
|
| 134 |
+
|
| 135 |
+
In the first stage, we encourage the model to learn a disentangled representation (without structure). We set the $\gamma$ in Equation 3 to 0 and fix the structural matrix $s$ to the identity $\mathcal { T }$ . The $\beta$ in Equation 3 is the same as the one in the $\beta$ -VAE (Higgins et al., 2017), and therefore, larger $\beta$ ’s encourage the model to learn a more disentangled representation. We first initialize the $\beta$ to 0.1 and then adaptively double the value of $\beta$ when the reconstruction loss reaches a preset threshold.
|
| 136 |
+
|
| 137 |
+
In the second stage, we train the model to learn the hierarchical representation. We fix the weights of motion encoder and kernel decoder, and set the $\beta$ to 0. We initialize the structural matrix $s$ , and optimize it with the image encoder and motion decoder jointly. We adaptively tune the value of $\gamma$ in the same way as the $\beta$ in the first stage.
|
| 138 |
+
|
| 139 |
+
# 5 EXPERIMENTS
|
| 140 |
+
|
| 141 |
+
We evaluate our model on three diverse settings: i) simple yet nontrivial shapes and digits, ii) Atari games of basketball playing, and iii) real-world human motions.
|
| 142 |
+
|
| 143 |
+
# 5.1 MOVEMENT OF SHAPES AND DIGITS
|
| 144 |
+
|
| 145 |
+
We first evaluate our method on shapes and digits. For each dataset, we rendered totally 100,000 pairs for training and 10,000 for testing, with random visual appearance (i.e., sizes, positions, and colors).
|
| 146 |
+
|
| 147 |
+
For the shapes dataset, we use three types of shapes: circles, triangles and squares. Circles always move diagonally, while the other two shapes’ movements consist of two sub-movements: moving together with circles and moving in their own directions (triangles horizontally, and squares vertically). Figure A3 demonstrates the motion distributions of each shape. The complex global motions (after structure descriptor) are decomposed into several simple local motions (before structure descriptor). These local motions are much easier to represent.
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 7: Qualitative results of object segmentation on shapes and digits: (a) Ground-truth; (b) PSD; (c) NEM; and (d) R-NEM. In this visualization, we superimpose the segmentation masks on images.
|
| 151 |
+
|
| 152 |
+
<table><tr><td rowspan="2"></td><td colspan="3">Shapes</td><td colspan="6">Digits</td></tr><tr><td>Circles</td><td>Squares</td><td>Triangles</td><td>0's</td><td>1's</td><td>2's</td><td>3's</td><td>4's</td><td>5's</td></tr><tr><td>NEM</td><td>0.368</td><td>0.457</td><td>0.348</td><td>0.470</td><td>0.229</td><td>0.322</td><td>0.512</td><td>0.295</td><td>0.251</td></tr><tr><td>R-NEM</td><td>0.540</td><td>0.559</td><td>0.583</td><td>0.323</td><td>0.416</td><td>0.339</td><td>0.448</td><td>0.352</td><td>0.326</td></tr><tr><td>PSD (ours)</td><td>0.935</td><td>0.816</td><td>0.905</td><td>0.750</td><td>0.742</td><td>0.739</td><td>0.739</td><td>0.472</td><td>0.641</td></tr></table>
|
| 153 |
+
|
| 154 |
+
Table 1: Quantitative results (IoUs) of object segmentation on shapes and digits.
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 8: Qualitative results of object segmentation when generalizing to new dataset.
|
| 158 |
+
|
| 159 |
+
We also construct an additional dataset with up to nine different shapes. We assign these shapes into four different groups: i) square and two types of parallelograms, ii) circle and two types of triangles, iii) two types of trapezoids, and iv) pentagon. The movements of shapes in the same group have intrinsic relations, while shapes in different groups are independent of each other. These nine shapes have their own different motion direction. In the first group, the tree structure is the same as that of our original shapes dataset: replacing circles with squares, triangles with left parallelograms, and squares with right parallelograms. In the second group, circle and two types of triangles form a chain-like structure, which is similar to the one in our digits dataset. In the third group, the structure is a chain contains two types of trapezoids. In the last group, there is only a pentagon.
|
| 160 |
+
|
| 161 |
+
As for the digits dataset, we use six types of hand-written digits from MNIST (LeCun et al., 1998). These digits are divided into two groups: 0’s, 1’s and 2’s are in the first group, and 3’s, 4’s and 5’s in the second group. The movements of digits in the same group have some intrinsic relations, while digits in different groups are independent of each other. In the first group, the tree structure is the same as that of our shapes dataset: replacing circles with 0’s, triangles with 1’s, and squares with 2’s. The second group has a chain-like structure: 3’s move diagonally, 4’s move together with $_ { 3 } ,$ and move horizontally at the same time, and 5’s move with 4’s and move vertically at the same time.
|
| 162 |
+
|
| 163 |
+
After training, our model should be able to synthesize future frames, segment different objects (i.e., shapes and digits), and discover the relationship between these objects.
|
| 164 |
+
|
| 165 |
+
Future Prediction. In Figure 4d and Figure 6d, we present some qualitative results of synthesizing future frames. Our PSD model captures the different motion patterns for each object and synthesizes multiple possible future frames. Figure A3 summarizes the distribution of sampled motion of these shapes; our model learns to approximate each shape’s dynamics in the training set.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 9: Results of segmenting objects (d-f) and learning hierarchical structure (g) on Atari games.
|
| 169 |
+
|
| 170 |
+
Latent Representation. After analyzing the representation $z$ , we observe that its intrinsic dimensionality is extremely sparse. On the shapes dataset, there are three dimensions learning meaningful representations, each of which correspond to one particular shape, while all the other dimensions are very close to the Gaussian noise. Similarly, on digits dataset, there are six dimensions, corresponding to different digits. In further discussions, we will only focus on these meaningful dimensions.
|
| 171 |
+
|
| 172 |
+
Object Segmentation. For each meaningful dimension, the feature map can be considered as the segmentation mask of one particular object (by thresholding). We evaluate our model’s ability on learning the concept of objects and segmenting them by computing the intersection over union (IoU) between model’s prediction and the ground-truth instance mask. We compare our model with Neural Expectation Maximization (NEM) proposed by Greff et al. (2017) and Relational Neural Expectation Maximization (R-NEM) proposed by van Steenkiste et al. (2018). As these two methods both take a sequence of frames as inputs, we feed two input frames repetitively $( \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } , \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } , \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } , \ldots )$ into these models for fair comparison. Besides, as these methods do not learn the correspondence of objects across data points, we manually iterate all possible mappings and report the one with the best performance.
|
| 173 |
+
|
| 174 |
+
We present qualitative results in Figure 7 and Figure 5b, and quantitative results in Table 1. Our PSD model significantly outperforms two baselines. In particular, R-NEM and our PSD model focus on complementary topics: R-NEM learns to identify instances through temporal reasoning, using signals across the entire video to group pixels into objects; our PSD model learns the appearance prior of objects: by watching how they move, it learns to recognize how object parts can be grouped based on their appearance and can be applied on static images. As the videos in our dataset has only two frames, temporal signals alone are often not enough to tell objects apart. This explains the less compelling results from R-NEM. We included a more systematic study in Section A.3 to verify that.
|
| 175 |
+
|
| 176 |
+
To evaluate the generalization ability, we train our PSD model on a dataset with two squares, among other shapes, and test it on a dataset with three squares. In each piece of data, all squares move together and have the same motion. Other settings are the same as the original shapes dataset. Figure 8 shows segmentation results on these two datasets. Our model generalizes to recognize the three squares simultaneously, despite having seen up to two in training.
|
| 177 |
+
|
| 178 |
+
Hierarchical Structure. To discover the tree structure between these dimensions, we binarize the structural matrix $S _ { i k }$ by a threshold of 0.5 and recover the hierarchical structure from it. We compare our PSD model with R-NEM and Neural Relational Inference (NRI) proposed by Kipf et al. (2018). As the NRI model requires objects’ feature vectors (i.e., location and velocity) as input, we directly feed the coordinates of different objects in and ask it to infer the underlying interaction graph. In Figure 4f and Figure 6f, we visualize the hierarchical tree structure obtained from these models. Our model is capable of discovering the underlying structure; while two baselines fail to learn any meaningful relationships. This might be because NRI and R-NEM both assume that the system dynamics is fully characterized by their current states and interactions, and therefore, they are not able to model the uncertainties in the system dynamics. On the challenging dataset with more shapes, our PSD model is still able to discover the underlying structure among them (see Figure 5c).
|
| 179 |
+
|
| 180 |
+
# 5.2 ATARI GAMES OF PLAYING BASKETBALL
|
| 181 |
+
|
| 182 |
+
We then evaluate our model on a dataset of Atari games. In particular, we select the Basketball game from the Atari 2600. In this game, there are two players competing with each other. Each player can move in eight different directions. The offensive player constantly dribbles the ball and throws the ball at some moment; while the defensive player tries to steal the ball from his opponent player. We download a video of playing this game from YouTube and construct a dataset with 5,000 pairs for training and 500 for testing.
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 10: Qualitative results of synthesizing future frames on real-world human motions (exercise).
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 11: Qualitative results of synthesizing future frames on real-world human motions (yoga).
|
| 189 |
+
|
| 190 |
+
Our PSD model discovers three meaningful dimensions in the latent representation $z$ . We visualize the feature maps in these three dimensions in Figure 9. We observe that one dimension (in Figure 9d) is learning the offensive player with ball, another (in Figure 9e) is learning the ball, and the other (in Figure 9f) is learning the defensive player. We construct the hierarchical tree structure among these three dimensions from the structural matrix $s$ . As illustrated in Figure $9 \mathrm { { g } }$ , our PSD model is able to discover the relationship between the ball and the players: the offensive player controls the ball. This is because our model observes that the ball always moves along with the offensive player.
|
| 191 |
+
|
| 192 |
+
# 5.3 MOVEMENT OF HUMANS
|
| 193 |
+
|
| 194 |
+
We finally evaluate our method on two datasets of real-world human motions: the human exercise dataset used in Xue et al. (2016) and the yoga dataset used in Balakrishnan et al. (2018a). We estimate the optical flows between frames by an off-the-shelf package (Liu, 2009). Compared with previous datasets, these two require much more complicated visual perception, and they have challenging hierarchical structures. In the human exercise dataset, there are 50,000 pairs of frames used for training and 500 for testing. As for the yoga dataset, there are 4,720 pairs of frames for training and 526 for testing.
|
| 195 |
+
|
| 196 |
+
Future Prediction. In Figure 10 and Figure 11, we present qualitative results of synthesizing future frames. Our model is capable of predicting multiple future frames, each with a different motion. We compare with $3 \mathrm { D c V A E }$ (Li et al., 2018), which takes one frame as input and predicts the next 16 frames. As our training dataset only has paired frames, for fair comparison, we use the repetition of two frames as input: $( \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } , \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } , . . . , \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } )$ . We also use the same optical flow (Liu, 2009) for both methods. In Figure 12, the future frames predicted by 3DcVAE have much more artifacts, compared with our PSD model.
|
| 197 |
+
|
| 198 |
+
Object Segmentation. In Figure 13 and Figure 14, we visualize the feature maps corresponding to the active latent dimensions. It turns out that each of these dimensions corresponds to one particular human part: full torsos (13c, 14c), upper torsos (13d), arms (13e), left arms (14d), right arms (14e), right legs (13f, $\mathrm { ~ \bf ~ g ~ } )$ , and left legs (13g, 14f). Note that it is extremely challenging to distinguish
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 12: Comparison of synthesizing future frames between our PSD model and 3DcVAE
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 13: Results of segmenting parts (c-g) and learning hierarchical structure $\mathbf { ( h ) }$ on human motions.
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
|
| 208 |
+
Figure 14: Results of segmenting parts $\mathbf { ( c { - } g ) }$ and learning hierarchical structure (h) on human motions.
|
| 209 |
+
|
| 210 |
+
<table><tr><td></td><td>Full torso</td><td>Upper torso</td><td>Arm</td><td>Left leg</td><td>Right leg</td><td>Overall</td></tr><tr><td>NEM</td><td>0.298</td><td>0.347</td><td>0.125</td><td>0.264</td><td>0.222</td><td>0.251</td></tr><tr><td>R-NEM</td><td>0.321</td><td>0.319</td><td>0.220</td><td>0.294</td><td>0.228</td><td>0.276</td></tr><tr><td>PSD (ours)</td><td>0.697</td><td>0.574</td><td>0.391</td><td>0.374</td><td>0.336</td><td>0.474</td></tr></table>
|
| 211 |
+
|
| 212 |
+
Table 2: Quantitative results (IoUs) of object segmentation on human exercise dataset.
|
| 213 |
+
|
| 214 |
+
different parts from motions, because different parts (e.g., arms and legs) might have similar motions (see Figure 13b). R-NEM is not able to segment any meaningful parts, let alone structure, while our PSD model gives imperfect yet reasonable part segmentation results. For quantitative evaluation, we collect the ground truth part segmentation for 30 images and compute the intersection over union (IoU) between the ground-truth and the prediction of our model and the other two baselines (NEM, R-NEM). The quantitative results are presented in Table 2. Our PSD model significantly outperforms the two baselines.
|
| 215 |
+
|
| 216 |
+
Hierarchical Structure. We recover the hierarchical tree structure among these dimensions from the structural matrix $s$ . From Figure 13h, our PSD model is able to discover that the upper torso and the legs are part of the full torso, and the arm is part of the upper torso, and from Figure 14h, our PSD model discovers that the arms and legs are parts the full torso.
|
| 217 |
+
|
| 218 |
+
# 6 CONCLUSION
|
| 219 |
+
|
| 220 |
+
We have presented a novel formulation that simultaneously discovers object parts, their hierarchical structure, and the system dynamics from unlabeled videos. Our model uses a layered image representation to discover basic concepts and a structural descriptor to compose them. Experiments suggest that it works well on both real and synthetic datasets for part segmentation, hierarchical structure recovery, and motion prediction. We hope our work will inspire future research along the direction of learning structural object representations from raw sensory inputs.
|
| 221 |
+
|
| 222 |
+
Acknowledgements. We thank Michael Chang and Sjoerd van Steenkiste for helpful discussions and suggestions. This work was supported in part by NSF #1231216, NSF #1447476, ONR MURI N00014-16-1-2007, and Facebook.
|
| 223 |
+
|
| 224 |
+
# REFERENCES
|
| 225 |
+
|
| 226 |
+
Pulkit Agrawal, Ashvin Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. In NeurIPS, 2016. 2
|
| 227 |
+
|
| 228 |
+
Jimmy Ba, Volodymyr Mnih, and Koray Kavukcuoglu. Multiple object recognition with visual attention. In ICLR, 2015. 2
|
| 229 |
+
|
| 230 |
+
Guha Balakrishnan, Amy Zhao, Adrian V Dalca, Fredo Durand, and John Guttag. Synthesizing images of humans in unseen poses. In CVPR, 2018a. 9
|
| 231 |
+
|
| 232 |
+
Guha Balakrishnan, Amy Zhao, Adrian V Dalca, Fredo Durand, and John Guttag. Synthesizing images of humans in unseen poses. In CVPR, 2018b. 2
|
| 233 |
+
|
| 234 |
+
Peter W. Battaglia, Razvan Pascanu, Matthew Lai, Danilo Rezende, and Koray Kavukcuoglu. Interaction networks for learning about objects, relations and physics. In NeurIPS, 2016. 2
|
| 235 |
+
|
| 236 |
+
Marcus A. Brubaker, David J. Fleet, and Aaron Hertzmann. Physics-based person tracking using the anthropomorphic walker. IJCV, 87(1-2):140–155, aug 2009. doi: 10.1007/s11263-009-0274-5. 3
|
| 237 |
+
|
| 238 |
+
Susan Carey. The origin of concepts. Oxford University Press, 2009. 1
|
| 239 |
+
|
| 240 |
+
Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. In ICLR, 2017. 2
|
| 241 |
+
|
| 242 |
+
Tian Qi Chen, Xuechen Li, Roger Grosse, and David Duvenaud. Isolating sources of disentanglement in variational autoencoders. arXiv:1802.04942, 2018. 2
|
| 243 |
+
|
| 244 |
+
Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In NeurIPS, 2016. 1, 2
|
| 245 |
+
|
| 246 |
+
François Chollet. Xception: Deep learning with depthwise separable convolutions. In CVPR, 2017. 5
|
| 247 |
+
|
| 248 |
+
Sebastien Ehrhardt, Aron Monszpart, Niloy J Mitra, and Andrea Vedaldi. Learning a physical long-term predictor. arXiv:1703.00247, 2017. 2
|
| 249 |
+
|
| 250 |
+
SM Eslami, Nicolas Heess, Theophane Weber, Yuval Tassa, Koray Kavukcuoglu, and Geoffrey E Hinton. Attend, infer, repeat: Fast scene understanding with generative models. In NeurIPS, 2016. 1, 2
|
| 251 |
+
|
| 252 |
+
Babak Esmaeili, Hao Wu, Sarthak Jain, Siddharth Narayanaswamy, Brooks Paige, and Jan-Willem van de Meent. Hierarchical disentangled representations. arXiv:1804.02086, 2018. 2
|
| 253 |
+
|
| 254 |
+
Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NeurIPS, 2016. 2
|
| 255 |
+
|
| 256 |
+
Fernando Flores-Mangas and Allan D Jepson. Fast rigid motion segmentation via incrementally-complex local models. In CVPR, 2013. 2
|
| 257 |
+
|
| 258 |
+
Katerina Fragkiadaki, Pulkit Agrawal, Sergey Levine, and Jitendra Malik. Learning visual predictive models of physics for playing billiards. In ICLR, 2016. 2
|
| 259 |
+
|
| 260 |
+
Samuel J Gershman, Joshua B Tenenbaum, and Frank Jäkel. Discovering hierarchical motion structure. Vis. Res., 126:232–241, 2016. 2
|
| 261 |
+
|
| 262 |
+
Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. Neural expectation maximization. In NeurIPS, 2017. 8
|
| 263 |
+
|
| 264 |
+
Matthias Grundmann, Vivek Kwatra, Mei Han, and Irfan Essa. Efficient hierarchical graph-based video segmentation. In CVPR, 2010. 2
|
| 265 |
+
|
| 266 |
+
Irina Higgins, Loic Matthey, Arka Pal, Christopher P Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. Beta-vae: Learning basic visual concepts with a constrained variational framework. In ICLR, 2017. 2, 5, 6
|
| 267 |
+
|
| 268 |
+
Irina Higgins, Nicolas Sonnerat, Loic Matthey, Arka Pal, Christopher P Burgess, Matthew Botvinick, Demis Hassabis, and Alexander Lerchner. Scan: learning abstract hierarchical compositional visual concepts. In ICLR, 2018. 2
|
| 269 |
+
Geoffrey E Hinton and Drew Van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In COLT, 1993. 2
|
| 270 |
+
Wei-Ning Hsu, Yu Zhang, and James Glass. Unsupervised learning of disentangled and interpretable representations from sequential data. In NeurIPS, 2017. 2
|
| 271 |
+
Jonathan Huang and Kevin Murphy. Efficient inference in occlusion-aware generative models of images. In ICLR Workshop, 2015. 1, 2
|
| 272 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. 5
|
| 273 |
+
Mihir Jain, Jan Van Gemert, Hervé Jégou, Patrick Bouthemy, and Cees GM Snoek. Action localization with tubelets from motion. In CVPR, 2014. 2
|
| 274 |
+
Gunnar Johansson. Visual perception of biological motion and a model for its analysis. Perception & Psychophysics, 14(2):201–211, 1973. 1
|
| 275 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. 6
|
| 276 |
+
Thomas N Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard S Zemel. Neural relational inference for interacting systems. arXiv:1802.04687, 2018. 2, 8
|
| 277 |
+
Kris M. Kitani, De-An Huang, and Wei-Chiu Ma. Activity forecasting. In Group and Crowd Behavior for Computer Vision, pp. 273–294. Elsevier, 2017. doi: 10.1016/b978-0-12-809276-7.00014-x. 2
|
| 278 |
+
Kurt Koffka. Principles of Gestalt psychology. Routledge, 2013. 1
|
| 279 |
+
Tejas D Kulkarni, Pushmeet Kohli, Joshua B Tenenbaum, and Vikash Mansinghka. Picture: A probabilistic programming language for scene perception. In CVPR, 2015a. 2
|
| 280 |
+
Tejas D Kulkarni, William F Whitney, Pushmeet Kohli, and Josh Tenenbaum. Deep convolutional inverse graphics network. In NeurIPS, 2015b. 2
|
| 281 |
+
Nikolaos Kyriazis and Antonis Argyros. Physically plausible 3d scene tracking: The single actor hypothesis. In CVPR, 2013. 3
|
| 282 |
+
Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proc. IEEE, 86(11):2278–2324, 1998. 7
|
| 283 |
+
Jungbeom Lee, Jangho Lee, Sungmin Lee, and Sungroh Yoon. Msnet: Mutual suppression network for disentangled video representations. arXiv:1804.04810, 2018. 2
|
| 284 |
+
Yijun Li, Chen Fang, Jimei Yang, Zhaowen Wang, Xin Lu, and Ming-Hsuan Yang. Flow-grounded spatialtemporal video prediction from still images. In ECCV, 2018. 9
|
| 285 |
+
Yingzhen Li and Stephan Mandt. A deep generative model for disentangled representations of sequential data. arXiv:1803.02991, 2018. 2
|
| 286 |
+
Ce Liu. Beyond pixels: exploring new representations and applications for motion analysis. PhD thesis, Massachusetts Institute of Technology, 2009. 9
|
| 287 |
+
William Lotter, Gabriel Kreiman, and David Cox. Deep predictive coding networks for video prediction and unsupervised learning. In ICLR, 2017. 2
|
| 288 |
+
Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In ICML, 2013. 5
|
| 289 |
+
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. In ICLR, 2016. 2
|
| 290 |
+
Peter Ochs, Jitendra Malik, and Thomas Brox. Segmentation of moving objects by long term video analysis. TPAMI, 2014. 2
|
| 291 |
+
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In NIPS Workshop, 2017. 6
|
| 292 |
+
Juan-Manuel Pérez-Rúa, Tomas Crivelli, Patrick Pérez, and Patrick Bouthemy. Discovering motion hierarchies via tree-structured coding of trajectories. In BMVC, 2016. 2
|
| 293 |
+
Danilo Jimenez Rezende, SM Eslami, Shakir Mohamed, Peter Battaglia, Max Jaderberg, and Nicolas Heess. Unsupervised learning of 3d structure from images. In NeurIPS, 2016. 2
|
| 294 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICCAI, 2015. 5
|
| 295 |
+
David A Ross and Richard S Zemel. Learning parts-based representations of data. JMLR, 2006. 2
|
| 296 |
+
David A Ross, Daniel Tarlow, and Richard S Zemel. Learning articulated structure and motion. IJCV, 2010. 2
|
| 297 |
+
Mathieu Salzmann and Raquel Urtasun. Physically-based motion models for 3d tracking: A convex formulation. In ICCV, 2011. 3
|
| 298 |
+
Tianjia Shao, Aron Monszpart, Youyi Zheng, Bongjin Koo, Weiwei Xu, Kun Zhou, and Niloy J Mitra. Imagining the unseen: Stability-based cuboid arrangements for scene understanding. ACM TOG, 33(6), 2014. 2
|
| 299 |
+
Elizabeth S Spelke and Katherine D Kinzler. Core knowledge. Dev. Psychol., 10(1):89–96, 2007. 1
|
| 300 |
+
Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jürgen Schmidhuber. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. In ICLR, 2018. 2, 8
|
| 301 |
+
Marek Vondrak, Leonid Sigal, and Odest Chadwicke Jenkins. Dynamical simulation priors for human motion tracking. IEEE TPAMI, 35(1):52–65, 2013. 3
|
| 302 |
+
Jacob Walker, Carl Doersch, Abhinav Gupta, and Martial Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In ECCV, 2016. 2
|
| 303 |
+
John YA Wang and Edward H Adelson. Layered representation for motion analysis. In CVPR, 1993. 2, 3
|
| 304 |
+
Nicholas Watters, Andrea Tacchetti, Theophane Weber, Razvan Pascanu, Peter Battaglia, and Daniel Zoran. Visual interaction networks. In NeurIPS, 2017. 2
|
| 305 |
+
Jiajun Wu, Erika Lu, Pushmeet Kohli, William T Freeman, and Joshua B Tenenbaum. Learning to see physics via visual de-animation. In NeurIPS, 2017. 2
|
| 306 |
+
Chenliang Xu, Caiming Xiong, and Jason J Corso. Streaming hierarchical video segmentation. In ECCV, 2012. 2
|
| 307 |
+
Tianfan Xue, Jiajun Wu, Katherine L Bouman, and William T Freeman. Visual dynamics: Probabilistic future frame synthesis via cross convolutional networks. In NeurIPS, 2016. 2, 5, 9
|
| 308 |
+
|
| 309 |
+
# A.1 MORE QUALITATIVE RESULTS
|
| 310 |
+
|
| 311 |
+
In Figure A1, we demonstrate more future prediction results on shapes and digits dataset. In Figure A2, we present several segmentation results on shapes (with more objects), exercise and yoga dataset.
|
| 312 |
+
|
| 313 |
+

|
| 314 |
+
Figure A1: Additional results of future prediction on shapes and digits dataset.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure A2: Additional results of segmentation on shapes, exercise and yoga dataset.
|
| 318 |
+
|
| 319 |
+
# A.2 MOTION DISTRIBUTION OF SHAPE DATASET
|
| 320 |
+
|
| 321 |
+
In Figure A3, we demonstrate the motion distributions of each shape.
|
| 322 |
+
|
| 323 |
+

|
| 324 |
+
Figure A3: Motion distributions of different shapes before and after the structure descriptor. The first row is the ground truth and the second row is the prediction of our model.
|
| 325 |
+
|
| 326 |
+
# A.3 ADDITIONAL RESULTS OF R-NEM
|
| 327 |
+
|
| 328 |
+
As mentioned in the main paper, R-NEM and our PSD model focus on complementary topics: RNEM learns to identify instances through temporal reasoning, using signals across the entire video to group pixels into objects; our PSD model learns the appearance prior of objects: by watching how they move, it learns to recognize how object parts can be grouped based on their appearance and can be applied on static images. As the videos in our dataset has only two frames, temporal signals alone are often not enough to tell objects apart. This may explain the less compelling results from R-NEM.
|
| 329 |
+
|
| 330 |
+
Here, we include a more systematic study to verify that. We train the R-NEM with three types of inputs: 1) only one frame; 2) two input frames appear repetitively (the setup we used on our dataset, where videos only have two frames); 3) longer videos with 20 sequential frames. Figure A4 and Table A1 show that results on 20-frame input are significantly better than the previous two. R-NEM handles occluded objects with long trajectories, where each object appears without occlusion in at least one of the frames.
|
| 331 |
+
|
| 332 |
+

|
| 333 |
+
Figure A4: Results of R-NEM on different kinds of datasets.
|
| 334 |
+
|
| 335 |
+
(a) Only one frame
|
| 336 |
+
|
| 337 |
+
<table><tr><td></td><td>Circles</td><td>Squares</td><td>Triangles</td><td>Overall</td></tr><tr><td>1 frame</td><td>0.418</td><td>0.511</td><td>0.559</td><td>0.501</td></tr><tr><td>2 frames</td><td>0.513</td><td>0.552</td><td>0.612</td><td>0.558</td></tr><tr><td>20 frames</td><td>0.760</td><td>0.850</td><td>0.871</td><td>0.833</td></tr></table>
|
| 338 |
+
|
| 339 |
+
Table A1: Quantitative results (IoUs) of object segmentation with different types of inputs.
|
md/train/rkdU7tCaZ/rkdU7tCaZ.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DYNAMIC EVALUATION OF NEURAL SEQUENCE MODELS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present methodology for using dynamic evaluation to improve neural sequence models. Models are adapted to recent history via a gradient descent based mechanism, causing them to assign higher probabilities to re-occurring sequential patterns. Dynamic evaluation outperforms existing adaptation approaches in our comparisons. Dynamic evaluation improves the state-of-the-art word-level perplexities on the Penn Treebank and WikiText-2 datasets to 51.1 and 44.3 respectively, and the state-of-the-art character-level cross-entropies on the text8 and Hutter Prize datasets to 1.19 bits/char and 1.08 bits/char respectively.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Sequence generation and prediction tasks span many modes of data, ranging from audio and language modelling, to more general timeseries prediction tasks. Applications of such models include speech recognition, machine translation, dialogue generation, speech synthesis, forecasting, and music generation, among others. Neural networks can be applied to these tasks by predicting sequence elements one-by-one, conditioning on the history of sequence elements, forming an autoregressive model. Convolutional neural networks (CNNs) and recurrent neural networks (RNNs), including long-short term memory (LSTM) networks (Hochreiter & Schmidhuber, 1997) in particular, have achieved many successes at these tasks. However, in their basic form, these models have a limited ability to adapt to recently observed parts of a sequence.
|
| 12 |
+
|
| 13 |
+
Many sequences contain repetition; a pattern that occurs once is more likely to occur again. For instance, a word that occurs once in a document is much more likely to occur again. A sequence of handwriting will generally stay in the same handwriting style. A sequence of speech will generally stay in the same voice. Although RNNs have a hidden state that can summarize the recent past, they are often unable to exploit new patterns that occur repeatedly in a test sequence.
|
| 14 |
+
|
| 15 |
+
This paper concerns dynamic evaluation, which we investigate as a candidate solution to this problem. Our approach adapts models to recent sequences using gradient descent based mechanisms. We show several ways to improve on past dynamic evaluation approaches in Section 5, and use our improved methodology to achieve state-of-the-art results in Section 7. In Section 6 we design a method to dramatically to reduce the number of adaptation parameters in dynamic evaluation, making it practical in a wider range of situations. In Section 7.4 we analyse dynamic evaluation’s performance over varying time-scales and distribution shifts, and demonstrate that dynamically evaluated models can generate conditional samples that repeat many patterns from the conditioning data.
|
| 16 |
+
|
| 17 |
+
# 2 MOTIVATION
|
| 18 |
+
|
| 19 |
+
Generative models can assign probabilities to sequences by modelling each term in the factorization given by the product rule. The probability of a sequence $\stackrel { \cdot } { x _ { 1 : T } } = \{ x _ { 1 } , \stackrel { \cdot } { \dots } , x _ { T } \}$ factorizes as
|
| 20 |
+
|
| 21 |
+
$$
|
| 22 |
+
P ( x _ { 1 : T } ) = P ( x _ { 1 } ) P ( x _ { 2 } | x _ { 1 } ) P ( x _ { 3 } | x _ { 2 } , x _ { 1 } ) \cdot \cdot \cdot P ( x _ { T } | x _ { 1 } \ldots x _ { T - 1 } ) .
|
| 23 |
+
$$
|
| 24 |
+
|
| 25 |
+
Methods that apply this factorization either use a fixed context when predicting $P ( x _ { t } | x _ { 1 : t - 1 } )$ , for instance as in $\mathbf { N } .$ -grams or CNNs, or use a recurrent hidden state to summarize the context, as in an RNN. However, for longer sequences, the history $x _ { 1 : t - 1 }$ often contains re-occurring patterns that are difficult to capture using models with fixed parameters (static models).
|
| 26 |
+
|
| 27 |
+
In many domains, in a dataset of sequences $\{ x _ { 1 : T } ^ { 1 } , x _ { 1 : T } ^ { 2 } , . . . , x _ { 1 : T } ^ { M } \}$ , each sequence $\boldsymbol { x } _ { 1 : T } ^ { i }$ is generated from a slightly different distribution $P ( x _ { 1 : T } ^ { i } )$ . At any point in time $t$ , the history of a sequence $x _ { 1 : t - 1 } ^ { i }$ contains useful information about the generating distribution for that specific sequence $P ( x _ { 1 : T } ^ { i } )$ Therefore adapting the model parameters learned during training $\theta _ { g }$ is justified. We aim to infer a set of model parameters $\theta _ { l }$ from $x _ { 1 : t - 1 } ^ { i }$ that will better approximate $\bar { P } ( x _ { t } ^ { i } | x _ { 1 : t - 1 } ^ { i } )$ within sequence $i$ .
|
| 28 |
+
|
| 29 |
+
Many sequence modelling tasks are characterised by sequences generated from slightly different distributions as in the scenario described above. The generating distribution may also change continuously across a single sequence; for instance, a text excerpt may change topic. Furthermore, many machine learning benchmarks do not distinguish between sequence boundaries, and concatenate all sequences into one continuous sequence. Thus, many sequence modelling tasks could be seen as having a local distribution $P _ { l } ( x )$ as well as a global distribution $\textstyle P _ { g } ( x ) : = { \bar { J } } P ( l ) P _ { l } ( x ) d l$ . During training time, the goal is to find the best fixed model possible for $P _ { g } ( x )$ . However, during evaluation time, a model that can infer the current $P _ { l } ( x )$ from the recent history has an advantage.
|
| 30 |
+
|
| 31 |
+
# 3 DYNAMIC EVALUATION
|
| 32 |
+
|
| 33 |
+
Dynamic evaluation methods continuously adapt the model parameters $\theta _ { g }$ , learned at training time, to parts of a sequence during evaluation. The goal is to learn adapted parameters $\theta _ { l }$ that provide a better model of the local sequence distribution, $P _ { l } ( x )$ . When dynamic evaluation is applied in the present work, a long test sequence $x _ { 1 : T }$ is divided up into shorter sequences of length $n$ . We define $s _ { 1 : M }$ to be a sequence of shorter sequence segments $s _ { i }$
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
s _ { 1 : M } = \{ s _ { 1 } = x _ { 1 : n } , \ s _ { 2 } = x _ { n + 1 : 2 n } , \ s _ { 3 } = x _ { 2 n + 1 : 3 n } , \ . . . , \ s _ { M } \} .
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
The initial adapted parameters $\theta _ { l } ^ { 0 }$ are set to $\theta _ { g }$ , and used to compute the probability of the first segment, $P ( s _ { 1 } | \theta _ { l } ^ { 0 } )$ . This probability gives a cross entropy loss $\mathcal { L } ( s _ { 1 } )$ , with gradient $\nabla \mathcal { L } ( s _ { 1 } )$ , which is computed using truncated back-propagation through time (Werbos, 1990). The gradient $\nabla { \mathcal { L } } ( s _ { 1 } )$ is used to update the model, resulting in adapted parameters $\theta _ { l } ^ { 1 }$ , before evaluating $\bar { P ( s _ { 2 } | \theta _ { l } ^ { 1 } ) }$ . The same procedure is then repeated for $s _ { 2 }$ , and for each $s _ { i }$ in the sequence as shown in Figure 1. Gradients for each loss $\mathcal { L } ( s _ { i } )$ are only backpropagated to the beginning of $s _ { i }$ , so computation is linear in the sequence length. Each update applies one maximum likelihood training step to approximate the current local distribution $P _ { l } ( x )$ . The computational cost of dynamic evaluation is one forward pass and one gradient computation through the data, with some slight overhead to apply the update rule for every sequence segment.
|
| 40 |
+
|
| 41 |
+
As in all autoregressive models, dynamic evaluation only conditions on sequence elements that it has already predicted, and so evaluates a valid log-probability for each sequence. Dynamic evaluation can also be used while generating sequences. In this case, the model generates each sequence segment $s _ { i }$ using fixed weights, and performs a gradient descent based update step on $\mathcal { L } ( s _ { i } )$ . Applying dynamic evaluation for sequence generation could result in generated sequences with more consistent regularities, meaning that patterns that occur in the generated sequence are more likely to occur again.
|
| 42 |
+
|
| 43 |
+
# 4 BACKGROUND
|
| 44 |
+
|
| 45 |
+
# 4.1 RELATED APPROACHES
|
| 46 |
+
|
| 47 |
+
Adaptive language modelling was first considered for n-grams, adapting to recent history via caching (Jelinek et al., 1991; Kuhn, 1988), and other methods Bellegarda (2004). More recently, the neural cache approach (Grave et al., 2017) and the closely related pointer sentinel-LSTM (Merity et al., 2017b) have been used to for adaptive neural language modelling. Neural caching has recently been used to improve the state-of-the-art at word-level language modelling (Merity et al., 2017a).
|
| 48 |
+
|
| 49 |
+
The neural cache model learns a type of non-parametric output layer on the fly at test time, which allows the network to adapt to recent observations. Each past hidden state $h _ { i }$ is paired with the next input $x _ { i + 1 }$ , and is stored as a tuple $\left( h _ { i } , x _ { i + 1 } \right)$ . When a new hidden state $h _ { t }$ is observed, the output probabilities are adjusted to give a higher weight to output words that coincided with past hidden states with a large inner product $( h _ { t } ^ { T } h _ { i } )$ .
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
P _ { c a c h e } ( x _ { t + 1 } | x _ { 1 : t } , h _ { 1 : t } ) \propto \sum _ { i = 1 } ^ { t - 1 } e ^ { ( x _ { i + 1 } ) } \exp ( \omega h _ { t } ^ { T } h _ { i } ) ,
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 1: Illustration of dynamic evaluation. The model evaluates the probability of sequence segments $s _ { i }$ . The gradient $\dot { \nabla } \mathcal { L } ( s _ { i } )$ with respect to the log probability of $s _ { i }$ is used to update the model parameters $\theta _ { l } ^ { i - 1 }$ to $\theta _ { l } ^ { i }$ before the model progresses to the next sequence segment. Dashed edges are what distinguish dynamic evaluation from static (normal) evaluation.
|
| 57 |
+
|
| 58 |
+
where $e ^ { ( x _ { i + 1 } ) }$ is a one hot encoding of $x _ { i + 1 }$ , and $\omega$ is a scaling parameter. The cache probabilities are interpolated with the base network probabilities to adapt the base network at test time.
|
| 59 |
+
|
| 60 |
+
The neural cache closely relates to dynamic evaluation, as both methods can be added on top of a base model for adaptation at test time. The main difference is the mechanism used to fit to recent history: the neural cache approach uses a non-parametric, nearest neighbours-like method, whereas dynamic evaluation uses a gradient descent based method to change model parameters dynamically. Both methods rely on an autoregressive factorisation, as they depend on observing sequence elements after they are predicted in order to perform adaptation. Dynamic evaluation and neural caching methods are therefore both applicable to sequence prediction and generation tasks, but not directly to more general supervised learning tasks.
|
| 61 |
+
|
| 62 |
+
One drawback of the neural cache method is that it cannot adjust the recurrent hidden state dynamics. As a result, the neural cache’s ability to capture information that occurs jointly between successive sequence elements is limited. This capability is critical for adapting to sequences where each element has very little independent meaning, e.g. character level language modelling.
|
| 63 |
+
|
| 64 |
+
Another related approach is fast weights, (Ba et al., 2016; Schmidhuber, 1992). Fast weights feature recurrent architectures with dynamically changing weight matrices as a function of recent sequence history. Thus, dynamic evaluation as applied at test time, could be considered a form of fast-weights. In traditional fast weights, the network learns to control changes to the weights during training time, allowing it to be applied to more general sequence problems including sequence labeling. In dynamic evaluation, the procedure to change the weights is automated at test time via gradient descent optimization, making it only directly applicable to autoregressive sequence modelling. As dynamic evaluation leverages gradient descent, it has the potential to generalize better to previously unseen pattern repetitions at test time.
|
| 65 |
+
|
| 66 |
+
# 4.2 DYNAMIC EVALUATION IN NEURAL NETWORKS
|
| 67 |
+
|
| 68 |
+
Dynamic evaluation of neural language models was proposed by Mikolov et al. (2010). Their approach simply used stochastic gradient descent (SGD) updates at every time step, computing the gradient with fully truncated backpropagation through time, which is equivalent to setting $n = 1$ in equation (2). Dynamic evaluation has since been applied to character and word-level language models (Graves, 2013; Krause et al., 2017; Ororbia II et al., 2017; Fortunato et al., 2017). Previous work using dynamic evaluation considered it as an aside, and did not explore it in depth.
|
| 69 |
+
|
| 70 |
+
# 5 UPDATE RULE METHODOLOGY FOR DYNAMIC EVALUATION
|
| 71 |
+
|
| 72 |
+
We propose several changes to Mikolov et al. (2010)’s dynamic evaluation method with SGD and fully truncated backpropagation, which we refer to as traditional dynamic evaluation. The first modification reduces the update frequency, so that gradients are backpropagated over more timesteps. This change provides more accurate gradient information, and also improves the computational efficiency of dynamic evaluation, since the update rule is applied much less often. We use sequence segments of length 5 for word-level tasks and 20 for character-level tasks.
|
| 73 |
+
|
| 74 |
+
Next, we add a global decay prior to bias the model towards the parameters $\theta _ { g }$ learned during training. Our motivation for dynamic evaluation assumes that the local generating distribution $P _ { l } ( x )$ is constantly changing, so it is potentially desirable to weight recent sequence history higher in adaptation. Adding a global decay prior accomplishes this by causing previous adaptation updates to decay exponentially over time. The use of a decay prior for dynamic evaluation relates to the update rule used for fast weights in Ba et al. (2016), which decayed fast weights towards zero exponentially over time. For SGD with a global prior, learning rate $\eta$ and decay rate $\lambda$ ; we form the update rule
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\begin{array} { r } { \theta _ { i } \theta _ { i - 1 } - \eta \nabla \mathcal { L } ( s _ { i } ) + \lambda ( \theta _ { g } - \theta _ { l } ^ { i - 1 } ) . } \end{array}
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
We then consider using an RMSprop (Tieleman & Hinton, 2012) derived update rule for the learning rule in place of SGD. RMSprop uses a moving average of recent squared gradients to scale learning rates for each weight. In dynamic evaluation, near the start of a test sequence, RMSprop has had very few gradients to average, and therefore may not be able to leverage its updates as effectively. For this reason, we collect mean squared gradients, $M S _ { g }$ , on the training data rather than on recent test data (which is what RMSprop would do). $M S _ { g }$ is given by
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
M S _ { g } = \frac { 1 } { N _ { b } } \sum _ { k = 1 } ^ { N _ { b } } ( \nabla \mathcal { L } _ { k } ) ^ { 2 } ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $N _ { b }$ is the number of training batches and $\nabla \mathcal L _ { k }$ is the gradient on the $k$ th training batch. The mini-batch size for this computation becomes a hyper-parameter, as larger mini-batches will result in smaller mean squared gradients. The update rule, which we call RMS with a global prior in our experiments, is then
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\theta _ { l } ^ { i } \theta _ { l } ^ { i - 1 } - \eta \frac { \nabla \mathcal { L } ( s _ { i } ) } { \sqrt { M S _ { g } } + \epsilon } + \lambda ( \theta _ { g } - \theta _ { l } ^ { i - 1 } ) ,
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $\epsilon$ is a stabilization parameter. For the decay step of our update rule, we also consider scaling the decay rate for each parameter proportionally to $\sqrt { M S _ { g } }$ . Parameters with a high RMS gradient affect the dynamics of the network more, so it makes sense to decay them faster. $R M S _ { \mathrm { n o r m } }$ is $\sqrt { M S _ { g } }$ divided by its mean, resulting in a normalized version of $\sqrt { M S _ { g } }$ with a mean of 1:
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
R M S _ { \mathrm { n o r m } } = \frac { \sqrt { M S _ { g } } } { \mathrm { a v g } ( \sqrt { M S _ { g } } ) } .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
We clip the values of $R M S _ { \mathrm { n o r m } }$ to be no greater than $^ 1 / \lambda$ to be sure that the decay rate does not exceed 1 for any parameter. Combining the learning component and the regularization component results in the final update equation, which we refer to as RMS with an RMS global prior
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\theta _ { l } ^ { i } \theta _ { l } ^ { i - 1 } - \eta \frac { \nabla \mathcal { L } ( s _ { i } ) } { \sqrt { M S _ { g } } + \epsilon } + \lambda ( \theta _ { g } - \theta _ { l } ^ { i - 1 } ) \odot R M S _ { \mathrm { n o r m } } .
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
# 6 SPARSE DYNAMIC EVALUATION
|
| 105 |
+
|
| 106 |
+
Mini-batching over sequences is desirable for some test-time sequence modelling applications because it allows faster processing of multiple sequences in parallel. Dynamic evaluation has a high memory cost for mini-batching because it is necessary to store a different set of parameters for each sequence in the mini-batch. Therefore, we consider a sparse dynamic evaluation variant that updates a smaller number of parameters. We introduce a new adaptation matrix $\mathcal { M }$ which is initialized to zeros. $\mathcal { M }$ multiplies hidden state vector $h _ { t }$ of an RNN at every time-step to get a new hidden state $h _ { t } ^ { \prime }$ , via
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
h _ { t } ^ { \prime } = h _ { t } + \mathscr { M } h _ { t } .
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
$h _ { t } ^ { \prime }$ then replaces $h _ { t }$ and is propagated throughout the network via both recurrent and feed-forward connections. In a stacked RNN, this formulation could be applied to every layer or just one layer. Applying dynamic evaluation to $\mathcal { M }$ avoids the need to apply dynamic evaluation to the original parameters of the network, reduces the number of adaptation parameters, and makes mini-batching less memory intensive. We reduce the number of adaptation parameters further by only using $\mathcal { M }$ to transform an arbitrary subset of $H$ hidden units. This results in $\mathcal { M }$ being an $H \times H$ matrix with $d = H ^ { 2 }$ adaptation parameters. If $H$ is chosen to be much less than the number of hidden units, this reduces the number of adaptation parameters dramatically. In Section 7.3 we experiment with sparse dynamic evaluation for character-level language models.
|
| 113 |
+
|
| 114 |
+
# 7 EXPERIMENTS
|
| 115 |
+
|
| 116 |
+
We applied dynamic evaluation to word-level and character-level language modelling. In all tasks, we evaluate dynamic evaluation on top of a base model. After training the base model, we tune hyper-parameters for dynamic evaluation on the validation set, and evaluate both the static and dynamic versions of the model on the test set. We also consider follow up experiments that analyse the sequence lengths for which dynamic evaluation is useful.
|
| 117 |
+
|
| 118 |
+
# 7.1 SMALL SCALE WORD-LEVEL LANGUAGE MODELLING
|
| 119 |
+
|
| 120 |
+
We train base models on the Penn Treebank (PTB, Marcus et al., 1993), WikiText-2 (Merity et al., 2017b) datasets, and compare the performance of static and dynamic evaluation. These experiments compare dynamic evaluation against past approaches such as the neural cache and measure dynamic evaluation’s general performance across different models and datasets.
|
| 121 |
+
|
| 122 |
+
PTB is derived from articles of the Wall Street Journal. It contains 929k training tokens and a vocab size limited to 10k words. It is one of the most commonly used benchmarks in language modelling. We consider two baseline models on PTB, a standard LSTM implementation with recurrent dropout (Zaremba et al., 2014), and the recent state-of-the-art averaged SGD (ASGD) weight-dropped LSTM (AWD-LSTM, Merity et al., 2017a).
|
| 123 |
+
|
| 124 |
+
Our standard LSTM was taken from the Chainer (Tokui et al., 2015) tutorial on language modelling1, and used two LSTM layers with 650 units each, trained with SGD and regularized with recurrent dropout. On our standard LSTM, we experiment with traditional dynamic evaluation as applied by Mikolov et al. (2010), as well as each modification we make building up to our final update rule as described in Section 5. As our final update rule $( { \mathrm { R M S } } + { \mathrm { R M S } }$ global prior) worked best, we use this for all other experiments and use “dynamic eval” by default to refer to this update rule in tables.
|
| 125 |
+
|
| 126 |
+
We applied dynamic evaluation on an AWD-LSTM (Merity et al., 2017a). The AWD-LSTM is a vanilla LSTM that combines the use of drop-connect (Wan et al., 2013) on recurrent weights for regularization, and a variant of ASGD (Polyak & Juditsky, 1992) for optimisation. Our model, which used 3 layers and tied input and output embeddings (Press & Wolf, 2017; Inan et al., 2017), was intended to be a direct replication of AWD-LSTM, using code from their implementation2. Results are given in Table 1.
|
| 127 |
+
|
| 128 |
+
Dynamic evaluation gives significant overall improvements to both models on this dataset. Dynamic evaluation also achieves better final results than the neural cache on both a standard LSTM and the AWD-LSTM reimplementation, and improves the state-of-the-art on PTB.
|
| 129 |
+
|
| 130 |
+
Table 1: Penn Treebank perplexities. bptt refers to sequence segment lengths.
|
| 131 |
+
|
| 132 |
+
<table><tr><td>model</td><td>parameters</td><td>valid</td><td>test</td></tr><tr><td>RNN+LDA+kN-5+cache (Mikolov & Zweig,2012)</td><td></td><td></td><td>92.0</td></tr><tr><td>CharCNN (Kim et al., 2016)</td><td>19M</td><td></td><td>78.9</td></tr><tr><td>LSTM (Zaremba et al., 2014)</td><td>66M</td><td>82.2</td><td>78.4</td></tr><tr><td>Variational LSTM (Gal & Ghahramani, 2016)</td><td>66M</td><td></td><td>73.4</td></tr><tr><td>Pointer sentinel-LSTM (Merity et al.,2017b)</td><td>21M</td><td>72.4</td><td>70.9</td></tr><tr><td>Variational LSTM + augmented loss (Inan et al., 2017)</td><td>51M</td><td>71.1</td><td>68.5</td></tr><tr><td>Variational RHN (Zilly et al.,2017)</td><td>23M</td><td>67.9</td><td>65.4</td></tr><tr><td>NAS cell (Zoph & Le,2017)</td><td>54M</td><td></td><td>62.4</td></tr><tr><td>Variational LSTM + gradual learning (Aharoni et al., 2017)</td><td>105M</td><td></td><td>61.7</td></tr><tr><td>LSTM + BB tuning (Melis et al.,2017)</td><td>24M</td><td>60.9</td><td>58.3</td></tr><tr><td>LSTM (Grave et al., 2017)</td><td></td><td>86.9</td><td>82.3</td></tr><tr><td>LSTM + neural cache (Grave et al., 2017)</td><td></td><td>74.6</td><td>72.1</td></tr><tr><td>LSTM (ours)</td><td>20M</td><td>88.0</td><td>85.6</td></tr><tr><td>LSTM + traditional dynamic eval (sgd, bptt=1)</td><td>20M</td><td>78.6</td><td>76.2</td></tr><tr><td>LSTM + dynamic eval (sgd, bptt=5)</td><td>20M</td><td>78.0</td><td>75.6</td></tr><tr><td>LSTM + dynamic eval (sgd, bptt=5, global prior)</td><td>20M</td><td>77.4</td><td>74.8</td></tr><tr><td>LSTM + dynamic eval (RMS,bptt=5, global prior)</td><td>20M</td><td>74.3</td><td>72.2</td></tr><tr><td>LSTM + dynamic eval (RMS, bptt=5, RMS global prior)</td><td>20M</td><td>73.5</td><td>71.7</td></tr><tr><td>AWD-LSTM (Merity et al., 2017a)</td><td>24M</td><td>60.0</td><td>57.3</td></tr><tr><td>AWD-LSTM +neural cache (Merity et al., 2017a)</td><td>24M</td><td>53.9</td><td>52.8</td></tr><tr><td>AWD-LSTM (ours)</td><td>24M</td><td>59.8</td><td>57.7</td></tr><tr><td>AWD-LSTM + dynamic eval</td><td>24M</td><td>51.6</td><td>51.1</td></tr></table>
|
| 133 |
+
|
| 134 |
+
Table 2: WikiText-2 perplexities.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>model</td><td>parameters</td><td>valid</td><td>test</td></tr><tr><td>Byte mLSTM (Krause et al., 2016)</td><td>46M</td><td>92.8</td><td>88.8</td></tr><tr><td>Variational LSTM (Inan et al., 2017)</td><td>28M</td><td>91.5</td><td>87.0</td></tr><tr><td>Pointer sentinel-LSTM (Merity et al., 2017b)</td><td></td><td>84.8</td><td>80.8</td></tr><tr><td>LSTM + BB tuning (Melis et al., 2017)</td><td>24M</td><td>69.1</td><td>65.9</td></tr><tr><td>LSTM (Grave et al., 2017)</td><td></td><td>104.2</td><td>99.3</td></tr><tr><td>LSTM + neural cache (Grave et al., 2017)</td><td></td><td>72.1</td><td>68.9</td></tr><tr><td>LSTM (ours)</td><td>50M</td><td>109.1</td><td>103.4</td></tr><tr><td>LSTM + dynamic eval</td><td>50M</td><td>63.7</td><td>59.8</td></tr><tr><td>AWD-LSTM (Merity et al., 2017a)</td><td>33M</td><td>68.6</td><td>65.8</td></tr><tr><td>AWD-LSTM + neural cache (Merity et al., 2017a)</td><td>33M</td><td>53.8</td><td>52.0</td></tr><tr><td>AWD-LSTM (ours)</td><td>33M</td><td>68.9</td><td>66.1</td></tr><tr><td>AWD-LSTM + dynamic eval</td><td>33M</td><td>46.4</td><td>44.3</td></tr></table>
|
| 137 |
+
|
| 138 |
+
WikiText-2 is roughly twice the size of PTB, with 2 million training tokens and a vocab size of 33k. It features articles in a non-shuffled order, with dependencies across articles that adaptive methods should be able to exploit. For this dataset, we use the same baseline LSTM implementation and AWD-LSTM re-implementation as on PTB. Results are given in Table 2.
|
| 139 |
+
|
| 140 |
+
Dynamic evaluation improves the state-of-the-art perplexity on WikiText-2, and provides a significantly greater improvement than neural caching to both base models. This suggests that dynamic evaluation is effective at exploiting regularities that co-occur across non-shuffled documents.
|
| 141 |
+
|
| 142 |
+
Table 3: text8 (word-level) perplexities
|
| 143 |
+
|
| 144 |
+
<table><tr><td>model</td><td>valid</td><td>test</td></tr><tr><td>LSTM (Grave et al., 2017)</td><td></td><td>121.8</td></tr><tr><td>LSTM + neural cache (Grave et al., 2017)</td><td></td><td>99.9</td></tr><tr><td>AWD-LSTM</td><td>80.0</td><td>87.5</td></tr><tr><td>AWD-LSTM + neural cache</td><td>67.5</td><td>75.1</td></tr><tr><td>AWD-LSTM + dynamic eval</td><td>63.3</td><td>70.3</td></tr></table>
|
| 145 |
+
|
| 146 |
+
# 7.2 MEDIUM SCALE WORD-LEVEL LANGUAGE MODELLING
|
| 147 |
+
|
| 148 |
+
We benchmark the performance of dynamic evaluation against static evaluation and the neural cache on the larger text8 dataset. Like WikiText-2, text8 is derived from Wikipedia text. Text8 was introduced for word level language modelling by Mikolov et al. (2014), which preprocessed the data by mapping rare words to an ‘<unk>’ token, resulting in a vocab of 44k and 17M training tokens. We use the same test set as in Mikolov et al. (2014), but also hold out the final $1 0 0 \mathrm { k }$ training tokens as a validation set to allow for fair hyper-parameter tuning (the original task did not have a validation set). We trained an AWD-LSTM with 52M parameters using the implementation from Merity et al. (2017a). We then compare the performance of static evaluation, dynamic evaluation, and neural caching at test time.
|
| 149 |
+
|
| 150 |
+
To ensure a fair comparison between dynamic evaluation and the neural cache, we used robust hyper-parameter tuning on the validation set for both methods. For dynamic evaluation, we used the hyper-parameter settings found on PTB, and only tuned the learning rate (to 2 significant figures). The neural cache uses 3 hyper-parameters: the cache length, a mixing parameter and a flatness parameter. Starting from a cache size of 3000, we used a series of grid searches to find optimal values for the mixing parameter and flatness parameter (to 2 significant figures). We then varied the cache size in the range of 2000-4000, and found that the affect of this was negligible, so we kept the cache size at 3000. Results are given in table 3, with the results from Grave et al. (2017) that used the same test set given for context.
|
| 151 |
+
|
| 152 |
+
Dynamic evaluation soundly outperforms static evaluation and the neural cache method, demonstrating that the benefits of dynamic evaluation do not wash away when using a stronger model with more training data.
|
| 153 |
+
|
| 154 |
+
# 7.3 CHARACTER-LEVEL LANGUAGE MODELLING
|
| 155 |
+
|
| 156 |
+
We consider dynamic evaluation on the character-level text8, and Hutter Prize (Hutter, 2006) datasets. The Hutter Prize dataset is comprised of Wikipedia text, and includes XML and characters from non-Latin languages. It is 100 million UTF-8 bytes long and contains 205 unique bytes. Similarly to other reported results, we use a 90-5-5 split for training, validation, and testing. The text8 dataset is derived the Hutter Prize dataset, but has all XML removed, and is lower cased to only have 26 characters of English text plus spaces. The character-level text8 task corresponds to the unprocessed version of the text8 data used for our medium-scale word level language modelling experiments. As with Hutter Prize, we use the standard 90-5-5 split for training, validation, and testing for text8. We used a multiplicative LSTM (mLSTM) (Krause et al., 2016)3 as our base model for both datasets. The mLSTMs for both tasks used 2800 hidden units, an embedding layer of 400 units, weight normalization (Salimans & Kingma, 2016), variational dropout (Gal & Ghahramani, 2016), and ADAM (Kingma & Ba, 2014) for training.
|
| 157 |
+
|
| 158 |
+
We also consider sparse dynamic evaluation, as described in Section 6, on the Hutter Prize dataset. For sparse dynamic evaluation, we adapted a subset of 500 hidden units, resulting in a $5 0 0 \times 5 0 0$ adaptation matrix and $2 5 0 \mathrm { k }$ adaptation parameters. Our mLSTM only contained one recurrent layer, so only one adaptation matrix was used for sparse dynamic evaluation. All of our dynamic evaluation results in this section use the final update rule given in Section 5. Results for Hutter Prize are given in Table 4, and results for text8 are given in Table 5.
|
| 159 |
+
|
| 160 |
+
Table 4: Hutter Prize test set error in bits/char.
|
| 161 |
+
|
| 162 |
+
<table><tr><td>model</td><td>parameters</td><td>test</td></tr><tr><td>Stacked LSTM (Graves,2013)</td><td>21M</td><td>1.67</td></tr><tr><td rowspan="4">Stacked LSTM + traditional dynamic eval (Graves,2013) Multiplicative integration LSTM (Wu et al.,2016) HyperLSTM (Ha et al., 2017)</td><td>21M</td><td>1.33</td></tr><tr><td>17M</td><td>1.44</td></tr><tr><td>27M</td><td>1.34</td></tr><tr><td></td><td>1.32</td></tr><tr><td>Bytenet decoder (Kalchbrenner et al., 2016)</td><td></td><td>1.31</td></tr><tr><td>LSTM + BB tuning (Melis et al., 2017)</td><td>46M</td><td>1.30</td></tr><tr><td>Recurrent highway networks (Zilly et al.,2017) Fast-slow LSTM (Mujika et al.,2017)</td><td>46M</td><td>1.27</td></tr><tr><td></td><td>47M</td><td>1.25</td></tr><tr><td>mLSTM (Krause et al., 2016)</td><td>46M</td><td>1.24</td></tr><tr><td>mLSTM + sparse dynamic eval (d = 250k) mLSTM + dynamic eval</td><td>46M 46M</td><td>1.13 1.08</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Table 5: text8 (char-level) test set error in bits/char.
|
| 165 |
+
|
| 166 |
+
<table><tr><td>model</td><td>parameters</td><td>test</td></tr><tr><td>Multiplicative RNN (Mikolov et al., 2012)</td><td>5M</td><td>1.54</td></tr><tr><td>Multiplicative integration LSTM (Wu et al., 2016)</td><td>4M</td><td>1.44</td></tr><tr><td>LSTM (Cooijmans et al., 2017)</td><td></td><td>1.43</td></tr><tr><td>Batch normalised LSTM (Cooijmans et al., 2017)</td><td></td><td>1.36</td></tr><tr><td>Hierarchical multiscale LSTM (Chung et al., 2017)</td><td></td><td>1.29</td></tr><tr><td>Recurrent highway networks (Zilly et al., 2017)</td><td>45M</td><td>1.27</td></tr><tr><td>mLSTM (Krause et al., 2016)</td><td>45M</td><td>1.27</td></tr><tr><td>mLSTM + dynamic eval</td><td>45M</td><td>1.19</td></tr></table>
|
| 167 |
+
|
| 168 |
+
Dynamic evaluation achieves large improvements to our base models and state-of-the-art results on both datasets. Sparse dynamic evaluation also achieves significant improvements on Hutter Prize using only $0 . 5 \%$ of the adaptation parameters of regular dynamic evaluation.
|
| 169 |
+
|
| 170 |
+
# 7.4 TIME-SCALES OF DYNAMIC EVALUATION
|
| 171 |
+
|
| 172 |
+
We measure time-scales at which dynamic evaluation gains an advantage over static evaluation. Starting from the model trained on Hutter Prize, we plot the performance of static and dynamic evaluation against the number of characters processed on sequences from the Hutter Prize test set, and sequences in Spanish from the European Parliament dataset (Koehn, 2005).
|
| 173 |
+
|
| 174 |
+
The Hutter Prize data experiments show the timescales at which dynamic evaluation gained the advantage observed in Table 4. We divided the Hutter Prize test set into 500 sequences of length 10000, and applied static and dynamic evaluation to these sequences using the same model and methodology used to obtain results in Table 4. Losses were averaged across these 500 sequences to obtain average losses at each time step. Plots of the average cross-entropy errors against the number of Hutter characters sequenced are given in Figure 2a.
|
| 175 |
+
|
| 176 |
+
The Spanish experiments measure how dynamic evaluation handles large distribution shifts between training and test time, as Hutter Prize contains very little Spanish. We used the first 5 million characters of the Spanish European Parliament data in place of the Hutter Prize test set. The Spanish experiments used the same base model and dynamic evaluation settings as Hutter Prize. Plots of the average cross-entropy errors against the number of Spanish characters sequenced are given in Figure 2b.
|
| 177 |
+
|
| 178 |
+
On both datasets, dynamic evaluation gave a very noticeable advantage after a few hundred characters. For Spanish this advantage continued to grow as more of the sequence was processed, whereas for Hutter, this advantage was maximized after viewing around $2 \mathrm { - } 3 \mathrm { k }$ characters. The advantage of dynamic evaluation was also much greater on Spanish sequences than Hutter sequences.
|
| 179 |
+
|
| 180 |
+

|
| 181 |
+
Figure 2: Average losses in bits/char of dynamic evaluation and static evaluation plotted against number of characters processed; on sequences from the Hutter Prize test set (left) and European Parliament dataset in Spanish (right), averaged over 500 trials for each. Losses at each data point are averaged over sequence segments of length 100, and are not cumulative. Note the different y-axis scales in the two plots.
|
| 182 |
+
|
| 183 |
+
We also drew 300 character conditional samples from the static and dynamic versions of our model after viewing 10k characters of Spanish. For the dynamic model, we continued to apply dynamic evaluation during sampling as well, by the process described in Section 3. The conditional samples are given in the appendix. The static samples quickly switched to English that resembled Hutter Prize data. The dynamic model generated data with some Spanish words and a number of made up words with characteristics of Spanish words for the entirety of the sample. This is an example of the kinds of features that dynamic evaluation was able to learn to model on the fly.
|
| 184 |
+
|
| 185 |
+
# 8 CONCLUSION
|
| 186 |
+
|
| 187 |
+
This work explores and develops methodology for applying dynamic evaluation to sequence modelling tasks. Experiments show that the proposed dynamic evaluation methodology gives large test time improvements across character and word level language modelling. Our improvements to language modelling have applications to speech recognition and machine translation over longer contexts, including broadcast speech recognition and paragraph level machine translation. Overall, dynamic evaluation is shown to be an effective method for exploiting pattern re-occurrence in sequences.
|
| 188 |
+
|
| 189 |
+
# REFERENCES
|
| 190 |
+
|
| 191 |
+
Z. Aharoni, G. Rattner, and H. Permuter. Gradual learning of deep recurrent neural networks. arXiv preprint arXiv:1708.08863, 2017.
|
| 192 |
+
Jimmy Ba, Geoffrey E Hinton, Volodymyr Mnih, Joel Z Leibo, and Catalin Ionescu. Using fast weights to attend to the recent past. In Advances In Neural Information Processing Systems, pp. 4331–4339, 2016.
|
| 193 |
+
J. R. Bellegarda. Statistical language model adaptation: review and perspectives. Speech Communication, 42(1): 93–108, 2004.
|
| 194 |
+
J. Chung, S. Ahn, and Y. Bengio. Hierarchical multiscale recurrent neural networks. ICLR, 2017.
|
| 195 |
+
T. Cooijmans, N. Ballas, C. Laurent, and A. Courville. Recurrent batch normalization. ICLR, 2017.
|
| 196 |
+
M. Fortunato, C. Blundell, and O. Vinyals. Bayesian recurrent neural networks. arXiv preprint arXiv:1704.02798, 2017.
|
| 197 |
+
Y. Gal and Z. Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In Advances in neural information processing systems, pp. 1019–1027, 2016.
|
| 198 |
+
E. Grave, A. Joulin, and N. Usunier. Improving neural language models with a continuous cache. ICLR, 2017.
|
| 199 |
+
A. Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.
|
| 200 |
+
D. Ha, A. Dai, and Q. Lee. Hypernetworks. ICLR, 2017.
|
| 201 |
+
S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9:1735–1780, 1997.
|
| 202 |
+
M. Hutter. The human knowledge compression prize. URL http://prize.hutter1.net, 2006.
|
| 203 |
+
H. Inan, K. Khosravi, and R. Socher. Tying word vectors and word classifiers: A loss framework for language modeling. ICLR, 2017.
|
| 204 |
+
F. Jelinek, B. Merialdo, S. Roukos, and M. Strauss. A dynamic language model for speech recognition. In HLT, volume 91, pp. 293–295, 1991.
|
| 205 |
+
N. Kalchbrenner, L. Espeholt, K. Simonyan, A. Oord, A. Graves, and K. Kavukcuoglu. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099, 2016.
|
| 206 |
+
Y. Kim, Y. Jernite, D. Sontag, and A. M. Rush. Character-aware neural language models. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
|
| 207 |
+
D. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 208 |
+
P. Koehn. Europarl: A parallel corpus for statistical machine translation. In MT Summit, volume 5, pp. 79–86, 2005.
|
| 209 |
+
B. Krause, L. Lu, I. Murray, and S. Renals. Multiplicative LSTM for sequence modelling. arXiv preprint arXiv:1609.07959, 2016.
|
| 210 |
+
B. Krause, I. Murray, S. Renals, and L. Lu. Multiplicative LSTM for sequence modelling. ICLR Workshop track, 2017. URL https://openreview.net/forum?id $=$ SJCS5rXFl.
|
| 211 |
+
R. Kuhn. Speech recognition and the frequency of recently used words: A modified Markov model for natural language. In Proceedings of the 12th conference on Computational linguistics-Volume 1, pp. 348–350. Association for Computational Linguistics, 1988.
|
| 212 |
+
M. P. Marcus, M. A. Marcinkiewicz, and B. Santorini. Building a large annotated corpus of English: The Penn Treebank. Computational linguistics, 19(2):313–330, 1993.
|
| 213 |
+
G. Melis, C. Dyer, and P. Blunsom. On the state of the art of evaluation in neural language models. arXiv preprint arXiv:1707.05589, 2017.
|
| 214 |
+
S. Merity, N. S. Keskar, and R. Socher. Regularizing and optimizing LSTM language models. arXiv preprint arXiv:1708.02182, 2017a.
|
| 215 |
+
S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. ICLR, 2017b.
|
| 216 |
+
T. Mikolov and G. Zweig. Context dependent recurrent neural network language model. SLT, 12:234–239, 2012.
|
| 217 |
+
T. Mikolov, M. Karafiát, L. Burget, J. Cernocky, and S. Khudanpur. Recurrent neural network based language \` model. In Interspeech, volume 2, pp. 3, 2010.
|
| 218 |
+
T. Mikolov, I. Sutskever, A. Deoras, H. Le, S. Kombrink, and J. Cernocky. Subword language modeling with neural networks. preprint (http://www. fit. vutbr. cz/imikolov/rnnlm/char. pdf), 2012.
|
| 219 |
+
Tomas Mikolov, Armand Joulin, Sumit Chopra, Michael Mathieu, and Marc’Aurelio Ranzato. Learning longer memory in recurrent neural networks. arXiv preprint arXiv:1412.7753, 2014.
|
| 220 |
+
A. Mujika, F. Meier, and A. Steger. Fast-slow recurrent neural networks. arXiv preprint arXiv:1705.08639, 2017.
|
| 221 |
+
A. G. Ororbia II, T. Mikolov, and D. Reitter. Learning simpler language models with the differential state framework. Neural Computation, 2017.
|
| 222 |
+
B. T. Polyak and A. B. Juditsky. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 30(4):838–855, 1992.
|
| 223 |
+
O. Press and L. Wolf. Using the output embedding to improve language models. EACL 2017, pp. 157, 2017.
|
| 224 |
+
T. Salimans and D. P. Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909, 2016.
|
| 225 |
+
Jürgen Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent networks. Neural Computation, 4(1):131–139, 1992.
|
| 226 |
+
T. Tieleman and G. E. Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 4(2), 2012.
|
| 227 |
+
Seiya Tokui, Kenta Oono, Shohei Hido, and Justin Clayton. Chainer: a next-generation open source framework for deep learning. In Proceedings of workshop on machine learning systems (LearningSys) in the twenty-ninth annual conference on neural information processing systems (NIPS), volume 5, 2015.
|
| 228 |
+
L. Wan, M. Zeiler, S. Zhang, Yann L. Cun, and R. Fergus. Regularization of neural networks using dropconnect. In Proceedings of the 30th international conference on machine learning (ICML-13), pp. 1058–1066, 2013.
|
| 229 |
+
P. J. Werbos. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78: 1550–1560, 1990.
|
| 230 |
+
Y. Wu, S. Zhang, Y. Zhang, Y. Bengio, and R. Salakhutdinov. On multiplicative integration with recurrent neural networks. In NIPS, 2016.
|
| 231 |
+
W. Zaremba, I. Sutskever, and O. Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
|
| 232 |
+
J. G. Zilly, R. K. Srivastava, J. Koutník, and J. Schmidhuber. Recurrent highway networks. ICLR, 2017.
|
| 233 |
+
B. Zoph and Quoc V Le. Neural architecture search with reinforcement learning. ICLR, 2017.
|
| 234 |
+
|
| 235 |
+
# A APPENDIX
|
| 236 |
+
|
| 237 |
+
# A.1 DYNAMIC SAMPLES CONDITIONED ON SPANISH
|
| 238 |
+
|
| 239 |
+
300 character samples generated from the dynamic version of the model trained on Hutter Prize, conditioned on 10k of Spanish characters. The final sentence fragment of the 10k conditioning characters is given to the reader, with the generated text given in bold:
|
| 240 |
+
|
| 241 |
+
Tiene importancia este compromiso en la medida en que la Comisión es un organismo que tiene el montembre tas procedíns la conscriptione se ha Tesalo del Pómienda que et hanemos que Pe la Siemina.
|
| 242 |
+
|
| 243 |
+
De la Pedrera Orden es Señora Presidente civil, Orden de siemin presente relevante frónmida que esculdad pludiore e formidad President de la Presidenta Antidorne Adamirmidad i ciemano de el 200’. Fo
|
| 244 |
+
|
| 245 |
+
# A.2 STATIC SAMPLES CONDITIONED ON SPANISH
|
| 246 |
+
|
| 247 |
+
300 character samples generated from the static version of the model trained on Hutter Prize, conditioned on 10k of Spanish characters. The final sentence fragment of the 10k conditioning characters is given to the reader, with the generated text given in bold:
|
| 248 |
+
|
| 249 |
+
Tiene importancia este compromiso en la medida en que la Comisión es un organismo que tiene el monde,
|
| 250 |
+
|
| 251 |
+
<br>There is a secret act in the world except Cape Town, seen in now flat comalo and ball market and has seen the closure of the eagle as imprints in a dallas within the country." Is a topic for an increasingly small contract saying Allan Roth acquired the government in [[1916]].
|
md/train/rkeiQlBFPB/rkeiQlBFPB.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/ryF7rTqgl/ryF7rTqgl.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UNDERSTANDING INTERMEDIATE LAYERS USING LINEAR CLASSIFIER PROBES
|
| 2 |
+
|
| 3 |
+
Guillaume Alain & Yoshua Bengio
|
| 4 |
+
Department of Computer Science and Operations Research
|
| 5 |
+
Universite de Montr´ eal´
|
| 6 |
+
Montreal, QC. H3C 3J7
|
| 7 |
+
guillaume.alain.umontreal@gmail.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Neural network models have a reputation for being black boxes. We propose a new method to better understand the roles and dynamics of the intermediate layers. This has direct consequences on the design of such models and it enables the expert to be able to justify certain heuristics (such as adding auxiliary losses in middle layers). Our method uses linear classifiers, referred to as “probes”, where a probe can only use the hidden units of a given intermediate layer as discriminating features. Moreover, these probes cannot affect the training phase of a model, and they are generally added after training. They allow the user to visualize the state of the model at multiple steps of training. We demonstrate how this can be used to develop a better intuition about models and to diagnose potential problems.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
The recent history of deep neural networks features an impressive number of new methods and technological improvements to allow the training of deeper and more powerful networks.
|
| 16 |
+
|
| 17 |
+
Despite this, models still have a reputation for being black boxes. Neural networks are criticized for their lack of interpretability, which is a tradeoff that we accept because of their amazing performance on many tasks. Efforts have been made to identify the role played by each layer, but it can be hard to find a meaning to individual layers.
|
| 18 |
+
|
| 19 |
+
There are good arguments to support the claim that the first layers of a convolution network for image recognition contain filters that are relatively “general”, in the sense that they would work great even if we switched to an entirely different dataset of images. The last layers are specific to the dataset being used, and have to be retrained when using a different dataset. In Yosinski et al. (2014) the authors try to pinpoint the layer at which this transition occurs, but they show that the exact transition is spread across multiple layers.
|
| 20 |
+
|
| 21 |
+
In this paper, we introduce the concept of linear classifier probe, referred to as a “probe” for short when the context is clear. We start from the concept of Shannon entropy, which is the classic way to describe the information contents of a random variable. We then seek to apply that concept to understand the roles of the intermediate layers of a neural network, to measure how much information is gained at every layer (answer : technically, none). We argue that it fails to apply, and so we propose an alternative framework to ask the same question again. This time around, we ask what would be the performance of an optimal linear classifier if it was trained on the inputs of a given layer from our model. We demonstrate how this powerful concept can be very useful to understand the dynamics involved in a deep neural network during training and after.
|
| 22 |
+
|
| 23 |
+
# 2 INFORMATION THEORY
|
| 24 |
+
|
| 25 |
+
It was a great discovery when Claude Shannon repurposed the notion of entropy to represent information contents in a formal way. It laid the foundations for the discipline of information theory. We would refer the reader to first chapters of MacKay (2003) for a good exposition on the matter.
|
| 26 |
+
|
| 27 |
+
Naturally, we would like to ask some questions about the information contents of the many layers of convolutional neural networks.
|
| 28 |
+
|
| 29 |
+
• What happens when we add more layers? • Where does information flow in a neural network with multiple branches? • Does having multiple auxiliary losses help? (e.g. Inception model)
|
| 30 |
+
|
| 31 |
+
Intuitively, for a training sample $x _ { i }$ with its associated label $y _ { i }$ , a deep model is getting closer to the correct answer in the higher layers. It starts with the difficult job of classifying $x _ { i }$ , which becomes easier as the higher layers distill $x _ { i }$ into a representation that is easier to classify. One might be tempted to say that this means that the higher layers have more information about the ground truth, but this would be incorrect.
|
| 32 |
+
|
| 33 |
+
Here there is a mismatch between two different concepts of information. The notion of entropy fails to capture the essence of those questions. This is illustrated in a formal way by the Data Processing Inequality. It states that, for a set of three random variables satisfying the dependency
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
X Y Z
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
then we have that
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
I ( X ; Z ) \leq I ( X ; Y )
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $I ( X , Y )$ is the mutual information.
|
| 46 |
+
|
| 47 |
+
Intuitively, this means that the deterministic transformations performed by the many layers of a deep neural network are not adding more information. In the best case, they preserve information and affect only the representation. But in almost all situations, they lose some information in the process.
|
| 48 |
+
|
| 49 |
+
If we distill this further, we can think of the serious mismatch between the two following ideas :
|
| 50 |
+
|
| 51 |
+
• Part of the genius of the notion of entropy is that is distills the essence of information to a quantity that does not depend on the particular representation. • A deep neural network is a series of simple deterministic transformations that affect the representation so that the final layer can be fed to a linear classifier.
|
| 52 |
+
|
| 53 |
+
The former ignores the representation of data, while the latter is an expert in finding good representations. A deaf painter is working on a visual masterpiece to offer to a blind musician who plays music for him.
|
| 54 |
+
|
| 55 |
+
We need a conceptual tool to analyze neural networks in a way that corresponds better to our intuitive notion of information. The role of data representation is important, but we would also argue that we have to think about this issue as it relates to computational complexity. A linear classifier is basically the simplest form of classifier that is neither trivial nor degenerate.
|
| 56 |
+
|
| 57 |
+
We define a new notion of information that depends on our ability to classify features of a given layer with an optimal linear classifier. Then we have a conceptual tool to ask new questions and to get potentially interesting answers.
|
| 58 |
+
|
| 59 |
+
We end this section with a conceptual example in Figure 1. If $X$ contains an image of the savannah, and $Y \in \{ 0 , 1 \}$ refers to whether it contains a lion or not, then none of the subsequent layers are truly more informative than $X$ itself. The raw bits from the picture file contain everything.
|
| 60 |
+
|
| 61 |
+
# 3 LINEAR CLASSIFIER PROBES
|
| 62 |
+
|
| 63 |
+
In section 3.1 we present the main concept of this paper. We illustrate the concept in section 3.3. We then present a basic experiment in section 3.4. In section 3.6 we modify a very deep network in two different ways and we show how probes allow us to visualize the consequences (sometimes disastrous) of our design choices.
|
| 64 |
+
|
| 65 |
+

|
| 66 |
+
|
| 67 |
+
(a) hex dump of picture of a lion
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
(b) same lion in human-readable format
|
| 71 |
+
|
| 72 |
+
Figure 1: The hex dump represented on the left has more information contents than the image on the right. Only one of them can be processed by the human brain in time to save their lives. Computational convenience matters. Not just entropy.
|
| 73 |
+
|
| 74 |
+
# 3.1 PROBES
|
| 75 |
+
|
| 76 |
+
As we discussed the previous section, there is indeed a good reason to use many deterministic layers, and it is because they perform useful transformations to the data with the goal of ultimately fitting a linear classifier at the very end. That is the purpose of the many layers. They are a tool to transform data into a form to be fed to a boring linear classifier.
|
| 77 |
+
|
| 78 |
+
With this in mind, it is natural to ask if that transformation is sudden or progressive, and whether the intermediate layers already have a representation that is immediately useful to a linear classifier. We refer the reader to Figure 2 for a diagram of probes being inserted in the usual deep neural network.
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 2: Probes being added to every layer of a model. These additional probes are not supposed to change the training of the model, so we add a little diode symbol through the arrows to indicate that the gradients will not backpropagate through those connections.
|
| 82 |
+
|
| 83 |
+
The conceptual framework that we propose is one where the intuitive notion of information is equivalent with immediate suitability for a linear classifier (instead of being related to entropy).
|
| 84 |
+
|
| 85 |
+
Just to be absolutely clear about what we call a linear classifier, we mean a function
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\begin{array} { r } { f \colon H \to [ 0 , 1 ] ^ { D } \qquad } \\ { h \mapsto \operatorname { s o f t m a x } \left( W h + b \right) . } \end{array}
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $h \in H$ are the features of some hidden layer, $[ 0 , 1 ] ^ { D }$ is the space of one-hot encodings of the $D$ target classes, and $( W , b )$ are the probe weights and biases to be learned so as to minimize the usual cross-entropy loss.
|
| 92 |
+
|
| 93 |
+
Over the course of training a model, the parameters of the model change. However, probes only make sense when we refer to a given training step. We can talk about the probes at iteration $n$ of training, when the model parameters are $\theta _ { n }$ . These parameters are not affected by the probes. We prevent backpropagation through the model either by stopping the gradient flow (done with tf.stop gradient in tensorflow), or simply by specifying that the only variables to be updated are the probe parameters, while we keep $\theta _ { n }$ frozen.
|
| 94 |
+
|
| 95 |
+
# 3.1.1 TRAINING THE PROBES
|
| 96 |
+
|
| 97 |
+
For the purposes of this paper, we train the probes up to convergence with fixed model parameters, and we report the prediction error on the training set.
|
| 98 |
+
|
| 99 |
+
It is absolutely possible to train the probes simulatenously while training the model itself. This is a good approach if we consider about how long it can take to train the model. However, this creates a potential problem if we optimize the loss of the model more quickly than the loss of the probes. This can present a skewed view of the actual situation that we would have if we trained the probes until convergence before updating the model parameters. If we accept this trade off, then we can train the probes at the same time as the model.
|
| 100 |
+
|
| 101 |
+
In some situations, the probes might overfit the training set, so we may want to do early stopping on the validation set and report the performance for the probes on the test set. This is what we do in section 3.4 with the simple MNIST convnet.
|
| 102 |
+
|
| 103 |
+
We are still unsure if one of those variations should be preferred in general, and right now they all seem acceptable so long as we interpret the probe measurements properly.
|
| 104 |
+
|
| 105 |
+
Note that training those probes represents a convex optimization problem. In practice, this does mean guarantee that they are easy to train. However, it is reassuring because it means that probes taken at time $\theta _ { n }$ can be used as initialization for probes at time $\theta _ { n + 1 }$ .
|
| 106 |
+
|
| 107 |
+
We use cross-entropy as probe loss because all models studied here used cross-entropy. Other alternative losses could be justified in other settings.
|
| 108 |
+
|
| 109 |
+
# 3.2 PROBES ON BIFURCATING TOY MODEL
|
| 110 |
+
|
| 111 |
+
Here we show a hypothetical example in which a model contains a bifurcation with two paths that later recombine. We are interested in knowing whether those two branches are useful, or whether one is potentially redundant or useless.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
|
| 115 |
+
For example, the two different branches might contain convolutional layers with different dimensions. They may have a different number of sublayers, or one might represent a skip connection. We assume that the branches are combined through concatenation of their features, so that nothing is lost.
|
| 116 |
+
|
| 117 |
+
For this hypothetical situation, we indicate the probe prediction errors on the graphical model. The upper path has a prediction error of 0.75, the lower path has 0.60, and their combination has 0.45. Small errors are preferred. Although the upper path has “less information” than the lower path, we can see here that it is not redundant information, because when we concatenate the features of the two branches we get a prediction error of $0 . 4 5 < 0 . 6 0$ .
|
| 118 |
+
|
| 119 |
+
If the concatenated layer had a prediction error of 0.60 instead of 0.45, then we could declare that the above branch did nothing useful. It may have nonzero weights, but it’s still useless.
|
| 120 |
+
|
| 121 |
+
Naturally, this kind of conclusion might be entirely wrong. It might be the case that the branch above contains very meaningful features, and they simply happen to be useless to a linear classifier applied right there. The idea of using linear classification probes to understand the roles of different branches is suggested as a heuristic instead of a hard rule. Moreover, if the probes are not optimized perfectly, the conclusions drawn can be misleading.
|
| 122 |
+
|
| 123 |
+
Note that we are reporting here the prediction errors, and it might be the case that the loss is indeed lower when we concatenate the two branches, but for some reason it could fail to apply to the prediction error.
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 3: Toy experiment described in section 3.3, with linearly separable data (two labels), an untrained MLP with 32 layers, and probes at every layer. We report the prediction error for every probe, where 0.50 would be the performence of a coin flip and 0.00 would be ideal. Note that the layer 0 here corresponds to the raw data, and the probes are indeed able to classify it perfectly. As expected, performance degrades when applying random transformations. If many more layers were present, it would be hard to imagine how the final layer (with the model loss) can get any useful signal to backpropagate.
|
| 127 |
+
|
| 128 |
+
# 3.3 PROBES ON UNTRAINED MODEL
|
| 129 |
+
|
| 130 |
+
We start with a toy example to illustrate what kind of plots we expect from probes. We use a 32- layer MLP with 128 hidden units. All the layers are fully-connected and we use LeakyReLU(0.5) as activation function.
|
| 131 |
+
|
| 132 |
+
We will run the same experiment 100 times, with a different toy dataset each time. The goal is to use a data distribution $( X , Y )$ where $X \in \mathbb { R } ^ { 1 2 8 }$ is drawn $\mathcal { N } ( 0 , I )$ and where $Y \in \{ - 1 , 1 \}$ in linearly separable (i.e. super easy to classify with a one-layer neural network). To do this, we just pick a $w \in \mathbb { R } ^ { 1 2 8 }$ for each experiment, and let the label $y _ { n }$ be the sign of $x _ { n } ^ { T } w$ .
|
| 133 |
+
|
| 134 |
+
We initialize this 32-layer MLP using glorot normal initialization, we do not perform any training on the model, and we add one probe at every layer. We optimize the probes with RMSProp and a sufficiently small learning rate.
|
| 135 |
+
|
| 136 |
+
In Figure 3, we show the prediction error rate for every probe, averaged over the 100 experiments. The graph includes a probe applied directly on the inputs $X$ , where we naturally have an error rate that is essentially zero (to be expected by the way we constructed our data), and which serves as a kind of sanity check. Given that we have only two possible labels, we also show a dotted horizontal line at 0.50, which is essentially the prediction error that we would get by flipping a coin. We can see that the prediction error rate climbs up towards 0.50 as we go deeper in the MLP (with untrained parameters).
|
| 137 |
+
|
| 138 |
+
This illustrates the idea that the input signal is getting mangled by the successive layers, so much that it becomes rather useless by the time we reach the final layer. We checked the mean activation norm of the hidden units at layer 32 to be sure that numerical underflow was not the cause for the degradation. Note that this situation could be avoided by using orthogonal weights.
|
| 139 |
+
|
| 140 |
+
One of the popular explanation for training difficulties in very deep models is that of the exploding/vanishing (Hochreiter, 1991; Bengio et al., 1993). Here we would like to offer another complementary explanation, based on the observations from Figure 3. That is, at the beginning of training, the usefulness of layers decays as we go deeper, reaching the point where the deeper layers are utterly useless. The values contained in the last layer are then used in the final softmax classifier, and the loss backpropagates the values of the derivatives. Since that derivative is based on garbage activations, the backpropagated quantities are also garbage, which means that the weights are all going to be updated based on garbage. The weights stay bad, and we fail to train the model. The authors like to refer to that phenomenon as garbage forwardprop, garbage backprop, in reference to the popular concept of garbage in, garbage out in computer science.
|
| 141 |
+
|
| 142 |
+
# 3.4 PROBES ON MNIST CONVNET
|
| 143 |
+
|
| 144 |
+
In this section we run the MNIST convolutional model provided by the tensorflow github repo (tensorflow/models/image/mnist/convolutional.py) We selected that model for reproducibility and to demonstrate how to easily peek into popular models by using probes.
|
| 145 |
+
|
| 146 |
+
We start by sketching the model in Figure 4. We report the results at the beginning and the end of training on Figure 5. One of the interesting dynamics to be observed there is how useful the first layers are, despite the fact that the model is completely untrained. Random projections can be useful to classify data, and this has been studied by others (Jarrett et al., 2009).
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 4: This graphical model represents the neural network that we are going to use for MNIST. The model could be written in a more compact form, but we represent it this way to expose all the locations where we are going to insert probes. The model itself is simply two convolutional layers followed by two fully-connected layer (one being the final classifier). However, we insert probes on each side of each convolution, activation function, and pooling function. This is a bit overzealous, but the small size of the model makes this relatively easy to do.
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 5: We represent here the test prediction error for each probe, at the beginning and at the end of training. This measurement was obtained through early stopping based on a validation set of $1 0 ^ { 4 }$ elements. The probes are prevented from overfitting the training data. We can see that, at the beginning of training (on the left), the randomly-initialized layers were still providing useful transformations. The test prediction error goes from $8 \%$ to $2 \%$ simply using those random features. The biggest impact comes from the first ReLU. At the end of training (on the right), the test prediction error is improving at every layer (with the exception of a minor kink on fc1 preact).
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
(b) After training for 10 epochs.
|
| 156 |
+
|
| 157 |
+
(a) After initialization, no training.
|
| 158 |
+
|
| 159 |
+
# 3.5 PROBES ON INCEPTION V3
|
| 160 |
+
|
| 161 |
+
We have performed an experiment using the Inception v3 model on the ImageNet dataset (Szegedy et al., 2015; Russakovsky et al., 2015). This is very similar to what is presented in section 3.4, but on a much larger scale. Due to the challenge presented by this experiment, we were not able to do everything that we had hoped. We have chosen to put those results in the appendix section A.2.
|
| 162 |
+
|
| 163 |
+
Certain layers of the Inception v3 model have approximately one million features. With 1000 classes, this means that some probes can take even more storage space than the whole model itself. In these cases, one of the creative solutions was to try to use only a random subset of the features. This is discussed in the appendix section A.1.
|
| 164 |
+
|
| 165 |
+
# 3.6 AUXILIARY LOSS BRANCHES AND SKIP CONNECTIONS
|
| 166 |
+
|
| 167 |
+
Here we investigate two ways to modify a deep model in order to facilitate training. Our goal is not to convince the reader that they should implement these suggestions in their own models. Rather, we want to demonstrate the usefulness of the linear classifier probes as a way to better understand what is happening in their deep networks.
|
| 168 |
+
|
| 169 |
+
In both cases we use a toy model with 128 fully-connected layers with 128 hidden units in each layer. We train on MNIST, and we use Glorot initialization along with leaky ReLUs.
|
| 170 |
+
|
| 171 |
+
We choose this model because we wanted a pathologically deep model without getting involved in architecture details. The model is pathological in the sense that smaller models can easily be designed to achieve better performance, but also in the sense that the model is so deep that it is very hard to train it with gradient descent methods. From our experiments, the maximal depth where things start to break down was depth 64, hence the choice here of using depth 128.
|
| 172 |
+
|
| 173 |
+
In the first scenario, we add one linear classifier at every 16 layers. These classifiers contribute to the loss minimization. They are not probes. This is very similar to what happens in the famous Inception model where “auxiliary heads” are used (Szegedy et al., 2015). This is illustrated in Figure 6a, and it works nicely. The untrainable model is now made trainable through a judicious use of auxiliary classifier losses. The results are shown in Figure 7.
|
| 174 |
+
|
| 175 |
+
In the second scenario, we look at adding a bridge (a skip connection) between layer 0 and layer 64. This means that the input features to layer 64 are obtained by concatenating the output of layer 63 with the features of layer 0. The idea here is that we might observe that the model would effectively train a submodel of depth 64, using the skip connection, and shift gears later to use the whole depth of 128 layers. This is illustrated in Figure 6b, and the results are shown in Figure 8. It does not work as expected, but the failure of this approach is visualized very nicely with probes and serves as a great example of their usefulness in diagnosing problems with models.
|
| 176 |
+
|
| 177 |
+
In both cases, there are two interesting observations that can be made with probes. We refer readers to https://youtu.be/x8j4ZHCR2FI for the full videos associated to Figures 5, 7 and 8.
|
| 178 |
+
|
| 179 |
+
Firstly, at the beginning of training, we can see how the raw data is directly useful to perform linear classification, and how this degrades as more layers are added. In the case of the skip connection in Figure 8, this has the effect of creating two bumps. This is because the layer 64 also has the input data as direct parent, so it can fit a probe to that signal.
|
| 180 |
+
|
| 181 |
+
Secondly, the prediction error goes down in all probes during training, but it does so in a way that starts with the parents before it spreads to their descendants. This is even more apparent on the full video (instead of the 3 frames provided here). This is a ripple effect, where the prediction error in Figure 6b is visually spreading like a wave from the left of the plot to the right.
|
| 182 |
+
|
| 183 |
+
(a) Model with 16 layers, one guide at every 4 layers.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
(b) Model with 128 layers. A skip connection goes from the beginning straight to the middle of the graph.
|
| 187 |
+
|
| 188 |
+

|
| 189 |
+
Figure 6: Examples of deep neural network with one probe at every layer (drawn above the graph). We show here the addition of extra components to help training (under the graph, in orange).
|
| 190 |
+
|
| 191 |
+
# 4 DISCUSSION AND FUTURE WORK
|
| 192 |
+
|
| 193 |
+
We have presented more toy models or simple models instead of larger models such as Inception v3. In the appendix section A.2 we show an experiment on Inception v3, which proved to be more challenging than expected. Future work in this domain would involve performing better experiments on a larger scale than small MNIST convnets, but still within a manageable size so we can properly train all the probes. This would allow us to produce nice videos showing many training steps in sequence.
|
| 194 |
+
|
| 195 |
+
We have received many comments from people who thought about using multi-layer probes. This can be seen as a natural extension of the linear classifier probes. One downside to this idea is that we lose the convexity property of the probes. It might be worth pursuing in a particular setting, but as of now we feel that it is premature to start using multi-layer probes. This also leads to the convoluted idea of having a regular probe inside a multi-layer probe.
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 7: A pathologically deep model with 128 layers gets an auxiliary loss added at every 16 layers (refer to simplified sketch in Figure 6a if needed). This loss is added to the usual model loss at the last layer. We fit a probe at every layer to see how well each layer would perform if its values were used as a linear classifier. We plot the train prediction error associated to all the probes, at three different steps. Before adding those auxiliary losses, the model could not successfully be trained through usual gradient descent methods, but with the addition of those intermediate losses, the model is “guided” to achieve certain partial objectives. This leads to a successful training of the complete model. The final prediction error is not impressive, but the model was not designed to achieve state-of-the-art performance.
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 8: A pathologically deep model with 128 layers gets a skip connection from layer 0 to layer 64 (refer to sketch in Figure 6b if needed). We fit a probe at every layer to see how well each layer would perform if its values were used as a linear classifier. We plot the train prediction error associated to all the probes, at three different steps. We can see how the model completely ignores layers 1-63, even when we train it for a long time. The use of probes allows us to diagnose that problem through visual inspection.
|
| 202 |
+
|
| 203 |
+
# 5 CONCLUSION
|
| 204 |
+
|
| 205 |
+
In this paper we introduced the concept of the linear classifier probe as a conceptual tool to better understand the dynamics inside a neural network and the role played by the individual intermediate layers. We are now able to ask new questions and explore new areas. We have demonstrated how these probes can be used to identify certain problematic behaviors in models that might not be apparent when we traditionally have access to only the prediction loss and error.
|
| 206 |
+
|
| 207 |
+
We hope that the notions presented in this paper can contribute to the understanding of deep neural networks and guide the intuition of researchers that design them.
|
| 208 |
+
|
| 209 |
+
# ACKNOWLEDGMENTS
|
| 210 |
+
|
| 211 |
+
Yoshua Bengio is a senior CIFAR Fellow. The authors would like to acknowledge the support of the following agencies for research funding and computing support: NSERC, FQRNT, Calcul Quebec, ´ Compute Canada, the Canada Research Chairs and CIFAR.
|
| 212 |
+
|
| 213 |
+
# REFERENCES
|
| 214 |
+
|
| 215 |
+
Y Bengio, Paolo Frasconi, and P Simard. The problem of learning long-term dependencies in recurrent networks. In Neural Networks, 1993., IEEE International Conference on, pp. 1183– 1188. IEEE, 1993.
|
| 216 |
+
|
| 217 |
+
Sepp Hochreiter. Untersuchungen zu dynamischen neuronalen netzen. Diploma, Technische Universitat M¨ unchen ¨ , pp. 91, 1991.
|
| 218 |
+
|
| 219 |
+
Kevin Jarrett, Koray Kavukcuoglu, Yann Lecun, et al. What is the best multi-stage architecture for object recognition? In 2009 IEEE 12th International Conference on Computer Vision, pp. 2146–2153. IEEE, 2009.
|
| 220 |
+
|
| 221 |
+
David MacKay. Information Theory, Inference and Learning Algorithms. Cambridge University Press, 2003.
|
| 222 |
+
|
| 223 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
|
| 224 |
+
|
| 225 |
+
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015.
|
| 226 |
+
|
| 227 |
+
Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
|
| 228 |
+
|
| 229 |
+
# A APPENDIX
|
| 230 |
+
|
| 231 |
+
.1 PROPOSAL : TRAIN PROBES USING ONLY SUBSETS OF FEATURES
|
| 232 |
+
|
| 233 |
+
One of the challenges to train on the Inception v3 model is that many of the layers have more than 200, 000 features. This is even worse in the first convolution layers before the pooling operations, where we have around a million features. With 1000 output classes, a probe using 200, 000 features has a weight matrix taking almost 1GB of storage.
|
| 234 |
+
|
| 235 |
+
When using stochastic gradient descent, we require space to store the gradients, and if we use momentum this ends up taking three times the memory on the GPU. This is even worse for RMSProp. Normally this might be acceptable for a model of reasonable size, but this turns into almost 4GB overhead per probe.
|
| 236 |
+
|
| 237 |
+
We do not have to put a probe at every layer. We can also train probes independently. We can put probe parameters on the CPU instead of the GPU, if necessary. But when the act of training probes increases the complexity of the experiment beyond a certain point, the researcher might decide that they are not worth the trouble.
|
| 238 |
+
|
| 239 |
+
We propose the following solution $:$ for a given probe, use a fixed random subset of features instead of the whole set of features.
|
| 240 |
+
|
| 241 |
+
With certain assumptions about the independence of the features and their shared role in predicting the correct class, we can make certain claims about how few features are actually required to assess the prediction error of a probe. We thank Yaroslav Bulatov for suggesting this approach.
|
| 242 |
+
|
| 243 |
+
We ran an experiment in which we used data $X \sim \mathcal { N } ( 0 , I _ { D } )$ where $D = 1 0 0 , 0 0 0$ is the number of features. We used $K = 1 0 0 0$ classes and we generated the ground truth using a matrix $W$ of shape $( D , K )$ . To obtain the class of a given $x$ , we simply multiply $x ^ { T } W$ and take the argmax over the $K$ components of the result.
|
| 244 |
+
|
| 245 |
+
$$
|
| 246 |
+
\boldsymbol { x } \sim \mathcal { N } ( 0 , I _ { D } ) \qquad \quad \boldsymbol { y } = \underset { k = 1 \ldots K } { \arg \operatorname* { m a x } } \left( \boldsymbol { x } ^ { T } W [ : , k ] \right)
|
| 247 |
+
$$
|
| 248 |
+
|
| 249 |
+
We selected a matrix $W$ by drawing all its individual coefficients from a univariate gaussian.
|
| 250 |
+
|
| 251 |
+
Instead of using $D = 1 0 0 , 0 0 0$ features, we used instead only 1000 features picked at random. We trained a linear classifier on those features and, experimentally, it was relatively easy to achieve a $4 \%$ error rate on our first try. With all the features, we could achieve a $0 \%$ error rate, so $4 \%$ might not look great. We have to keep in mind that we have $K = 1 0 0 0$ classes so random guesses yield an error rate of $9 9 . 9 \%$ .
|
| 252 |
+
|
| 253 |
+
This can reduce the storage cost for a probe from 1GB down to 10MB. The former is hard to justify, and the latter is almost negligible.
|
| 254 |
+
|
| 255 |
+
# A.2 PROBES ON INCEPTION V3
|
| 256 |
+
|
| 257 |
+
We are interested in putting linear classifier probes in the popular Inception v3 model, training on the ImageNet dataset. We used the tensorflow implementation available online (tensorflow/models/inception/inception) and ran it on one GPU for 2 weeks.
|
| 258 |
+
|
| 259 |
+

|
| 260 |
+
|
| 261 |
+
As described in section A.1, one of the challenges is that the number of features can be prohibitively large, and we have to consider taking only a subset of the features. In this particular experiment, we have had the most success by taking 1000 random features for each probe. This gives certain layers an unfair advantage if they start with 4000 features and we kept 1000, whereas in other cases the probe insertion point has 426, 320 features and we keep 1000. There was no simple “fair” solution. That being said, 13 out of the 17 probes have more than 100, 000 features, and 11 of those probes have more than 200, 000 features, so things were relatively comparable.
|
| 262 |
+
|
| 263 |
+
We put linear classifier probes at certain strategic layers. We represent this using boxes in the following Figure 9. The prediction error of the probe given by the last layer of each box is illustrated by coloring the box. Red is bad (high prediction error) and green/blue is good (low prediction error).
|
| 264 |
+
|
| 265 |
+
We would have liked to have a video to show the evolution of this during training, but this experiment had to be scaled back due to the large computational demands. We show here the prediction errors at three moments of training. These correspond roughly to the beginning of training, then after a few days, and finally after a week.
|
| 266 |
+
|
| 267 |
+
# Inception v3
|
| 268 |
+
|
| 269 |
+

|
| 270 |
+
Figure 9: Inserting a probe at multiple moments during training the Inception v3 model on the ImageNet dataset. We represent here the prediction error evaluated at a random subset of 1000 features. As expected, at first all the probes have a $100 \%$ prediction error, but as training progresses we see that the model is getting better. Note that there are 1000 classes, so a prediction error of $50 \%$ is much better than a random guess. The auxiliary head, shown under the model, was observed to have a prediction error that was slightly better than the main head. This is not necessarily a condition that will hold at the end of training, but merely an observation.
|
md/train/ryUlhzWCZ/ryUlhzWCZ.md
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TRUNCATED HORIZON POLICY SEARCH: COMBINING REINFORCEMENT LEARNING & IMITATION LEARNING
|
| 2 |
+
|
| 3 |
+
# Wen Sun
|
| 4 |
+
|
| 5 |
+
# Byron Boots
|
| 6 |
+
|
| 7 |
+
J. Andrew Bagnell Robotics Institute Carnegie Mellon University Pittsburgh, PA, USA dbagnell@cs.cmu.edu
|
| 8 |
+
|
| 9 |
+
Robotics Institute Carnegie Mellon University Pittsburgh, PA, USA wensun@cs.cmu.edu
|
| 10 |
+
|
| 11 |
+
School of Interactive Computing Georgia Institute of Technology Atlanta, GA, USA bboots@cc.gatech.edu
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
In this paper, we propose to combine imitation and reinforcement learning via the idea of reward shaping using an oracle. We study the effectiveness of the nearoptimal cost-to-go oracle on the planning horizon and demonstrate that the costto-go oracle shortens the learner’s planning horizon as function of its accuracy: a globally optimal oracle can shorten the planning horizon to one, leading to a onestep greedy Markov Decision Process which is much easier to optimize, while an oracle that is far away from the optimality requires planning over a longer horizon to achieve near-optimal performance. Hence our new insight bridges the gap and interpolates between imitation learning and reinforcement learning. Motivated by the above mentioned insights, we propose Truncated HORizon Policy Search (THOR), a method that focuses on searching for policies that maximize the total reshaped reward over a finite planning horizon when the oracle is sub-optimal. We experimentally demonstrate that a gradient-based implementation of THOR can achieve superior performance compared to RL baselines and IL baselines even when the oracle is sub-optimal.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Reinforcement Learning (RL), equipped with modern deep learning techniques, has dramatically advanced the state-of-the-art in challenging sequential decision problems including high-dimensional robotics control tasks as well as video and board games (Mnih et al., 2015; Silver et al., 2016). However, these approaches typically require a large amount of training data and computational resources to succeed. In response to these challenges, researchers have explored strategies for making RL more efficient by leveraging additional information to guide the learning process. Imitation learning (IL) is one such approach. In IL, the learner can reference expert demonstrations (Abbeel & $\mathrm { N g }$ , 2004), or can access a cost-to-go oracle (Ross & Bagnell, 2014), providing additional information about the long-term effects of learner decisions. Through these strategies, imitation learning lowers sample complexity by reducing random global exploration. For example, Sun et al. (2017) shows that, with access to an optimal expert, imitation learning can exponentially lower sample complexity compared to pure RL approaches. Experimentally, researchers also have demonstrated sample efficiency by leveraging expert demonstrations by adding demonstrations into a replay buffer (Vecer ˇ ´ık et al., 2017; Nair et al., 2017), or mixing the policy gradient with a behavioral cloning-related gradient (Rajeswaran et al., 2017).
|
| 20 |
+
|
| 21 |
+
Although imitating experts can speed up the learning process in RL tasks, the performance of the learned policies are generally limited to the performance of the expert, which is often sub-optimal in practice. Previous imitation learning approaches with strong theoretical guarantees such as Data Aggregation (DAgger) (Ross et al., 2011) and Aggregation with Values (AGGREVATE) (Ross & Bagnell, 2014) can only guarantee a policy which performs as well as the expert policy or a one-step deviation improvement over the expert policy.1 Unfortunately, this implies that imitation learning with a sub-optimal expert will often return a sub-optimal policy. Ideally, we want the best of both
|
| 22 |
+
|
| 23 |
+
IL and RL: we want to use the expert to quickly learn a reasonable policy by imitation, while also exploring how to improve upon the expert with RL. This would allow the learner to overcome the sample inefficiencies inherent in a pure RL strategy while also allowing the learner to eventually surpass a potentially sub-optimal expert. Combining RL and IL is, in fact, not new. Chang et al. (2015) attempted to combine IL and RL by stochastically interleaving incremental RL and IL updates. By doing so, the learned policy will either perform as well as the expert policy–the property of IL (Ross & Bagnell, 2014), or eventually reach a local optimal policy–the property of policy iteration-based RL approaches. Although, when the expert policy is sub-optimal, the learned locally optimal policy could potentially perform better than the expert policy, it is still difficult to precisely quantify how much the learner can improve over the expert.
|
| 24 |
+
|
| 25 |
+
In this work, we propose a novel way of combining IL and RL through the idea of Reward Shaping $\mathrm { N g }$ et al., 1999). Throughout our paper we use cost instead of reward, and we refer to the concept of reward shaping with costs as cost shaping. We assume access to a cost-to-go oracle that provides an estimate of expert cost-to-go during training. The key idea is that the cost-to-go oracle can serve as a potential function for cost shaping. For example, consider a task modeled by a Markov Decision Process (MDP). Cost shaping with the cost-to-go oracle produces a new MDP with an optimal policy that is equivalent to the optimal policy of the original MDP $\mathrm { N g }$ et al., 1999). The idea of cost shaping naturally suggests a strategy for IL: pick a favourite RL algorithm and run it on the new MDP reshaped using expert’s cost-to-go oracle. In fact, $\mathrm { N g }$ et al. (1999) demonstrated that running SARSA (Sutton & Barto, 1998) on an MDP reshaped with a potential function that approximates the optimal policy’s value-to-go, is an effective strategy.
|
| 26 |
+
|
| 27 |
+
We take this idea one step further and study the effectiveness of the cost shaping with the expert’s cost-to-go oracle, with a focus on the setting where we only have an imperfect estimator $\hat { V } ^ { e }$ of the cost-to-go of some expert policy $\pi ^ { e }$ , i.e., $\tilde { V } ^ { e } \ne V ^ { * }$ , where $V ^ { * }$ is the optimal policy’s cost-to-go in the original MDP. We show that cost shaping with the cost-to-go oracle shortens the learner’s planning horizon as a function of the accuracy of the oracle $\hat { V } ^ { e }$ compared to $V ^ { * }$ . Consider two extremes. On one hand, when we reshape the cost of the original MDP with $V ^ { * }$ (i.e., $\hat { V } ^ { e } = V ^ { * }$ ), the reshaped MDP has an effective planning horizon of one: a policy that minimizes the one-step cost of the reshaped MDP is in fact the optimal policy (hence the optimal policy of the original MDP). On the other hand, when the cost-to-go oracle provides no information regarding $V ^ { * }$ , we have no choice but simply optimize the reshaped MDP (or just the original MDP) using RL over the entire planning horizon.
|
| 28 |
+
|
| 29 |
+
With the above insight, we propose the high-level strategy for combining IL and RL, which we name Truncated HORizon Policy Search with cost-to-go oracle (THOR). The idea is to first shape the cost using the expert’s cost-to-go oracle $\hat { V } ^ { e }$ , and then truncate the planning horizon of the new MDP and search for a policy that optimizes over the truncated planning horizon. For discrete MDPs, we mathematically formulate this strategy and guarantee that we will find a policy that performs better than the expert with a gap that can be exactly quantified (which is missing in the previous work of Chang et al. (2015)). In practice, we propose a gradient-based algorithm that is motivated from this insight. The practical algorithm allows us to leverage complex function approximators to represent policies and can be applied to continuous state and action spaces. We verify our approach on several MDPs with continuous state and action spaces and show that THOR can be much more sample efficient than strong RL baselines (we compared to Trust Region Policy Optimization with Generalized Advantage Estimation (TRPO-GAE) (Schulman et al., 2016)), and can learn a significantly better policy than AGGREVATE (we compared to the policy gradient version of AGGREVATE from (Sun et al., 2017)) with access only to an imperfect cost-to-go oracle.
|
| 30 |
+
|
| 31 |
+
# 1.1 RELATED WORK AND OUR CONTRIBUTION
|
| 32 |
+
|
| 33 |
+
Previous work has shown that truncating the planning horizon can result in a tradeoff between accuracy and computational complexity. Farahmand et al. (2016) proposed a model-based RL approach that focuses on a search for policies that maximize a sum of $k$ -step rewards with a termination value that approximates the optimal value-to-go. Their algorithm focuses on the model-based setting and the discrete state and action setting, as the algorithm needs to perform $k$ -step value iteration to compute the policy. Another use of the truncated planning horizon is to trade off bias and variance. When the oracle is an approximation of the value function of the agent’s current policy, by using kstep rollouts bottomed up by the oracle’s return, truncating the planning horizon trades off bias and variance of the estimated reward-to-go. The bias-variance tradeoff has been extensively studied in Temporal Difference Learning literature (Sutton, 1988) and policy iteration literature as well (Gabillon et al., 2011). $\mathrm { N g }$ (2003) is perhaps the closest to our work. In Theorem 5 in the Appendix of $\mathrm { N g }$ ’s dissertation, $\mathrm { N g }$ considers the setting where the potential function for reward shaping is close to the optimal value function and suggests that if one performs reward shaping with the potential function, then one can decrease the discount factor of the original MDP without losing the optimality that much. Although in this work we consider truncating the planning steps directly, Theorem 5 in $\mathrm { N g }$ ’s dissertation and our work both essentially considers trading off between the hardness of the reshaped MDP (the shorter the planning horizon, the easier the MDP to optimize) and optimality of the learned policy. In addition to this tradeoff, our work suggests a path toward understanding previous imitation learning approaches through reward shaping, and tries to unify IL and RL by varying the planning horizon from 1 to infinity, based on how close the expert oracle is to the optimal value function. Another contribution of our work is a lower bound analysis that shows that performance limitation of AGGREVATE with an imperfect oracle, which is missing in previous work (Ross & Bagnell, 2014). The last contribution of our work is a model-free, actor-critic style algorithm that can be used for continuous state and action spaces.
|
| 34 |
+
|
| 35 |
+
# 2 PRELIMINARIES
|
| 36 |
+
|
| 37 |
+
We consider the problem of optimizing Markov Decision Process defined as $\mathcal { M } _ { 0 } = ( S , \mathcal { A } , P , C , \gamma )$ . Here, $s$ is a set of $S$ states and $\mathcal { A }$ is a set of $A$ actions; $P$ is the transition dynamics at such that for any $s \in { \mathcal { S } } , s ^ { \prime } \in { \mathcal { S } } , a \in { \mathcal { A } }$ , $P ( s ^ { \prime } | s , a )$ is the probability of transitioning to state $s ^ { \prime }$ from state $s$ by taking action $a$ . For notation simplicity, in the rest of the paper, we will use short notation $P _ { s a }$ to represent the distribution $P ( \cdot | s , a )$ . The cost for a given pair of $s$ and $a$ is $c ( s , a )$ , which is sampled from the cost distribution $C ( s , a )$ with mean value $\textstyle { \bar { c } } ( s , a )$ . A stationary stochastic policy $\pi ( a | s )$ computes the probability of generating action $a$ given state $s$ .
|
| 38 |
+
|
| 39 |
+
The value function $V _ { \mathcal { M } _ { 0 } } ^ { \pi }$ and the state action cost-to-go $Q _ { \mathcal { M } _ { 0 } , h } ^ { \pi } ( s , a )$ of $\pi$ on $\mathcal { M } _ { 0 }$ are defined as:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
V _ { M _ { 0 } } ^ { \pi } ( s ) = \mathbb { E } \big [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } c ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a \sim \pi \big ] , \quad Q _ { \mathcal { M } _ { 0 } } ^ { \pi } ( s , a ) = \mathbb { E } \big [ c ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P _ { s a } } \big [ V _ { M _ { 0 } } ^ { \pi } ( s ^ { \prime } ) \big ] \big ] ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where the expectation is taken with respect to the randomness of $\mathcal { M } _ { 0 }$ and the stochastic policy $\pi$ . With $V _ { \mathcal { M } _ { 0 } } ^ { \pi }$ and $Q _ { { \mathcal { M } } _ { 0 } } ^ { \pi }$ , we define the disadvantage2 function $A _ { \mathcal { M } _ { 0 } } ^ { \pi } ( s , a ) = Q _ { \mathcal { M } _ { 0 } } ^ { \pi } ( s , a ) - V _ { \mathcal { M } _ { 0 } } ^ { \pi } ( s )$ The objective is to search for the optimal policy $\pi ^ { * }$ such that $\begin{array} { r } { \pi ^ { * } = \arg \operatorname* { m i n } _ { \pi } V ^ { \pi } ( s ) , \forall s \in \mathcal { S } } \end{array}$ .
|
| 46 |
+
|
| 47 |
+
Throughout this work, we assume access to an cost-to-go oracle ${ \hat { V } } ^ { e } ( s ) : { \mathcal { S } } \mathbb { R }$ . Note that we do not require $\hat { V } ^ { e } ( s )$ to be equal to $V _ { \mathcal { M } _ { 0 } } ^ { * }$ . For example, $\hat { V } ^ { e } ( s )$ could be obtained by learning from trajectories demonstrated by the expert $\pi ^ { e }$ (e.g., Temporal Difference Learning (Sutton & Barto, 1998)), or $\hat { V } ^ { e }$ could be computed by near-optimal search algorithms via access to ground truth information (Daume III et al., 2009; Chang et al., 2015; Sun et al., 2016) or via access to a simulator ´ using Dynamic Programming (DP) techniques (Choudhury et al., 2017; Pan et al., 2017). In our experiment, we focus on the setting where we learn a $\hat { V } ^ { e } ( s )$ using TD methods from a set of expert demonstrations.
|
| 48 |
+
|
| 49 |
+
# 2.1 COST SHAPING
|
| 50 |
+
|
| 51 |
+
Given the original MDP $\mathcal { M } _ { 0 }$ and any potential functions $\Phi : S \mathbb { R }$ , we can reshape the cost $c ( s , a )$ sampled from $C ( s , a )$ to be:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
c ^ { \prime } ( s , a ) = c ( s , a ) + \gamma \Phi ( s ^ { \prime } ) - \Phi ( s ) , ~ s ^ { \prime } \sim P _ { s a } .
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
Denote the new MDP $\mathcal { M }$ as the MDP obtained by replacing $c$ by $c ^ { \prime }$ in $\mathcal { M } _ { 0 }$ : $\mathcal { M } = ( \mathcal { S } , \mathcal { A } , P , c ^ { \prime } , \gamma )$ . $\mathrm { N g }$ et al. (1999) showed that the optimal policy $\pi _ { \mathcal { M } } ^ { * }$ on $\mathcal { M }$ and the optimal policy $\pi _ { \mathcal { M } _ { 0 } } ^ { * }$ on the original MDP are the same: $\pi _ { \mathcal M } ^ { * } ( s ) = \pi _ { \mathcal M _ { 0 } } ^ { * } ( s ) , \forall s$ . In other words, if we can successfully find $\pi _ { \mathcal { M } } ^ { * }$ on $\mathcal { M }$ , then we also find $\pi _ { \mathcal { M } _ { 0 } } ^ { * }$ , the optimal policy on the original MDP $\mathcal { M } _ { 0 }$ that we ultimately want to optimize.
|
| 58 |
+
|
| 59 |
+
# 2.2 IMITATION LEARNING
|
| 60 |
+
|
| 61 |
+
In $\mathrm { I L }$ , when given a cost-to-go oracle $V ^ { e }$ , we can use it as a potential function for cost shaping. Specifically let us define the disadvantage $A ^ { e } ( s , a ) = c ( s , a ) ^ { \circ } + \gamma \mathbb { E } _ { s ^ { \prime } \sim P _ { s a } } [ V ^ { e } ( s ^ { \prime } ) ] - V ^ { e } ( s )$ . As cost shaping does not change the optimal policy, we can rephrase the original policy search problem using the shaped cost:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\pi ^ { * } = \arg \operatorname* { m i n } _ { \pi } \mathbb { E } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } A ^ { e } ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a \sim \pi ] ,
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
for all $s \in S$ . Though Eq. 2 provides an alternative objective for policy search, it could be as hard as the original problem as $\begin{array} { r } { \bar { \mathbb { E } } [ \sum _ { t } \gamma ^ { t } A ^ { e } ( s _ { t } , a _ { t } ) ] } \end{array}$ is just equal to $\mathbb { E } [ \sum _ { t } \gamma ^ { t } c ( s _ { t } , a _ { t } ) - V ^ { e } ( s _ { 0 } ) ]$ , which can be easily verified using the definition of cost shaping and a telescoping sum trick.
|
| 68 |
+
|
| 69 |
+
As directly optimizing Eq 2 is as difficult as policy search in the original MDP, previous $\mathrm { I L }$ algorithms such as AGGREVATE essentially ignore temporal correlations between states and actions along the planning horizon and directly perform a policy iteration over the expert policy at every state, i.e., they are greedy with respect to $A ^ { e }$ as $\begin{array} { r } { \hat { \pi } ( s ) = \arg \operatorname* { m i n } _ { a } A ^ { e } ( s , a ) , \forall s \in \mathcal { S } } \end{array}$ . The policy iteration theorem guarantees that such a greedy policy $\hat { \pi }$ performs at least as well as the expert. Hence, when the expert is optimal, the greedy policy $\hat { \pi }$ is guaranteed to be optimal. However when $V ^ { e }$ is not the optimal value function, the greedy policy $\hat { \pi }$ over $A ^ { e }$ is a one-step deviation improvement over the expert but is not guaranteed to be close to the optimal $\pi ^ { * }$ . We analyze in detail how poor the policy resulting from such a greedy policy improvement method could be when $V ^ { e }$ is far away from the optimal value function in Sec. 3.
|
| 70 |
+
|
| 71 |
+
# 3 EFFECTIVENESS OF COST-TO-GO ORACLE ON PLANNING HORIZON
|
| 72 |
+
|
| 73 |
+
In this section we study the dependency of effective planning horizon on the cost-to-go oracle. We focus on the setting where we have access to an oracle $\hat { V } ^ { e } ( s )$ which approximates the cost-to-go of some expert policy $\pi ^ { e }$ (e.g., $V ^ { e }$ could be designed by domain knowledge $\mathrm { N g }$ et al., 1999) or learned from a set of expert demonstrations). We assume the oracle is close to $V _ { \mathcal { M } _ { 0 } } ^ { * }$ , but imperfect: $| \hat { V } ^ { e } - V _ { \mathcal { M } _ { 0 } } ^ { * } | = \epsilon$ for some $\epsilon \in \mathbb { R } ^ { + }$ . We first show that with such an imperfect oracle, previous $\mathrm { I L }$ algorithms AGGREVATE and AGGREVATE D (Ross & Bagnell, 2014; Sun et al., 2017) are only guaranteed to learn a policy that is $\gamma \epsilon / ( 1 - \gamma )$ away from the optimal. Let us define the expected total cost for any policy $\pi$ as $J ( \pi ) = \mathbb { E } _ { s _ { 0 } \sim v } \left[ V _ { \mathcal { M } _ { 0 } } ^ { \pi } ( s _ { 0 } ) \right]$ , measured under some initial state distribution $v$ and the original MDP $\mathcal { M } _ { 0 }$ .
|
| 74 |
+
|
| 75 |
+
Theorem 3.1. There exists an MDP and an imperfect oracle $\hat { V } ^ { e } ( s )$ with $| \hat { V } ^ { e } ( s ) - V _ { \mathcal { M } _ { 0 } , h } ^ { * } ( s ) | =$ , such that the performance of the induced policy from the cost-to-go oracle $\hat { \pi } ^ { * } =$ $\arg \operatorname* { m i n } _ { a } \Big [ c ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P _ { s a } } [ \hat { V } ^ { e } ( s ^ { \prime } ) ] \Big ]$ is at least $\Omega ( \gamma \epsilon / ( 1 - \gamma ) )$ away from the optimal policy $\pi ^ { * }$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
J ( \hat { \pi } ^ { * } ) - J ( \pi ^ { * } ) \geq \Omega \left( \frac { \gamma } { 1 - \gamma } \epsilon \right) .
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
The proof with the constructed example can be found in Appendix A. Denote $\hat { Q } ^ { e } ( s , a ) = c ( s , a ) +$ $\gamma \mathbb { E } _ { s ^ { \prime } } [ \hat { V } ^ { e } ( s ^ { \prime } ) ]$ , in high level, we construct an example where $\hat { Q } ^ { e }$ is close to $Q ^ { * }$ in terms of $\| \hat { Q } ^ { e } - $ $Q ^ { * } \| _ { \infty }$ , but the order of the actions induced by $\hat { Q } ^ { e }$ is different from the order of the actions from $Q ^ { * }$ , hence forcing the induced policy $\hat { \pi } ^ { * }$ to make mistakes.
|
| 82 |
+
|
| 83 |
+
As AGGREVATE at best computes a policy that is one-step improvement over the oracle, i.e., $\hat { \pi } ^ { * } =$ $\arg \operatorname* { m i n } _ { a } \Big [ c ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P _ { s a } } \bar { [ V ^ { e } ( { s ^ { \prime } } ) ] } \Big ]$ , it eventually has to suffer from the above lower bound. This $\epsilon$ gap in fact is not surprising as AGGREVATE is a one-step greedy algorithm in a sense that it is only optimizing the one-step cost function $c ^ { \prime }$ from the reshaped MDP $\mathcal { M }$ . To see this, note that the cost of the reshaped MDP $\mathcal { M }$ is $\mathbb { E } [ c ^ { \prime } ( s , a ) ] = [ c ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P _ { s a } } \hat { V } ^ { e } ( s ^ { \prime } ) - \hat { V } ^ { e } ( s ) ]$ , and we have $\begin{array} { r } { \hat { \pi } ^ { * } ( s ) = \arg \operatorname* { m i n } _ { a } \mathbb { E } [ c ^ { \prime } ( s , a ) ] } \end{array}$ . Hence AGGREVATE can be regarded as a special algorithm that aims to optimizing the one-step cost of MDP $\mathcal { M }$ that is reshaped from the original MDP $\mathcal { M } _ { 0 }$ using the cost-to-go oracle.
|
| 84 |
+
|
| 85 |
+
Though when the cost-to-go oracle is imperfect, AGGREVATE will suffer from the above lower bound due to being greedy, when the cost-to-go oracle is perfect, i.e., $\hat { V } ^ { e } = V ^ { * }$ , being greedy on one-step cost makes perfect sense. To see this, use the property of the cost shaping $\mathrm { N g }$ et al., 1999), we can verify that when $\hat { V } ^ { e } = V ^ { * }$ :
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
V _ { \mathcal { M } } ^ { * } ( s ) = 0 , \quad \pi _ { \mathcal { M } } ^ { * } ( s ) = \arg \operatorname* { m i n } _ { a } \mathbb { E } [ c ^ { \prime } ( s , a ) ] , \quad \forall s \in \mathcal { S } .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
Namely the optimal policy on the reshaped MDP $\mathcal { M }$ only optimizes the one-step cost, which indicates that the optimal cost-to-go oracle shortens the planning horizon to one: finding the optimal policy on $\mathcal { M } _ { 0 }$ becomes equivalent to optimizing the immediate cost function on $\mathcal { M }$ at every state $s$ .
|
| 92 |
+
|
| 93 |
+
When the cost-to-go oracle is $\epsilon$ away from the optimality, we lose the one-step greedy property shown in Eq. 4. In the next section, we show that how we can break the lower bound $\Omega ( \epsilon / ( 1 - \gamma ) )$ only with access to an imperfect cost-to-go oracle $\hat { V } ^ { e }$ , by being less greedy and looking head for more than one-step.
|
| 94 |
+
|
| 95 |
+
# 3.1 OUTPERFORMING THE EXPERT
|
| 96 |
+
|
| 97 |
+
Given the reshaped MDP $\mathcal { M }$ with $\hat { V } ^ { e }$ as the potential function, as we mentioned in Sec. 2.2, directly optimizing Eq. 2 is as difficult as the original policy search problem, we instead propose to minimize the total cost of a policy $\pi$ over a finite $k \geq 1$ steps at any state $s \in S$ :
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\mathbb { E } \Big [ \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ^ { \prime } ( s _ { i } , a _ { i } ) | s _ { 1 } = s ; a \sim \pi \Big ] .
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
Using the definition of cost shaping and telescoping sum trick,we can re-write Eq. 5 in the following format, which we define as $k$ -step disadvantage with respect to the cost-to-go oracle:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\mathbb { E } \Big [ \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) - \hat { V } ^ { e } ( s _ { 1 } ) | s _ { 1 } = s ; a \sim \pi \Big ] , \forall s \in \mathcal { S } .
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
We assume that our policy class $\Pi$ is rich enough that there always exists a policy $\hat { \pi } ^ { * } \in \Pi$ that can simultaneously minimizes the $k -$ step disadvantage at every state (e.g., policies in tabular representation in discrete MDPs). Note that when $k = 1$ , minimizing Eq. 6 becomes the problem of finding a policy that minimizes the disadvantage $A _ { \mathcal { M } _ { 0 } } ^ { e } ( s , a )$ with respect to the expert and reveals AGGREVATE.
|
| 110 |
+
|
| 111 |
+
The following theorem shows that to outperform expert, we can optimize Eq. 6 with $k > 1$ . Let us denote the policy that minimizes Eq. 6 in every state as $\hat { \pi } ^ { * }$ , and the value function of $\hat { \pi } ^ { * }$ as $V ^ { \hat { \pi } ^ { * } }$ .
|
| 112 |
+
|
| 113 |
+
Theorem 3.2. Assume $\hat { \pi } ^ { * }$ minimizes Eq. 6 for every state $s \in S$ with $k > 1$ and $| \hat { V } ^ { e } ( s ) - V ^ { * } ( s ) | =$ $\Theta ( \epsilon ) , \forall s$ . We have :
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
J ( \hat { \pi } ^ { * } ) - J ( \pi ^ { * } ) \leq O \left( \frac { \gamma ^ { k } } { 1 - \gamma ^ { k } } \epsilon \right)
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
Compare the above theorem to the lower bound shown in Theorem 3.1, we can see that when $k > 1$ , we are able to learn a policy that performs better than the policy induced by the oracle (i.e., ${ \hat { \pi } } ^ { * } ( s ) =$ $\mathrm { a r g m i n } _ { a } \hat { Q } ^ { e } ( s , a ) )$ by at least $\begin{array} { r } { \big ( \frac { \gamma } { 1 - \gamma } - \frac { \gamma ^ { k } } { 1 - \gamma ^ { k } } \big ) \epsilon } \end{array}$ . The proof can be found in Appendix B.
|
| 120 |
+
|
| 121 |
+
Theorem 3.2 and Theorem 3.1 together summarize that when the expert is imperfect, simply computing a policy that minimizes the one-step disadvantage (i.e., $k = 1 )$ ) is not sufficient to guarantee near-optimal performance; however, optimizing a $k$ -step disadvantage with $k > 1$ leads to a policy that guarantees to outperform the policy induced by the oracle (i.e., the best possible policy that can be learnt using AGGREVATE and AGGREVATED). Also our theorem provides a concrete performance gap between the policy that optimizes Eq. 6 for $k > 1$ and the policy that induced by the oracle, which is missing in previous work (e.g., (Chang et al., 2015)).
|
| 122 |
+
|
| 123 |
+
As we already showed, if we set $k = 1$ , then optimizing Eq. 6 becomes optimizing the disadvantage over the expert $A _ { \mathcal { M } _ { 0 } } ^ { e }$ , which is exactly what AGGREVATE aims for. When we set $k = \infty$ , optimizing Eq. 6 or Eq. 5 just becomes optimizing the total cost of the original MDP. Optimizing over a shorter
|
| 124 |
+
|
| 125 |
+
1: Input: The original MDP $\mathcal { M } _ { 0 }$ . Truncation Step $k$ . Oracle $V ^ { e }$ .
|
| 126 |
+
2: Initialize policy $\pi _ { \theta _ { 0 } }$ with parameter $\theta _ { 0 }$ and truncated advantage estimator $\hat { A } _ { \mathcal { M } } ^ { 0 , k }$ .
|
| 127 |
+
3: for $\mathrm { \Omega } _ { \mathrm { n } } = 0$ , ... do
|
| 128 |
+
4: Reset system.
|
| 129 |
+
5: Execute $\pi _ { \theta _ { n } }$ to generate a set of trajectories $\{ \tau _ { i } \} _ { i = 1 } ^ { N }$ .
|
| 130 |
+
6: Reshape cost $c ^ { \prime } \bar { ( s _ { t } , \underline { { { a _ { t } } } } ) } = c ( s _ { t } , a _ { t } ) + V _ { t + 1 } ^ { e } \bar { ( s _ { t + 1 } ) } \stackrel { . } { - } V _ { t } ^ { e } ( s _ { t } )$ , for every $t \in [ 1 , | \tau _ { i } | ]$ in every
|
| 131 |
+
trajectory $\tau _ { i } , i \in [ N ]$ .
|
| 132 |
+
7: Compute gradient:
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\sum _ { \tau _ { i } } \sum _ { t } \nabla _ { \boldsymbol { \theta } } \big ( \ln \pi _ { \boldsymbol { \theta } } \big ( a _ { t } | s _ { t } \big ) \big ) \big | _ { { \boldsymbol \theta } = { \boldsymbol { \theta } } _ { n } } \hat { A } _ { \mathcal { M } } ^ { \pi _ { n } , k } \big ( s _ { t } , a _ { t } \big )
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
8: Update disadvantage estimator to $\hat { A } _ { \mathcal { M } } ^ { \pi _ { n } , k }$ using $\{ \tau _ { i } \} _ { i }$ with reshaped cost $c ^ { \prime }$
|
| 139 |
+
|
| 140 |
+
10: end for
|
| 141 |
+
|
| 142 |
+
finite horizon is easier than optimizing over the entire infinite long horizon due to advantages such as smaller variance of the empirical estimation of the objective function, less temporal correlations between states and costs along a shorter trajectory. Hence our main theorem essentially provides a tradeoff between the optimality of the solution $\hat { \pi } ^ { * }$ and the difficulty of the underlying optimization problem.
|
| 143 |
+
|
| 144 |
+
# 4 PRACTICAL ALGORITHM
|
| 145 |
+
|
| 146 |
+
Given the original MDP $\mathcal { M } _ { 0 }$ and the cost-to-go oracle $\hat { V } ^ { e }$ , the reshaped MDP’s cost function $c ^ { \prime }$ is obtained from Eq. 1 using the cost-to-go oracle as a potential function. Instead of directly applying RL algorithms on $\mathcal { M } _ { 0 }$ , we use the fact that the cost-to-go oracle shortens the effective planning horizon of $\mathcal { M }$ , and propose THOR: Truncated HORizon Policy Search summarized in Alg. 1. The general idea of THOR is that instead of searching for policies that optimize the total cost over the entire infinitely long horizon, we focus on searching for polices that minimizes the total cost over a truncated horizon, i.e., a $k -$ step time window. Below we first show how we derive THOR from the insight we obtained in Sec. 3.
|
| 147 |
+
|
| 148 |
+
Let us define a $k$ -st truncated value function $V _ { \mathcal { M } } ^ { \pi , k }$ and similar state action value function $Q _ { \mathcal { M } } ^ { \pi , k }$ on the reshaped MDP $\mathcal { M }$
|
| 149 |
+
|
| 150 |
+
$$
|
| 151 |
+
\begin{array} { r l } & { V _ { \mathcal { M } } ^ { \pi , k } ( s ) = \mathbb { E } \Big [ \displaystyle \sum _ { t = 1 } ^ { k } \gamma ^ { t - 1 } c ^ { \prime } ( s _ { t } , a _ { t } ) | s _ { 1 } = s , a \sim \pi \Big ] , } \\ & { Q _ { \mathcal { M } } ^ { \pi , k } ( s , a ) = \mathbb { E } \Big [ c ^ { \prime } ( s , a ) + \displaystyle \sum _ { i = 1 } ^ { k - 1 } \gamma ^ { i } c ^ { \prime } ( s _ { i } , a _ { i } ) | s _ { i } \sim P _ { s a } , a _ { i } \sim \pi ( s _ { i } ) \Big ] , } \end{array}
|
| 152 |
+
$$
|
| 153 |
+
|
| 154 |
+
At any time state $s , V _ { \mathcal { M } } ^ { \pi , k }$ only considers (reshaped) cost signals $c ^ { \prime }$ from a $\mathbf { k }$ -step time window.
|
| 155 |
+
|
| 156 |
+
We are interested in searching for a policy that can optimizes the total cost over a finite $\mathbf { k }$ -step horizon as shown in Eq. 5. For MDPs with large or continuous state spaces, we cannot afford to enumerate all states $s \in { \mathcal { S } }$ to find a policy that minimizes the $k -$ step disadvantage function as in Eq. 5. Instead one can leverage the approximate policy iteration idea and minimize the weighted cost over state space using a state distribution $\nu$ (Kakade & Langford, 2002; Bagnell et al., 2004):
|
| 157 |
+
|
| 158 |
+
$$
|
| 159 |
+
\operatorname* { m i n } _ { \pi \in \Pi } \mathbb { E } _ { s _ { 0 } \sim \nu } \left[ \mathbb { E } \Big [ \sum _ { i = 1 } ^ { k } \gamma ^ { i } c ^ { \prime } ( s _ { i } , a _ { i } ) | a \sim \pi \Big ] \right] .
|
| 160 |
+
$$
|
| 161 |
+
|
| 162 |
+
For parameterized policy $\pi$ (e.g., neural network policies), we can implement the minimization in Eq. 10 using gradient-based update procedures (e.g., Stochastic Gradient Descent, Natural Gradient (Kakade, 2002; Bagnell & Schneider, 2003)) in the policy’s parameter space. In the setting where the system cannot be reset to any state, a typical choice of exploration policy is the currently learned policy (possibly mixed with a random process (Lillicrap et al., 2015) to futher encourage exploration). Denote $\pi _ { n }$ as the currently learned policy after iteration $n$ and $P r _ { \pi _ { n } } ( \cdot )$ as the average state distribution induced by executing $\pi _ { n }$ (parameterized by $\theta _ { n }$ ) on the MDP. Replacing the exploration distribution by ${ P r } _ { \pi _ { n } } ( \cdot )$ in Eq. 10, and taking the derivative with respect to the policy parameter $\theta$ , the policy gradient is:
|
| 163 |
+
|
| 164 |
+
$$
|
| 165 |
+
\begin{array} { r l } { { \mathbb { E } _ { s \sim P r _ { \pi _ { n } } } \Bigg [ \mathbb { E } _ { \tau ^ { k } \sim \pi _ { n } } [ \sum _ { i = 1 } ^ { k } \nabla _ { \theta } \ln \pi ( a _ { i } | s _ { i } ; \theta ) ( \sum _ { j = i } ^ { k + i } \gamma ^ { j - i } c ^ { \prime } ( s _ { j } , a _ { j } ) ) ] \Bigg ] } \Bigg ] } \\ & { \approx \mathbb { E } _ { s \sim P r _ { \pi _ { n } } } [ \mathbb { E } _ { \tau ^ { k } \sim \pi _ { n } } [ \sum _ { i = 1 } ^ { k } \nabla _ { \theta } \ln \pi ( a _ { i } | s _ { i } ; \theta ) Q _ { \mathcal { M } } ^ { \pi , k } ( s _ { i } , a _ { i } ) ] ] } \end{array}
|
| 166 |
+
$$
|
| 167 |
+
|
| 168 |
+
where $\tau ^ { k } \sim \pi _ { n }$ denotes a partial $k -$ step trajectory $\tau ^ { k } = \{ s _ { 1 } , a _ { 1 } , . . . , s _ { k } , a _ { k } | s _ { 1 } = s \}$ sampled from executing $\pi _ { n }$ , replacing chulman et $Q _ { \mathcal { M } } ^ { \pi , k }$ $\pi _ { n }$ on the MDP from state by a critic approximated by Generalized disadvantage Estimator (GAE) 016), we get back to the gradient used in Alg. 1: $s$ . Replacing the expectation by empirical samples from $\hat { A } _ { \mathcal { M } } ^ { \pi , k }$
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\begin{array} { r l } { { \mathbb { E } _ { s \sim P r _ { \pi _ { n } } } \Bigg [ \mathbb { E } _ { \tau _ { k } \sim \pi _ { n } } [ \sum _ { i = 1 } ^ { k } \nabla _ { \theta } \ln \pi ( a _ { i } | s _ { i } ; \theta ) Q _ { \mathcal { M } } ^ { \pi , k } ( s _ { i } , a _ { i } ) ] \Bigg ] } } \\ & { \approx k \sum _ { \tau } \Big ( \sum _ { t = 1 } ^ { | \tau | } \nabla _ { \theta } \ln ( \pi ( a _ { t } | s _ { t } ; \theta ) ) \hat { A } _ { \mathcal { M } } ^ { \pi , k } ( s _ { t } , a _ { t } ) \Big ) / H , } \end{array}
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
where $| \tau |$ denotes the length of the trajectory $\tau$
|
| 175 |
+
|
| 176 |
+
# 4.1 INTERPRETATION USING TRUNCATED BACK-PROPAGATION THROUGH TIME
|
| 177 |
+
|
| 178 |
+
If using the classic policy gradient formulation on the reshaped MDP $\mathcal { M }$ we should have the following expression, which is just a re-formulation of the classic policy gradient (Williams, 1992):
|
| 179 |
+
|
| 180 |
+
$$
|
| 181 |
+
\mathbb { E } _ { \tau } \sum _ { t = 1 } ^ { | \tau | } \big ( c _ { t } ^ { \prime } \sum _ { i = 0 } ^ { t - 1 } ( \nabla _ { \theta } \ln \pi ( a _ { t - i } | s _ { t - i } ; \theta ) ) \big ) ,
|
| 182 |
+
$$
|
| 183 |
+
|
| 184 |
+
which is true since the cost $c _ { i } ^ { \prime }$ (we denote $c _ { i } ^ { \prime } ( s , a )$ as $c _ { i } ^ { \prime }$ for notation simplicity) at time step $i$ is correlated with the actions at time step $t = i$ all the way back to the beginning $t = 1$ . In other words, in the policy gradient format, the effectiveness of the cost $c _ { t }$ is back-propagated through time all the way back the first step. Our proposed gradient formulation in Alg. 1 shares a similar spirit of Truncated Back-Propagation Through Time (Zipser, 1990), and can be regarded as a truncated version of the classic policy gradient formulation: at any time step $t$ , the cost $c ^ { \prime }$ is back-propagated through time at most $k$ -steps:
|
| 185 |
+
|
| 186 |
+
$$
|
| 187 |
+
\mathbb { E } _ { \tau } \sum _ { t = 1 } ^ { | \tau | } \big ( c _ { t } ^ { \prime } \sum _ { i = 0 } ^ { k - 1 } ( \nabla _ { \theta } \ln \pi ( a _ { t - i } | s _ { t - i } ; \theta ) ) \big ) ,
|
| 188 |
+
$$
|
| 189 |
+
|
| 190 |
+
In Eq. 13, for any time step $t$ , we ignore the correlation between $c _ { t } ^ { \prime }$ and the actions that are executed $k$ -step before $t$ , hence elimiates long temporal correlations between costs and old actions. In fact, AGGREVATE D (Sun et al., 2017), a policy gradient version of AGGREVATE, sets $k = 1$ and can be regarded as No Back-Propagation Through Time.
|
| 191 |
+
|
| 192 |
+
# 4.2 CONNECTION TO IL AND RL
|
| 193 |
+
|
| 194 |
+
The above gradient formulation provides a natural half-way point between $\mathrm { I L }$ and RL. When $k = 1$ and $\hat { V } ^ { e } = V _ { \mathcal { M } _ { 0 } } ^ { * }$ (the optimal value function in the original MDP $\mathcal { M } _ { 0 }$ ):
|
| 195 |
+
|
| 196 |
+
$$
|
| 197 |
+
\begin{array} { r l } & { \mathbb { E } _ { \tau } \Big [ \displaystyle \sum _ { t = 1 } ^ { | \tau | } \nabla _ { \theta } ( \ln \pi _ { \theta } ( a _ { t } | s _ { t } ) ) A _ { \mathcal { M } } ^ { \pi ^ { c } , 1 } ( s _ { t } , a _ { t } ) \Big ] = \mathbb { E } _ { \tau } \Big [ \displaystyle \sum _ { t = 1 } ^ { | \tau | } \nabla _ { \theta } ( \ln \pi _ { \theta } ( a _ { t } | s _ { t } ) ) Q _ { \mathcal { M } } ^ { \pi _ { \epsilon } , 1 } ( s _ { t } , a _ { t } ) \Big ] } \\ & { = \mathbb { E } _ { \tau } \Big [ \displaystyle \sum _ { t = 1 } ^ { | \tau | } \nabla _ { \theta } ( \ln \pi _ { \theta } ( a _ { t } | s _ { t } ) ) \mathbb { E } [ c ^ { \prime } ( s _ { t } , a _ { t } ) ] \Big ] = \mathbb { E } _ { \tau } \Big [ \displaystyle \sum _ { t = 1 } ^ { | \tau | } \nabla _ { \theta } ( \ln \pi _ { \theta } ( a _ { t } | s _ { t } ) ) A _ { \mathcal { M } _ { 0 } } ^ { \pi ^ { * } } ( s _ { t } , a _ { t } ) \Big ] , } \end{array}
|
| 198 |
+
$$
|
| 199 |
+
|
| 200 |
+
where, for notation simplicity, we here use $\mathbb { E } _ { \tau }$ to represent the expectation over trajectories sampled from executing policy $\pi _ { \theta }$ , and $A _ { { \mathcal { M } } _ { \mathrm { . } } } ^ { \pi ^ { * } }$ is the advantage function on the original MDP $\mathcal { M } _ { 0 }$ . The fourth expression in the above equation is exactly the gradient proposed by AGGREVATED (Sun et al., 2017). AGGREVATED performs gradient descent with gradient in the format of the fourth expression in Eq. 14 to discourage the log-likelihood of an action $a _ { t }$ that has low advantage over $\pi ^ { * }$ at a given state $s _ { t }$ .
|
| 201 |
+
|
| 202 |
+
On the other hand, when we set $k = \infty$ , i.e., no truncation on horizon, then we return back to the classic policy gradient on the MDP $\mathcal { M }$ obtained from cost shaping with $\hat { V } ^ { e }$ . As optimizing $\mathcal { M }$ is the same as optimizing the original MDP $\mathcal { M } _ { 0 }$ $\mathrm { N g }$ et al., 1999), our formulation is equivalent to a pure RL approach on $\mathcal { M } _ { 0 }$ . In the extreme case when the oracle $\hat { V } ^ { e }$ has nothing to do with the true optimal oracle $V ^ { * }$ , as there is no useful information we can distill from the oracle and RL becomes the only approach to solve $\mathcal { M } _ { 0 }$ .
|
| 203 |
+
|
| 204 |
+
# 5 EXPERIMENTS
|
| 205 |
+
|
| 206 |
+
We evaluated THOR on robotics simulators from OpenAI Gym (Brockman et al., 2016). Throughout this section, we report reward instead of cost, since OpenAI Gym by default uses reward. The baseline we compare against is TRPO-GAE (Schulman et al., 2016) and AGGREVATED (Sun et al., 2017).
|
| 207 |
+
|
| 208 |
+
To simulate oracles, we first train TRPO-GAE until convergence to obtain a policy as an expert $\pi ^ { e }$ . We then collected a batch of trajectories by executing $\pi ^ { e }$ . Finally, we use TD learning Sutton (1988) to train a value function $\hat { V } ^ { e }$ that approximates $V ^ { e }$ . In all our experiments, we ignored $\pi ^ { e }$ and only used the pre-trained $\hat { V } ^ { e }$ for reward shaping. Hence our experimental setting simulates the situation where we only have a batch of expert demonstrations available, and not the experts themselves. This is a much harder setting than the interactive setting considered in previous work (Ross et al., 2011; Sun et al., 2017; Chang et al., 2015). Note that $\pi ^ { e }$ is not guaranteed to be an optimal policy, and $\hat { V } ^ { e }$ is only trained on the demonstrations from $\pi ^ { e }$ , therefore the oracle $\hat { V } ^ { e }$ is just a coarse estimator of V ∗M0 . Our goal is to show that, compared to AGGREVATED, THOR with $k > 1$ results in significantly better performance; compared to TRPO-GAE, THOR with some $k < < H$ converges faster and is more sample efficient. For fair comparison to RL approaches, we do not pre-train policy or critic $\hat { A }$ using demonstration data, though initialization using demonstration data is suggested in theory and has been used in practice to boost the performance (Ross et al., 2011; Bahdanau et al., 2016).
|
| 209 |
+
|
| 210 |
+
For all methods we report statistics (mean and standard deviation) from 25 seeds that are i.i.d generated. For trust region optimization on the actor $\pi _ { \theta }$ and GAE on the critic, we simply use the recommended parameters in the code-base from TRPO-GAE (Schulman et al., 2016). We did not tune any parameters except the truncation length $k$ .
|
| 211 |
+
|
| 212 |
+
# 5.1 DISCRETE ACTION CONTROL
|
| 213 |
+
|
| 214 |
+
We consider two discrete action control tasks with sparse rewards: Mountain-Car, Acrobot and a modified sparse reward version of CartPole. All simulations have sparse reward in the sense that no reward signal is given until the policy succeeds (e.g., Acrobot swings up). In these settings, pure RL approaches that rely on random exploration strategies, suffer from the reward sparsity. On the other hand, THOR can leverage oracle information for more efficient exploration. Results are shown in Fig. 1.
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
Figure 1: Reward versus batch iterations of THOR with different $k$ and TRPO-GAE (blue) for Mountain car, Sparse Reward (SR) CartPole, and Acrobot with different horizon. Average rewards across 25 runs are shown in solid lines and averages $^ +$ std are shown in dotted lines.
|
| 218 |
+
|
| 219 |
+
Note that in our setting where $\hat { V } ^ { e }$ is imperfect, THOR with $k > 1$ works much better than AGGREVATED (THOR with $k = 1$ ) in Acrobot. In Mountain Car, we observe that AGGREVATED achieves good performance in terms of the mean, but THOR with $k > 1$ (especially $k = 1 0$ ) results in much higher mean $^ +$ std, which means that once THOR receives the reward signal, it can leverage this signal to perform better than the oracles.
|
| 220 |
+
|
| 221 |
+
We also show that THOR with $k > 1$ (but much smaller than $H$ ) can perform better than TRPOGAE. In general, as $k$ increases, we get better performance. We make the acrobot setting even harder by setting $H = 2 0 0$ to even reduce the chance of a random policy to receive reward signals. Compare Fig. 1 (c) to Fig. 1 (b), we can see that THOR with different settings of $k$ always learns faster than TRPO-GAE, and THOR with $k = 5 0$ and $k = 1 0 0$ significantly outperform TRPO-GAE in both mean and mean+std. This indicates that THOR can leverage both reward signals (to perform better than AGGREVATED) and the oracles (to learn faster or even outperform TRPO).
|
| 222 |
+
|
| 223 |
+
# 5.2 CONTINUOUS ACTION CONTROL
|
| 224 |
+
|
| 225 |
+
We tested our approach on simulators with continuous state and actions from MuJoCo simulators: a modified sparse reward Inverted Pendulum, a modifed sparse reward Inverted Double Pendulum, Hopper and Swimmer. Note that, compared to the sparse reward setting, Hopper and Swimmer do not have reward sparsity and policy gradient methods have shown great results (Schulman et al., 2015; 2016). Also, due to the much larger and more complex state space and control space compared to the simulations we consider in the previous section, the value function estimator $\hat { V } ^ { e }$ is much less accurate in terms of estimating $V _ { \mathcal { M } _ { 0 } } ^ { * }$ since the trajectories demonstrated from experts may only cover a very small part of the state and control space. Fig. 2 shows the results of our approach. For all simulations, we require $k$ to be around $2 0 \% \sim 3 0 \%$ of the original planning horizon $H$ to achieve good performance. AGGREVATED $k = 1$ ) learned very little due to the imperfect value function estimator $\hat { V } ^ { e }$ . We also tested $k = H$ , where we observe that reward shaping with $\hat { V } ^ { e }$ gives better performance than TRPO-GAE. This empirical observation is consistent with the observation from $\mathrm { N g }$ et al., 1999) ( $\mathrm { N g }$ et al. (1999) used SARSA (Sutton, 1988), not policy gradient based methods). This indicates that even when $\hat { V } ^ { e }$ is not close to $V ^ { * }$ , policy gradient methods can still employ the oracle $\hat { V } ^ { e }$ just via reward shaping.
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
Figure 2: Reward versus batch iterations of THOR with different $k$ and TRPO-GAE (blue) for Sparse Reward (SR) Inverted Pendulum, Sparse Reward Inverted-Double Pendulum, Swimmer and Hopper. Average rewards across 25 runs are shown in solid lines and averages $^ +$ std are shown in dotted lines.
|
| 229 |
+
|
| 230 |
+
Finally, we also observed that our approach significantly reduces the variance of the performance of the learned polices (e.g., Swimmer in Fig. 2(a)) in all experiments, including the sparse reward setting. This is because truncation can significantly reduce the variance from the policy gradient estimation when $k$ is small compared to $H$ .
|
| 231 |
+
|
| 232 |
+
# 6 CONCLUSION
|
| 233 |
+
|
| 234 |
+
We propose a novel way of combining $\mathrm { I L }$ and RL through the idea of cost shaping with an expert oracle. Our theory indicates that cost shaping with the oracle shortens the learner’s planning horizon as a function of the accuracy of the oracle compared to the optimal policy’s value function. Specifically, when the oracle is the optimal value function, we show that by setting $k = 1$ reveals previous imitation learning algorithm AGGREVATED. On the other hand, we show that when the oracle is imperfect, using planning horizon $k > 1$ can learn a policy that outperforms a policy that would been learned by AGGREVATE and AGGREVATED (i.e., $k = 1$ ). With this insight, we propose
|
| 235 |
+
|
| 236 |
+
THOR (Truncated HORizon policy search), a gradient based policy search algorithm that explicitly focusing on minimizing the total cost over a finite planning horizon. Our formulation provides a natural half-way point between IL and RL, and experimentally we demonstrate that with a reasonably accurate oracle, our approach can outperform RL and IL baselines.
|
| 237 |
+
|
| 238 |
+
We believe our high-level idea of shaping the cost with the oracle and then focusing on optimizing a shorter planning horizon is not limited to the practical algorithm we proposed in this work. In fact our idea can be combined with other RL techniques such as Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015), which has an extra potential advantage of storing extra information from the expert such as the offline demonstrations in its replay buffer (Vecer ˇ ´ık et al. (2017)). Though in our experiments, we simply used some expert’s demonstrations to pre-train $\hat { V } ^ { e }$ using TD learning, there are other possible ways to learn a more accurate $\hat { V } ^ { e }$ . For instance, if an expert is available during training (Ross et al., 2011), one can online update $\hat { V } ^ { e }$ by querying expert’s feedback.
|
| 239 |
+
|
| 240 |
+
# ACKNOWLEDGEMENT
|
| 241 |
+
|
| 242 |
+
Wen Sun is supported in part by Office of Naval Research contract N000141512365. The authors also thank Arun Venkatraman and Geoff Gordon for value discussion.
|
| 243 |
+
|
| 244 |
+
# REFERENCES
|
| 245 |
+
|
| 246 |
+
Pieter Abbeel and Andrew Y Ng. Apprenticeship learning via inverse reinforcement learning. In ICML, pp. 1. ACM, 2004.
|
| 247 |
+
|
| 248 |
+
J Andrew Bagnell and Jeff Schneider. Covariant policy search. In IJCAI, 2003.
|
| 249 |
+
|
| 250 |
+
J Andrew Bagnell, Sham M Kakade, Jeff G Schneider, and Andrew Y Ng. Policy search by dynamic programming. In Advances in neural information processing systems, pp. 831–838, 2004.
|
| 251 |
+
|
| 252 |
+
Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. arXiv preprint arXiv:1607.07086, 2016.
|
| 253 |
+
|
| 254 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
|
| 255 |
+
|
| 256 |
+
Kai-wei Chang, Akshay Krishnamurthy, Alekh Agarwal, Hal Daume, and John Langford. Learning to search better than your teacher. In ICML, 2015.
|
| 257 |
+
|
| 258 |
+
Sanjiban Choudhury, Ashish Kapoor, Gireeja Ranade, and Debadeepta Dey. Learning to gather information via imitation. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 908–915. IEEE, 2017.
|
| 259 |
+
|
| 260 |
+
Hal Daume III, John Langford, and Daniel Marcu. Search-based structured prediction. ´ Machine learning, 2009.
|
| 261 |
+
|
| 262 |
+
Amir-massoud Farahmand, Daniel Nikolaev Nikovski, Yuji Igarashi, and Hiroki Konaka. Truncated approximate dynamic programming with task-dependent terminal value. In AAAI, pp. 3123–3129, 2016.
|
| 263 |
+
|
| 264 |
+
Victor Gabillon, Alessandro Lazaric, Mohammad Ghavamzadeh, and Bruno Scherrer. Classification-based policy iteration with a critic. 2011.
|
| 265 |
+
|
| 266 |
+
Sham Kakade. A natural policy gradient. NIPS, 2002.
|
| 267 |
+
|
| 268 |
+
Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In ICML, 2002.
|
| 269 |
+
|
| 270 |
+
Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
|
| 271 |
+
|
| 272 |
+
Volodymyr Mnih et al. Human-level control through deep reinforcement learning. Nature, 2015.
|
| 273 |
+
|
| 274 |
+
Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. arXiv preprint arXiv:1709.10089, 2017.
|
| 275 |
+
|
| 276 |
+
Andrew Y Ng. Shaping and policy search in reinforcement learning. PhD thesis, University of California, Berkeley, 2003.
|
| 277 |
+
|
| 278 |
+
Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ , Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
|
| 279 |
+
|
| 280 |
+
Yunpeng Pan, Ching-An Cheng, Kamil Saigol, Keuntaek Lee, Xinyan Yan, Evangelos Theodorou, and Byron Boots. Agile off-road autonomous driving using end-to-end deep imitation learning. arXiv preprint arXiv:1709.07174, 2017.
|
| 281 |
+
|
| 282 |
+
Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. arXiv preprint arXiv:1709.10087, 2017.
|
| 283 |
+
|
| 284 |
+
Stephane Ross and J Andrew Bagnell. Reinforcement and imitation learning via interactive no-regret learning. arXiv preprint arXiv:1406.5979, 2014.
|
| 285 |
+
|
| 286 |
+
Stephane Ross, Geoffrey J Gordon, and J.Andrew Bagnell. A reduction of imitation learning and ´ structured prediction to no-regret online learning. In AISTATS, 2011.
|
| 287 |
+
|
| 288 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael I Jordan, and Philipp Moritz. Trust region policy optimization. In ICML, pp. 1889–1897, 2015.
|
| 289 |
+
|
| 290 |
+
John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. ICLR, 2016.
|
| 291 |
+
|
| 292 |
+
David Silver et al. Mastering the game of go with deep neural networks and tree search. Nature, 2016.
|
| 293 |
+
|
| 294 |
+
Wen Sun, Arun Venkatraman, Byron Boots, and J Andrew Bagnell. Learning to filter with predictive state inference machines. In ICML, 2016.
|
| 295 |
+
|
| 296 |
+
Wen Sun, Arun Venkatraman, Geoffrey J Gordon, Byron Boots, and J Andrew Bagnell. Deeply aggrevated: Differentiable imitation learning for sequential prediction. 2017.
|
| 297 |
+
|
| 298 |
+
Richard S Sutton and Andrew G Barto. Introduction to reinforcement learning, volume 135. MIT Press Cambridge, 1998.
|
| 299 |
+
|
| 300 |
+
RichardS. Sutton. Learning to predict by the methods of temporal differences. Machine Learning, 3:9–44, 1988.
|
| 301 |
+
|
| 302 |
+
Matej Vecer ˇ ´ık, Todd Hester, Jonathan Scholz, Fumin Wang, Olivier Pietquin, Bilal Piot, Nicolas Heess, Thomas Rothorl, Thomas Lampe, and Martin Riedmiller. Leveraging demonstra-¨ tions for deep reinforcement learning on robotics problems with sparse rewards. arXiv preprint arXiv:1707.08817, 2017.
|
| 303 |
+
|
| 304 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 1992.
|
| 305 |
+
|
| 306 |
+
David Zipser. Subgrouping reduces complexity and speeds up learning in recurrent networks. In Advances in neural information processing systems, pp. 638–641, 1990.
|
| 307 |
+
|
| 308 |
+
A PROOF OF THEOREM 3.1
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
Figure 3: The special MDP we constructed for theorem 3.1
|
| 312 |
+
|
| 313 |
+
Proof. We prove the theorem by constructing a special MDP shown in Fig 3, where $H = \infty$ . The MDP has deterministic transition, $2 H + 2$ states, and each state has two actions $a _ { 1 }$ and $a _ { 2 }$ as shown in Fig. 3. Every episode starts at state $s _ { 0 }$ . For state $s _ { i }$ (states on the top line), we have $c ( s _ { i } ) = 0$ and for state $s _ { i } ^ { \prime }$ (states at the bottom line) we have $c ( s _ { i } ) = 1$ .
|
| 314 |
+
|
| 315 |
+
It is clear that for any state $s _ { i }$ , we have $Q ^ { * } ( s _ { i } , a _ { 1 } ) ~ = ~ 0$ , $Q ^ { * } ( s _ { i } , a _ { 2 } ) \ = \ \gamma$ , $Q ^ { * } ( s _ { i } ^ { \prime } , a _ { 1 } ) \ = \ 1$ and $Q ^ { * } ( s _ { i } ^ { \prime } , a _ { 2 } ) = 1 + \gamma _ { \mathrm { { } } }$ , for $i \geq 1$ . Let us assume that we have an oracle $\hat { V } ^ { e }$ such that $\hat { V } ^ { e } ( s _ { i } ) = 0 . 5 + \delta$ and $V ^ { e } ( s _ { i } ^ { \prime } ) = 0 . 5 - \delta$ , for some positive real number $\delta$ . Hence we can see that $| \hat { V } ^ { e } ( s ) - V ^ { * } ( s ) | =$ $0 . 5 + \delta$ , for all $s$ . Denote $\hat { Q } ^ { e } ( s , a ) = c ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P _ { s a } } [ \hat { V } ^ { e } ( s ^ { \prime } ) ]$ , we know that ${ \hat { Q } } ^ { e } ( s _ { i } , a _ { 1 } ) =$ $\gamma ( 0 . 5 + \delta )$ $. 5 + \delta ) , \hat { Q } ^ { e } ( s _ { i } , a _ { 2 } ) = \gamma ( 0 . 5 - \delta ) , \hat { Q } ^ { e } ( s _ { i } ^ { \prime } , a _ { 1 } ) = 1 + \gamma ( 0 . 5 + \delta )$ and $\hat { Q } ^ { e } ( s _ { i } ^ { \prime } , a _ { 2 } ) = 1 + \gamma ( 0 . 5 - \delta )$ . It is clear that the optimal policy $\pi ^ { * }$ has cost $J ( \pi ^ { * } ) = 0$ . Now let us compute the cost of the induced policy from oracle $\hat { Q } ^ { e }$ : ${ \hat { \pi } } ( s ) = \arg \operatorname* { m i n } _ { a } { \hat { Q } } ^ { e } ( s , a )$ . As we can see $\hat { \pi }$ makes a mistake at every state as $\operatorname { a r g m i n } _ { a } \hat { Q } ^ { e } ( s , a ) \neq \operatorname { a r g m i n } _ { a } Q ^ { * } ( s , a )$ . Hence we have $\begin{array} { r } { J ( \hat { \pi } ) = \frac { \gamma } { 1 - \gamma } } \end{array}$ . Recall that in our constructed example, we have $\epsilon = 0 . 5 + \delta$ . Now let $\delta 0 ^ { + }$ (by $\delta 0 ^ { + }$ we mean $\delta$ approaches to zero from the right side), we have $\epsilon 0 . 5$ , hence $\begin{array} { r } { J ( \hat { \pi } ) = \frac { \gamma } { 1 - \gamma } \to \frac { 2 \gamma } { 1 - \gamma } \epsilon } \end{array}$ (due to the fact $2 \epsilon 1$ ). Hence we have $\begin{array} { r } { J ( \hat { \pi } ) - J ( \pi ^ { * } ) = \Omega \left( \frac { \gamma } { 1 - \gamma } \epsilon \right) } \end{array}$
|
| 316 |
+
|
| 317 |
+
# B PROOF OF THEOREM 3.2
|
| 318 |
+
|
| 319 |
+
Below we prove Theorem 3.2.
|
| 320 |
+
|
| 321 |
+
Proof of Theorem 3.2. In this proof, for notation simplicity, we denote $V _ { \mathcal { M } _ { 0 } } ^ { \pi }$ as $V ^ { \pi }$ for any $\pi$ . Using the definition of value function $V ^ { \pi }$ , for any state $s _ { 1 } \in { \mathcal { S } }$ we have:
|
| 322 |
+
|
| 323 |
+
$$
|
| 324 |
+
\begin{array} { r l } & { \boldsymbol { V } ^ { * * } ( s _ { 1 } ) - \boldsymbol { V } ^ { * * } ( s _ { 1 } ) } \\ & { = \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] - \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] } \\ & { = \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] - \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] } \\ & { \qquad + \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] - \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { k } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] } \\ & \qquad + \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \boldsymbol { \hat { \tau } } ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \boldsymbol { \gamma } ^ { k } \boldsymbol { V } ^ { * } ( s _ { k + 1 } ) | \boldsymbol { \hat { \pi } } ^ { * } \Big ] - \mathbb { E } \Big \end{array}
|
| 325 |
+
$$
|
| 326 |
+
|
| 327 |
+
Using the fact that $\| V ^ { * } ( s ) - { \hat { V } } ^ { e } ( s ) \| \leq \epsilon$ , we have that:
|
| 328 |
+
|
| 329 |
+
$$
|
| 330 |
+
\begin{array} { r l } & { \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } V ^ { * } ( s _ { k + 1 } ) | \hat { \pi } ^ { * } \Big ] \leq \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) | \hat { \pi } ^ { * } \Big ] + \gamma ^ { k } \epsilon , } \\ & { \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } V ^ { * } ( s _ { k + 1 } ) | \pi ^ { * } \Big ] \geq \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) | \pi ^ { * } \Big ] - \gamma ^ { k } \epsilon . } \end{array}
|
| 331 |
+
$$
|
| 332 |
+
|
| 333 |
+
Substitute the above two inequality into Eq. 15, we have:
|
| 334 |
+
|
| 335 |
+
$$
|
| 336 |
+
\begin{array} { r l r } { { V ^ { \tilde { \pi } ^ { * } } ( s _ { 1 } ) - V ^ { * } ( s _ { 1 } ) \leq \gamma ^ { k } \mathbb { E } [ V ^ { \tilde { \pi } ^ { * } } ( s _ { k + 1 } ) - V ^ { * } ( s _ { k + 1 } ) ] + 2 \gamma ^ { k } \epsilon } } \\ & { } & { + \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) | \hat { \pi } ^ { * } \Big ] - \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) | \pi ^ { * } \Big ] } \\ & { \leq \gamma ^ { k } \mathbb { E } [ V ^ { \tilde { \pi } ^ { * } } ( s _ { k + 1 } ) - V ^ { * } ( s _ { k + 1 } ) ] + 2 \gamma ^ { k } \epsilon } \\ & { } & { + \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) | \hat { \pi } ^ { * } \Big ] - \mathbb { E } \Big [ \displaystyle \sum _ { i = 1 } ^ { k } \gamma ^ { i - 1 } c ( s _ { i } , a _ { i } ) + \gamma ^ { k } \hat { V } ^ { e } ( s _ { k + 1 } ) | \hat { \pi } ^ { * } \Big ] } \\ & { = \gamma ^ { k } \mathbb { E } [ V ^ { \tilde { \pi } ^ { * } } ( s _ { k + 1 } ) - V ^ { * } ( s _ { k + 1 } ) ] + 2 \gamma ^ { k } \epsilon , } \end{array}
|
| 337 |
+
$$
|
| 338 |
+
|
| 339 |
+
where the second inequality comes from the fact that $\hat { \pi } ^ { * }$ is the minimizer from Eq. 6. Recursively expand $V ^ { \pi ^ { * } } ( s _ { k + 1 } ) - V ^ { * } ( s _ { k + 1 } )$ using the above procedure, we can get:
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
V ^ { \hat { \pi } ^ { * } } ( s _ { 1 } ) - V ^ { * } ( s _ { 1 } ) \leq 2 \gamma ^ { k } \epsilon ( 1 + \gamma ^ { k } + \gamma ^ { 2 k } + \ldots ) \leq \frac { 2 \gamma ^ { k } } { 1 - \gamma ^ { k } } \epsilon = O ( \frac { \gamma ^ { k } } { 1 - \gamma ^ { k } } \epsilon ) .
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
Since the above inequality holds for any $s _ { 1 } \in S$ , for any initial distribution $v$ over state space $s$ , we will have $\begin{array} { r } { J ( \hat { \pi } ^ { * } ) - J ( \pi ^ { * } ) \leq O ( \frac { \gamma ^ { k } } { 1 - \gamma ^ { k } } \epsilon ) } \end{array}$ . □
|
md/train/rygeHgSFDH/rygeHgSFDH.md
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DISENTANGLEMENT BY NONLINEAR ICA WITHGENERAL INCOMPRESSIBLE-FLOW NETWORKS (GIN)
|
| 2 |
+
|
| 3 |
+
Peter Sorrenson, Carsten Rother, Ullrich Kothe ¨
|
| 4 |
+
Visual Learning Lab
|
| 5 |
+
Heidelberg University
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
A central question of representation learning asks under which conditions it is possible to reconstruct the true latent variables of an arbitrarily complex generative process. Recent breakthrough work by Khemakhem et al. (2019) on nonlinear ICA has answered this question for a broad class of conditional generative processes. We extend this important result in a direction relevant for application to real-world data. First, we generalize the theory to the case of unknown intrinsic problem dimension and prove that in some special (but not very restrictive) cases, informative latent variables will be automatically separated from noise by an estimating model. Furthermore, the recovered informative latent variables will be in one-to-one correspondence with the true latent variables of the generating process, up to a trivial component-wise transformation. Second, we introduce a modification of the RealNVP invertible neural network architecture (Dinh et al., 2016) which is particularly suitable for this type of problem: the General Incompressibleflow Network (GIN). Experiments on artificial data and EMNIST demonstrate that theoretical predictions are indeed verified in practice. In particular, we provide a detailed set of exactly 22 informative latent variables extracted from EMNIST.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Deep latent-variable models promise to unlock the key factors of variation within a dataset, opening a window to interpretation and granting the power to manipulate data in an intuitive fashion. The theory of identifiability in linear independent component analysis (ICA) (Comon, 1994) tells us when this is possible, if we restrict the model to a linear transformation, but until recently there was no corresponding theory for the highly nonlinear models needed to manipulate complex data. This changed with the recent breakthrough work by Khemakhem et al. (2019), which showed that under relatively mild conditions, it is possible to recover the joint data and latent space distribution, up to a simple transformation in the latent space. The key requirement is that the generating process is conditioned on a variable which is observed along with the data. This condition could be a class label, time index of a time series, or any other piece of information additional to the data. They interpret their theory as a nonlinear version of ICA.
|
| 14 |
+
|
| 15 |
+
This work extends this theory in a direction relevant for application to real-world data. The existing theory assumes knowledge of the intrinsic problem dimension, but this is unrealistic for anything but artificially generated datasets. Here, we show that in the special case of Gaussian latent space distributions, the intrinsic problem dimension can be discovered. The important latent variables are organically separated from noise variables by the estimating model. Furthermore, the variables discovered correspond to the true generating latent variables, up to a trivial component-wise translation and scaling. Very similar results exist for other members of the exponential family with two parameters, such as the beta and gamma distributions.
|
| 16 |
+
|
| 17 |
+
We introduce a variant of the RealNVP (Dinh et al., 2016) invertible neural network: the General Incompressible-flow Network (GIN). The flow is called incompressible in reference to fluid dynamics, since it preserves volumes: the Jacobian determinant is simply unity. We emphasise its generality and increased expressive power in comparison to previous volume-preserving flows, such as NICE (Dinh et al., 2014). As already noted in Khemakhem et al. (2019), flow-based generative models are a natural fit for the theory of nonlinear ICA, as are the variational autoencoders (VAEs) (Kingma &
|
| 18 |
+
|
| 19 |
+
Welling, 2013) used in that work. For us, major advantages of invertible architectures over VAEs are the ability to specify volume preservation and directly optimize the likelihood, and freedom from the requirement to specify the dimension of the model’s latent space. An INN always has a latent space of the same dimension as the data. In addition, the forward and backward models share parameters, saving the effort of learning separate models for each direction.
|
| 20 |
+
|
| 21 |
+
In summary, our work makes the following contributions:
|
| 22 |
+
|
| 23 |
+
• We extend the theory of nonlinear ICA to allow for unknown intrinsic problem dimension. Doing so, we find that this dimension can be discovered and a one-to-one correspondence between generating and estimated latent variables established. We propose as an implementation an invertible neural network obtained by modifying the RealNVP architecture. We call our new architecture GIN: the General Incompressible-flow Network.
|
| 24 |
+
• We demonstrate the viability of the model on artificial data and the EMNIST dataset. We extract 22 meaningful variables from EMNIST, encoding both global and local features.
|
| 25 |
+
|
| 26 |
+
# 2 RELATED WORK
|
| 27 |
+
|
| 28 |
+
The basic goals of nonlinear ICA stem from the original work on linear ICA. An influential formulation, as well as the first identifiability results, were given in Comon (1994). These stated the conditions which allow the generating latent variables to be discovered, when the mixing function is a linear transformation. However, it was shown in Hyvarinen & Pajunen (1999) that this approach ¨ to identifiability does not extend to general nonlinear functions.
|
| 29 |
+
|
| 30 |
+
The first identifiability results in nonlinear ICA came in Hyvarinen & Morioka (2016) and Hyv ¨ arinen ¨ & Morioka (2017), applied to time series, and implemented via a discriminative model and semisupervised learning. A more general formulation, valid for other forms of data, was given in Hyvarinen et al. (2018) and the theory was extended to generative models in Khemakhem et al. ¨ (2019), where experiments were implemented by a VAE.
|
| 31 |
+
|
| 32 |
+
Many authors have addressed the general problem of disentanglement, and proposed models to learn disentangled features. Prominent among these is $\beta$ -VAE (Higgins et al., 2017) and its variations (e.g. Chen et al., 2018) which augment the standard ELBO loss with tunable hyperparameters to encourage disentanglement. There are also attempts to modify the GAN framework (Goodfellow et al., 2014) such as InfoGAN (Chen et al., 2016), which tries to maximize the mutual information between some dimensions of the latent space and the observed data. Many of these approaches are unsupervised. However, as pointed out and empirically demonstrated in Locatello et al. (2018), unsupervised models without conditioning in the latent space are in general unidentifiable.
|
| 33 |
+
|
| 34 |
+
Several unsupervised VAE models implement conditioning in the latent space by means of Gaussian mixtures (Johnson et al., 2016; Dilokthanakul et al., 2016; Zhao et al., 2019). Our work differs mainly by (i) only considering supervised tasks, therefore being safely covered by the theory of Khemakhem et al. (2019), and (ii) enforcing volume-preservation, not possible in a VAE.
|
| 35 |
+
|
| 36 |
+
The invertible neural networks in this work build upon the NICE framework (Dinh et al., 2014) and its extension in RealNVP (Dinh et al., 2016). A similar network design to ours is Ardizzone et al. (2019). This is a conditioned INN based on RealNVP, however the conditioning information is applied as a parameter of the network. The authors find in experiments with MNIST that meaningful variables are present in their latent space, but are rotated such that they are not aligned with the axes of the space. In this work, the conditioning is only present as a parameter of the latent space distributions. As a result, it is covered by the theory of Khemakhem et al. (2019) and its extension here, which results in non-rotated, meaningful latent variables.
|
| 37 |
+
|
| 38 |
+
# 3 THEORY
|
| 39 |
+
|
| 40 |
+
# 3.1 EXISTING THEORY OF NONLINEAR ICA
|
| 41 |
+
|
| 42 |
+
This section adapts theoretical results from Khemakhem et al. (2019) to the context of invertible neural networks. Suppose the existence of the following three random variables: a latent generating
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
Figure 1: Relationship between the variables and functions defined in Sec. 3.1, as well as indication of the training scheme.
|
| 46 |
+
|
| 47 |
+
variable $z \in \mathbb { R } ^ { n }$ , a condition $\mathbf { u } \in \mathbb { R } ^ { m }$ and a data point $\mathbf { x } \in \mathbb { R } ^ { d }$ , where $n \leq d$ . If $n < d$ , also suppose the existence of a noise variable $\varepsilon \in \mathbb { R } ^ { d - n }$ . The variables z and $\varepsilon$ make up the generating latent space, and are not necessarily known, whereas u and $\mathbf { X }$ are observable and therefore always known.
|
| 48 |
+
|
| 49 |
+
The distribution of $\mathbf { Z }$ is a factorial member of the exponential family with $k$ sufficient statistics, conditioned on u. In its most general form the distribution can be written as
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
p _ { \mathbf { z } } ( \mathbf { z } | \mathbf { u } ) = \prod _ { i = 1 } ^ { n } \frac { Q _ { i } ( z _ { i } ) } { Z _ { i } ( \mathbf { u } ) } \exp \left[ \sum _ { j = 1 } ^ { k } T _ { i , j } ( z _ { i } ) \lambda _ { i , j } ( \mathbf { u } ) \right]
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where the $T _ { i , j }$ are the sufficient statistics, the $\lambda _ { i , j }$ their coefficients and $Z _ { i }$ the normalizing constant.
|
| 56 |
+
$Q _ { i }$ is called the base measure, which in many cases is simply 1.
|
| 57 |
+
|
| 58 |
+
The distribution of $\varepsilon$ must not depend on u and its probability density function must be always finite.
|
| 59 |
+
|
| 60 |
+
The variable $\mathbf { X }$ is the result of an arbitrarily complex, invertible, deterministic transformation from the generating latent space to the data space: $\mathbf { x } = f ( \mathbf { z } , \varepsilon )$ . This can alternatively be formulated as an injective, non-deterministic transformation from the lower-dimensional $\mathbf { Z }$ -space to the higherdimensional $\mathbf { X }$ -space: ${ \bf x } = f _ { \varepsilon } ( { \bf z } )$ .
|
| 61 |
+
|
| 62 |
+
In general, an observed dataset $\mathcal { D }$ will consist only of instances of $\mathbf { X }$ and u. The task of nonlinear ICA is to disentangle the data to recover the generating latent variables $\mathbf { Z }$ , as well as the form of the function $f$ and its inverse. We can try to achieve this with a sufficiently general, invertible function approximator $g$ , which maps from a latent variable w $\in \mathbb { R } ^ { d }$ to the data space: $\mathbf { x } = g ( \mathbf { w } ; \theta )$ . Here $\theta$ denotes the parameters of $g$ . Note that the dimensions of the latent space and data space are the same due to the invertibility of $g$ . We assume that w follows a conditionally independent exponential probability distribution, conditioned on the same condition u as $\mathbf { Z }$ :
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
p _ { \mathrm { w } } ( \mathrm { w } | \mathrm { u } ) = \prod _ { i = 1 } ^ { d } \frac { Q _ { i } ^ { \prime } ( w _ { i } ) } { Z _ { i } ^ { \prime } ( \mathrm { u } ) } \exp \left[ \sum _ { j = 1 } ^ { k } T _ { i , j } ^ { \prime } ( w _ { i } ) \lambda _ { i , j } ^ { \prime } ( \mathrm { u } ) \right] .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
The coefficients of the sufficient statistics $\lambda _ { i , j } ^ { \prime } ( \mathbf { u } )$ are not restricted, which means that a given variable $i$ of the estimated latent space is allowed to lose its dependence on u. If this occurs, we will consider this variable to encode noise, playing a role equivalent to $\varepsilon$ in the generating latent space.
|
| 69 |
+
|
| 70 |
+
In addition to this specification of the generative and estimating models, some conditions are necessary to ensure the latent variables can be recovered. The most important of these concerns the variability of $\lambda _ { i , j } ( \mathbf { u } )$ under u. However, as long as the $\lambda _ { i , j }$ are randomly and independently generated, and there are at least $n k + 1$ distinct conditions $\mathbf { u }$ , this condition is almost surely fulfilled. See Appendix A.1 for further details.
|
| 71 |
+
|
| 72 |
+
In the limit of infinite data and perfect convergence, the estimating model will give the same conditional likelihood to all data points as the true generating model:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
p _ { \mathbf { T } , \lambda , f , \varepsilon } ( \mathbf { x } | \mathbf { u } ) = p _ { \mathbf { T } ^ { \prime } , \lambda ^ { \prime } , g } ( \mathbf { x } | \mathbf { u } ) .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
If this is the case, the vector of sufficient statistics $\mathbf { T }$ from the generating latent space will be related to that of the estimated latent space by an affine transformation:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathbf { T } ( \mathbf { z } ) = A \mathbf { T } ^ { \prime } ( \mathbf { w } ) + \pmb { c } ,
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $\pmb { A }$ is some constant, full-rank, $n k \times d k$ matrix and $\mathbf { c } \in \mathbb { R } ^ { n k }$ some constant vector. The relationship holds for all values of $\mathbf { Z }$ and w. The proof of this result can be found in Appendix A.
|
| 85 |
+
|
| 86 |
+
This relationship is a generalization of that derived in Khemakhem et al. (2019). In that version, they assume knowledge of $n$ , the dimension of the generating latent space, and give their estimating model a latent space of the same dimension. In this context the matrix $\pmb { A }$ defines a relationship between latent spaces of the same dimension, making it square and invertible.
|
| 87 |
+
|
| 88 |
+
# 3.2 NONLINEAR ICA WITH A GAUSSIAN LATENT SPACE
|
| 89 |
+
|
| 90 |
+
Given the relationship in equation (4), we can ask whether any stronger results hold for particular special cases. We hope in particular to induce sparsity in the matrix $\pmb { A }$ , so that the estimated latent space is related to the true one by as simple a transformation as possible. We show (proof in Appendix B) that when both the generating and estimated latent spaces follow a Gaussian distribution, the generating latent space variables are recovered up to a trivial translation and scaling. Furthermore, the dimension of the generating latent space is recovered.
|
| 91 |
+
|
| 92 |
+
More precisely, each generating latent variable $z _ { i }$ is related to exactly one estimated latent variable $w _ { j }$ , for some $j$ , as $z _ { i } = a _ { i } w _ { j } + b _ { i }$ , for some constant $a _ { i }$ and $b _ { i }$ . Furthermore, each estimated latent variable $w _ { j }$ is related to at most one $z _ { i }$ . If the estimating latent space has higher dimension than the dimension of the generating latent space, some estimating latent variables are not related to any generating latent variables and so must encode only noise. This is the dimension discovery mechanism, since the estimated latent space organically splits into informative and non-informative parts, with the dimension of the informative part equal to the unknown intrinsic dimension of the generating latent space. Very similar results can be derived for all common continuous two-parameter members of the exponential family, including the gamma and beta distributions. See Appendix C.
|
| 93 |
+
|
| 94 |
+
# 3.3 VOLUME PRESERVATION VIA INCOMPRESSIBLE FLOW
|
| 95 |
+
|
| 96 |
+
In a multivariate Gaussian distribution with diagonal covariance, the standard deviations are directly proportional to the principal axes of the ellipsoid defining a surface of constant probability. In classical PCA, this property is used to assign importance to each principal component based on its standard deviation. In PCA we can think of the rotation of the data into the basis defined by the principal components as the latent space. In a deep latent variable model the transformation between the latent space and the data is significantly more complex, but if this transformation preserves volumes like the rotation in PCA, it will retain the desirable correspondence between the standard deviation of a latent space variable and its importance in explaining the data. Because invertible neural networks (normalizing flows) have a tractable Jacobian determinant, they open the possibility to constrain it to unity. This is equivalent to volume preservation and is the rationale behind the General Incompressible-flow Network.
|
| 97 |
+
|
| 98 |
+
# 4 EXPERIMENTS
|
| 99 |
+
|
| 100 |
+
Experiments on artificial datasets confirm the theory for a normally distributed latent space, as well as identifying potential causes of failure. Experiments on the EMNIST dataset (Cohen et al., 2017) demonstrate the ability of GIN to estimate independent and interpretable latent variables from realworld data.
|
| 101 |
+
|
| 102 |
+
# 4.1 MODEL DESCRIPTION
|
| 103 |
+
|
| 104 |
+
The GIN model is similar in form to RealNVP (Dinh et al., 2016) and shares its flexibility, but retains the volume-preserving properties of the NICE framework (Dinh et al., 2014).
|
| 105 |
+
|
| 106 |
+
RealNVP coupling layers split $D$ -dimensional input $x$ into two parts, $x _ { 1 : d }$ and $x _ { d + 1 : D }$ where $d < D$ The output of the layer is the concatentation of $y _ { 1 : d }$ and $y _ { d + 1 : D }$ with
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\begin{array} { r } { y _ { 1 : d } = x _ { 1 : d } \qquad } \\ { y _ { d + 1 : D } = x _ { d + 1 : D } \odot \exp ( s ( x _ { 1 : d } ) ) + t ( x _ { 1 : d } ) } \end{array}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 2: Successful reconstruction by GIN of the two informative latent variables out of ten in total. The other eight are correctly identified as noise. The observed data is ten-dimensional (projection into two dimensions shown here). The spectrum shows the standard deviation of each variable of the reconstruction (in black, log scale) which quantifies its importance. Ground truth is in gray. There is a clear distinction between the two informative dimensions and the noise dimensions, showing that GIN has correctly detected a two-dimensional manifold in the ten-dimensional data presented to it.
|
| 114 |
+
|
| 115 |
+
where addition, multiplication and exponentiation are applied component-wise. The logarithm of the Jacobian determinant of a coupling layer is simply the sum of the scaling function $s ( x _ { 1 : d } )$ . Volume preservation is achieved by setting the final component $s ( x _ { d } )$ to the negative sum of the previous components, so the total sum of $s ( x _ { 1 : d } )$ is zero (in contrast, NICE sets $s ( x _ { 1 : d } ) ~ \equiv ~ 0 )$ . Hence the Jacobian determinant is unity and volume is preserved. The network is free to allow the volume contribution of some dimensions of the output of any coupling layer to grow, but only by shrinking the other dimensions of the output in direct proportion. As well as enforcing a strong correspondence between the importance of a latent variable and its standard deviation, we believe volume-preservation has a regularizing effect, since it is a very strong constraint, comparable to orthonormality in linear transformations.
|
| 116 |
+
|
| 117 |
+
# 4.2 OPTIMIZATION
|
| 118 |
+
|
| 119 |
+
The experiments in this section deal with labeled data, where each data point belongs to one of $M$ different classes. This class label is used as the condition u associated with each data point x. In the estimated latent space, all data instances with the same label should belong to the same Gaussian distribution. Hence we are learning a Gaussian mixture in the estimated latent space, with $M$ mixture components. Since the distribution for each class in the estimated latent space is required to be factorial, the variance of each mixture component is diagonal, and we can write $\sigma _ { i } ^ { 2 } ( \mathbf { u } )$ for the variance in the $i$ -th dimension.
|
| 120 |
+
|
| 121 |
+
Given a set of data, condition pairs $\mathcal { D } = \{ ( \mathbf { x } ^ { ( 1 ) } , \mathbf { u } ^ { ( 1 ) } ) , \dots , ( \mathbf { x } ^ { ( N ) } , \mathbf { u } ^ { ( N ) } ) \}$ and model $g$ , parameterized by $\pmb \theta$ (where $g$ maps from the latent space to the data space) we can construct a loss from the log-likelihood. Using the change of variables formula, we have $\log p ( \mathbf { x } | \mathbf { u } ) = \log p ( \mathbf { w } | \mathbf { u } )$ , with no Jacobian term since the transformation $\mathbf { w } = g ^ { - 1 } ( \mathbf { x } ; \pmb \theta )$ is volume-preserving. To maximize the likelihood of $\mathcal { D }$ , we minimize the negative log-likelihood of w in the estimated latent space:
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { ( \mathbf { x } , \mathbf { u } ) \in \mathcal { D } } \left[ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left( \frac { ( g _ { i } ^ { - 1 } ( \mathbf { x } ; \pmb { \theta } ) - \mu _ { i } ( \mathbf { u } ; \pmb { \theta } ) ) ^ { 2 } } { 2 \sigma _ { i } ^ { 2 } ( \mathbf { u } ; \pmb { \theta } ) } + \log ( \sigma _ { i } ( \mathbf { u } ; \pmb { \theta } ) ) \right) \right] .
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
# 4.3 ARTIFICIAL DATA
|
| 128 |
+
|
| 129 |
+
# 4.3.1 EXPERIMENT 1: CONDITIONS OF THEORY FULFILLED
|
| 130 |
+
|
| 131 |
+
Samples are generated in two dimensions, conditioned on five different cluster labels, see Fig. 2. The means of the clusters are chosen independently from a uniform distribution on $[ - 5 , 5 ]$ and variances from a uniform distribution on [.5, 3].1 This data is then concatenated with independent Gaussian noise in eight dimensions to make a ten-dimensional generating latent space, where only the first two variables are informative. The noise is scaled by 0.01 to be small in comparison to the informative dimensions. The latent space samples are then passed through a RealNVP network with 8 fully connected coupling blocks with randomly initialized weights to produce the observed data. This acts as a highly nonlinear mixing which can only be successfully treated with nonlinear methods.
|
| 132 |
+
|
| 133 |
+
GIN is used as the estimating model, with 8 fully connected coupling blocks (full details in Appendix D). Training converges quickly and stably using the Adam optimizer (Kingma & Ba, 2014) with initial learning rate $\bar { 1 0 } ^ { - 2 }$ and other values set to the usual recommendations. Batch size is 1,000 and the data is augmented with Gaussian noise $\sigma = 0 . 0 1 )$ at each iteration. After convergence of the loss, the learning rate is reduced by a factor of 10 and trained again until convergence.
|
| 134 |
+
|
| 135 |
+
Over a number of experiments we made the following observations:
|
| 136 |
+
|
| 137 |
+
• The model converges stably and gives importance (quantified by standard deviation) to only two variables in the estimated latent space, provided there is sufficient overlap between the mixture components in the generating latent space. Where there is not enough overlap in the generating latent space, the model cannot recognize common variables across all the different classes, and tends to split one genuine dimension of variation into two or more in its estimated latent space. This appears to be a problem of finite data. We have observed that when this behaviour occurs, and if the gap between mixture components is not too large, it can be prevented by increasing the number of samples so that the space between the mixture components is better filled (see Fig. 6 and 7 in Appendix E). This is consistent with the theory, where equation (4) is true asymptotically. Since the latent space distributions are members of the exponential family, they have support across the entire domain of the latent space, hence gaps can never remain in the limit of infinite samples.
|
| 138 |
+
• Choice of learning rate is important. If the initial learning rate is too low, training gets stuck in bad local optima, where single true variables are split into several latent dimensions.
|
| 139 |
+
|
| 140 |
+
# 4.3.2 EXPERIMENT 2: CONDITIONS OF THEORY NOT FULFILLED
|
| 141 |
+
|
| 142 |
+
Samples are generated as in Experiment 1, but with only three mixture components. Since there are two sufficient statistics per dimension, and two dimensions of variation, according to the theory we need at least $n k + 1 = 5$ distinct conditions u for equation (4) to hold (see section 3.1). Therefore, we might not expect successful experiments. Nonetheless, we observe essentially the same results as for the previous experiments (see Fig. 8 in Appendix E), with the same caveats regarding gaps between the mixture components in the generating latent space. This suggests that the conditions derived in Khemakhem et al. (2019), although sufficient for disentanglement, are not necessary.
|
| 143 |
+
|
| 144 |
+
# 4.4 EMNIST
|
| 145 |
+
|
| 146 |
+
# 4.4.1 EXPERIMENT
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 3: Spectrum of sorted standard deviations derived from training GIN on EMNIST. On the right is the equivalent spectrum from PCA, a linear method, on MNIST. The nonlinear spectrum exhibits a sharp knee not obtained by linear methods. In the nonlinear spectrum, the first 22 latent variables encode information about the shape of a digit, while the rest of the latent variables encode noise. This distinction is marked with a dotted line in the left and center figures (see Sec. 4.4.2 for explanation of the choice of this cut-off). Within the first 22 variables, the first eight encode global information, such as slant and width, whereas the following 14 encode more local information. This distinction is marked in the center figure only.
|
| 150 |
+
|
| 151 |
+
The data comes from the EMNIST Digits training set of 240,000 images of handwritten digits with labels (Cohen et al., 2017). EMNIST is a larger version of the well-known MNIST dataset, and also includes handwritten letters. Here we use only the digits. The digit label is used as the condition u, hence we construct a Gaussian mixture in the estimated latent space with 10 mixture components. According to the theory (see 3.1), these are only enough conditions to guarantee identifiability if there are only four informative latent variables in the generating latent space. We expect that the true number of informative variables is somewhat higher, so as in Experiment 2 above, we are operating outside of the guarantees of the theory. In addition, the true generative process of human handwriting may not exactly fulfill our method’s assumptions, and we might still lack data on rare or subtle variations, despite the large size of the dataset in comparison to MNIST.
|
| 152 |
+
|
| 153 |
+
The estimating model is a GIN which uses convolutional coupling blocks and fully connected coupling blocks to transform the data to the latent space (full details in Appendix D). Optimization is with the Adam optimizer, with initial learning rate 3e-4. Batch size is 240 and the data is augmented with Gaussian noise $\mathit { \Pi } _ { \sigma } = 0 . 0 1 $ ) at each iteration. The model is trained for 45 epochs, then for a further 50 epochs with the learning rate reduced by a factor of 10.
|
| 154 |
+
|
| 155 |
+
# 4.4.2 RESULTS
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
(a) Variable 1: upper width (b) Variable 8: lower width (c) Variable 3: height (d) Variable 4: bend
|
| 159 |
+
|
| 160 |
+
Figure 4: Selection of global latent variables found by GIN. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between -1 and $+ 1$ standard deviations. Variable 1 controls the width of the top half of a digit, whereas variable 8 controls the width of the bottom half. Width in both cases is somewhat entangled with slant. Variable 3 controls the height and variable 4 controls how bent the digit is. Full set of variables for all digits in Appendix F.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 5: Selection of local latent variables found by GIN. Refer to Figure 4 above for explanation of the layout. Variable 11 controls the shape of curved lines in the middle right. Digits without such lines are not affected. Variable 12 controls extension towards the upper right. Variable 13 modifies the top left of 2, 3 and 7 only (7 not shown here) and variable 16 modifies only the lower right stroke of a 2. Full set of variables for all digits in Appendix F.
|
| 164 |
+
|
| 165 |
+
The model encodes information into 22 broadly interpretable latent space variables. The eight variables with the highest standard deviation encode global information, such as slant, line thickness and width which affect all digits more or less equally. The remaining 14 meaningful variables encode more local information, which does not affect all digits equally. We interpret all other variables as encoding noise. This is motivated mainly by our observation of an abrupt end to any observable change in the reconstructed digits when any variable after the first 22 is changed. This can be seen clearly in Fig. 15 in Appendix F. Some variables, particularly the global ones, are not entirely disentangled from another. Nevertheless, the results are compelling and suggest that the assumptions required by the theory are approximately met.
|
| 166 |
+
|
| 167 |
+
We observed some global features which are not usually seen in disentanglement experiments on MNIST (e.g. Chen et al., 2016; Dupont, 2018). These experiments usually obtain digit slant, width and line thickness as the major global independent variables. We too observe slant and line thickness as independent variables (variables 2 and 5), but find width to be split into two variables, one governing the width of the upper half of a digit (variable 1) and the other the lower half (variable 8). This makes sense, since these can in fact vary independently. We also observe the height of a digit (variable 3) (see Fig. 4). This does not usually appear in disentanglement experiments, possibly because it is too subtle a variation for those experiments, but possibly because it is not present or not discoverable in the smaller MNIST dataset but is in EMNIST.
|
| 168 |
+
|
| 169 |
+
Local features are also usually not observed in such experiments, so the variables which control these are particularly interesting. These variables modify only a region of the digit, leaving the rest of the digit untouched. In addition, digits which do not have the feature which is being modified in that region are left alone. Examples include variable 13, which changes the orientation of the top-left stroke in 2, 3 and 7, and variable 16, which modifies only the lower-right stroke of a 2 (see Fig. 5). The full set of local and global variables can be seen in Fig. 10 to Fig. 15 in Appendix F.
|
| 170 |
+
|
| 171 |
+
# 4.4.3 NOTE ON THE CHOICE OF CONDITIONING VARIABLE
|
| 172 |
+
|
| 173 |
+
The concept of a “true generative process” rests on the assumption that conditioning variables u act as causes for the latent variables z, such that the elements of the latter become independent given the former. In the case of handwritten digits, u represents a person’s decision to write a particular digit, and z determines the hand motions to produce this digit. Modelling u in terms of digit labels is a plausible proxy for the unknown causal variables in the human brain, and the success of the resulting model suggests that the assumptions are approximately fulfilled. Identifying promising conditioning variables u in less obvious situations is an important open problem for future work.
|
| 174 |
+
|
| 175 |
+
# 4.4.4 POTENTIAL IMPROVEMENTS
|
| 176 |
+
|
| 177 |
+
Increasing the number of conditioning variables would bring this work closer in line with the existing theory. At the current value of ten, the theory only applies if there are at most four informative generating latent variables, which is almost certainly too low a number. One option to increase the number of conditions is to relax the labels from hard to soft, i.e. compute posterior probabilities of class membership given a data example. This could be achieved by information distillation as in Hinton et al. (2015). Another possibility is to split existing labels into sub-labels, for example making a distinction between sevens with and without crossbars. This may also aid the generation of more realistic samples, since we observed no sevens with crossbars in our generated samples, even though they make up approximately $5 \%$ of the sevens in the dataset.
|
| 178 |
+
|
| 179 |
+
# 5 CONCLUSION AND OUTLOOK
|
| 180 |
+
|
| 181 |
+
We have expanded the theory of nonlinear ICA to cover problems with unknown intrinsic dimension and demonstrated an implementation with GIN, a new volume-preserving modification of the RealNVP invertible network architecture. The variables discovered by GIN in EMNIST are interpretable and detailed enough to suggest that the assumptions made about the generating process are approximately true. Furthermore, our experiments with EMNIST demonstrate the viability of applying models inspired by the new theory of nonlinear ICA to real-world data, even when not all of the conditions of the theory are met.
|
| 182 |
+
|
| 183 |
+
It is not clear if the methods from this work will scale to larger problems. However, given the recent advances of similar flow-based generative models in density estimation on larger datasets such as CelebA and ImageNet (e.g. Kingma & Dhariwal, 2018; Ho et al., 2019), it is a plausible prospect. In addition, it is not clear whether the method can successfully be extended to the context of semisupervised learning, or ultimately, unsupervised learning.
|
| 184 |
+
|
| 185 |
+
# REFERENCES
|
| 186 |
+
|
| 187 |
+
Lynton Ardizzone, Carsten Luth, Jakob Kruse, Carsten Rother, and Ullrich K ¨ othe. Guided image ¨ generation with conditional invertible neural networks. arXiv:1907.02392, 2019.
|
| 188 |
+
|
| 189 |
+
Tian Qi Chen, Xuechen Li, Roger B Grosse, and David K Duvenaud. Isolating sources of disentanglement in variational autoencoders. In Advances in Neural Information Processing Systems, pp. 2610–2620, 2018.
|
| 190 |
+
|
| 191 |
+
Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in neural information processing systems, pp. 2172–2180, 2016.
|
| 192 |
+
|
| 193 |
+
Gregory Cohen, Saeed Afshar, Jonathan Tapson, and Andre van Schaik. EMNIST: an extension of ´ MNIST to handwritten letters. arXiv:1702.05373, 2017.
|
| 194 |
+
|
| 195 |
+
Pierre Comon. Independent component analysis, a new concept? Signal processing, 36(3):287–314, 1994.
|
| 196 |
+
|
| 197 |
+
Nat Dilokthanakul, Pedro AM Mediano, Marta Garnelo, Matthew CH Lee, Hugh Salimbeni, Kai Arulkumaran, and Murray Shanahan. Deep unsupervised clustering with gaussian mixture variational autoencoders. arXiv preprint arXiv:1611.02648, 2016.
|
| 198 |
+
|
| 199 |
+
Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv:1410.8516, 2014.
|
| 200 |
+
|
| 201 |
+
Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using Real NVP. arXiv:1605.08803, 2016.
|
| 202 |
+
|
| 203 |
+
Emilien Dupont. Learning disentangled joint continuous and discrete representations. In Advances in Neural Information Processing Systems, pp. 710–720, 2018.
|
| 204 |
+
|
| 205 |
+
Ian 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, pp. 2672–2680, 2014.
|
| 206 |
+
|
| 207 |
+
Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. $\beta$ -VAE: Learning basic visual concepts with a constrained variational framework. ICLR, 2(5):6, 2017.
|
| 208 |
+
|
| 209 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv:1503.02531, 2015.
|
| 210 |
+
|
| 211 |
+
Jonathan Ho, Xi Chen, Aravind Srinivas, Yan Duan, and Pieter Abbeel. Flow $^ { + + }$ : Improving flow-based generative models with variational dequantization and architecture design. arXiv:1902.00275, 2019.
|
| 212 |
+
|
| 213 |
+
Aapo Hyvarinen and Hiroshi Morioka. Unsupervised feature extraction by time-contrastive learning ¨ and nonlinear ICA. In Advances in Neural Information Processing Systems, pp. 3765–3773, 2016.
|
| 214 |
+
|
| 215 |
+
Aapo Hyvarinen and Hiroshi Morioka. Nonlinear ICA of temporally dependent stationary sources. ¨ In Proceedings of Machine Learning Research, 2017.
|
| 216 |
+
|
| 217 |
+
Aapo Hyvarinen and Petteri Pajunen. Nonlinear independent component analysis: Existence and ¨ uniqueness results. Neural Networks, 12(3):429–439, 1999.
|
| 218 |
+
|
| 219 |
+
Aapo Hyvarinen, Hiroaki Sasaki, and Richard E Turner. Nonlinear ICA using auxiliary variables ¨ and generalized contrastive learning. arXiv:1805.08651, 2018.
|
| 220 |
+
|
| 221 |
+
Jorn-Henrik Jacobsen, Arnold Smeulders, and Edouard Oyallon. i-RevNet: Deep invertible net-¨ works. arXiv:1802.07088, 2018.
|
| 222 |
+
|
| 223 |
+
Matthew J Johnson, David K Duvenaud, Alex Wiltschko, Ryan P Adams, and Sandeep R Datta. Composing graphical models with neural networks for structured representations and fast inference. In Advances in neural information processing systems, pp. 2946–2954, 2016.
|
| 224 |
+
|
| 225 |
+
Ilyes Khemakhem, Diederik P Kingma, and Aapo Hyvarinen. Variational autoencoders and nonlin- ¨ ear ICA: A unifying framework. arXiv:1907.04809, 2019.
|
| 226 |
+
|
| 227 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv:1412.6980, 2014.
|
| 228 |
+
|
| 229 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv:1312.6114, 2013.
|
| 230 |
+
|
| 231 |
+
Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems, pp. 10215–10224, 2018.
|
| 232 |
+
|
| 233 |
+
Francesco Locatello, Stefan Bauer, Mario Lucic, Sylvain Gelly, Bernhard Scholkopf, and Olivier ¨ Bachem. Challenging common assumptions in the unsupervised learning of disentangled representations. arXiv:1811.12359, 2018.
|
| 234 |
+
|
| 235 |
+
Qingyu Zhao, Nicolas Honnorat, Ehsan Adeli, Adolf Pfefferbaum, Edith V Sullivan, and Kilian M Pohl. Variational autoencoder with truncated mixture of gaussians for functional connectivity analysis. In International Conference on Information Processing in Medical Imaging, pp. 867– 879. Springer, 2019.
|
| 236 |
+
|
| 237 |
+
SUPPLEMENTARY MATERIAL
|
| 238 |
+
|
| 239 |
+
# A PROOF OF IDENTIFIABILITY
|
| 240 |
+
|
| 241 |
+
This section reproduces a proof from Khemakhem et al. (2019) with some modifications to adapt it to the context of invertible neural networks (normalizing flows).
|
| 242 |
+
|
| 243 |
+
Define the domain of $f _ { \varepsilon }$ as $\mathcal { Z } = \mathcal { Z } _ { 1 } \times \cdots \times \mathcal { Z } _ { n }$ . Define the vector of sufficient statistics $\mathbf { T } ( \mathbf { z } ) =$ $( T _ { 1 , 1 } ( z _ { 1 } ) , \dots , T _ { n , k } ( z _ { n } ) )$ and the vector of their coefficients $\lambda ( \mathbf { u } ) = ( \lambda _ { 1 , 1 } ( \mathbf { u } ) , \ldots , \lambda _ { n , k } ( \mathbf { u } ) )$ .
|
| 244 |
+
|
| 245 |
+
Theorem 1 Assume we observe data distributed according to the generative model defined in Sec. 3.1. Further suppose the following:
|
| 246 |
+
|
| 247 |
+
(i) The sufficient statistics $T _ { i , j } ( z )$ are differentiable almost everywhere and their derivatives $\mathrm { d } T _ { i , j } ( z ) / \mathrm { d } z$ are nonzero almost surely for all $z \in \mathcal { Z } _ { i }$ and all $1 \leq i \leq n$ and $1 \le j \le k$ .
|
| 248 |
+
|
| 249 |
+
(ii) There exist $n k + 1$ distinct conditions $\mathbf { u } _ { 0 } , \ldots , \mathbf { u } _ { n k }$ such that the matrix
|
| 250 |
+
|
| 251 |
+
$$
|
| 252 |
+
{ \cal L } = ( \lambda ( { \mathbf { u } } _ { 1 } ) - \lambda ( { \mathbf { u } } _ { 0 } ) , \ldots , \lambda ( { \mathbf { u } } _ { n k } ) - \lambda ( { \mathbf { u } } _ { 0 } ) )
|
| 253 |
+
$$
|
| 254 |
+
|
| 255 |
+
of size $n k \times n k$ is invertible.
|
| 256 |
+
|
| 257 |
+
Then the sufficient statistics of the generating latent space are related to those of the estimated latent space by the following relationship:
|
| 258 |
+
|
| 259 |
+
$$
|
| 260 |
+
\mathbf { T } ( \mathbf { z } ) = A \mathbf { T } ^ { \prime } ( \mathbf { w } ) + c
|
| 261 |
+
$$
|
| 262 |
+
|
| 263 |
+
where $\pmb { A }$ is a constant, full-rank $n k \times d k$ matrix and $\mathbf { c } \in \mathbb { R } ^ { n k }$ a constant vector.
|
| 264 |
+
|
| 265 |
+
Proof: The conditional probabilities $p _ { \mathbf { T } , \lambda , f , \varepsilon } ( \mathbf { x } | \mathbf { u } )$ and $p _ { \mathbf { T } ^ { \prime } , \lambda ^ { \prime } , g } ( \mathbf { x } | \mathbf { u } )$ are assumed to be the same in the limit of infinite data. By expanding these expressions via the change of variables formula and taking the logarithm we find
|
| 266 |
+
|
| 267 |
+
$$
|
| 268 |
+
\log p _ { \mathbf { T } , \lambda } ( z | \mathbf { u } ) + \log p ( \boldsymbol { \varepsilon } ) + \log \left| \operatorname* { d e t } J _ { f ^ { - 1 } } ( \mathbf { x } ) \right| = \log p _ { \mathbf { T } ^ { \prime } , \lambda ^ { \prime } } ( \mathbf { w } | \mathbf { u } ) + \log \left| \operatorname* { d e t } J _ { g ^ { - 1 } } ( \mathbf { x } ) \right|
|
| 269 |
+
$$
|
| 270 |
+
|
| 271 |
+
where $J$ is the Jacobian matrix. Let $\mathbf { u } _ { 0 } , \ldots , \mathbf { u } _ { n k }$ be the conditions from (ii) above. We can subtract this expression for $\mathbf { u } _ { 0 }$ from the expression for some condition ${ \mathbf { u } } _ { l }$ . The Jacobian terms and the term involving $\varepsilon$ will vanish, since they do not depend on u:
|
| 272 |
+
|
| 273 |
+
$$
|
| 274 |
+
\begin{array} { r } { \log p _ { \mathbf { z } } ( \mathbf { z } | \mathbf { u } _ { l } ) - \log p _ { \mathbf { z } } ( \mathbf { z } | \mathbf { u } _ { 0 } ) = \log p _ { \mathbf { w } } ( \mathbf { w } | \mathbf { u } _ { l } ) - \log p _ { \mathbf { w } } ( \mathbf { w } | \mathbf { u } _ { 0 } ) . } \end{array}
|
| 275 |
+
$$
|
| 276 |
+
|
| 277 |
+
Since the conditional probabilities of $\mathbf { Z }$ and w are exponential family members, we can write this expression as
|
| 278 |
+
|
| 279 |
+
$$
|
| 280 |
+
\begin{array} { r l } & { \displaystyle \sum _ { i = 1 } ^ { n } \left[ \log \frac { Z _ { i } ( \mathbf { u _ { 0 } } ) } { Z _ { i } ( \mathbf { u } _ { l } ) } + \sum _ { j = 1 } ^ { k } T _ { i , j } ( \mathbf { z } ) \big ( \lambda _ { i , j } ( \mathbf { u } _ { l } ) - \lambda _ { i , j } ( \mathbf { u _ { 0 } } ) \big ) \right] } \\ & { \quad \quad \quad \quad \quad = \displaystyle \sum _ { i = 1 } ^ { d } \left[ \log \frac { Z _ { i } ^ { \prime } ( \mathbf { u _ { 0 } } ) } { Z _ { i } ^ { \prime } ( \mathbf { u } _ { l } ) } + \sum _ { j = 1 } ^ { k } T _ { i , j } ^ { \prime } ( \mathbf { w } ) \big ( \lambda _ { i , j } ^ { \prime } ( \mathbf { u } _ { l } ) - \lambda _ { i , j } ^ { \prime } ( \mathbf { u _ { 0 } } ) \big ) \right] } \end{array}
|
| 281 |
+
$$
|
| 282 |
+
|
| 283 |
+
where the base measures $Q _ { i }$ have cancelled out, since they do not depend on u. Defining $\bar { \lambda } ( { \mathfrak { u } } ) =$ $\lambda ( \mathbf { u } ) - \lambda ( \mathbf { u } _ { 0 } )$ and writing the above in terms of inner products, we find
|
| 284 |
+
|
| 285 |
+
$$
|
| 286 |
+
\langle \mathbf { T } ( \mathbf { z } ) , { \bar { \mathbf { \Xi } } } \rangle + \sum _ { i } \log \frac { Z _ { i } ( \mathbf { u } _ { 0 } ) } { Z _ { i } ( \mathbf { u } _ { l } ) } = \langle \mathbf { T } ^ { \prime } ( \mathbf { w } ) , { \bar { \mathbf { \Xi } } } { } \rangle + \sum _ { i } \log \frac { Z _ { i } ^ { \prime } ( \mathbf { u } _ { 0 } ) } { Z _ { i } ^ { \prime } ( \mathbf { u } _ { l } ) }
|
| 287 |
+
$$
|
| 288 |
+
|
| 289 |
+
for $1 \leq l \leq n k$ . Combining the $n k$ expressions into a single matrix equation we can write this in terms of $\pmb { L }$ from condition (ii) above and an analogously defined $L ^ { \prime } \in \dot { \mathbb { R } } ^ { d k \times n k }$ :
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
L ^ { T } \mathbf { T } ( \mathbf { \boldsymbol { z } } ) = L ^ { \prime T } \mathbf { T } ^ { \prime } ( \mathbf { \boldsymbol { w } } ) + b
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
where bl = Pi log Z i(u0)Zi(ul)Zi(u0)Z0(ul) . Since $L ^ { T }$ is invertible, we can multiply this expression by its inverse from the left to get
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
\mathbf { T } ( \mathbf { z } ) = A \mathbf { T } ^ { \prime } ( \mathbf { w } ) + c
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
where ${ \pmb A } = { \pmb L } ^ { - T } { \pmb L } ^ { \prime T }$ and $\pmb { c } = \pmb { L } ^ { - T } \pmb { b } .$ . It now remains to show that $\pmb { A }$ has full rank.
|
| 302 |
+
|
| 303 |
+
According to a lemma from Khemakhem et al. (2019), there exist $k$ distinct values $z _ { i } ^ { 1 }$ to $z _ { i } ^ { k }$ such that $\begin{array} { r } { \left( \frac { \mathrm { d } T _ { i } } { \mathrm { d } z _ { i } } ( z _ { i } ^ { 1 } ) , \dots , \frac { \mathrm { d } T _ { i } } { \mathrm { d } z _ { i } } ( z _ { i } ^ { k } ) \right) } \end{array}$ are linearly independent in $\mathbb { R } ^ { k }$ , for all $1 \leq i \leq n$ . Define $k$ vectors $\mathbf { z } ^ { l } = ( z _ { 1 } ^ { l } , \dots , z _ { n } ^ { l } )$ from the points given by this lemma. Take the derivative of equation (15) evaluated at each of these $k$ vectors and concatentate the resulting Jacobians as $Q = [ \mathcal { \bar { I } } _ { \mathbf { T } } ( \mathbf { z } ^ { 1 } ) , \dots , \mathcal { I } _ { \mathbf { T } } ( \mathbf { z } ^ { k } ) ]$ . Each Jacobian has size $n k \times n$ , hence $Q$ has size $n k \times n k$ and is invertible by the lemma and the fact that each component of $\mathbf { T }$ is univariate. We can construct a corresponding matrix $Q ^ { \prime }$ made up of the Jacobians of $\mathbf { T } ^ { \prime } ( g ^ { - 1 } \circ f _ { \varepsilon } ( \mathbf { z } ) )$ evaluated at the same points and write
|
| 304 |
+
|
| 305 |
+
$$
|
| 306 |
+
Q = A Q ^ { \prime } .
|
| 307 |
+
$$
|
| 308 |
+
|
| 309 |
+
Since $Q$ is full rank, both $\pmb { A }$ and $\pmb { Q } ^ { \prime }$ must also be full rank.
|
| 310 |
+
|
| 311 |
+
# A.1 REMARK REGARDING CONDITION (II)
|
| 312 |
+
|
| 313 |
+
If the coefficients of the sufficient statistics $\boldsymbol { \lambda }$ are generated randomly and independently, then condition (ii) is almost surely fulfilled. In this case, we can ignore the dependence on u to consider the $\pmb { \lambda } ( \mathbf { u } _ { l } )$ as independent random variables. Then condition (ii) states that instances of these random variables are in general position in $\mathbb { R } ^ { n k }$ , which is true almost surely.
|
| 314 |
+
|
| 315 |
+
# A.2 REMARK REGARDING NOISE VARIABLES IN THE ESTIMATED LATENT SPACE
|
| 316 |
+
|
| 317 |
+
Any variables in the estimated latent space whose distribution does not depend on the conditioning variable u is considered as encoding only noise. Such variables will be cancelled out in equation (12) and the corresponding column of ${ \pmb { L } } ^ { \bar { \prime } T }$ will contain only zeros. This means the corresponding column of $\pmb { A }$ will also contain only zeros, so any variation in such a noise variable has no effect on z. The reverse is also true: if a column of $\pmb { A }$ contains only zeros, the corresponding variable in the estimated latent space does not depend on u and must encode only noise.
|
| 318 |
+
|
| 319 |
+
# B SPARSITY IN UNMIXING MATRIX: GAUSSIAN DISTRIBUTION
|
| 320 |
+
|
| 321 |
+
Suppose samples z from the generating latent space follow a conditional Gaussian distribution. Suppose the estimating model $g$ faithfully reproduces the observed conditional density $p ( \mathbf { x } | \mathbf { u } )$ and samples w from its latent space also follow a conditional Gaussian distribution. Then we can apply equation (4) to relate the generating and estimating latent spaces.
|
| 322 |
+
|
| 323 |
+
The sufficient statistics of a normal distribution with free mean and variance are $z$ and $z ^ { 2 }$ . Hence the relationship between the latent spaces becomes
|
| 324 |
+
|
| 325 |
+
$$
|
| 326 |
+
{ \binom { \mathbf { z } } { \mathbf { z } ^ { 2 } } } = A \left( { \begin{array} { l } { \mathbf { w } } \\ { \mathbf { w } ^ { 2 } } \end{array} } \right) + c
|
| 327 |
+
$$
|
| 328 |
+
|
| 329 |
+
where the squaring is applied element-wise. We can write $\pmb { A }$ in block matrix form as
|
| 330 |
+
|
| 331 |
+
$$
|
| 332 |
+
\pmb { A } = \left( \begin{array} { c c } { \pmb { A } ^ { ( 1 ) } } & { \pmb { A } ^ { ( 2 ) } } \\ { \pmb { A } ^ { ( 3 ) } } & { \pmb { A } ^ { ( 4 ) } } \end{array} \right)
|
| 333 |
+
$$
|
| 334 |
+
|
| 335 |
+
and $^ c$ as
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\pmb { c } = \binom { \pmb { c } ^ { ( 1 ) } } { \pmb { c } ^ { ( 2 ) } }
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
Then:
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
\begin{array} { r } { \mathbf { z } = \pmb { A } ^ { ( 1 ) } \mathbf { w } + \pmb { A } ^ { ( 2 ) } \mathbf { w } ^ { 2 } + \pmb { c } ^ { ( 1 ) } } \\ { \mathbf { z } ^ { 2 } = \pmb { A } ^ { ( 3 ) } \mathbf { w } + \pmb { A } ^ { ( 4 ) } \mathbf { w } ^ { 2 } + \pmb { c } ^ { ( 2 ) } } \end{array}
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
so we can write for each dimension $i$ of $\mathbf { Z }$
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\begin{array} { l } { { z _ { i } = \displaystyle \sum _ { j } A _ { i j } ^ { ( 1 ) } w _ { j } + \sum _ { j } A _ { i j } ^ { ( 2 ) } w _ { j } ^ { 2 } + c _ { i } ^ { ( 1 ) } } } \\ { { z _ { i } ^ { 2 } = \displaystyle \sum _ { j } A _ { i j } ^ { ( 3 ) } w _ { j } + \sum _ { j } A _ { i j } ^ { ( 4 ) } w _ { j } ^ { 2 } + c _ { i } ^ { ( 2 ) } } } \end{array}
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
In order to compare the equations, we need to square (22). To do so, we will have to square the second term on the right hand side, involving $w _ { j } ^ { 2 }$ . There is no matching term in (23), so we have to set all entries of $A ^ { ( 2 ) }$ to zero. In more detail:
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\begin{array} { r l } { { ( \sum _ { j } A _ { i j } ^ { ( 2 ) } w _ { j } ^ { 2 } ) ^ { 2 } = \sum _ { j } \sum _ { j ^ { \prime } } A _ { i j } ^ { ( 2 ) } A _ { i j ^ { \prime } } ^ { ( 2 ) } w _ { j } ^ { 2 } w _ { j ^ { \prime } } ^ { 2 } } } \\ & { = \sum _ { j } ( A _ { i j } ^ { ( 2 ) } ) ^ { 2 } w _ { j } ^ { 4 } + \sum _ { j \ne j ^ { \prime } } A _ { i j } ^ { ( 2 ) } A _ { i j ^ { \prime } } ^ { ( 2 ) } w _ { j } ^ { 2 } w _ { j ^ { \prime } } ^ { 2 } } \end{array}
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
The first term with $\boldsymbol { w _ { j } ^ { 4 } }$ matches no term in (23), so we have to set $A _ { i j } ^ { ( 2 ) } = 0$ for all $i$ and $j$ . This simplifies the earlier equation:
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
z _ { i } = \sum _ { j } A _ { i j } ^ { ( 1 ) } w _ { j } + c _ { i } ^ { ( 1 ) }
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
The square of the first term on the right hand side involves terms with $w _ { j } w _ { j ^ { \prime } }$ cross terms:
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
\left( \sum _ { j } A _ { i j } ^ { ( 1 ) } w _ { j } \right) ^ { 2 } = \sum _ { j } A _ { i j } ^ { ( 1 ) } w _ { j } ^ { 2 } + \sum _ { j \neq j ^ { \prime } } A _ { i j } ^ { ( 1 ) } A _ { i j ^ { \prime } } ^ { ( 1 ) } w _ { j } w _ { j ^ { \prime } }
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
so we have to set $A _ { i j } ^ { ( 1 ) } A _ { i j ^ { \prime } } ^ { ( 1 ) } = 0$ for all $j \neq j ^ { \prime }$ . This means that the $i$ -th row of $A ^ { ( 1 ) }$ can have at most one nonzero entry. It must also have at least one nonzero entry, since if the row were all zero, a row of $\pmb { A }$ would be all zero (since $\begin{array} { r } { \pmb { A } ^ { ( 2 ) } = 0 } \end{array}$ ), but $\pmb { A }$ has full rank. Since there are as many or fewer rows than columns $( n \leq d )$ , each row of $\pmb { A }$ is linearly independent, so it is not possible for one to be zero. Hence each row of $A ^ { ( 1 ) }$ has exactly one nonzero entry. Moreover, no two rows of $A ^ { ( 1 ) }$ have their nonzero entries in the same column. If they did, the two rows would not be linearly independent, but they must be since $\pmb { A }$ has full rank. Therefore we can write
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
z _ { i } = a _ { i } w _ { j } + b _ { i }
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
where $a _ { i } = A _ { i j _ { \alpha } } ^ { ( 1 ) }$ and $b _ { i } = c _ { i } ^ { ( 1 ) }$ c(1)i . That is, the generating latent variable zi is linearly related to some latent variable of the estimating model $w _ { j }$ . This estimated latent variable is uniquely associated with $z _ { i }$ and any estimated latent variables not associated with a generating latent variable $z _ { i }$ (in the case $d > n$ ) encode no information about the generating latent space. So the model has decoded the original latent variables $\mathbf { Z }$ up to an affine transformation and permutation as a subset of variables in its estimated latent space and has encoded no information (only noise) into the remaining latent variables.
|
| 378 |
+
|
| 379 |
+
# C SPARSITY IN UNMIXING MATRIX: TWO-PARAMETER EXPONENTIAL FAMILY MEMBERS
|
| 380 |
+
|
| 381 |
+
The results of Appendix B can be extended to other members of the exponential family with 2 parameters. In the general case, writing $T _ { i , 1 } = T _ { 1 }$ and $T _ { i , 2 } = T _ { 2 }$ for all $i$ , equations (22) and (23) become
|
| 382 |
+
|
| 383 |
+
$$
|
| 384 |
+
\begin{array} { l } { { T _ { 1 } ( z _ { i } ) = \displaystyle \sum _ { j } A _ { i j } ^ { ( 1 ) } T _ { 1 } ( w _ { j } ) + \displaystyle \sum _ { j } A _ { i j } ^ { ( 2 ) } T _ { 2 } ( w _ { j } ) + c _ { i } ^ { ( 1 ) } } } \\ { { T _ { 2 } ( z _ { i } ) = \displaystyle \sum _ { j } A _ { i j } ^ { ( 3 ) } T _ { 1 } ( w _ { j } ) + \displaystyle \sum _ { j } A _ { i j } ^ { ( 4 ) } T _ { 2 } ( w _ { j } ) + c _ { i } ^ { ( 2 ) } } } \end{array}
|
| 385 |
+
$$
|
| 386 |
+
|
| 387 |
+
which, with the definition $t = T _ { 2 } \circ T _ { 1 } ^ { - 1 }$ becomes
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\begin{array} { c } { { T _ { 1 } ( z _ { i } ) = \displaystyle \sum _ { j } A _ { i j } ^ { ( 1 ) } T _ { 1 } ( w _ { j } ) + \displaystyle \sum _ { j } A _ { i j } ^ { ( 2 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 1 ) } } } \\ { { t ( T _ { 1 } ( w _ { j } ) ) = \displaystyle \sum _ { j } A _ { i j } ^ { ( 3 ) } T _ { 1 } ( w _ { j } ) + \displaystyle \sum _ { j } A _ { i j } ^ { ( 4 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 2 ) } . } } \end{array}
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
We can combine these equations to get
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
\left( \sum _ { j } A _ { i j } ^ { ( 1 ) } T _ { 1 } ( w _ { j } ) + \sum _ { j } A _ { i j } ^ { ( 2 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 1 ) } \right) = \sum _ { j } A _ { i j } ^ { ( 3 ) } T _ { 1 } ( w _ { j } ) + \sum _ { j } A _ { i j } ^ { ( 4 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 2 ) } .
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
This equation has many summed terms on the right. Suppose that $t$ has a convergent Taylor expansion in some region of its domain. We can take this expansion of the term on the left and compare coefficients. Since $t$ cannot be linear, there will be terms in the expansion of order two or higher. As in the Gaussian case, these polynomial terms create cross terms which are impossible to reconcile with those on the right hand side of the equation. The only consistent solutions can be found by setting all coefficients except those of functions of $w _ { j }$ (for some $j$ ) to zero:
|
| 400 |
+
|
| 401 |
+
$$
|
| 402 |
+
t \left( A _ { i j } ^ { ( 1 ) } T _ { 1 } ( w _ { j } ) + A _ { i j } ^ { ( 2 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 1 ) } \right) = A _ { i j } ^ { ( 3 ) } T _ { 1 } ( w _ { j } ) + A _ { i j } ^ { ( 4 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 2 ) }
|
| 403 |
+
$$
|
| 404 |
+
|
| 405 |
+
We can further simplify this equation by examining higher-order terms, but need to know the form of $t$ to do so. In any case, we can now write equation (29) as
|
| 406 |
+
|
| 407 |
+
$$
|
| 408 |
+
T _ { 1 } ( z _ { i } ) = A _ { i j } ^ { ( 1 ) } T _ { 1 } ( w _ { j } ) + A _ { i j } ^ { ( 2 ) } t ( T _ { 1 } ( w _ { j } ) ) + c _ { i } ^ { ( 1 ) }
|
| 409 |
+
$$
|
| 410 |
+
|
| 411 |
+
showing that each generating latent variable $z _ { i }$ is related to exactly one estimated latent variable $w _ { j }$ . As in the Gaussian case, we can use the full rank property of $\pmb { A }$ to see that each estimated latent variable is associated with at most one generating latent variable, and any estimated latent variables not associated with any generating latent variables must encode only noise. The task now is to check the form of $t$ for each two-parameter member of the exponential family, to see what further constraints we can derive from equation (34). The results are stated in Table 1.
|
| 412 |
+
|
| 413 |
+
Table 1: Two-parameter exponential family members and selected properties.
|
| 414 |
+
|
| 415 |
+
<table><tr><td>Distribution</td><td>Suffcient Statistics</td><td>t(x)</td><td>Latent Space Relationship</td></tr><tr><td>Normal</td><td>(z,22)</td><td>x2</td><td>zi = awj +c</td></tr><tr><td>Lognormal</td><td>(log z, (log z)2)</td><td>x²</td><td>log zi = alog wj + c</td></tr><tr><td>Inverse Gaussian</td><td>(2,1/2)</td><td>1/x</td><td> Zi = awj or zi = a/wj</td></tr><tr><td>Gamma</td><td>(log z, z)</td><td>exp(x)</td><td>zi =awj</td></tr><tr><td>Inverse Gamma</td><td>(log z,1/z)</td><td>exp(-x)</td><td>zi=awj</td></tr><tr><td>Beta</td><td>(log z,log(1 - z))</td><td>log(1- exp(x))</td><td>log zi = log wj or log zi = log(1- wj)</td></tr></table>
|
| 416 |
+
|
| 417 |
+
# D NETWORK ARCHITECTURE
|
| 418 |
+
|
| 419 |
+
The estimating model $g$ is built in the reverse direction for practical purposes, so the models described here are $g ^ { - 1 }$ which maps from the data space to the latent space. The type and number of coupling blocks for the different experiments are shown below. The affine coupling function is the concatentation of the scale function $s$ and the translation function $t$ , computed together for efficiency, as in Kingma & Dhariwal (2018). It is implemented as either a fully connected network (MLP) or convolutional network, with the specified layer widths and a ReLU activation after all but the final layers. For the convolutional coupling blocks, the splits are along the channel dimension. The scale function $s$ is passed through a clamping function $2 \operatorname { t a n h } ( s )$ , which limits the output to the range (-2, 2), as in Ardizzone et al. (2019). Two affine coupling functions are applied per block, as described in Dinh et al. (2016). Downsampling increases the number of channels by a factor of 4 and decreases the image width and height by a factor of 2, done in a checkerboard-like manner, as described in Jacobsen et al. (2018). The dimensions are permuted in a random but fixed way before application of each fully connected coupling block and likewise the channels for the convolutional coupling blocks. The network for the artificial data experiments has 4,480 learnable parameters and the network for the EMNIST experiments has 2,620,192 learnable parameters.
|
| 420 |
+
|
| 421 |
+
Table 2: Network architecture for artificial data experiments
|
| 422 |
+
|
| 423 |
+
<table><tr><td rowspan=1 colspan=1>Type of block</td><td rowspan=1 colspan=1>Number</td><td rowspan=1 colspan=1>Input shape</td><td rowspan=1 colspan=1> Number|Input shape|Affine coupling function layer widths</td></tr><tr><td rowspan=1 colspan=1>Fully Connected Coupling</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>5→10→10→10</td></tr></table>
|
| 424 |
+
|
| 425 |
+
Table 3: Network architecture for EMNIST experiments
|
| 426 |
+
|
| 427 |
+
<table><tr><td>Type of block</td><td>Number</td><td>Input shape</td><td>Affine coupling function layer widths</td></tr><tr><td>Downsampling</td><td>1</td><td>(1,28,28)</td><td></td></tr><tr><td>Convolutional Coupling</td><td>4</td><td>(4,14, 14)</td><td>2→16→16→4</td></tr><tr><td>Downsampling</td><td>1</td><td>(4, 14, 14)</td><td></td></tr><tr><td>Convolutional Coupling</td><td>4</td><td>(16,7,7)</td><td>8→32→32→16</td></tr><tr><td>Flattening</td><td>1</td><td>(16,7,7)</td><td></td></tr><tr><td>Fully Connected Coupling</td><td>2</td><td>784</td><td>392→392→→392→784</td></tr></table>
|
| 428 |
+
|
| 429 |
+
# D.1 NOTE ON OPTIMIZATION METHOD
|
| 430 |
+
|
| 431 |
+
In the experiments described in this paper, the mean and variance of a mixture component was updated at each iteration as the mean and variance of the transformations to latent space of all data points belonging to that mixture component in a minibatch of data $\mathcal { D }$ :
|
| 432 |
+
|
| 433 |
+
$$
|
| 434 |
+
\begin{array} { r l } & { \mu _ { i } ( \boldsymbol { \mathsf { u } } ^ { \prime } ; \boldsymbol { \theta } ) \mathbb { E } _ { \mathcal { D } : \boldsymbol { \mathsf { u } } = \boldsymbol { \mathsf { u } } ^ { \prime } } ( g _ { i } ^ { - 1 } ( \boldsymbol { \mathsf { x } } ; \boldsymbol { \theta } ) ) } \\ & { \sigma _ { i } ^ { 2 } ( \boldsymbol { \mathsf { u } } ^ { \prime } ; \boldsymbol { \theta } ) \operatorname { V a r } _ { \mathcal { D } : \boldsymbol { \mathsf { u } } = \boldsymbol { \mathsf { u } } ^ { \prime } } ( g _ { i } ^ { - 1 } ( \boldsymbol { \mathsf { x } } ; \boldsymbol { \theta } ) ) . } \end{array}
|
| 435 |
+
$$
|
| 436 |
+
|
| 437 |
+
Hence the parameters of the mixture components would change in each batch, according to the data present. The notation $\mu _ { i } ( \mathbf { u } ; \pmb \theta )$ does not indicate that $\mu$ is directly parameterized by $\pmb \theta$ and learned, instead it indicates that $\mu$ is a function of $g ^ { - 1 }$ which is parameterized by $\pmb \theta$ . A change in $\pmb { \theta }$ will also change the output of $\mu$ , given the same mini-batch of data $\mathcal { D }$ . The same holds for $\sigma _ { i } ( \mathfrak { u } ; \pmb \theta )$ .
|
| 438 |
+
|
| 439 |
+
We expect that specifying the means and variances as learnable parameters updated in tandem with the model weights would have worked equally well.
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
Figure 6: Experiment 1: Five mixture components and 100,000 data points. GIN successfully reconstructs the generating latent space and gives importance to only two of its ten latent variables, reflecting the two-dimensional nature of the generating latent space.
|
| 443 |
+
|
| 444 |
+

|
| 445 |
+
Figure 7: Same experiment as in Figure 6 with the number of data points reduced to 10,000. GIN fails to successfully estimate the ground truth latent variables, due to limited data: The first variable ( $x$ -axis) is well approximated in the reconstruction, but the second variable $y$ -axis) is split into two in the reconstruction, one capturing mainly information about the lower two clusters (shown here) and another information about the other mixture components (not shown). We also observe a less clear spectrum, where three variables are given more importance than the rest, not faithfully reflecting the two-dimensional nature of the generating latent space.
|
| 446 |
+
|
| 447 |
+

|
| 448 |
+
Figure 8: Experiment 2: Only three mixture components (not sufficient for identifiability according to the theory). Nevertheless, GIN successfully reconstructs the ground truth latent variables. This suggests that the current theory of nonlinear ICA relies on sufficient, but not necessary, conditions for identifiability.
|
| 449 |
+
|
| 450 |
+
# F EMNIST FIGURES
|
| 451 |
+
|
| 452 |
+

|
| 453 |
+
Figure 9: Full and reduced temperature samples from the model trained on EMNIST. Reduced temperature samples are made by sampling from a Gaussian distribution where the standard deviation is reduced by the temperature factor. The 22 most significant variables are sampled, with the others kept to their mean value. This eliminates noise from the images but preserves the full variability of digit shapes. Each row has the same latent code (whitened value) but is conditioned on a different class in each column, hence the style of the digits is consistent across rows.
|
| 454 |
+
|
| 455 |
+

|
| 456 |
+
Figure 10: Most significant latent variables 1 to 4. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between $^ { - 1 }$ and $+ 1$ standard deviations.
|
| 457 |
+
|
| 458 |
+

|
| 459 |
+
Figure 11: Most significant latent variables 5 to 8. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between -1 and $+ 1$ standard deviations.
|
| 460 |
+
|
| 461 |
+

|
| 462 |
+
(a) Variable 9: extension of center left feature towards the left
|
| 463 |
+
|
| 464 |
+

|
| 465 |
+
(b) Variable 10: openness of lower loop
|
| 466 |
+
|
| 467 |
+

|
| 468 |
+
Figure 12: Most significant latent variables 9 to 12. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between -1 and $+ 1$ standard deviations.
|
| 469 |
+
|
| 470 |
+

|
| 471 |
+
(d) Variable 12: top right corner
|
| 472 |
+
|
| 473 |
+
(c) Variable 11: shape of center right feature
|
| 474 |
+
|
| 475 |
+

|
| 476 |
+
(a) Variable 13: orientation of stroke in top left corner for 2, 3 and 7
|
| 477 |
+
|
| 478 |
+

|
| 479 |
+
(b) Variable 14: shape of top part of bottom loop
|
| 480 |
+
|
| 481 |
+

|
| 482 |
+
(d) Variable 16: bottom right stroke of 2
|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
Figure 13: Most significant latent variables 13 to 16. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between $^ { - 1 }$ and $+ 1$ standard deviations.
|
| 486 |
+
|
| 487 |
+
(c) Variable 15: angle of centrally located horizontal features
|
| 488 |
+
|
| 489 |
+

|
| 490 |
+
Figure 14: Most significant latent variables 17 to 20. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between -1 and $+ 1$ standard deviations.
|
| 491 |
+
|
| 492 |
+

|
| 493 |
+
Figure 15: Most significant latent variables 21 to 24. Each row is conditioned on a different digit label. The variable runs from -2 to $+ 2$ standard deviations across the columns, with all other variables held constant at their mean value. The rightmost column shows a heatmap of the image areas most affected by the variable, computed as the absolute pixel difference between -1 and $+ 1$ standard deviations.
|
md/train/xyGFYKIPTDJ/xyGFYKIPTDJ.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|