Datasets:
Upload folder using huggingface_hub (part 10)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- md/train/rJxgknCcK7/rJxgknCcK7.md +317 -0
- md/train/rJxpuoCqtQ/rJxpuoCqtQ.md +479 -0
- md/train/rJxt0JHKvS/rJxt0JHKvS.md +475 -0
- md/train/rJzIBfZAb/rJzIBfZAb.md +398 -0
- md/train/rJzLciCqKm/rJzLciCqKm.md +572 -0
- md/train/rYhBGWYm6AU/rYhBGWYm6AU.md +223 -0
- md/train/rbdKZJxDWWx/rbdKZJxDWWx.md +214 -0
- md/train/rcQdycl0zyk/rcQdycl0zyk.md +344 -0
- md/train/rdT5GV-LnZU/rdT5GV-LnZU.md +529 -0
- md/train/rh0vIXw6i33/rh0vIXw6i33.md +396 -0
- md/train/rk49Mg-CW/rk49Mg-CW.md +267 -0
- md/train/rk4Fz2e0b/rk4Fz2e0b.md +281 -0
- md/train/rk4Qso0cKm/rk4Qso0cKm.md +340 -0
- md/train/rk5UYassf/rk5UYassf.md +160 -0
- md/train/rk5upnsxe/rk5upnsxe.md +327 -0
- md/train/rk6H0ZbRb/rk6H0ZbRb.md +334 -0
- md/train/rk6cfpRjZ/rk6cfpRjZ.md +239 -0
- md/train/rk6qdGgCZ/rk6qdGgCZ.md +252 -0
- md/train/rk8wKk-R-/rk8wKk-R-.md +336 -0
- md/train/rk9eAFcxg/rk9eAFcxg.md +316 -0
- md/train/rkA1f3NpZ/rkA1f3NpZ.md +209 -0
- md/train/rkE3y85ee/rkE3y85ee.md +311 -0
- md/train/rkE8pVcle/rkE8pVcle.md +402 -0
- md/train/rkEFLFqee/rkEFLFqee.md +299 -0
- md/train/rkEfPeZRb/rkEfPeZRb.md +233 -0
- md/train/rkFBJv9gg/rkFBJv9gg.md +258 -0
- md/train/rkGG6s0qKQ/rkGG6s0qKQ.md +343 -0
- md/train/rkGZuJb0b/rkGZuJb0b.md +177 -0
- md/train/rkGabzZgl/rkGabzZgl.md +0 -0
- md/train/rkHVZWZAZ/rkHVZWZAZ.md +450 -0
- md/train/rkKCdAdgx/rkKCdAdgx.md +291 -0
- md/train/rkMW1hRqKX/rkMW1hRqKX.md +377 -0
- md/train/rkQkBnJAb/rkQkBnJAb.md +273 -0
- md/train/rkQu4Wb0Z/rkQu4Wb0Z.md +273 -0
- md/train/rkRwGg-0Z/rkRwGg-0Z.md +306 -0
- md/train/rkTBjG-AZ/rkTBjG-AZ.md +371 -0
- md/train/rkTS8lZAb/rkTS8lZAb.md +406 -0
- md/train/rkWN3g-AZ/rkWN3g-AZ.md +254 -0
- md/train/rkYTTf-AZ/rkYTTf-AZ.md +291 -0
- md/train/rkZB1XbRZ/rkZB1XbRZ.md +0 -0
- md/train/rkZvSe-RZ/rkZvSe-RZ.md +504 -0
- md/train/rkZzY-lCb/rkZzY-lCb.md +401 -0
- md/train/rkaSvlnoG/rkaSvlnoG.md +211 -0
- md/train/rkaT3zWCZ/rkaT3zWCZ.md +339 -0
- md/train/rkaqxm-0b/rkaqxm-0b.md +353 -0
- md/train/rkcQFMZRb/rkcQFMZRb.md +445 -0
- md/train/rkcya1ZAW/rkcya1ZAW.md +444 -0
- md/train/rkdU7tCaZ/rkdU7tCaZ.md +251 -0
- md/train/rke3TJrtPS/rke3TJrtPS.md +653 -0
- md/train/rke41hC5Km/rke41hC5Km.md +373 -0
md/train/rJxgknCcK7/rJxgknCcK7.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FFJORD: FREE-FORM CONTINUOUS DYNAMICS FOR SCALABLE REVERSIBLE GENERATIVE MODELS
|
| 2 |
+
|
| 3 |
+
Will Grathwohl∗†‡ , Ricky T. Q. Chen∗†, Jesse Bettencourt†, Ilya Sutskever‡ , David Duvenaud†
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Reversible generative models map points from a simple distribution to a complex distribution through an easily invertible neural network. Likelihood-based training of these models requires restricting their architectures to allow cheap computation of Jacobian determinants. Alternatively, the Jacobian trace can be used if the transformation is specified by an ordinary differential equation. In this paper, we use Hutchinson’s trace estimator to give a scalable unbiased estimate of the logdensity. The result is a continuous-time invertible generative model with unbiased density estimation and one-pass sampling, while allowing unrestricted neural network architectures. We demonstrate our approach on high-dimensional density estimation, image generation, and variational inference, improving the state-ofthe-art among exact likelihood methods with efficient sampling.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Reversible generative models use cheaply invertible neural networks to transform samples from a fixed base distribution. Examples include NICE (Dinh et al., 2014), Real NVP (Dinh et al., 2017), and Glow (Kingma & Dhariwal, 2018). These models are easy to sample from, and can be trained by maximum likelihood using the change of variables formula. However, this requires placing awkward restrictions on their architectures, such as partitioning dimensions or using rank one weight matrices, in order to avoid an $\mathcal { O } ( D ^ { 3 } )$ cost determinant computation.
|
| 12 |
+
|
| 13 |
+
Recently, Chen et al. (2018) introduced continuous normalizing flows (CNF), defining the mapping from latent variables to data using ordinary differential equations (ODE). In their model, the likelihood can be computed using trace operations costing only $\mathcal { O } ( D ^ { 2 } )$ . This allows a more flexible, but still restricted, family of network architectures to be used.
|
| 14 |
+
|
| 15 |
+
Extending this work, we introduce an unbiased stochastic estimator of the likelihood that has $\mathcal { O } ( D )$ time cost, allowing completely unrestricted architectures. Furthermore, we have implemented GPU-based adaptive ODE solvers to train and evaluate these models on modern hardware. We call our approach Free-form Jacobian of
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: FFJORD transforms a simple base distribution at $t _ { 0 }$ into the target distribution at $t _ { 1 }$ by integrating over learned continuous dynamics.
|
| 19 |
+
|
| 20 |
+
Reversible Dynamics (FFJORD). Figure 1 shows FFJORD smoothly transforming a Gaussian distribution into a multi-modal distribution.
|
| 21 |
+
|
| 22 |
+
# 2 BACKGROUND: GENERATIVE MODELS AND CHANGE OF VARIABLES
|
| 23 |
+
|
| 24 |
+
In contrast to directly parameterizing a normalized distribution (e.g. Oord et al. (2016); Germain et al. (2015)), the change of variables formula allows one to specify a complex normalized distribution $p _ { \mathbf { x } } ( \mathbf { x } )$ implicitly by warping a normalized base distribution $p _ { \mathbf { z } } ( \mathbf { z } )$ through an invertible function $f : \mathbb { R } ^ { D } \overset { \cdot } { } \mathbb { R } ^ { D }$ . Given a random variable $\mathbf { z } \sim p _ { \mathbf { z } } ( \mathbf { z } )$ the log density of ${ \bf x } = f ( { \bf z } )$ follows
|
| 25 |
+
|
| 26 |
+
$$
|
| 27 |
+
\log p _ { \mathbf { x } } ( \mathbf { x } ) = \log p _ { \mathbf { z } } ( \mathbf { z } ) - \log \operatorname* { d e t } \left| \frac { \partial f ( \mathbf { z } ) } { \partial \mathbf { z } } \right|
|
| 28 |
+
$$
|
| 29 |
+
|
| 30 |
+
where $\partial f ( \mathbf { z } ) / \partial \mathbf { z }$ is the Jacobian of $f$ . In general, computing the log determinant has a time cost of $\mathcal { O } ( D ^ { 3 } )$ . Much work has gone into developing restricted neural network architectures which make computing the Jacobian’s determinant more tractable. These approaches broadly fall into three categories:
|
| 31 |
+
|
| 32 |
+
Normalizing flows. By restricting the functional form of $f$ , various determinant identities can be exploited (Rezende & Mohamed, 2015; Berg et al., 2018). These models cannot be trained as generative models from data because they do not have a tractable inverse $f ^ { - 1 }$ . However, they are useful for specifying approximate posteriors for variational inference (Kingma & Welling, 2014).
|
| 33 |
+
|
| 34 |
+
Autoregressive transformations. By using an autoregressive model and specifying an ordering of the dimensions, the Jacobian of $f$ is enforced to be lower triangular (Kingma et al., 2016; Oliva et al., 2018). These models excel at density estimation for tabular datasets (Papamakarios et al., 2017), but require $D$ sequential evaluations of $f$ to invert, which is prohibitive when $D$ is large.
|
| 35 |
+
|
| 36 |
+
Partitioned transformations. Partitioning the dimensions and using affine transformations makes the determinant of the Jacobian cheap to compute, and the inverse $\breve { f } ^ { - 1 }$ computable with the same cost as $f$ (Dinh et al., 2014; 2017). This method allows the use of convolutional architectures, excelling at density estimation for image data (Dinh et al., 2017; Kingma & Dhariwal, 2018).
|
| 37 |
+
|
| 38 |
+
Throughout this work, we refer to reversible generative models as those which use the change of variables to transform a base distribution to the model distribution while maintaining both efficient density estimation and efficient sampling capabilities using a single pass of the model.
|
| 39 |
+
|
| 40 |
+
# 2.1 OTHER GENERATIVE MODELS
|
| 41 |
+
|
| 42 |
+
There exist several approaches to generative modeling approaches which do not use the change of variables equation for training. Generative adversarial networks (GANs) (Goodfellow et al., 2014) use large, unrestricted neural networks to transform samples from a fixed base distribution. Lacking a closed-form likelihood, an auxiliary discriminator model must be trained to estimate divergences or density ratios in order to provide a training signal. Autoregressive models (Germain et al., 2015; Oord et al., 2016) directly specify the joint distribution $p ( \mathbf { x } )$ as a sequence of explicit conditional distributions using the product rule. These models require at least $\mathcal { O } ( D )$ evaluations to sample from. Variational autoencoders (VAEs) (Kingma & Welling, 2014) use an unrestricted architecture to explicitly specify the conditional likelihood $p ( x | z )$ , but can only efficiently provide a stochastic lower bound on the marginal likelihood $p ( x )$ .
|
| 43 |
+
|
| 44 |
+
# 2.2 CONTINUOUS NORMALIZING FLOWS
|
| 45 |
+
|
| 46 |
+
Chen et al. (2018) define a generative model for data $\mathbf { x } \in \mathbb { R } ^ { D }$ similar to those based on (1), but replace the warping function with an integral of continuous-time dynamics. The generative process first samples from a base distribution ${ \bf z } _ { 0 } \sim p _ { z _ { 0 } } ( { \bf z } _ { 0 } )$ . Then, given an ODE whose dynamics are defined by the parametric function $\partial \mathbf { z } ( t ) / \partial t = f ( \mathbf { z } ( t ) , t ; \theta )$ , we solve the initial value problem with $\mathbf { z } ( t _ { 0 } ) = \dot { \mathbf { z } } _ { 0 }$ to obtain a data sample ${ \mathbf x } = { \mathbf z } ( t _ { 1 } )$ . These models are called Continous Normalizing Flows (CNF). The change in log-density under this model follows a second differential equation, called the instantaneous change of variables formula (Chen et al., 2018):
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\frac { \partial \log p ( { \bf z } ( t ) ) } { \partial t } = - \mathrm { T r } \left( \frac { \partial f } { \partial { \bf z } ( t ) } \right) .
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
We can compute total change in log-density by integrating across time:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\log p ( \mathbf { z } ( t _ { 1 } ) ) = \log p ( \mathbf { z } ( t _ { 0 } ) ) - \int _ { t _ { 0 } } ^ { t _ { 1 } } \operatorname { T r } \left( { \frac { \partial f } { \partial \mathbf { z } ( t ) } } \right) d t .
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
<table><tr><td colspan="2">Method</td><td rowspan="2">Train on data</td><td rowspan="2">One-pass Sampling</td><td rowspan="2">Exact/Unbiased Log- likelihood</td><td rowspan="2">Free- form Jacobian</td></tr><tr><td colspan="2"></td></tr><tr><td rowspan="4"></td><td>Variational Autoencoders</td><td></td><td></td><td>X</td><td>√</td></tr><tr><td>Generative Adversarial Nets</td><td></td><td>√</td><td>×</td><td>√</td></tr><tr><td>Likelihood-based Autoregressive</td><td></td><td>×</td><td>√</td><td>×</td></tr><tr><td>Normalizing Flows</td><td>X</td><td>√</td><td></td><td>X</td></tr><tr><td rowspan="3">o auegg 2aaiber</td><td>Reverse-NF,MAF, TAN</td><td></td><td>X</td><td></td><td>X</td></tr><tr><td>NICE,Real NVP, Glow, Planar CNF</td><td></td><td>√</td><td></td><td>X</td></tr><tr><td>FFJORD</td><td></td><td>「</td><td></td><td></td></tr></table>
|
| 59 |
+
|
| 60 |
+
Given a datapoint x, we can compute both the point $\mathbf { z } _ { 0 }$ which generates $\mathbf { x }$ , as well as $\log p ( \mathbf { x } )$ under the model by solving the combined initial value problem:
|
| 61 |
+
|
| 62 |
+
which integrates the combined dynamics of $z ( t )$ and the log-density of the sample backwards in time from $t _ { 1 }$ to $t _ { 0 }$ . We can then compute $\log p ( \mathbf { x } )$ using the solution of (4) and adding $\log p _ { z _ { 0 } } ( { \bf z } _ { 0 } )$ . The existence and uniqueness of (4) require that $f$ and its first derivatives be Lipschitz continuous (Khalil, 2002), which can be satisfied in practice using neural networks with smooth Lipschitz activations, such as softplus or tanh.
|
| 63 |
+
|
| 64 |
+
# 2.2.1 BACKPROPAGATING THROUGH ODE SOLUTIONS WITH THE ADJOINT METHOD
|
| 65 |
+
|
| 66 |
+
CNFs are trained to maximize (3). This objective involves the solution to an initial value problem with dynamics parameterized by $\theta$ . For any scalar loss function which operates on the solution to an initial value problem
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
L ( \mathbf { z } ( t _ { 1 } ) ) = L \left( \int _ { t _ { 0 } } ^ { t _ { 1 } } f ( \mathbf { z } ( t ) , t ; \theta ) d t \right)
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
then Pontryagin (1962) shows that its derivative takes the form of another initial value problem
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\frac { d L } { d \theta } = - \int _ { t _ { 1 } } ^ { t _ { 0 } } \left( \frac { \partial L } { \partial \mathbf { z } ( t ) } \right) ^ { T } \frac { \partial f ( \mathbf { z } ( t ) , t ; \theta ) } { \partial \theta } d t .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
The quantity $- { \partial L } / { \partial { \bf z } ( t ) }$ is known as the adjoint state of the ODE. Chen et al. (2018) use a black-box ODE solver to compute ${ \bf z } ( t _ { 1 } )$ , and then a separate call to a solver to compute (6) with the initial value ${ \partial L } / { \partial { \bf z } ( t _ { 1 } ) }$ . This approach is a continuous-time analog to the backpropgation algorithm (Rumelhart et al., 1986; Andersson, 2013) and can be combined with gradient-based optimization to fit the parameters $\theta$ by maximum likelihood.
|
| 79 |
+
|
| 80 |
+
# 3 SCALABLE DENSITY EVALUATION WITH UNRESTRICTED ARCHITECTURES
|
| 81 |
+
|
| 82 |
+
Switching from discrete-time dynamics to continuous-time dynamics reduces the primary computational bottleneck of normalizing flows from $\mathcal { O } ( D ^ { 3 } )$ to $\mathcal { O } ( D ^ { 2 } )$ , at the cost of introducing a numerical ODE solver. This allows the use of more expressive architectures. For example, each layer of the original normalizing flows model of Rezende & Mohamed (2015) is a one-layer neural network with only a single hidden unit. In contrast, the instantaneous transformation used in planar continuous normalizing flows (Chen et al., 2018) is a one-layer neural network with many hidden units. In this section, we construct an unbiased estimate of the log-density with $\mathcal { O } ( D )$ cost, allowing completely unrestricted neural network architectures to be used.
|
| 83 |
+
|
| 84 |
+
# 3.1 UNBIASED LINEAR-TIME LOG-DENSITY ESTIMATION
|
| 85 |
+
|
| 86 |
+
In general, computing $\operatorname { T r } \left( { \partial f } / { \partial \mathbf { z } ( t ) } \right)$ exactly costs $\mathcal { O } ( D ^ { 2 } )$ , or approximately the same cost as $D$ evaluations of $f$ , since each entry of the diagonal of the Jacobian requires computing a separate derivative of $f$ (Griewank & Walther, 2008). However, there are two tricks that can help. First, vector-Jacobian products ${ \pmb v } ^ { T } \frac { \partial f } { \partial { \bf z } }$ can be computed for approximately the same cost as evaluating $f$ using reverse-mode automatic differentiation. Second, we can get an unbiased estimate of the trace of a matrix by taking a double product of that matrix with a noise vector:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\operatorname { T r } ( A ) = \mathbb { E } _ { p ( \epsilon ) } [ \epsilon ^ { T } A \epsilon ] .
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
The above equation holds for any $D$ -by- $D$ matrix $A$ and distribution $p ( \epsilon )$ over $D$ -dimensional vectors such that $\mathbb { E } [ \boldsymbol { \epsilon } ] = 0$ and $\mathrm { C o v } ( \epsilon ) = I$ . The Monte Carlo estimator derived from (7) is known as Hutchinson’s trace estimator (Hutchinson, 1989; Adams et al., 2018).
|
| 93 |
+
|
| 94 |
+
To keep the dynamics deterministic within each call to the ODE solver, we can use a fixed noise vector $\epsilon$ for the duration of each solve without introducing bias:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\begin{array} { r l } & { \log p ( \mathbf { z } ( t _ { 1 } ) ) = \log p ( \mathbf { z } ( t _ { 0 } ) ) - \int _ { t _ { 0 } } ^ { t _ { 1 } } \operatorname { T r } \left( \frac { \partial f } { \partial \mathbf { z } ( t ) } \right) d t } \\ & { \qquad = \log p ( \mathbf { z } ( t _ { 0 } ) ) - \int _ { t _ { 0 } } ^ { t _ { 1 } } \mathbb { E } _ { p ( \epsilon ) } \left[ \epsilon ^ { T } \frac { \partial f } { \partial \mathbf { z } ( t ) } \epsilon \right] d t } \\ & { \qquad = \log p ( \mathbf { z } ( t _ { 0 } ) ) - \mathbb { E } _ { p ( \epsilon ) } \left[ \int _ { t _ { 0 } } ^ { t _ { 1 } } \epsilon ^ { T } \frac { \partial f } { \partial \mathbf { z } ( t ) } \epsilon d t \right] } \end{array}
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
Typical choices of $p ( \epsilon )$ are a standard Gaussian or Rademacher distribution (Hutchinson, 1989).
|
| 101 |
+
|
| 102 |
+
# 3.1.1 REDUCING VARIANCE WITH BOTTLENECK CAPACITY
|
| 103 |
+
|
| 104 |
+
Often, there exist bottlenecks in the architecture of the dynamics network, i.e. hidden layers whose width $H$ is smaller than the dimensions of the input $D$ . In such cases, we can reduce the variance of Hutchinson’s estimator by using the cyclic property of trace. Since the variance of the estimator for $\operatorname { T r } ( A )$ grows asymptotic to $| | \bar { A | | } _ { F } ^ { 2 }$ (Hutchinson, 1989), we suspect that having fewer dimensions should help reduce variance. If we view the dynamics as a composition of two functions $f = g \circ h ( \mathbf { z } )$ then we observe
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\operatorname { T r } \underbrace { \left( { \frac { \partial f } { \partial \mathbf { z } } } \right) } _ { D \times D } = \operatorname { T r } \underbrace { \left( { \frac { \partial g } { \partial h } } { \frac { \partial h } { \partial \mathbf { z } } } \right) } _ { D \times D } = \operatorname { T r } \underbrace { \left( { \frac { \partial h } { \partial \mathbf { z } } } { \frac { \partial g } { \partial h } } \right) } _ { H \times H } = \mathbb { E } _ { p ( \epsilon ) } \left[ \epsilon ^ { T } { \frac { \partial h } { \partial \mathbf { z } } } { \frac { \partial g } { \partial h } } \epsilon \right] .
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
When $f$ has multiple hidden layers, we choose $H$ to be the smallest dimension. This bottleneck trick can reduce the norm of the matrix which may also help reduce the variance of the trace estimator. As introducing a bottleneck limits our model capacity, we do not use this trick in our experiments. However this trick can reduce variance when a bottleneck is used, as shown in our ablation studies.
|
| 111 |
+
|
| 112 |
+
# 3.2 FFJORD: A CONTINUOUS-TIME REVERSIBLE GENERATIVE MODEL
|
| 113 |
+
|
| 114 |
+
Our complete method uses the dynamics defined in (2) and the efficient log-likelihood estimator of (8) to produce the first scalable and reversible generative model with an unconstrained Jacobian. We call this method Free-Form Jacobian of Reversible Dyanamics (FFJORD). Pseudo-code of our method is given in Algorithm 1, and Table 1 summarizes the capabilities of our model compared to other recent generative modeling approaches.
|
| 115 |
+
|
| 116 |
+
Assuming the cost of evaluating $f$ is on the order of $\mathcal { O } ( D H )$ where $D$ is the dimensionality of the data and $H$ is the size of the largest hidden layer in $f$ , then the cost of computing the likelihood in models with repeated use of invertible transformations (1) is $\mathcal { O } ( ( D H + \bar { D ^ { 3 } } ) L )$ where $L$ is the number of transformations used. For CNF, this reduces to ${ \mathcal O } ( ( D H + D ^ { 2 } ) \hat { L } )$ for CNFs, where $\hat { L }$ is the number of evaluations of $f$ used by the ODE solver. With FFJORD, this reduces further to $\mathcal { O } ( ( D H + D ) \hat { L } )$ .
|
| 117 |
+
|
| 118 |
+
<table><tr><td colspan="2">Algorithm1 Unbiased stochastic log-density estimation using the FFJORD model Require: dynamics fe,start time to,stop time t1,data samples x,data dimension D.</td></tr><tr><td>∈ ← sample_unit_variance(x.shape) function faug([zt, log pt],t):</td><td>> Sample E outside of the integral >Augment f with log-density dynamics.</td></tr><tr><td>ft←fo(z(t),t) Taf</td><td>Evaluate neural network</td></tr><tr><td>g←εT zlz(t)</td><td> Compute vector-Jacobian product with automatic differentiation</td></tr><tr><td>Tr= ge return [ft,-Tr]</td><td> Unbiased estimateof Tr() with eTOfe</td></tr><tr><td>end function [zo,△logp] ←odeint(faug,[x,0],to,t1)</td><td>> Concatenate dynamics of state and log-density Solve theODE St fug([z(t),lgp(z(t)),t)t</td></tr></table>
|
| 119 |
+
|
| 120 |
+
# 4 EXPERIMENTS
|
| 121 |
+
|
| 122 |
+
We demonstrate FFJORD on a variety of density estimation tasks, and for approximate inference in variational autoencoders (Kingma & Welling, 2014). Experiments were conducted using a suite of GPU-based ODE-solvers and an implementation of the adjoint method for backpropagation1. In all experiments the RungeKutta 4(5) algorithm with the tableau from Shampine (1986) was used to solve the ODEs. We ensure tolerance is set low enough so numerical error is negligible; see Appendix C.
|
| 123 |
+
|
| 124 |
+
We used Hutchinson’s trace estimator (7) during training and the exact trace when reporting test results. This was done in all experiments except for our density estimation models trained on MNIST and CIFAR10 where computing the exact Jacobian trace was too expensive.
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
Figure 2: Comparison of trained Glow, planar CNF, and FFJORD models on 2-dimensional distributions, including multi-modal and discontinuous densities.
|
| 128 |
+
|
| 129 |
+
The dynamics of FFJORD are defined by a neural network $f$ which takes as input the current state $\mathbf { z } ( t ) \in \mathbb { R } ^ { D }$ and the current time $t \in \mathbb { R }$ . We experimented with several ways to incorporate $t$ as an input to $f$ , such as hyper-networks, but found that simply concatenating $t$ on to ${ \bf z } ( t )$ at the input to every layer worked well and was used in all of our experiments.
|
| 130 |
+
|
| 131 |
+
# 4.1 DENSITY ESTIMATION ON TOY 2D DATA
|
| 132 |
+
|
| 133 |
+
We first train on 2 dimensional data to visualize the model and the learned dynamics.2 In Figure 2, we show that by warping a simple isotropic Gaussian, FFJORD can fit both multi-modal and even discontinuous distributions. The number of evaluations of the ODE solver is roughly 70-100 on all datasets, so we compare against a Glow model with 100 discrete layers.
|
| 134 |
+
|
| 135 |
+
The learned distributions of both FFJORD and Glow can be seen in Figure 2. Interestingly, we find that Glow learns to stretch the unimodal base distribution into multiple modes but has trouble modeling the areas of low probability between disconnected regions. In contrast, FFJORD is capable of modeling disconnected modes and can also learn convincing approximations of discontinuous density functions (middle row in Figure 2). Since the main benefit of FFJORD is the ability to train with deeper dynamics networks, we also compare against planar CNF (Chen et al., 2018) which can
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 3: Samples and data from our image models. MNIST on left, CIFAR10 on right.
|
| 139 |
+
|
| 140 |
+
<table><tr><td></td><td>POWER</td><td>GAS</td><td>HEPMASS</td><td>MINIBOONE</td><td>BSDS300</td><td>MNIST</td><td>CIFAR10</td></tr><tr><td>Real NVP</td><td>-0.17</td><td>-8.33</td><td>18.71</td><td>13.55</td><td>-153.28</td><td>1.06*</td><td>3.49*</td></tr><tr><td>Glow</td><td>-0.17</td><td>-8.15</td><td>18.92</td><td>11.35</td><td>-155.07</td><td>1.05*</td><td>3.35*</td></tr><tr><td>FFJORD</td><td>-0.46</td><td>-8.59</td><td>14.92</td><td>10.43</td><td>-157.40</td><td>0.99* (1.05†)</td><td>3.40*</td></tr><tr><td>MADE</td><td>3.08</td><td>-3.56</td><td>20.98</td><td>15.59</td><td>-148.85</td><td>2.04</td><td>5.67</td></tr><tr><td>MAF</td><td>-0.24</td><td>-10.08</td><td>17.70</td><td>11.75</td><td>-155.69</td><td>1.89</td><td>4.31</td></tr><tr><td>TAN</td><td>-0.48</td><td>-11.19</td><td>15.12</td><td>11.01</td><td>-157.03</td><td>-</td><td>-</td></tr><tr><td>MAF-DDSF</td><td>-0.62</td><td>-11.96</td><td>15.09</td><td>8.86</td><td>-157.73</td><td>-</td><td>-</td></tr></table>
|
| 141 |
+
|
| 142 |
+
Table 2: Negative log-likehood on test data for density estimation models; lower is better. In nats for tabular data and bits/dim for MNIST and CIFAR10. \*Results use multi-scale convolutional architectures. †Results use a single flow with a convolutional encoder-decoder architecture.
|
| 143 |
+
|
| 144 |
+
be viewed as a single hidden layer network. Without the benefit of a flexible network, planar CNF is unable to model complex distributions.
|
| 145 |
+
|
| 146 |
+
# 4.2 DENSITY ESTIMATION ON REAL DATA
|
| 147 |
+
|
| 148 |
+
We perform density estimation on five tabular datasets preprocessed as in Papamakarios et al. (2017) and two image datasets; MNIST and CIFAR10. When reproducing Glow, we use the same configurations for Real NVP as Papamakarios et al. (2017) and add invertible fully connected layer between all coupling layers. On the tabular datasets, FFJORD performs the best out of reversible models by a wide margin but is outperformed by recent autoregressive models. Of those, FFJORD outperforms MAF (Papamakarios et al., 2017) on all but one dataset and manages to outperform TAN Oliva et al. (2018) on the MINIBOONE dataset. These models require $\mathcal { O } ( D )$ sequential computations to sample from while the best performing method, MAF-DDSF (Huang et al., 2018), cannot be sampled from without resorting to correlated or expensive sampling algorithms such as MCMC.
|
| 149 |
+
|
| 150 |
+
On MNIST we find that FFJORD can model the data as effectively as Glow and Real NVP using only a single flow defined by a single neural network. This is in contrast to Glow and Real NVP which must compose many flows to achieve similar performance. When we use multiple flows in a multiscale architecture (like those used by Glow and Real NVP) we obtain better performance on MNIST and comparable performance to Glow on CIFAR10. Notably, FFJORD is able to achieve this performance while using less than $2 \%$ as many parameters as Glow. We also note that Glow uses a learned base distribution whereas FFJORD and Real NVP use a fixed Gaussian. A summary of our results on density estimation can be found in Table 2 and samples can be seen in Figure 3. Full details on architectures used, our experimental procedure, and additional samples can be found in Appendix B.1.
|
| 151 |
+
|
| 152 |
+
In general, our approach is slower than competing methods, but we find the memory-efficiency of the adjoint method allows us to use much larger batch sizes than those methods. On the tabular datasets we used a batch sizes up to 10,000 and on the image datasets we used a batch size of 900.
|
| 153 |
+
|
| 154 |
+
# 4.3 VARIATIONAL AUTOENCODER
|
| 155 |
+
|
| 156 |
+
We compare FFJORD to other normalizing flows for use in variational inference. We train a VAE (Kingma & Welling, 2014) on four datasets using a FFJORD flow and compare to VAEs with no flow, Planar Flows (Rezende & Mohamed, 2015), Inverse Autoregressive Flow (IAF) (Kingma
|
| 157 |
+
|
| 158 |
+
<table><tr><td></td><td>MNIST</td><td>Omniglot</td><td>Frey Faces</td><td>Caltech Silhouettes</td></tr><tr><td>No Flow</td><td>86.55 ± .06</td><td>104.28 ± .39</td><td>4.53 ± .02</td><td>110.80 ± .46</td></tr><tr><td>Planar IAF</td><td>86.06 ± .31 84.20 ± .17</td><td>102.65 ± .42</td><td>4.40 ± .06</td><td>109.66 ± .42 111.58 ± .38</td></tr><tr><td></td><td></td><td>102.41 ± .04</td><td>4.47 ± .05</td><td></td></tr><tr><td>Sylvester</td><td>83.32 ± .06</td><td>99.00 ± .04</td><td>4.45 ± .04</td><td>104.62 ± .29</td></tr><tr><td>FFJORD</td><td>82.82 ± .01</td><td>98.33 ± .09</td><td>4.39 ± .01</td><td>104.03 ± .43</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Table 3: Negative ELBO on test data for VAE models; lower is better. In nats for all datasets except Frey Faces which is presented in bits per dimension. Mean/stdev are estimated over 3 runs.
|
| 161 |
+
|
| 162 |
+
et al., 2016), and Sylvester normalizing flows (Berg et al., 2018). To provide a fair comparison, our encoder/decoder architectures and learning setup exactly mirror those of Berg et al. (2018).
|
| 163 |
+
|
| 164 |
+
In VAEs it is common for the encoder network to also output the parameters of the flow as a function of the input $\mathbf { x }$ . With FFJORD, we found this led to differential equations which were too difficult to integrate numerically. Instead, the encoder network outputs a low-rank update to a global weight matrix and an input-dependent bias vector. When used in recognition nets, neural network layers defining the dynamics inside FFJORD take the form
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\mathrm { l a y e r } ( h ; \mathbf { x } , W , b ) = \sigma \left( \left( \underbrace { W } _ { D _ { o u t } \times D _ { i n } } + \underbrace { \hat { U } ( \mathbf { x } ) } _ { D _ { o u t } \times k } \underbrace { \hat { V } ( \mathbf { x } ) } _ { D _ { i n } \times k } ^ { T } \right) h + \underbrace { b } _ { D _ { o u t } \times 1 } + \underbrace { \hat { b } ( \mathbf { x } ) } _ { D _ { o u t } \times 1 } \right)
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
where $h$ is the input to the layer, $\sigma$ is an element-wise activation function, $D _ { i n }$ and $D _ { o u t }$ are the input and output dimension of this layer, and ${ \hat { U } } ( \mathbf { x } ) , { \hat { V } } ( \mathbf { x } ) , { \hat { b } } ( \mathbf { x } )$ are input-dependent parameters returned from an encoder network. A full description of the model architectures used and our experimental setup can be found in Appendix B.2.
|
| 171 |
+
|
| 172 |
+
On every dataset tested, FFJORD outperforms all other competing normalizing flows. A summary of our variational inference results can be found in Table 3.
|
| 173 |
+
|
| 174 |
+
# 5 ANALYSIS AND DISCUSSION
|
| 175 |
+
|
| 176 |
+
We performed a series of ablation experiments to gain a better understanding of the proposed model.
|
| 177 |
+
|
| 178 |
+
# 5.1 FASTER TRAINING WITH BOTTLENECK TRICK
|
| 179 |
+
|
| 180 |
+
We plotted the training losses on MNIST using an encoder-decoder architecture (see Appendix B.1 for details). Loss during training is plotted in Figure 4, where we use the trace estimator directly on the $D \times D$ Jacobian, or we use the bottleneck trick to reduce the dimension to $H \times H$ . Interestingly, we find that while the bottleneck trick (9) can lead to faster convergence when the trace is estimated using a Gaussian-distributed $\epsilon$ , we did not observe faster convergence when using a Rademacherdistributed $\epsilon$ .
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 4: The variance of our model’s log-density estimator can be reduced using neural network architectures with a bottleneck layer, speeding up training.
|
| 184 |
+
|
| 185 |
+
# 5.2 NUMBER OF FUNCTION EVALUATIONS VS. DATA DIMENSION
|
| 186 |
+
|
| 187 |
+
The full computational cost of integrating the instantaneous change of variables (2) is $\mathcal { O } ( D H \widehat { L } )$ where $D$ is dimensionality of the data, $H$ is the size of the hidden state, and $\widehat { L }$ is the number of function evaluations (NFE) that the adaptive solver uses to integrate the ODE. In general, each evaluation of the model is $\mathcal { O } ( D H )$ and in practice, $H$ is typically chosen to be close to $D$ . Since the general form of the discrete change of variables equation (1) requires $\mathcal { O } ( D ^ { 3 } )$ -cost, one may wonder whether the number of evaluations $\widehat { L }$ depends on $D$ .
|
| 188 |
+
|
| 189 |
+
We train VAEs using FFJORD flows with increasing latent dimension $D$ . The NFE throughout training is shown in Figure 5. In all models, we find that the NFE increases throughout training, but converges to the same value, independent of $D$ . We conjecture that the number of evaluations is not dependent on the dimensionality of the data but the complexity of its distribution, or more specifically, how difficult it is to transform its density into the base distribution.
|
| 190 |
+
|
| 191 |
+
# 5.3 SINGLE-SCALE VS. MULTI-SCALE FFJORD
|
| 192 |
+
|
| 193 |
+
Crucial to the scalability of Real NVP and Glow is the multiscale architecture originally proposed in Dinh et al. (2017). We compare a single-scale encoder-decoder style FFJORD with a multiscale FFJORD on the MNIST dataset where both models have a comparable number of parameters and plot the total NFE–in both forward and backward passes–against the loss achieved in Figure 6. We find that while the single-scale model uses approximately one half as many function evaluations as the multiscale model, it is not able to achieve the same performance as the multiscale model.
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 5: NFE used by the adaptive ODE solver is approximately independent of data-dimension. Lines are smoothed using a Gaussian filter.
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
Figure 6: For image data, a single FFJORD flow can achieve near performance to multi-scale architecture while using half the number of evaluations.
|
| 200 |
+
|
| 201 |
+
# 6 SCOPE AND LIMITATIONS
|
| 202 |
+
|
| 203 |
+
Number of function evaluations can be prohibitive. The number of function evaluations required to integrate the dynamics is not fixed ahead of time, and is a function of the data, model architecture, and model parameters. This number tends to grow as the models trains and can become prohibitively large, even when memory stays constant due to the adjoint method. Various forms of regularization such as weight decay and spectral normalization (Miyato et al., 2018) can be used to reduce the this quantity, but their use tends to hurt performance slightly.
|
| 204 |
+
|
| 205 |
+
Limitations of general-purpose ODE solvers. In theory, our model can approximate any differential equation (given mild assumptions based on existence and uniqueness of the solution), but in practice our reliance on general-purpose ODE solvers restricts us to non-stiff differential equations that can be efficiently solved. ODE solvers for stiff dynamics exist, but they evaluate $f$ many more times to achieve the same error. We find that a small amount of weight decay regularizes the ODE to be sufficiently non-stiff.
|
| 206 |
+
|
| 207 |
+
# 7 CONCLUSION
|
| 208 |
+
|
| 209 |
+
We have presented FFJORD, a reversible generative model for high-dimensional data which can compute exact log-likelihoods and can be sampled from efficiently. Our model uses continuoustime dynamics to produce a generative model which is parameterized by an unrestricted neural network. All required quantities for training and sampling can be computed using automatic differentiation, Hutchinson’s trace estimator, and black-box ODE solvers. Our model stands in contrast to other methods with similar properties which rely on restricted, hand-engineered neural network architectures. We demonstrated that this additional flexibility allows our approach to achieve on-par or improved performance on density estimation and variational inference.
|
| 210 |
+
|
| 211 |
+
We believe there is much room for further work exploring and improving this method. FFJORD is empirically slower to evaluate than other reversible models like Real NVP or Glow, so we are interested specifically in ways to reduce the number of function evaluations used by the ODE-solver without hurting predictive performance. Advancements like these will be crucial in scaling this method to even higher-dimensional datasets.
|
| 212 |
+
|
| 213 |
+
# 8 ACKNOWLEDGEMENTS
|
| 214 |
+
|
| 215 |
+
We thank Yulia Rubanova and Roger Grosse for helpful discussions.
|
| 216 |
+
|
| 217 |
+
# REFERENCES
|
| 218 |
+
|
| 219 |
+
R. P. Adams, J. Pennington, M. J. Johnson, J. Smith, Y. Ovadia, B. Patton, and J. Saunderson. Estimating the Spectral Density of Large Implicit Matrices. ArXiv e-prints, February 2018.
|
| 220 |
+
|
| 221 |
+
Joel Andersson. A general-purpose software framework for dynamic optimization. PhD thesis, 2013.
|
| 222 |
+
|
| 223 |
+
Rianne van den Berg, Leonard Hasenclever, Jakub M Tomczak, and Max Welling. Sylvester normalizing flows for variational inference. arXiv preprint arXiv:1803.05649, 2018.
|
| 224 |
+
|
| 225 |
+
Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations. Advances in Neural Information Processing Systems, 2018.
|
| 226 |
+
|
| 227 |
+
Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: Non-linear independent components estimation. International Conference on Learning Representations Workshop, 2014.
|
| 228 |
+
|
| 229 |
+
Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using Real NVP. International Conference on Learning Representations, 2017.
|
| 230 |
+
|
| 231 |
+
Mathieu Germain, Karol Gregor, Iain Murray, and Hugo Larochelle. Made: Masked autoencoder for distribution estimation. In International Conference on Machine Learning, pp. 881–889, 2015.
|
| 232 |
+
|
| 233 |
+
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.
|
| 234 |
+
|
| 235 |
+
Andreas Griewank and Andrea Walther. Evaluating derivatives: principles and techniques of algorithmic differentiation, volume 105. Siam, 2008.
|
| 236 |
+
|
| 237 |
+
Chin-Wei Huang, David Krueger, Alexandre Lacoste, and Aaron Courville. Neural autoregressive flows. International Conference on Machine Learning, 2018.
|
| 238 |
+
|
| 239 |
+
M.F. Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. 18:1059–1076, 01 1989.
|
| 240 |
+
|
| 241 |
+
H.K. Khalil. Nonlinear Systems. Pearson Education. Prentice Hall, 2002.
|
| 242 |
+
|
| 243 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference on Learning Representations, 2015.
|
| 244 |
+
|
| 245 |
+
Diederik P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. Advances in Neural Information Processing Systems, 2018.
|
| 246 |
+
|
| 247 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. International Conference on Learning Representations, 2014.
|
| 248 |
+
|
| 249 |
+
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, pp. 4743–4751, 2016.
|
| 250 |
+
|
| 251 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. International Conference on Learning Representations, 2018.
|
| 252 |
+
|
| 253 |
+
Junier B Oliva, Avinava Dubey, Barnabas P ´ oczos, Jeff Schneider, and Eric P Xing. Transformation ´ autoregressive networks. International Conference on Machine Learning, 2018.
|
| 254 |
+
|
| 255 |
+
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. International Conference on Machine Learning, 2016.
|
| 256 |
+
|
| 257 |
+
George Papamakarios, Iain Murray, and Theo Pavlakou. Masked autoregressive flow for density estimation. In Advances in Neural Information Processing Systems, pp. 2338–2347, 2017.
|
| 258 |
+
|
| 259 |
+
Lev Semenovich Pontryagin. Mathematical theory of optimal processes. Routledge, 1962.
|
| 260 |
+
|
| 261 |
+
Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. International Conference on Machine Learning, 2015.
|
| 262 |
+
|
| 263 |
+
David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by backpropagating errors. Nature, 323(6088):533, 1986.
|
| 264 |
+
|
| 265 |
+
Lawrence F Shampine. Some practical Runge-Kutta formulas. Mathematics of Computation, 46 (173):135–150, 1986.
|
| 266 |
+
|
| 267 |
+
# APPENDIX A QUALITATIVE SAMPLES
|
| 268 |
+
|
| 269 |
+
Samples from our FFJORD models trained on MNIST and CIFAR10 can be found in Figure 7.
|
| 270 |
+
|
| 271 |
+

|
| 272 |
+
Figure 7: Samples and data from our image models. MNIST on left, CIFAR10 on right.
|
| 273 |
+
|
| 274 |
+
# APPENDIX B EXPERIMENTAL DETAILS AND ADDITIONAL RESULTS
|
| 275 |
+
|
| 276 |
+
# B.1 DENSITY ESTIMATION
|
| 277 |
+
|
| 278 |
+
On the tabular datasets we performed a grid-search over network architectures. We searched over models with 1, 2, 5, or 10 flows with 1, 2, 3, or 4 hidden layers per flow. Since each dataset has a different number of dimensions, we searched over hidden dimensions equal to 5, 10, or 20 times the data dimension (hidden dimension multiplier in Table 4). We tried both the tanh and softplus nonlinearities. The best performing models can be found in the Table 4.
|
| 279 |
+
|
| 280 |
+
On the image datasets we experimented with two different model architectures; a single flow with an encoder-decoder style architecture and a multiscale architecture composed of multiple flows.
|
| 281 |
+
|
| 282 |
+
While they were able to fit MNIST and obtain competitive performance, the encoder-decoder architectures were unable to fit more complicated image datasets such as CIFAR10 and Street View House Numbers. The architecture for MNIST which obtained the results in Table 2 was composed of four convolutional layers with $6 4 \to 6 4 \to 1 2 8 \to 1 2 8$ filters and down-sampling with strided convolutions by two every other layer. There are then four transpose-convolutional layers who’s filters mirror the first four layers and up-sample by two every other layer. The softplus activation function is used in every layer.
|
| 283 |
+
|
| 284 |
+
The multiscale architectures were inspired by those presented in Dinh et al. (2017). We compose multiple flows together interspersed with “squeeze” operations which down-sample the spatial resolution of the images and increase the number of channels. These operations are stacked into a “scale block” which contains $N$ flows, a squeeze, then $N$ flows. For MNIST we use 3 scale blocks and for CIFAR10 we use 4 scale blocks and let $N = 2$ for both datasets. Each flow is defined by 3 convolutional layers with 64 filters and a kernel size of 3. The softplus nonlinearity is used in all layers.
|
| 285 |
+
|
| 286 |
+
Both models were trained with the Adam optimizer (Kingma & Ba, 2015). We trained for 500 epochs with a learning rate of .001 which was decayed to .0001 after 250 epochs. Training took place on six GPUs and completed after approximately five days.
|
| 287 |
+
|
| 288 |
+
# B.2 VARIATIONAL AUTOENCODER
|
| 289 |
+
|
| 290 |
+
Our experimental procedure exactly mirrors that of Berg et al. (2018). We use the same 7-layer encoder and decoder, learning rate (.001), optimizer (Adam Kingma & Ba (2015)), batch size (100), and early stopping procedure (stop after 100 epochs of no validaiton improvment). The only difference was in the nomralizing flow used in the approximate posterior.
|
| 291 |
+
|
| 292 |
+
We performed a grid-search over neural network architectures for the dynamics of FFJORD. We searched over networks with 1 and 2 hidden layers and hidden dimension 512, 1024, and 2048. We used flows with 1, 2, or 5 steps and wight matrix updates of rank 1, 20, and 64. We use the softplus activation function for all datasets except for Caltech Silhouettes where we used tanh. The best performing models can be found in the Table 5. Models were trained on a single GPU and training took between four hours and three days depending on the dataset.
|
| 293 |
+
|
| 294 |
+
<table><tr><td>Dataset</td><td>nonlinearity</td><td>#layers</td><td>hidden dim multiplier</td><td># flow steps</td><td>batchsize</td></tr><tr><td>POWER</td><td>tanh</td><td>3</td><td>10</td><td>5</td><td>10000</td></tr><tr><td>GAS</td><td>tanh</td><td>3</td><td>20</td><td>5</td><td>1000</td></tr><tr><td>HEPMASS</td><td>softplus</td><td>2</td><td>10</td><td>10</td><td>10000</td></tr><tr><td>MINIBOONE</td><td>softplus</td><td>2</td><td>20</td><td>1</td><td>1000</td></tr><tr><td>BSDS300</td><td> softplus</td><td>3</td><td>20</td><td>2</td><td>10000</td></tr></table>
|
| 295 |
+
|
| 296 |
+
Table 4: Best performing model architectures for density estimation on tabular data with FFJORD.
|
| 297 |
+
|
| 298 |
+
Table 5: Best performing model architectures for VAEs with FFJORD.
|
| 299 |
+
|
| 300 |
+
<table><tr><td>Dataset</td><td>nonlinearity</td><td># layers</td><td>hidden dimension</td><td>#flow steps</td><td>rank</td></tr><tr><td>MNIST</td><td>softplus</td><td>2</td><td>1024</td><td>2</td><td>64</td></tr><tr><td>Omniglot</td><td>softplus</td><td>2</td><td>512</td><td>5</td><td>20</td></tr><tr><td>Frey Faces</td><td>softplus</td><td>2</td><td>512</td><td>2</td><td>20</td></tr><tr><td>Caltech</td><td>tanh</td><td>1</td><td>2048</td><td>1</td><td>20</td></tr></table>
|
| 301 |
+
|
| 302 |
+
B.3 STANDARD DEVIATIONS FOR TABULAR DENSITY ESTIMATION
|
| 303 |
+
|
| 304 |
+
<table><tr><td></td><td>POWER</td><td>GAS</td><td>HEPMASS</td><td>MINIBOONE</td><td>BSDS300</td></tr><tr><td>Real NVP</td><td>-0.17 ± 0.01</td><td>-8.33 ± 0.14</td><td>18.71 ± 0.02</td><td>13.55 ± 0.49</td><td>-153.28 ± 1.78</td></tr><tr><td>Glow</td><td>-0.17 ± 0.01</td><td>-8.15 ± 0.40</td><td>18.92 ± 0.08</td><td>11.35 ± 0.07</td><td>-155.07 ± 0.03</td></tr><tr><td>FFJORD</td><td>-0.46 ± 0.01</td><td>-8.59 ±0.12</td><td>14.92 ± 0.08</td><td>10.43 ± 0.04</td><td>-157.40 ± 0.19</td></tr><tr><td>MADE</td><td>3.08 ± 0.03</td><td>-3.56 ± 0.04</td><td>20.98 ± 0.02</td><td>15.59 ± 0.50</td><td>-148.85 ± 0.28</td></tr><tr><td>MAF</td><td>-0.24 ± 0.01</td><td>-10.08 ± 0.02</td><td>17.70 ± 0.02</td><td>11.75 ± 0.44</td><td>-155.69 ± 0.28</td></tr><tr><td>TAN</td><td>-0.48 ± 0.01</td><td>-11.19 ± 0.02</td><td>15.12 ± 0.02</td><td>11.01 ± 0.48</td><td>-157.03 ± 0.07</td></tr><tr><td>MAF-DDSF</td><td>-0.62 ± 0.01</td><td>-11.96 ± 0.33</td><td>15.09 ± 0.40</td><td>8.86 ± 0.15</td><td>-157.73 ± 0.04</td></tr></table>
|
| 305 |
+
|
| 306 |
+
Table 6: Negative log-likehood on test data for density estimation models. Means/stdev over 3 runs. Real NVP, MADE, MAF, TAN, and MAF-DDSF results on are taken from Huang et al. (2018). In reproducing Glow, we were able to get comparable results to the reported Real NVP by removing the invertible fully connected layers.
|
| 307 |
+
|
| 308 |
+
# APPENDIX C NUMERICAL ERROR FROM THE ODE SOLVER
|
| 309 |
+
|
| 310 |
+
ODE solvers are numerical integration methods so there is error inherent in their outputs. Adaptive solvers (like those used in all of our experiments) attempt to predict the errors that they accrue and modify their step-size to reduce their error below a user set tolerance. It is important to be aware of this error when we use these solvers for density estimation as the solver outputs the density that we report and compare with other methods. When tolerance is too low, we run into machine precision errors. Similarly when tolerance is too high, errors are large, our training objective becomes biased and we can run into divergent training dynamics.
|
| 311 |
+
|
| 312 |
+
Since a valid probability density function integrates to one, we take a model trained on Figure 1 and numerically find the area under the curve using Riemann sum and a very fine grid. We do this for a range of tolerance values and show the resulting error in Figure 8. We set both atol and rtol to the same tolerance.
|
| 313 |
+
|
| 314 |
+

|
| 315 |
+
Figure 8: Numerical integration shows that the density under the model does integrate to one given sufficiently low tolerance. Both log and non-log plots are shown.
|
| 316 |
+
|
| 317 |
+
The numerical error follows the same order as the tolerance, as expected. During training, we find that the error becomes non-negligible when using tolerance values higher than $\bar { 1 0 } ^ { - 5 }$ . For most of our experiments, we set tolerance to $1 0 ^ { - 5 }$ as that gives reasonable performance while requiring few number of evaluations. For the tabular experiments, we use atol $= 1 0 ^ { - 8 }$ and $\mathtt { r t o l } \mathtt { = } 1 0 ^ { - 6 }$ .
|
md/train/rJxpuoCqtQ/rJxpuoCqtQ.md
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LIKELIHOOD-BASED PERMUTATION INVARIANT LOSS FUNCTION FOR PROBABILITY DISTRIBUTIONS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We propose a permutation-invariant loss function designed for the neural networks reconstructing a set of elements without considering the order within its vector representation. Unlike popular approaches for encoding and decoding a set, our work does not rely on a carefully engineered network topology nor by any additional sequential algorithm. The proposed method, Set Cross Entropy, has a natural information-theoretic interpretation and is related to the metrics defined for sets. We evaluate the proposed approach in two object reconstruction tasks and a rule learning task.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Sets are fundamental mathematical objects which appear frequently in the real-world dataset. However, there are only a handful of studies on learning a set representation in the machine learning literature. In this study, we propose a new objective function called Set Cross Entropy (SCE) to address the permutation invariant set generation. SCE measures the cross entropy between two sets that consists of multiple elements, where each element is represented as a multi-dimensional probability distribution in $[ 0 , 1 ] \subset \mathbb { R }$ (a closed set of reals between 0,1). SCE is invariant to the object permutation, therefore does not distinguish two vector representations of a set with the different ordering. The SCE is simple enough to fit in one line and can be naturally interpreted as a formulation of the log-likelihood maximization between two sets derived from a logical statement.
|
| 12 |
+
|
| 13 |
+
The SCE loss trains a neural network in a permutation-invariant manner, and the network learns to output a set. Importantly, this is not to say that the neural network learns to represent a function that is permutation-invariant with regard to the input. The key difference in our approach is that we allow the network to output a vector representation of a set that may have a different ordering than the examples used during the training. In contrast, previous studies focus on learning a function that returns the same output for the different permutations of the input elements. Such scenarios assume that an output value at some index is matched against the target value at the same index.
|
| 14 |
+
|
| 15 |
+
This characteristic is crucial in the tasks where the objects included in the supervised signals (training examples for the output) do not have any meaningful ordering. For example, in the logic rule learning tasks, a first-order logic horn clause does not care about the ordering inside the rule body since logical conjunctions are invariant to permutations, e.g. father $( \mathsf { c } , \mathsf { f } ) \gets ( \bar { \mathsf { p a r e n t } } ( \mathsf { c } , \mathsf { f } ) \wedge \mathsf { m a l e } ( \mathsf { f } ) )$ and fathe $\cdot ( \mathsf { c } , \mathsf { f } ) \gets ( \mathsf { m a l e } ( \mathsf { f } ) \wedge \mathsf { p a r e n t } ( \mathsf { c } , \mathsf { f } ) )$ are equivalent.
|
| 16 |
+
|
| 17 |
+
To apply our approach, no special engineering of the network topology is required other than the standard hyperparameter tuning. The only requirement is that the target output examples are the probability vectors in $[ 0 , 1 ] ^ { N \times \mathbf { \overline { { F } } } }$ , which is easily addressed by an appropriate feature engineering including autoencoders with softmax or sigmoid latent activation.
|
| 18 |
+
|
| 19 |
+
We demonstrate the effectiveness of our approach in two object-set reconstruction tasks and the supervised theory learning tasks that learn to perform the backward chaining of the horn clauses. In particular, we show that the SCE objective is superior to the training using the other set distance metrics, including Hausdorff and set average (Chamfer) distances.
|
| 20 |
+
|
| 21 |
+
# 2 BACKGROUNDS AND RELATED WORK
|
| 22 |
+
|
| 23 |
+
# 2.1 LEARNING A SET REPRESENTATION
|
| 24 |
+
|
| 25 |
+
Previous studies try to discover the appropriate structure for the neural networks that can represent a set. Notable recent work includes permutation-equivariant $/$ invariant layers that addresses the permutation in the input (Guttenberg et al., 2016; Ravanbakhsh et al., 2016; Zaheer et al., 2017).
|
| 26 |
+
|
| 27 |
+
Let $X$ be a vector representation of a set $\{ x _ { 1 } , \ldots , x _ { n } \}$ and $\pi$ be an arbitrary permutation function for a sequence. A function $f ( X )$ is permutation invariant when $\forall \pi$ ; $f ( X ) = f ( \pi ( X ) ) .$ . Zaheer et al. (2017) showed that functions are permutation-invariant iff it can be decomposed into a form
|
| 28 |
+
|
| 29 |
+
$$
|
| 30 |
+
f ( X ) = \rho \Biggl ( \sum _ { x \in X } \phi ( x ) \Biggr )
|
| 31 |
+
$$
|
| 32 |
+
|
| 33 |
+
where $\rho , \phi$ are the appropriate mapping function.
|
| 34 |
+
|
| 35 |
+
However, as mentioned in the introduction, the aim of these layers is to learn the functions that are permutation-invariant with regard to the input permutation, and not to reconstruct a set in a permutation-invariant manner (i.e. ignoring the ordering). In other words, permutationequivariant/invariant layers are only capable of encoding a set.
|
| 36 |
+
|
| 37 |
+
Probst (2018) recently proposed a method dubbed as “Set Autoencoder”. It additionally learns a permutation matrix that is applied before the output so that the output matches the target. The target for the permutation matrix is generated by a Gale-Shapley greedy stable matching algorithm, which requires $O ( n ^ { 2 } )$ runtime. The output is compared against the training example with a conventional loss function such as binary cross entropy or mean squared error, which requires the final output to have the same ordering as the target. Therefore, this work tries to learn the set as well as the ordering between the elements, which is conceptually different from learning to reconstruct a set while ignoring the ordering.
|
| 38 |
+
|
| 39 |
+
Another line of related work utilizes Sinkhorn iterations (Adams & Zemel, 2011; Santa Cruz et al., 2017; Mena et al., 2018) in order to directly learn the permutations. Again, these work assumes that the output is generated in a specific order (e.g. a sorting task), which does not align with the concept of the set reconstruction.
|
| 40 |
+
|
| 41 |
+
# 2.2 SET DISTANCE
|
| 42 |
+
|
| 43 |
+
Set distances / metrics are the binary functions that satisfy the metric axioms. They have been utilized for measuring the visual object matching or for feature selection (Huttenlocher et al., 1993; Dubuisson & Jain, 1994; Piramuthu, 1999). Note that, however, in this work, we use the informal usage of the terms “distance” or “metric” for any non-negative binary functions that may not satisfy the metric axioms.
|
| 44 |
+
|
| 45 |
+
There are several variants of set distances. Hausdorff distance between sets (Huttenlocher et al., 1993) is a function that satisfies the metric axiom. For two sets $X$ and $Y$ , the directed Hausdorff distance with an element-wise distance $d ( x , y )$ is defined as follows:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
{ \mathcal { H } } _ { 1 d } ( X , Y ) = \operatorname* { m a x } _ { x \in X } \operatorname* { m i n } _ { y \in Y } d ( x , y )
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
The element-wise distance $d$ is Euclidean distance or Hamming distance, for example, depending on the target domain.
|
| 52 |
+
|
| 53 |
+
Set average (pseudo) distance (Dubuisson & Jain, 1994, Eq.(6)), also known as Chamfer distance, is a modification of the original Hausdorff distance which aggregates the element-wise distances by summation. The directed version is defined as follows:
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
A _ { 1 d } ( X , Y ) = { \frac { 1 } { | X | } } \sum _ { x \in X } \operatorname* { m i n } _ { y \in Y } d ( x , y ) .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
Set average distance has been used for image matching, as well as to autoencode the 3D point clouds in the euclidean space for shape matching (Zhu et al., 2016).
|
| 60 |
+
|
| 61 |
+
# 3 SET CROSS ENTROPY
|
| 62 |
+
|
| 63 |
+
Inspired by the various set distances, we propose a straightforward formulation of likelihood maximization between two sets of probability distributions. In what follows, we define the cross entropy between two sets $X , Y \in [ 0 , \dot { 1 } ] ^ { N \times F }$ , where $[ 0 , 1 ]$ is a closed set of reals between 0 and 1.
|
| 64 |
+
|
| 65 |
+
Let $\mathcal { X } = \left\{ X ^ { ( 1 ) } , X ^ { ( 2 ) } , . . . \right\}$ be the training dataset, and $Y$ be the output matrix of a neural network. Assume that each $X \in { \mathcal { X } }$ consists of $N$ elements where each element is represented by $F$ features, i.e. $X = \{ x _ { 1 } \ldots x _ { N } \} , x _ { i } \in \mathbb { R } ^ { F }$ . We further assume that $x _ { i } \in [ 0 , 1 ] ^ { F }$ by a suitable transformation, which can be done by the feature learning with sigmoid activation added to the latent layer. The set $X$ actually takes the vector representation, which essentially makes $X \in [ 0 , 1 ] ^ { N \times F }$ . In this paper, we focus on the binomial distribution. However, the proposed method naturally extends to the multinomial case.
|
| 66 |
+
|
| 67 |
+
For simplicity, we assume that the number of elements in the set $X$ and $Y$ is known and fixed to $N$ . Therefore $Y$ is also a matrix in $[ 0 , 1 ] ^ { N \times F }$ . Furthermore, we assume that $X$ is preprocessed and contains no duplicated elements.
|
| 68 |
+
|
| 69 |
+
In practice, if $| X |$ varies across the dataset, it suffices to take $N ^ { \mathrm { m a x } } = \operatorname* { m a x } _ { X \in { \mathcal { X } } } | X |$ , the largest number of elements in $X$ across the dataset $\mathcal { X }$ , and add the dummy, distinct objects $d _ { 0 } \dots d _ { N ^ { \mathrm { m a x } } }$ to fill in the blanks. For example, when there are $N$ objects of $F$ features and we want to normalize the size of the set to $N ^ { \prime } ( > N )$ , one way is to add an additional axis to the feature vector $( F + 1$ features) where the additional $F + 1$ -th feature is 0 for the real data and 1 for the dummy data, and the additional $N ^ { \prime } - N$ objects are generated in an arbitrary way (e.g. as a binary sequence 100000, 100001, 100010, 100011, ... for $F = 5$ )
|
| 70 |
+
|
| 71 |
+
For measuring the similarity between the two probability vectors $x , y \in [ 0 , 1 ] ^ { F }$ , the natural loss function would be the cross entropy $\operatorname { H } ( x , y )$ or, equivalently, the negative log likelihood.
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathrm { H } ( x , y ) = \mathbb { E } _ { x } \langle - \log P ( x = y ) \rangle = \sum _ { i = 1 } ^ { F } - x _ { i } \log y _ { i } - ( 1 - x _ { i } ) \log ( 1 - y _ { i } ) .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
However, applying it directly to the matrices $X , Y$ unnecessarily limits the global optima of this loss because it does not consider the permutations between $N$ objects, e.g., for $X = [ o _ { 1 } , o _ { 2 } , o _ { 3 } ]$ , $Y = \left[ o _ { 2 } , o _ { 3 } , o _ { 1 } \right]$ is not the global minima of $\mathrm { H } ( X , Y )$ . Previous approach (Probst, 2018) tried to solve this problem by learning an additional permutation matrix that “fixes” the order, basically requiring to memorize the ordering.
|
| 78 |
+
|
| 79 |
+
We take a different approach of directly fixing this loss function. The target objective is to maximize the probability of two sets being equal, thus ideally, at the global minima, two sets $X$ and $Y$ should be equal. Equivalence of two sets is defined as:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
{ \begin{array} { r l } { X = Y \Longleftrightarrow X \subseteq Y \wedge X \supseteq Y } \\ & { \qquad \Longleftrightarrow ( \forall x \in X ; x \in Y ) \wedge ( \forall y \in Y ; y \in X ) . } \end{array} }
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
However, under the assumption that $| X | = | Y | = N$ and $X$ contains $N$ distinct elements (no duplicates), $X \subseteq Y$ is a sufficient condition for $X = Y$ . (Proof: If $X \subseteq Y$ and $X ~ \nsupseteq ~ Y$ , there are some $y ^ { \prime } \in Y$ such that $y ^ { \prime } \not \in X$ . Since $N$ distinct elements in $X$ are also included in $Y , y ^ { \prime }$ becomes $Y$ ’s $N + 1$ -th element, which contradicts $| Y | = N$ . Note that this proof did not depend on the distinctness of $Y$ ’s elements.)
|
| 86 |
+
|
| 87 |
+
Under this condition, therefore,
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
{ \begin{array} { r l } { X = Y \Longleftrightarrow X \subseteq Y } \\ & { \Longleftrightarrow \forall x \in X ; x \in Y } \\ & { \Longleftrightarrow \forall x \in X ; \exists y \in Y ; x = y } \\ & { \Longleftrightarrow \bigwedge { \bigvee } x = y . } \end{array} }
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
We now translate this logical formula into the corresponding log likelihood as follows:
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\begin{array} { l } { \log P ( X = Y ) = \log P ( \bigwedge \bigvee = y ) = \displaystyle \sum _ { z \in X } \log P ( \bigvee X = y ) } \\ { \qquad x \leqslant x X \leqslant z \quad } \\ { \quad } \\ { \quad } \\ { \qquad = \displaystyle \sum _ { z \in X } \log \displaystyle \sum _ { y \in Y } P ( x = y ) \quad : \mathrm { ~ e a c h ~ } x = y _ { \mathrm { t } } \mathrm { ~ a r e ~ m u t a l } } \\ { \qquad } \\ { \quad = \displaystyle \sum _ { z \in X } \log \displaystyle \sum _ { y \in Y } \exp ( x = y ) } \\ { \qquad = \displaystyle \sum _ { z \in X } \log \operatorname* { m u e r } _ { y \in Y } \log P ( x = y ) } \\ { \qquad \quad = \displaystyle \sum _ { z \in X } \log \operatorname* { s u p } ( x = y ) , } \\ { \quad \mathrm { s e t ~ C n o s ~ E n t r o p } ; \quad \mathrm { S H } ( X , Y ) \stackrel { \mathrm { d i } } { = } \mathbb { E } _ { X } \langle - \log P ( X = Y ) \rangle } \\ { \qquad = \displaystyle - \sum _ { \mathrm { ~ l o s s u m e r ~ o p } , \mathrm { e x p } ( - \mathbb { H } ( x , y ) ) . } } \end{array}
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
∵ each $x$ is independent.
|
| 100 |
+
|
| 101 |
+
This Set Cross Entropy has the following characteristics: First, compared to the original cross entropy loss, whose global minima is limited to the data point that preserves the same ordering of the elements, SCE increases the number of global minima exponentially by making every permutations of the point also the global minima.
|
| 102 |
+
|
| 103 |
+
Next, notice that logsumexp is a smooth upper approximation of the maximum, therefore $\operatorname { S H } ( X , Y )$ is upper-bounded by the set average equivalent,
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\operatorname { S H } ( X , Y ) \leq - \sum _ { x \in X } \operatorname* { m a x } _ { y \in Y } ( - \mathrm { H } ( x , y ) ) = \sum _ { x \in X } \operatorname* { m i n } _ { y \in Y } \mathrm { H } ( x , y ) = N \cdot A _ { \operatorname { I H } } ( X , Y ) .
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
Intuitively, this is because Eq.9 returns a value which does not account for the possibility that the current closest $y = \arg \operatorname* { m i n } _ { y } \mathrm { H } ( x , y )$ of $x$ may not converge to the $x$ in the future during the training.
|
| 110 |
+
|
| 111 |
+
We illustrate this by comparing two examples: Let $X = \{ [ 0 , 1 ] , [ 0 , 0 ] \}$ , $Y _ { 1 } = \{ [ 0 . 1 , 0 . 5 ] , [ 0 . 1 , 0 . 5 ] \}$ and $Y _ { 2 } = \{ [ 0 . 1 , 0 . { \bar { 5 } } ] , [ 0 . 9 , 0 . 5 ] \}$ . The set cross entropy Eq.8 reports the smaller loss for ${ \mathrm { S H } } ( X , Y _ { 1 } ) =$ $- \log 0 . 8 1 ~ \approx ~ 0 . 0 9$ than for $\mathrm { S H } ( X , Y _ { 2 } ) ~ = ~ - \log { 0 . 2 5 } ~ \approx ~ 0 . 6 0 .$ . This is reasonable because the global minima is given when the first axis of both $y \mathrm { s }$ are $0 \mathrm { ~ - ~ } Y _ { 2 }$ should be more penalized than $Y _ { 1 }$ for the 0.9 in the second element. In contrast, Eq.9 considers only the closest element ( $\mathrm { a r g m i n } _ { y \in Y } \mathrm { H } ( x , y ) ~ = ~ [ 0 . 1 , 0 . 5 ] )$ for each $x$ , therefore returns the same loss $=$ $- \log { 0 . 2 0 2 5 } \approx 0 . 6 9$ for both cases, ignoring [0.9, 0.5] completely. In fact, Eq.9 has zero gradient at $Y = \{ [ 0 , 0 . 5 ] , [ y , 0 . 5 ] \}$ for any $y \in [ 0 , 1 ]$ .
|
| 112 |
+
|
| 113 |
+
Furthermore, the following inequality suggests that the traditional cross entropy between the matrices $X$ and $Y$ is an even looser upper bound of Eq.9. Here, $x _ { i } , y _ { i }$ are the $i$ -th element of the vector representation of $X$ and $Y$ , respectively:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\begin{array} { l } { \displaystyle \mathrm { S H } ( X , Y ) \leq \sum _ { x \in X } \displaystyle \operatorname* { m i n } _ { y \in Y } \mathrm { H } ( x , y ) \qquad } & { \therefore \mathrm { E q . } 9 } \\ { \leq \displaystyle \sum _ { x _ { i } \in X } \mathrm { H } ( x _ { i } , y _ { i } ) \qquad } & { \therefore \forall y _ { i } ; \displaystyle \operatorname* { m i n } _ { y \in Y } \mathrm { H } ( x , y ) \leq \mathrm { H } ( x , y _ { i } ) } \end{array}
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
This gives a natural interpretation that ignoring the permutation reduces the cross entropy.
|
| 120 |
+
|
| 121 |
+
# 4 EVALUATION
|
| 122 |
+
|
| 123 |
+
# 4.1 OBJECT SET RECONSTRUCTION
|
| 124 |
+
|
| 125 |
+
The purpose of the task is to obtain the latent representation of a set of objects and reconstruct them, where each object is represented as a feature vector. We prepared two datasets originating from classical AI domains: Sliding tile puzzle (8-puzzle) and Blocksworld.
|
| 126 |
+
|
| 127 |
+
Learning to reason about the object-based, set representation of the environment is crucial in the robotic systems that continuously receive the list of visible objects from the visual perception module (e.g. Redmon et al. (2016, YOLO)). In a real-world systems, appropriate handling of the set is necessary because it is unnatural to assume that the objects in the environments are always reported in the same order. In particular, the objects even in the same environment state may be reported in various orders if multiple such modules are running in parallel in an asynchronous manner.
|
| 128 |
+
|
| 129 |
+
In this experiment, we show that the permutation invariant loss function like SCE is necessary for learning to reconstruct a set in such a scenario. In this setting, a network is required to reconstruct a set from a single latent representation, while the objects as the target output may be randomly reordered each time the same set is observed and presented to the neural network.
|
| 130 |
+
|
| 131 |
+
# 8 PUZZLE
|
| 132 |
+
|
| 133 |
+
Each feature vector as an object consists of 15 features, 9 of which represent the tile number (object ID) and the remaining 6 represent the coordinates. Each data point has 9 such vectors, corresponding to the 9 objects in a single tile configuration. The entire state space of the puzzle is 362880 states. We generated 5000 states and used the 4500 states as the training set.
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 1: A single 8-puzzle state as a $9 \mathrm { x } 1 5$ matrix, representing 9 objects of 15 features. The first 9 features are the tile numbers and the other 6 features are the 1-hot x/y-coordinates.
|
| 137 |
+
|
| 138 |
+
We prepared an autoencoder with the permutation invariant layers (Zaheer et al., 2017) as the encoder and the fully-connected layers as the decoder. Since it uses a permutation-invariant encoder, the latent space is already guaranteed to learn a representation that is invariant to the input ordering. The key question here is then whether they can be robustly trained against the random permutations in the training examples for the output.
|
| 139 |
+
|
| 140 |
+
We tested the reconstruction ability in four scenarios: (1) In the first scenario, the dataset is provided in a standard manner. (2) In the second scenario, we augment the input dataset by repeating the elements 5 times and randomly reorder the object vectors in each set. The randomized dataset is used as the input to the network, while the target output is still the original dataset (repeated 5 times, without reordering). The purpose of this experiment is to verify the claim of the Deep Set (Zaheer et al., 2017) that it is able to handle the input in a permutation invariant manner. In order to compensate the datasize difference, the maximum training epoch is reduced by 1/5 times compared to the first scenario. (3) In the third scenario, we apply the similar operation to the target output of the network. Essentially we always feed the input in the same fixed order while forcing it to learn from the randomized target output. Each time the same data is presented, the target output has the different ordering while the input has the fixed ordering. Therefore, the training should be performed in such a way that the ordering in the output is properly ignored. (4) Finally, in the fourth scenario, the ordering in both the input and the output are randomized.
|
| 141 |
+
|
| 142 |
+
We trained the same network with four different loss functions, (a) the traditional cross entropy H, (b) Set Cross Entropy SH, (c) directed set average of the cross entropy $A _ { \mathrm { 1 H } }$ and (d) the directed Hausdorff measure of the cross entropy $\mathcal { H } _ { \mathrm { 1 H } }$ , resulting in 16 training scenarios in total. We performed the same experiment 10 times and took the statistics. The purpose of this is to address the potential concern about the stability of the training. We kept the same set of training/testing data, and the only difference between the runs is the random seed.
|
| 143 |
+
|
| 144 |
+
We first measured the Set Cross Entropy value between the test dataset and its reconstruction in the above 16 scenarios. Table 1 shows the results. The training with the standard cross entropy loss (H) succeeds in cases (1,2) while failed in cases (3,4). The case (2) reproduces the claim in (Zaheer et al., 2017) that it encodes the input in an permutation-invariant manner, while it failed in the latter cases because the training is not permutation-invariant with regard to the output. In contrast, the training with the Set Cross Entropy loss succeeds in all cases. This shows that the permutation-invariant loss function is necessary for training a network with a dataset consisting of sets.
|
| 145 |
+
|
| 146 |
+
The training with set average distance $A _ { \mathrm { 1 H } }$ also reduces the Set Cross Entropy because it is an upper-bound approximation of the Set Cross Entropy. However, in one of the 10 runs, $A _ { \mathrm { 1 H } }$ did not converge, showing that the A1H (baseline) could be unstable, possibly due to the issue explained in the example at the end of section 3. In contrast, the training with Hausdorff distance failed to learn the representation at all.
|
| 147 |
+
|
| 148 |
+
<table><tr><td rowspan="2"></td><td colspan="8">Test error in 1O runs (measured by SH)</td></tr><tr><td colspan="4">Best</td><td colspan="4">Worst</td></tr><tr><td>Target ordering</td><td>Fixed</td><td></td><td>Random</td><td></td><td>Fixed</td><td></td><td>Random</td><td></td></tr><tr><td>Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H SH</td><td>0.00 0.00</td><td>0.00</td><td>29.28 0.00</td><td>30.79</td><td>5.04 0.15</td><td>0.01</td><td>42.24</td><td>41.91 0.07</td></tr><tr><td>A1H</td><td></td><td>0.00</td><td>0.00</td><td>0.00</td><td></td><td>0.03 133.34</td><td>0.10 0.09</td><td>0.00</td></tr><tr><td>H1H</td><td>0.00 28.27</td><td>0.00 28.28</td><td>28.26</td><td>0.00 28.26</td><td>0.14 233.47</td><td>167.74</td><td>184.41</td><td>196.14</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>Mean</td><td></td><td></td></tr><tr><td></td><td colspan="4">Median</td><td colspan="4"></td></tr><tr><td>Target ordering</td><td>Fixed</td><td></td><td></td><td>Random</td><td>Fixed</td><td></td><td>Random</td><td></td></tr><tr><td>Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H</td><td>0.04</td><td>0.00</td><td>32.87</td><td>32.57</td><td>0.59</td><td>0.00</td><td>34.14</td><td>33.44</td></tr><tr><td>SH</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.02</td><td>0.00</td><td>0.02</td><td>0.01</td></tr><tr><td>A1H</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.02</td><td>13.39</td><td>0.01</td><td>0.00</td></tr><tr><td>H1H</td><td>31.85</td><td>28.39</td><td>31.33</td><td>28.56</td><td>77.85</td><td>59.27</td><td>50.37</td><td>67.50</td></tr></table>
|
| 149 |
+
|
| 150 |
+
Table 1: The summary of test errors out of 10 runs. Best results in bold. SH and $A _ { \mathrm { 1 H } }$ both succeeded to achieve a good log likelihood sufficiently often. The set average $A _ { \mathrm { 1 H } }$ however suffered from a divergence in one training instance, showing its potential instability. The traditional cross entropy H fails to converge when the output is presented in a different order in each iteration. Hausdorff distance failed to converge in all cases.
|
| 151 |
+
|
| 152 |
+
We next measured the rate of the successful reconstruction among the entire dataset. The “successful reconstruction” is defined as follows: Recall that every data point is a discrete binary vector in the 8-Puzzle dataset while the output of the network is a continuous $N \times F$ matrix of reals between 0 and 1. Therefore, we round the output of the network to $0 / 1$ and directly compare the result with the input. If every object vector in a set is matched by some of the output object vector, then it is counted as a success. Similar results were obtained in Table 6: SH and $A _ { \mathrm { 1 H } }$ both succeeded to achieve a high success rate, while other two metrics completely failed. (We rerun the experiment, therefore the divergence of $A _ { \mathrm { 1 H } }$ in the previous experiment did not happen this time.)
|
| 153 |
+
|
| 154 |
+
Finally, to address the claim that the network is able to learn from the dataset with the variable set size, we performed an experiment which applies the dummy-vector scheme (Sec. 3). In this experiment, we modified the dataset to model such a scenario by randomly dropping one to five elements out of 9 elements. The maximum number of elements is 9. The dropping scheme is specified as follows: Out of the 5000 states generated in total (including the training / testing dataset), approximately half of the states have 9 tiles, $1 / 4$ of the states have 8 tiles, ... and $1 / 2 ^ { 5 }$ of the states have 5 tiles. The elements to drop are selected randomly.
|
| 155 |
+
|
| 156 |
+
The results in Table 3 shows that the training with our proposed SH loss function achieves the best success ratio for the reconstruction. The reconstruction includes the dummy vectors, indicating that the network is able to represent not only the elements in the set but also the number of the missing elements.
|
| 157 |
+
|
| 158 |
+
# BLOCKSWORLD
|
| 159 |
+
|
| 160 |
+
In order to test the reconstruction ability for the more complex feature vectors, we prepared a photorealistic Blocksworld dataset (Fig. 2) which contains the blocks world states rendered by Blender 3D engine. There are several cylinders or cubes of various colors and sizes and two surface materials (Metal/Rubber) stacked on the floor, just like in the usual STRIPS (McDermott, 2000) Blocksworld domain. In this domain, three actions are performed: move a block onto another stack or on the
|
| 161 |
+
|
| 162 |
+
Table 2: The summary of the success rate for the 10 runs of 16 training scenarios. Best results in bold. SH and $A _ { \mathrm { 1 H } }$ both succeeded to reconstruct the binary vectors in the 8 puzzles. The traditional cross entropy $\mathrm { H }$ and the Hausdorff distance $\mathcal { H } _ { \mathrm { 1 H } }$ both failed to reconstruct the binary vectors.
|
| 163 |
+
|
| 164 |
+
<table><tr><td colspan="9">Reconstruction success ratio in 1O runs</td></tr><tr><td></td><td colspan="4">Best</td><td colspan="4">Worst</td></tr><tr><td>Target ordering</td><td colspan="2">Fixed</td><td colspan="2">Random</td><td colspan="2">Fixed</td><td colspan="2">Random</td></tr><tr><td>Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H SH</td><td>0.00</td><td>0.00</td><td>0.00 1.00</td><td>0.00 1.00</td><td>0.00 1.00</td><td>0.00 1.00</td><td>0.00</td><td>0.00 1.00</td></tr><tr><td>A1H</td><td>1.00 1.00</td><td>1.00</td><td></td><td>1.00</td><td>1.00</td><td></td><td>0.89</td><td>1.00</td></tr><tr><td>H1H</td><td>0.00</td><td>1.00 0.00</td><td>1.00 0.00</td><td>0.00</td><td>0.00</td><td>1.00 0.00</td><td>1.00</td><td></td></tr><tr><td></td><td></td><td>Median</td><td></td><td></td><td></td><td></td><td>0.00</td><td>0.00</td></tr><tr><td></td><td colspan="4"></td><td colspan="4">Mean</td></tr><tr><td>Target ordering</td><td>Fixed</td><td></td><td>Random</td><td></td><td>Fixed</td><td></td><td>Random</td><td></td></tr><tr><td>Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H SH</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>0.99</td><td>1.00</td></tr><tr><td>A1H</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td></tr><tr><td>H1H</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr></table>
|
| 165 |
+
|
| 166 |
+
<table><tr><td colspan="9"></td></tr><tr><td></td><td colspan="4">Best</td><td colspan="3">Worst</td></tr><tr><td>Target ordering</td><td>Fixed</td><td></td><td>Random</td><td></td><td>Fixed</td><td></td><td>Random</td></tr><tr><td>Input ordering H</td><td>Fixed</td><td>Random 0.49</td><td>Fixed 0.05</td><td>Random 0.56</td><td>Fixed Random 0.00</td><td>Fixed 0.00</td><td>Random 0.00</td></tr><tr><td>SH</td><td>0.03 0.62</td><td>0.63 0.65</td><td>0.65</td><td>0.52</td><td>0.00 0.54</td><td>0.57</td><td>0.54</td></tr><tr><td>A1H</td><td>0.62</td><td>0.62 0.60</td><td>0.59</td><td>0.52</td><td>0.09</td><td>0.51</td><td>0.50</td></tr><tr><td>H1H</td><td>0.00</td><td>0.00 0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td></td><td>Median</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td colspan="4"></td><td colspan="4">Mean</td></tr><tr><td>Target ordering</td><td>Fixed</td><td></td><td>Random</td><td></td><td>Fixed</td><td></td><td>Random</td><td></td></tr><tr><td>Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H SH</td><td>0.00</td><td>0.12</td><td>0.00</td><td>0.27 0.60</td><td>0.01</td><td>0.17</td><td>0.01</td><td>0.31</td></tr><tr><td></td><td>0.57</td><td>0.59</td><td>0.60</td><td></td><td>0.58</td><td>0.59</td><td>0.61</td><td>0.60</td></tr><tr><td>A1H</td><td>0.59</td><td>0.57</td><td>0.57</td><td>0.56</td><td>0.58</td><td>0.53</td><td>0.57</td><td>0.56</td></tr><tr><td>H1H</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr></table>
|
| 167 |
+
|
| 168 |
+
Table 3: The summary of the success rate for the 10 runs of 16 training scenarios, where the size of the set randomly varies from 4 to 9 in the dataset. Best results in bold. The proposed SH achieved the best success rate overall, $A _ { \mathrm { 1 H } }$ comes next, the traditional cross entropy H and the Hausdorff distance $\mathcal { H } _ { \mathrm { 1 H } }$ both failed in most cases.
|
| 169 |
+
|
| 170 |
+
floor, and polish/unpolish a block i.e. change the surface of a block from Metal to Rubber or vice versa. All actions are applicable only when the block is on top of a stack or on the floor. The latter actions allow changes in the non-coordinate features of the object vectors.
|
| 171 |
+
|
| 172 |
+

|
| 173 |
+
Figure 2: An example Blocksworld transition. Each state has a perturbation from the jitter in the light positions and the ray-tracing noise. Objects have the different sizes, colors, shapes and surface materials. Regions corresponding to each object in the environment are extracted according to the bounding box information included in the dataset generator output, but is ideally automatically extracted by object recognition methods such as YOLO (Redmon et al., 2016). Other objects may intrude the extracted regions.
|
| 174 |
+
|
| 175 |
+
The dataset generator produces a $3 0 0 { \bf x } 2 0 0$ RGB image and a state description which contains the bounding boxes (bbox) of the objects. Extracting these bboxes is a object recognition task we do not address in this paper, and ideally, should be performed by a system like YOLO (Redmon et al., 2016). We resized the extracted image patches in the bboxes to $3 2 \mathrm { x } 3 2 $ RGB, compressed it into a feature vector of 1024 dimensions with a convolutional autoencoder, then concatenated it with the bbox $( x _ { 1 } , y _ { 1 } , x _ { 2 } , y _ { 2 } )$ which is discretized by 5 pixels and encoded as 1-hot vectors (60/40 categories for $x / y$ -axes), resulting in 1224 features per object. The generator is able to enumerate all possible states (80640 states for 5 blocks and 3 stacks). We used 2250 states as the training set and 250 states as the test set.
|
| 176 |
+
|
| 177 |
+
We also verified the results qualitatively. Some reconstruction results are visualized in Fig. 3. These visualizations are generated by pasting the image patches decoded from the first 1024 axes of the reconstructed 1224-D feature vectors in a position specified by the reconstructed bounding box in the last 200 axes.
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
Figure 3: The visualizations of the Blocksworld state input (left), its reconstruction (middle) and their pixel-wise difference (right). From the left, each three columns represent (a) the traditional cross entropy H, (b) Set Cross Entropy SH, (c) directed set average of the cross entropy $A _ { \mathrm { 1 H } }$ and (d) the directed Hausdorff measure of the cross entropy $\mathcal { H } _ { \mathrm { 1 H } }$ . The proposed (b) Set Cross Entropy correctly reconstructs the input.
|
| 181 |
+
|
| 182 |
+
Results in Table 4 shows that the training with SH and $A _ { \mathrm { 1 H } }$ achieved a better test error compared to the other metrics.
|
| 183 |
+
|
| 184 |
+
<table><tr><td colspan="5">Best test error in 1O runs (measured by SH) Random</td></tr><tr><td>Target ordering</td><td colspan="4">Fixed</td></tr><tr><td>Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H</td><td>3360.22</td><td>3360.26</td><td>3425.89</td><td>3434.60</td></tr><tr><td>SH</td><td>3253.70</td><td>3260.04</td><td>3251.32</td><td>3252.71</td></tr><tr><td>A1H</td><td>3258.84</td><td>3251.74</td><td>3261.13</td><td>3264.82</td></tr><tr><td>H1H</td><td>3409.58</td><td>3410.77</td><td>3415.18</td><td>3373.22</td></tr></table>
|
| 185 |
+
|
| 186 |
+
Table 4: The best results of 10 runs. Both SH and $A _ { \mathrm { 1 H } }$ successfully converged below the sufficient accuracy.
|
| 187 |
+
|
| 188 |
+
In Table 5, as another metric with the more intuitive sense, we measure the difference between the visualization results of the input and the output (as shown in Fig. 3) by the Root Mean Squared Error of the pixel values averaged over RGB, pixels and the dataset. Each pixel is represented in the $[ 0 , 1 ]$ range (closed set of reals between 0 and 1), thus the 0.1 on the table means that pixels differ by 0.1 on average.
|
| 189 |
+
|
| 190 |
+
<table><tr><td rowspan="2"></td><td colspan="4">RMSE between the visualized image</td></tr><tr><td colspan="2">Fixed</td><td colspan="2">Random</td></tr><tr><td>Target ordering Input ordering</td><td>Fixed</td><td>Random</td><td>Fixed</td><td>Random</td></tr><tr><td>H</td><td>0.10</td><td>0.10</td><td>0.15</td><td>0.15</td></tr><tr><td>SH</td><td>0.08</td><td>0.08</td><td>0.07</td><td>0.08</td></tr><tr><td>A1H</td><td>0.08</td><td>0.10</td><td>0.08</td><td>0.08</td></tr><tr><td>H1H</td><td>0.14</td><td>0.15</td><td>0.16</td><td>0.15</td></tr></table>
|
| 191 |
+
|
| 192 |
+
Table 5: The best results of 10 runs. Both SH and $A _ { \mathrm { 1 H } }$ successfully converged below the sufficient accuracy.
|
| 193 |
+
|
| 194 |
+
# 4.2 RULE LEARNING ILP TASKS
|
| 195 |
+
|
| 196 |
+
The purpose of this task is to learn to generate the prerequisites (body) of the first-order-logic horn clauses from the head of the clause. Unlike the previous tasks, this task is not an autoencoding task. The bodies are considered as a set because the order of the terms inside a body does not matter for the clause to be satisfied.
|
| 197 |
+
|
| 198 |
+
The main purpose of this experiment is to show the effectiveness of our approach on set generation, not to demonstrate a more general neural theorem proving system. An interesting avenue of future work is to see how our approach can help the existing work on neural theorem proving.
|
| 199 |
+
|
| 200 |
+
We used a Countries dataset (Bouchard et al., 2015) that contains 163 countries and trained the models for $n$ -hop neighbor relations. For example, for $\begin{array} { r l r l } { n } & { { } = } & { 2 } \end{array}$ , given a head neighbor2(austria, germany, belgium) as an input, the task is to predict the body {neighborOf(austria, germany), neighborOf(germany, belgium)}, which is a set of two terms. This is a weaker form of a more general backward chaining used in Neural Theorem Proving (Rocktaschel ¨ & Riedel, 2017) because the output does not contain free variables.
|
| 201 |
+
|
| 202 |
+
In the $n$ -neighbor scenario, the input is a $2 + 1 6 3 ( n + 1 )$ -dimensional vector, which consists of a one-hot label of 2 categories for the predicate of the head, and $n + 1$ one-hot labels of 163 categories for the arguments of the head. For example, a head neighbor2(austria, germany, belgium) spends 2 dimensions for identifying the predicate neighbor2, and three 1-hot vectors of 163 categories for representing austria,germany,belgium. The output is a $n \times 3 2 8$ matrix, where each row represents a binary predicate $( 3 2 8 ~ = ~ 2 + 2 ~ { \cdot } ~ 1 6 3 )$ . This is again because the answer is {neighborOf(austria, germany), neighborOf(germany, belgium)}: There are 2 elements in the set, thus the output is a $2 \times 3 2 8$ matrix. Each element uses 2 dimensions for identifying the predicate head neighborOf and two 1-hot vectors of 163 categories for the arguments (e.g. austria and germany).
|
| 203 |
+
|
| 204 |
+
We trained the network with the neighbor- $^ n$ datasets ranging from $n = 2$ to $n = 5$ (see the result table for the detailed domain characteristics). The softmax output of the network is parsed back to the symbolic representation by selecting the index that gives the maximum probability, then compared against the test examples as a set. We counted the ratio of the clauses across the test set where every body term matches against one of the output terms. The output data (body terms) may have an arbitrary ordering, and we have another variant similar to the previous experiment: In the randomized body order dataset, the dataset is repeated 5 times, while the ordering of the terms inside each body is randomly shuffled.
|
| 205 |
+
|
| 206 |
+
Table 6 shows that the network with Set Cross Entropy achieved the best accuracy, set average generally comes in the second and the traditional cross entropy struggles. This trend was observed not only in the the randomized-body-ordering dataset, which observes the same body in a different order in each iteration, but also in the fixed-body-ordering dataset. This shows that the Set Cross Entropy relaxes the search space by adding more global minima and making the training easier.
|
| 207 |
+
|
| 208 |
+
# 5 DISCUSSION
|
| 209 |
+
|
| 210 |
+
Vinyals et al. (2016) repeatedly emphasized the advantage of limiting the possible equivalence classes of the outputs by engineering the training data for solving the combinatorial problems. For example, they pre-sorted the training example for the Delaunay triangulation (set of triangles) by the lexicographical order and trained an LSTM model with the standard cross entropy (Vinyals et al., 2015). However, this is an ad-hoc method that depends on the particular domain knowledge and, as we have shown, the difficulty of learning such an output was caused by the loss function that considers the ordering. Moreover, we showed that the standard cross entropy and the set average metrics are the less tighter upper bound of the proposed Set Cross Entropy and also that it empirically outperforms the standard cross entropy in the theory learning task, even if a specific ordering is imposed on the output.
|
| 211 |
+
|
| 212 |
+
One limitation of the current approach is that the set cross entropy contains a double-loop, therefore takes $O ( N ^ { 2 } )$ runtime for a set of $N$ objects. However, unlike the algorithm proposed in Probst (2018), which uses a sequential Gale-Shapley algorithm which also uses $O ( N ^ { 2 } )$ runtime, our loss function can be efficiently implemented on GPUs because it consists of a simple combination of logsumexp and summation.
|
| 213 |
+
|
| 214 |
+
Still, improving the runtime complexity is an important direction for future work because the other set reconstruction tasks, including 3D point clouds datasets like Shapenet (Chang et al., 2015), may contain a much larger number of elements in each set. A promising candidate for tacking this difficulty is to combine Set Cross Entropy with Approximate $k$ -Nearest Neighbor (Indyk & Motwani, 1998) methods, especially the Locality Sensitive Hashing (Wang et al., 2016, LSH). LSH can preprocess and divide the target output $X$ into the subsets within a certain radius and we can limit the inner loop to each subset. The resulting method can be seen as the midpoint of Set Cross Entropy and set average because set average (Eq.9) is the special case of this extension that uses the nearest neighbor $( \operatorname* { m i n } _ { y \in Y } H ( x , y ) )$ and worked reasonably well in the tasks evaluated in this paper. The main obstacle for this approach would be to extend Set Cross Entropy to a metric variant that satisfies the metric axioms (non-negativity, identity, symmetry, the triangular inequality) that is required for LSH methods in general. One candidate in this direction is a variant of Jensen-Shannon divergence called S2JSD (Endres & Schindelin, 2003), which satisfies the metric axioms and has a LSH method (Mao et al., 2017).
|
| 215 |
+
|
| 216 |
+
Another direction for future work is to use the Long Short Term Memory (Hochreiter & Schmidhuber, 1997) for handling the sets without imposing the shared upper bound on the number of elements in a set, which has been already explored in the literature (Vinyals et al., 2015; 2016). Since our approach is agnostic to the type of the neural network, they are orthogonal to our approach.
|
| 217 |
+
|
| 218 |
+
# 6 CONCLUSION
|
| 219 |
+
|
| 220 |
+
In this paper, we proposed Set Cross Entropy, a measure that models the likelihood between the sets of probability distributions. When the output of the neural network model can be naturally regarded as a set, Set Cross Entropy is able to relax the search space by making the permutations of a global minima also the global minima, and makes the training easier. This is in contrast to the existing approaches that try to correct the ordering of the output by learning a permutation matrix, or an ad-hoc methods that reorder the dataset using the domain-specific expert knowledge. Training based on the Set Cross Entropy is also robust against the dataset which contains vectors whose internal ordering may change time to time in an arbitrary manner. We demonstrated the effectiveness of the approach by comparing Set Cross Entropy against the normal cross entropy, as well as the other set-based metrics such as Hausdorff distance or set average (Chamfer) distance. set average distance was shown to upper-bound Set Cross Entropy, and while it performed comparably well in the object reconstruction task, it was outperformed by Set Cross Entropy in the rule learning task. Training a neural network with Hausdorff distance turned out to be particularly hard, and it failed in many scenarios, showing that it is not suitable as a loss function for the set reconstruction tasks considered in this paper.
|
| 221 |
+
|
| 222 |
+
<table><tr><td rowspan="2"></td><td colspan="7">The rate of correct answering on the test set,10 runs</td></tr><tr><td rowspan="2"></td><td colspan="6">n = 2, neighbor2(a,b,c):-neighborOf(a,b), neighborOf(b,c) Dataset: 2858 ground clauses; Training: 2250 clauses; Test: 250 clauses.</td></tr><tr><td>Target ordering</td><td colspan="2">Fixed</td><td colspan="4">Random</td></tr><tr><td></td><td>Best 0.32</td><td>Worst 0.23</td><td>Median 0.29</td><td>Mean 0.28</td><td>Best 0.36</td><td>Worst 0.25</td><td>Median 0.31</td><td>Mean 0.31</td></tr><tr><td>H SH</td><td>0.96</td><td>0.90</td><td>0.91</td><td>0.92</td><td>0.94</td><td>0.88</td><td>0.91</td><td>0.91</td></tr><tr><td>A1H</td><td>0.91</td><td>0.79</td><td>0.86</td><td>0.86</td><td>0.94</td><td>0.72</td><td>0.88</td><td>0.87</td></tr><tr><td>H1H</td><td>0.87</td><td>0.66</td><td>0.82</td><td>0.80</td><td>0.85</td><td>0.66</td><td>0.83</td><td>0.81</td></tr><tr><td></td><td colspan="6">n = 3, neighbor3(a,b,c,d):-..</td></tr><tr><td rowspan="3">Target ordering</td><td colspan="6">Dataset: 11000 ground clauses; Training: 2250 clauses; Test: 250 clauses.</td></tr><tr><td colspan="2">Fixed</td><td></td><td></td><td></td><td>Random</td><td></td></tr><tr><td>Best</td><td>Worst</td><td>Median</td><td>Mean</td><td>Best</td><td>Worst 0.06</td><td>Median</td><td>Mean</td></tr><tr><td>H</td><td>0.10</td><td>0.04</td><td>0.06</td><td>0.06</td><td>0.10</td><td>0.07</td><td>0.07</td></tr><tr><td>SH</td><td>0.72</td><td>0.55</td><td>0.61</td><td>0.62</td><td>0.70</td><td>0.53</td><td>0.66</td><td>0.64</td></tr><tr><td>A1H</td><td>0.61 0.55</td><td>0.52 0.31</td><td>0.55</td><td>0.56</td><td>0.60</td><td>0.53</td><td>0.57</td><td>0.57</td></tr><tr><td>H1H</td><td></td><td></td><td>0.44</td><td>0.44</td><td>0.57</td><td>0.37</td><td>0.43</td><td>0.45</td></tr><tr><td rowspan="3">Target ordering</td><td colspan="6">n =4,neighbor4(a,b,c,d,e):-..</td></tr><tr><td colspan="6">Dataset: 39878 ground clauses; Training: 2250 clauses; Test: 250 clauses.</td></tr><tr><td>Best</td><td>Worst</td><td>Fixed Median</td><td>Mean</td><td>Best</td><td>Random Worst</td><td>Median</td><td>Mean</td></tr><tr><td>H</td><td>0.02</td><td>0.00</td><td>0.01</td><td>0.01</td><td>0.03 0.00</td><td>0.02</td><td>0.02</td></tr><tr><td>SH</td><td>0.38</td><td>0.24</td><td>0.33</td><td>0.32</td><td>0.36</td><td>0.28 0.32</td><td>0.32</td></tr><tr><td>A1H</td><td>0.33</td><td>0.22</td><td>0.27</td><td>0.26</td><td>0.34</td><td>0.22 0.26</td><td>0.26</td></tr><tr><td>H1H</td><td>0.22</td><td>0.12</td><td>0.18</td><td>0.18</td><td>0.24</td><td>0.13 0.18</td><td>0.18</td></tr><tr><td></td><td colspan="6">n = 4, neighbor4(a,b,c,d,e):-... Dataset: 39878 ground clauses; Training: 90o0 clauses; Test: 1000 clauses.</td></tr><tr><td rowspan="4">Target ordering H</td><td></td><td>Fixed</td><td></td><td></td><td></td><td>Random</td><td></td></tr><tr><td>Best</td><td>Worst</td><td>Median</td><td>Mean</td><td>Best</td><td>Worst Median</td><td>Mean</td></tr><tr><td>0.04</td><td>0.03</td><td>0.04</td><td>0.03</td><td>0.04</td><td>0.02 0.03</td><td>0.03</td></tr><tr><td>0.87</td><td>0.81</td><td>0.82</td><td>0.83</td><td>0.86</td><td>0.77 0.82</td><td>0.82</td></tr><tr><td>SH</td><td></td><td>0.77</td><td>0.76</td><td>0.79</td><td>0.59</td><td>0.73</td><td>0.72</td></tr><tr><td>A1H</td><td>0.81 0.50</td><td>0.71</td><td></td><td></td><td></td><td>0.42</td><td>0.41</td></tr><tr><td>H1H</td><td>0.12</td><td>0.40</td><td>0.37 n = 5, neighbor5(a,b,c,d,e,f):-...</td><td>0.53</td><td>0.24</td><td></td><td></td></tr><tr><td colspan="6"></td></tr><tr><td rowspan="3">Target ordering H</td><td>Dataset: 137738 ground clauses; Training: 2250 clauses; Test: 250 clauses.</td><td>Fixed</td><td></td><td></td><td></td><td>Random</td><td></td></tr><tr><td>Best</td><td>Worst</td><td>Median</td><td>Mean</td><td>Best</td><td>Worst</td><td>Median Mean</td></tr><tr><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.01</td><td>0.00 0.00</td><td>0.00</td></tr><tr><td>SH</td><td>0.17</td><td>0.10 0.11</td><td>0.12</td><td>0.15</td><td>0.06</td><td>0.11</td><td>0.11</td></tr><tr><td>A1H</td><td>0.13</td><td>0.06 0.10</td><td>0.10</td><td>0.13</td><td>0.06</td><td>0.11</td><td>0.10</td></tr><tr><td>H1H</td><td>0.06</td><td>0.01 0.04</td><td>0.04</td><td>0.06</td><td>0.04</td><td>0.05</td><td>0.05</td></tr><tr><td></td><td></td><td></td><td>n = 5, neighbor5(a,b,c,d,e,f):-...</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">Target ordering</td><td colspan="6">Dataset: 137738 ground clauses; Training: 9000 clauses; Test: 1000 clauses.</td><td></td></tr><tr><td></td><td>Fixed</td><td></td><td></td><td></td><td>Random</td><td></td></tr><tr><td>H</td><td>Best Worst</td><td>Median 0.00</td><td>Mean 0.00</td><td>Best 0.01</td><td>Worst</td><td>Median 0.01</td><td>Mean 0.01</td></tr><tr><td>SH</td><td>0.01</td><td>0.00</td><td></td><td></td><td>0.00 0.50</td><td></td><td>0.55</td></tr><tr><td>A1H</td><td>0.65 0.53</td><td>0.52 0.46</td><td>0.55 0.48</td><td>0.56 0.48</td><td>0.60</td><td>0.56 0.50</td><td>0.50</td></tr><tr><td></td><td></td><td></td><td></td><td>0.56</td><td>0.46</td><td></td><td></td></tr><tr><td>H1H</td><td>0.20</td><td>0.04</td><td>0.11</td><td>0.11</td><td>0.18 0.07</td><td>0.13</td><td>0.13</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 223 |
+
|
| 224 |
+
Table 6: The summary of the rule learning task, 10 runs.
|
| 225 |
+
|
| 226 |
+
# REFERENCES
|
| 227 |
+
|
| 228 |
+
Ryan Prescott Adams and Richard S Zemel. Ranking via Sinkhorn Propagation. arXiv preprint arXiv:1106.1925, 2011.
|
| 229 |
+
Masataro Asai and Alex Fukunaga. Classical Planning in Deep Latent Space: Bridging the SubsymbolicSymbolic Boundary. In Proc. of AAAI Conference on Artificial Intelligence, 2018. URL https: //www.aaai.org/ocs/index.php/AAAI/AAAI18/paper/view/16302.
|
| 230 |
+
Guillaume Bouchard, Sameer Singh, and Theo Trouillon. On Approximate Reasoning Capabilities of Low-Rank Vector Spaces. AAAI Spring Syposium on Knowledge Representation and Reasoning (KRR): Integrating Symbolic and Neural Approaches, 2015.
|
| 231 |
+
Angel X. Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, Jianxiong Xiao, Li Yi, and Fisher Yu. ShapeNet: An Information-Rich 3D Model Repository. Technical Report arXiv:1512.03012 [cs.GR], Stanford University — Princeton University — Toyota Technological Institute at Chicago, 2015.
|
| 232 |
+
M-P Dubuisson and Anil K Jain. A Modified Hausdorff Distance for Object Matching. In Proceedings of 12th International Conference on Pattern Recognition, pp. 566–568. IEEE, 1994.
|
| 233 |
+
Dominik Maria Endres and Johannes E Schindelin. A New Metric for Probability Distributions. IEEE Transactions on Information theory, 2003.
|
| 234 |
+
Nicholas Guttenberg, Nathaniel Virgo, Olaf Witkowski, Hidetoshi Aoki, and Ryota Kanai. PermutationEquivariant Neural Networks Applied to Dynamics Prediction. arXiv preprint arXiv:1612.04530, 2016.
|
| 235 |
+
Malte Helmert. A Planning Heuristic Based on Causal Graph Analysis. In Proc. of the International Conference on Automated Planning and Scheduling(ICAPS), pp. 161–170, 2004. URL http:// www.aaai.org/Library/ICAPS/2004/icaps04-021.php.
|
| 236 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long Short-Term Memory. ¨ Neural Computation, 9(8):1735– 1780, 1997.
|
| 237 |
+
Daniel P. Huttenlocher, Gregory A. Klanderman, and William J Rucklidge. Comparing Images using the Hausdorff Distance. IEEE Transactions on Pattern Analysis and Machine Intelligence, 15(9):850–863, 1993.
|
| 238 |
+
Piotr Indyk and Rajeev Motwani. Approximate Nearest Neighbors: Towards Removing the Curse of Dimensionality. In Proceedings of the thirtieth annual ACM symposium on Theory of computing, pp. 604–613. ACM, 1998.
|
| 239 |
+
Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. In Proc. of the International Conference on Learning Representations, 2017.
|
| 240 |
+
Thanard Kurutach, Aviv Tamar, Ge Yang, Stuart Russell, and Pieter Abbeel. Learning Plannable Representations with Causal InfoGAN. In In Proceedings of ICML / IJCAI / AAMAS 2018 Workshop on Planning and Learning (PAL-18), 2018.
|
| 241 |
+
Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. In Proc. of the International Conference on Learning Representations, 2017.
|
| 242 |
+
Xianling Mao, Bo-Si Feng, Yi-Jing Hao, Liqiang Nie, Heyan Huang, and Guihua Wen. S2JSD-LSH: A Locality-Sensitive Hashing Schema for Probability Distributions. In AAAI, pp. 3244–3251, 2017.
|
| 243 |
+
Drew V. McDermott. The 1998 AI Planning Systems Competition. AI Magazine, 21(2):35–55, 2000. URL http://www.aaai.org/ojs/index.php/aimagazine/article/view/1506.
|
| 244 |
+
Gonzalo Mena, David Belanger, Scott Linderman, and Jasper Snoek. Learning Latent Permutations with Gumbel-Sinkhorn Networks. In Proc. of the International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Byt3oJ-0W.
|
| 245 |
+
Selwyn Piramuthu. The Hausdorff Distance Measure for Feature Selection in Learning Applications. In Systems Sciences, 1999. HICSS-32. Proceedings of the 32nd Annual Hawaii International Conference on, pp. 6–pp. IEEE, 1999.
|
| 246 |
+
Malte Probst. The Set Autoencoder: Unsupervised Representation Learning for Sets. 2018. A rejected submission to ICLR2018.
|
| 247 |
+
Siamak Ravanbakhsh, Jeff Schneider, and Barnabas Poczos. Deep Learning with Sets and Point Clouds. arXiv preprint arXiv:1611.04500, 2016.
|
| 248 |
+
Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You Only Look Once: Unified, RealTime Object Detection. In Proc. of IEEE Conference on Computer Vision and Pattern Recognition, pp. 779–788, 2016.
|
| 249 |
+
Tim Rocktaschel and Sebastian Riedel. End-to-End Differentiable Proving. In ¨ Advances in Neural Information Processing Systems, pp. 3788–3800, 2017.
|
| 250 |
+
Rodrigo Santa Cruz, Basura Fernando, Anoop Cherian, and Stephen Gould. DeepPermNet: Visual Permutation Learning. In Proc. of IEEE Conference on Computer Vision and Pattern Recognition, pp. 6044–6052. IEEE, 2017.
|
| 251 |
+
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015. URL http://papers.nips.cc/paper/ 5866-pointer-networks.
|
| 252 |
+
Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order Matters: Sequence to Sequence for Sets. Proc. of the International Conference on Learning Representations, 2016.
|
| 253 |
+
Jun Wang, Wei Liu, Sanjiv Kumar, and Shih-Fu Chang. Learning to Hash for Indexing Big DataA Survey. Proceedings of the IEEE, 104(1):34–57, 2016.
|
| 254 |
+
Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep Sets. In Advances in Neural Information Processing Systems, pp. 3391– 3401, 2017.
|
| 255 |
+
Zhuotun Zhu, Xinggang Wang, Song Bai, Cong Yao, and Xiang Bai. Deep Learning Representation using Autoencoder for 3D Shape Retrieval. Neurocomputing, 204:41–50, 2016.
|
| 256 |
+
|
| 257 |
+
# APPENDIX
|
| 258 |
+
|
| 259 |
+
# 6.1 NETWORK MODEL FOR 8 PUZZLE
|
| 260 |
+
|
| 261 |
+
As mentioned in the earlier sections, the network has a permutation invariant encoder and the fullyconnected decoder.
|
| 262 |
+
|
| 263 |
+
The input to the network is a $9 \times 1 5$ matrix, where the first dimension represents the objects and the second dimension represents the features of each object. The encoder has two 1D convolution layers of 1000 neurons with filter size 1, modeling the element-wise network $\rho$ . The output of these layers is then aggregated by taking the sum of the first dimension. The result is then fed to two another fully-connected layers of width 1000, which maps to the latent layer of 100 neurons. All encoder layers are activated by ReLU. The latent representation is regularized and activated by Gumbel-Softmax Maddison et al. (2017); Jang et al. (2017) as the input is a categorical model.
|
| 264 |
+
|
| 265 |
+
The decoder consists of three fully-connected layers with dropout and batch normalization as shown below:
|
| 266 |
+
|
| 267 |
+
fc(1000), relu, batchnorm, dropout(0.5), fc(1000), relu, batchnorm, dropout(0.5), dense(135), reshape $( 9 \times 1 5 )$
|
| 268 |
+
|
| 269 |
+
The last layer is then split into $9 \times 9 , 9 \times 3 , 9 \times 3$ matrices and separately activated by softmax, reflecting the input dataset (Fig. 1).
|
| 270 |
+
|
| 271 |
+
# 6.2 NETWORK MODEL FOR BLOCKSWOLRD
|
| 272 |
+
|
| 273 |
+
The same network as the 8-puzzle was used, except that the input and the output is a $5 \times 1 2 2 4$ matrix. The activations of the last layer is different: The first 1024 features are activated by a sigmoid function, while the 200 features are divided into 40, 60, 40, 60 dimensions (for the one-hot bounding box information) and are separately activated by softmax.
|
| 274 |
+
|
| 275 |
+
# 6.3 FEATURE EXTRACTION FOR BLOCKSWORLD
|
| 276 |
+
|
| 277 |
+
The 32x32 RGB image patches in the Blocksworld states are compressed into the feature vectors that are later used as the input. The image features are learned by a convolutional autoencoder depicted in Fig. 4 and Fig. 5.
|
| 278 |
+
|
| 279 |
+
Input $3 2 \times 3 2 \times 3 )$ ,
|
| 280 |
+
GaussianNoise(0.1),
|
| 281 |
+
conv2d(filte ${ = } 1 6$ , kerne $\mathsf { 1 { = } 3 \times 3 , }$ ),
|
| 282 |
+
relu,
|
| 283 |
+
MaxPooling ${ \mathfrak { Q } } ( 2 \times 2 )$ ,
|
| 284 |
+
conv2d(filte ${ = } 1 6$ , kerne $\mathrm { { \Omega } | = 3 \times 3 . }$ ,),
|
| 285 |
+
relu,
|
| 286 |
+
MaxPooling $2 { \mathrm { d } } ( 2 \times 2 )$ ,
|
| 287 |
+
conv2d(filte ${ = } 1 6$ , kernel $\mathrm { = 3 \times 3 }$ ,),
|
| 288 |
+
sigmoid
|
| 289 |
+
|
| 290 |
+
Figure 4: The implementation of the encoder for feature selection, which outputs a $8 \times 8 \times 1 6$ tensor.
|
| 291 |
+
|
| 292 |
+
Input(8 × 8 × 16),
|
| 293 |
+
conv2d(filte ${ = } 1 6$ , kernel=3 × 3,),
|
| 294 |
+
relu,
|
| 295 |
+
UpSampling2d $( 2 \times 2 )$ ,
|
| 296 |
+
conv2d(filte ${ = } 1 6$ , kerne $\mathrm { = } 3 \times 3 ,$ ,),
|
| 297 |
+
relu,
|
| 298 |
+
UpSampling $2 { \mathrm { d } } ( 2 \times 2 )$ ,
|
| 299 |
+
conv2d(filte ${ = } 1 6$ , kernel $= 3 \times 3 .$ ,),
|
| 300 |
+
relu,
|
| 301 |
+
fc(3072),
|
| 302 |
+
sigmoid,
|
| 303 |
+
reshape $( 3 2 \times 3 2 \times 3 )$
|
| 304 |
+
|
| 305 |
+
# 6.4 NETWORK MODEL FOR RULE LEARNING
|
| 306 |
+
|
| 307 |
+
We removed the encoder and the latent layer from the above models, and connected the input directly to the decoder. While the decoder has the same types of layers, the width is shrinked to 400. In the $_ n$ - neighbor scenario, the input is a $2 + 1 6 3 ( n + 1 )$ vector, which consists of a one-hot label of 2 categories for the predicate of the head, and $n + 1$ one-hot labels of 163 categories for the arguments of the head. 163 categories corresponds to the number of countries in the Countries dataset (Bouchard et al., 2015). The output is a $[ n , 3 2 8 ]$ matrix, where each row represents a binary predicate $3 2 8 = 2 + 2 \cdot 1 6 3$ ).
|
| 308 |
+
|
| 309 |
+
# 6.5 EXAMPLE APPLICATION OF THE PERMUTATION-INVARIANT REPRESENTATION & RECONSTRUCTION
|
| 310 |
+
|
| 311 |
+
To address the practical utility of “set reconstruction” or “set autoencoding”, we added a new experiment. We modified Latplan (Asai & Fukunaga, 2018) neural-symbolic classical planning system, a system that operates on a discrete symbolic latent space of the real-valued inputs and runs Dijkstra $\mathrm { \Phi _ { s / A ^ { * } } }$ search using a state-of-the-art symbolic classical planning solver. We modified Latplan to take the set-of-object-featurevector input rather than images. It is a high-level task planner (unlike motion planning / actuator control) that has implications on robotic systems, which perceives a set of inputs already preprocessed by the external system. For example, the image input is first fed into Object Recognition system (e.g. YOLO, (Redmon et al., 2016)) and the planner receives a set of feature vectors extracted from the image patches segmented from the raw image, rather than feeding the image input directly to the planning system.
|
| 312 |
+
|
| 313 |
+
Latplan system learns the binary latent space of an arbitrary raw input (e.g. images) with a GumbelSoftmax variational autoencoder, learns a discrete state space from the transition examples, and runs a symbolic, systematic search algorithm such as Dijkstra or $\mathbf { A } ^ { * }$ search which guarantee the optimality of the solution. Unlike RL-based planning systems, the search agent does not contain the learning aspects. The discrete plan in the latent space is mapped back to the raw image visualization of the plan execution, which requires the reconstruction capability of (V)AE. A similar system replacing Gumbel Softmax VAE with Causal InfoGAN was later proposed (Kurutach et al., 2018).
|
| 314 |
+
|
| 315 |
+
We replaced Latplan’s Gumbel-Softmax VAE with our autoencoder used in the 8-Puzzle and the Blocksworld experiments (Appendix, Sec. 6.1,Sec. 6.2). Our autoencoder also uses Gumbel Softmax in the latent layer, but it uses (Zaheer et al., 2017) encoder and is trained with Set Cross Entropy.
|
| 316 |
+
|
| 317 |
+
When the network learned the representation, it guarantees that the planner finds a solution because the search algorithm being used (e.g. Dijkstra) is a complete, systematic, symbolic search algorithm, which guarantees to find a solution whenever it is reachable in the state space. If the network cannot learn the permutation-invariant representation, the system cannot solve the problem and/or return the humancomprehensive visualization. This makes the specific permutation-invariant representation using (Zaheer et al., 2017) and the proposed Set Cross Entropy necessary when the input is given as a set of future vectors.
|
| 318 |
+
|
| 319 |
+
# 8 PUZZLE
|
| 320 |
+
|
| 321 |
+
First, the training was performed on a dataset in which the object vector ordering is randomized. The autoencoder compresses the $1 5 \times 9 = 1 3 5$ -bit binary representation (object vectors) into a permutationinvariant 100-bit discrete latent binary representation. We provided 5000 states for training the autoencoder, while the search space consists of $3 6 2 8 8 0 ( = 9 ! )$ states and 967680 transitions.
|
| 322 |
+
|
| 323 |
+
Note that each state have 9! variations due to the permutations in the order the tiles and the locations are reported. This also increases the number of transition quadratically $( ( 9 ! ) ^ { 2 } ,$ ).
|
| 324 |
+
|
| 325 |
+
We generated 40 problem instances of 8-puzzle each generated by a random walk from the goal state. 40 instances consist of 20 instances each generated by a 7-steps random walk and another 20 by 14 steps. We solved 40 instances using Fast Downward classical planner Helmert (2004) with blind heuristics in order to remove the effect of heuristics.
|
| 326 |
+
|
| 327 |
+
We compared the number of problems successfully solved by two variations of Latplan where each uses the autoencoder trained with Set Average and Set Cross Entropy, respectively, for encoding the input into binary latent space. Both version managed to solve all instances because both Set Average and Set Cross Entropy managed to train the AE from 5000 examples with a sufficient accuracy. All solutions were correct (checked manually). Since the search algorithm being used is optimal, the quality of the solution was also identical.
|
| 328 |
+
|
| 329 |
+
# BLOCKSWORLD
|
| 330 |
+
|
| 331 |
+
We solved 30 planning instances in a 4-blocks, 3-stacks environment. The instances are generated by taking a random initial state and choosing a goal state by the 3, 7, or 14 steps random walks (10 instances each). The correctness of the plans are again checked manually. The same planner configuration was used for all instances.
|
| 332 |
+
|
| 333 |
+
The search space consists of 5760 states and 34560 transitions, and each state have 4! variations due to permutations of 4 blocks. We provided 1000 randomly selected states for training the autoencoder.
|
| 334 |
+
|
| 335 |
+

|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 6: (Left) An example plan in a set-of-object-vector form, decoded from its binary latent representation using the permutation-invariant autoencoder (the plan is executed from top to bottom). (Right) Its visualization using the tile images (taken from MNIST) pasted onto a black canvas (The plan is executed from left to right, top to bottom).
|
| 339 |
+
|
| 340 |
+
We compared the number of problems successfully solved by Latplan between two variations of Latplan using the autoencoder trained with Set Average and Set Cross Entropy, respectively. For the total of 30 instances, both Latplan $\mathbf { \Gamma } _ { \mathrm { + } \mathrm { S e t } }$ Avg and Latplan $\mathrm { \mathbf { \Omega } _ { 1 + } S C E }$ returned plans, however the plans returned by Latplan $+ \mathrm { S e t }$ Avg were correct in 11 instnaces, while Latplan $+ \mathrm { S C E }$ returned 14 correct instances (Details in Table 7).
|
| 341 |
+
|
| 342 |
+
As the autoencoder trained by Set Average had larger reconstruction error, it sometimes fails to capture the essential feature of the input, causing the system to return an invalid plan. The common error was changing the surface of the blocks or swapping the blocks without a proper action needed, e.g., moving more than two blocks, move a block and polish another block in a single time step, etc.
|
| 343 |
+
|
| 344 |
+
<table><tr><td>Random walk steps used for generating</td><td colspan="2">The number of solved instances (out of 1O instances each)</td></tr><tr><td>the problem instances 3</td><td>SH 7</td><td>A1H</td></tr><tr><td>7</td><td>5</td><td>7</td></tr><tr><td>14</td><td>2</td><td>3 1</td></tr></table>
|
| 345 |
+
|
| 346 |
+
Table 7: The number of instances solved by Latplan using a VAE trained by Set Cross Entropy (SH) and Set Average $( A _ { \mathrm { 1 H } } )$ of the cross entropy.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 7: An example of a problem instance. (Left) The initial state. (Right) The goal state. The planner should unpolish a green cube and move the blocks to the appropriate goal position, while also following the environment constraint that the blocks can move or polished only when it is on top of a stack (including the floor itself).
|
| 350 |
+
|
| 351 |
+

|
| 352 |
+
Figure 8: An example of a successful plan execution, returned by Latplan using the AE trained by the proposed Set Cross Entropy method. The AE is used for encoding the object-vector input into a binary space that is suitable for Dijkstra search. While the problem was generated by a 7-step random walk from the goal state, Latplan found a shorter, optimal solution because of the underlying optimal search algorithm (Dijkstra).
|
| 353 |
+
|
| 354 |
+

|
| 355 |
+
Figure 9: The decoded solution found by Latplan for the same instance, where the AE is trained by SetAverage, which had a higher mean square error for the reconstruction. As a result, not only the initial state is invalid, but also, at the second step, two blocks are simultaneously moved in a single action, which is an invalid state transition.
|
| 356 |
+
|
| 357 |
+
6.6 ENTIRE PLANNING RESULTS
|
| 358 |
+
|
| 359 |
+
# 8 PUZZLE
|
| 360 |
+
|
| 361 |
+
Problem 000, generated by 007 steps
|
| 362 |
+
|
| 363 |
+
Set Cross Entropy
|
| 364 |
+
|
| 365 |
+
Set Average
|
| 366 |
+
|
| 367 |
+

|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
|
| 373 |
+

|
| 374 |
+
|
| 375 |
+
Problem 001, generated by 007 steps
|
| 376 |
+
|
| 377 |
+
Set Cross Entropy
|
| 378 |
+
|
| 379 |
+
Set Average
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
|
| 383 |
+

|
| 384 |
+
|
| 385 |
+

|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
|
| 389 |
+
Problem 002, generated by 007 steps
|
| 390 |
+
|
| 391 |
+
Set Cross Entropy
|
| 392 |
+
|
| 393 |
+
Set Average
|
| 394 |
+
|
| 395 |
+

|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
|
| 399 |
+

|
| 400 |
+
|
| 401 |
+

|
| 402 |
+
|
| 403 |
+
Problem 003, generated by 007 steps
|
| 404 |
+
|
| 405 |
+
Set Cross Entropy
|
| 406 |
+
|
| 407 |
+
Set Average
|
| 408 |
+
|
| 409 |
+

|
| 410 |
+
|
| 411 |
+

|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
|
| 417 |
+

|
| 418 |
+
|
| 419 |
+
Problem 006, generated by 007 steps
|
| 420 |
+
|
| 421 |
+
Set Cross Entropy
|
| 422 |
+
|
| 423 |
+
Set Average
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
|
| 427 |
+

|
| 428 |
+
|
| 429 |
+

|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
|
| 433 |
+
Problem 007, generated by 007 steps
|
| 434 |
+
|
| 435 |
+
Set Cross Entropy
|
| 436 |
+
|
| 437 |
+
Set Average
|
| 438 |
+
|
| 439 |
+

|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
|
| 443 |
+

|
| 444 |
+
|
| 445 |
+

|
| 446 |
+
|
| 447 |
+

|
| 448 |
+
|
| 449 |
+

|
| 450 |
+
|
| 451 |
+

|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
|
| 455 |
+

|
| 456 |
+
|
| 457 |
+

|
| 458 |
+
|
| 459 |
+

|
| 460 |
+
|
| 461 |
+

|
| 462 |
+
|
| 463 |
+

|
| 464 |
+
|
| 465 |
+

|
| 466 |
+
|
| 467 |
+

|
| 468 |
+
|
| 469 |
+
# BLOCKSWORLD
|
| 470 |
+
|
| 471 |
+

|
| 472 |
+
|
| 473 |
+

|
| 474 |
+
|
| 475 |
+

|
| 476 |
+
|
| 477 |
+

|
| 478 |
+
|
| 479 |
+
<table><tr><td rowspan=1 colspan=9>Problem O09,generated by 014 stepsSet Cross Entropy (X) Set Average (X)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>■</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>□</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>:1</td></tr><tr><td rowspan=1 colspan=1>1.</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td></tr></table>
|
md/train/rJxt0JHKvS/rJxt0JHKvS.md
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COLORING GRAPH NEURAL NETWORKS FOR NODE DISAMBIGUATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In this paper, we show that a simple coloring scheme can improve, both theoretically and empirically, the expressive power of Message Passing Neural Networks (MPNNs). More specifically, we introduce a graph neural network called Colored Local Iterative Procedure (CLIP) that uses colors to disambiguate identical node attributes, and show that this representation is a universal approximator of continuous functions on graphs with node attributes. Our method relies on separability, a key topological characteristic that allows to extend well-chosen neural networks into universal representations. Finally, we show experimentally that CLIP is capable of capturing structural characteristics that traditional MPNNs fail to distinguish, while being state-of-the-art on benchmark graph classification datasets.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Learning good representations is seen by many machine learning researchers as the main reason behind the tremendous successes of the field in recent years (Bengio et al., 2013). In image analysis (Krizhevsky et al., 2012), natural language processing (Vaswani et al., 2017) or reinforcement learning (Mnih et al., 2015), groundbreaking results rely on efficient and flexible deep learning architectures that are capable of transforming a complex input into a simple vector while retaining most of its valuable features. The universal approximation theorem (Cybenko, 1989; Hornik et al., 1989; Hornik, 1991; Pinkus, 1999) provides a theoretical framework to analyze the expressive power of such architectures by proving that, under mild hypotheses, multi-layer perceptrons (MLPs) can uniformly approximate any continuous function on a compact set. This result provided a first theoretical justification of the strong approximation capabilities of neural networks, and was the starting point of more refined analyses providing valuable insights into the generalization capabilities of these architectures (Baum and Haussler, 1989; Geman et al., 1992; Saxe et al., 2014; Bartlett et al., 2018).
|
| 12 |
+
|
| 13 |
+
Despite a large literature and state-of-the-art performance on benchmark graph classification datasets, graph neural networks yet lack a similar theoretical foundation (Xu et al., 2019). Universality for these architectures is either hinted at via equivalence with approximate graph isomorphism tests $k$ -WL tests in Xu et al. 2019; Maron et al. 2019a), or proved under restrictive assumptions (finite node attribute space in Murphy et al. 2019). In this paper, we introduce Colored Local Iterative Procedure1 (CLIP), which tackles the limitations of current Message Passing Neural Networks (MPNNs) by showing, both theoretically and experimentally, that adding a simple coloring scheme can improve the flexibility and power of these graph representations. More specifically, our contributions are: 1) we provide a precise mathematical definition for universal graph representations, 2) we present a general mechanism to design universal neural networks using separability, 3) we propose a novel node coloring scheme leading to CLIP, the first provably universal extension of MPNNs, 4) we show that CLIP achieves state of the art results on benchmark datasets while significantly outperforming traditional MPNNs as well as recent methods on graph property testing.
|
| 14 |
+
|
| 15 |
+
The rest of the paper is organized as follows: Section 2 gives an overview of the graph representation literature and related works. Section 3 provides a precise definition for universal representations, as well as a generic method to design them using separable neural networks. In Section 4, we show that most state-of-the-art representations are not sufficiently expressive to be universal. Then, using the analysis of Section 3, Section 5 provides CLIP, a provably universal extension of MPNNs. Finally,
|
| 16 |
+
|
| 17 |
+
Section 6 shows that CLIP achieves state-of-the-art accuracies on benchmark graph classification taks, as well as outperforming its competitors on graph property testing problems.
|
| 18 |
+
|
| 19 |
+
# 2 RELATED WORKS
|
| 20 |
+
|
| 21 |
+
The first works investigating the use of neural networks for graphs used recurrent neural networks to represent directed acyclic graphs (Sperduti and Starita, 1997; Frasconi et al., 1998). More generic graph neural networks were later introduced by Gori et al. (2005); Scarselli et al. (2009), and may be divided into two categories. 1) Spectral methods (Bruna et al., 2014; Henaff et al., 2015; Defferrard et al., 2016; Kipf and Welling, 2017) that perform convolution on the Fourier domain of the graph through the spectral decomposition of the graph Laplacian. 2) Message passing neural networks (Gilmer et al., 2017), sometimes simply referred to as graph neural networks, that are based on the aggregation of neighborhood information through a local iterative process. This category contains most state-of-the-art graph representation methods such as (Duvenaud et al., 2015; Grover and Leskovec, 2016; Lei et al., 2017; Ying et al., 2018; Verma and Zhang, 2019), DeepWalk (Perozzi et al., 2014), graph attention networks (Velickovic et al., 2018), graphSAGE (Hamilton et al., 2017) or GIN (Xu et al., 2019).
|
| 22 |
+
|
| 23 |
+
Recently, (Xu et al., 2019) showed that MPNNs were, at most, as expressive as the WeisfeilerLehman (WL) test for graph isomorphism (Weisfeiler and Lehman, 1968). This suprising result led to several works proposing MPNN extensions to improve their expressivity, and ultimately tend towards universality (Maron et al., 2019a;b;c; Murphy et al., 2019; Chen et al., 2019). However, these graph representations are either as powerful as the $k$ -WL test (Maron et al., 2019a), or provide universal graph representations under the restrictive assumption of finite node attribute space (Murphy et al., 2019). Other recent approaches (Maron et al., 2019c) implies quadratic order of tensors in the size of the considered graphs. Some more powerfull GNNs are studied and benchmarked on real classical datasets and on graph property testing (Kriege et al., 2018; Murphy et al., 2019; Chen et al., 2019): a set of problems that classical MPNNs cannot handle. Our work thus provides a more general and powerful result of universality, matching the original definition of (Cybenko, 1989) for MLPs.
|
| 24 |
+
|
| 25 |
+
# 3 UNIVERSAL REPRESENTATIONS VIA SEPARABILITY
|
| 26 |
+
|
| 27 |
+
In this section we present the theoretical tools used to design our universal graph representation. More specifically, we show that separable representations are sufficiently flexible to capture all relevant information about a given object, and may be extended into universal representations.
|
| 28 |
+
|
| 29 |
+
# 3.1 NOTATIONS AND BASIC ASSUMPTIONS
|
| 30 |
+
|
| 31 |
+
Let $\mathcal { X } , \mathcal { y }$ be two topological spaces, then $\mathcal { F } ( \mathcal { X } , \mathcal { Y } )$ (resp. $\mathcal { C } ( \mathcal { X } , \mathcal { Y } ) )$ denotes the space of all functions (resp. continuous functions) from $\mathcal { X }$ to $\mathcal { V }$ . Moreover, for any group $G$ acting on a set $\mathcal { X }$ , $\mathcal { X } / G$ denotes the set of orbits of $\mathcal { X }$ under the action of $G$ (see Appendix B for more details). Finally, $\| \cdot \|$ is a norm on $\mathbb { R } ^ { d }$ , and $\mathcal { P } _ { n }$ is the set of all permutation matrices of size $n$ . In what follows, we assume that all the considered topological spaces are Hausdorff (see e.g. (Bourbaki, 1998) for an in-depth review): each pair of distinct points can be separated by two disjoint open sets. This assumption is rather weak (e.g. all metric spaces are Hausdorff) and is verified by most topological spaces commonly encountered in the field of machine learning.
|
| 32 |
+
|
| 33 |
+
# 3.2 UNIVERSAL REPRESENTATIONS
|
| 34 |
+
|
| 35 |
+
Let $\mathcal { X }$ be a set of objects (e.g. vectors, images, graphs, or temporal data) to be used as input information for a machine learning task (e.g. classification, regression or clustering). In what follows, we denote as vector representation of $\mathcal { X }$ a function $f : \mathcal { X } \overset { } { \to } \mathbb { R } ^ { d }$ that maps each element $x \in \mathcal { X }$ to a $d$ -dimensional vector $f ( x ) \in \mathbb { R } ^ { d }$ . A standard setting for supervised representation learning is to define a class of vector representations $\mathfrak { F } _ { d } \subset \mathcal { F } ( \mathcal { X } , \mathbb { R } ^ { d } )$ (e.g. convolutional neural networks for images) and use the target values (e.g. image classes) to learn a good vector representation in light of the supervised learning task (i.e. one vector representation $f \in \mathfrak { F } _ { d }$ that leads to a good accuracy on the learning task). In order to present more general results, we will consider neural network architectures that can output vectors of any size, i.e. $\mathfrak { F } \subset \cup _ { d \in \mathbb { N } ^ { * } } \mathcal { F } ( \mathcal { X } , \mathbb { R } ^ { d } )$ , and will denote $\mathfrak { F } _ { d } = \mathfrak { F } \cap \mathcal { F } ( \mathcal { X } , \mathbb { R } ^ { d } )$
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 1: Concatenation of two MLPs $f$ and $g$
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Universal representations can easily be created by combining a separable representation with an MLP.
|
| 42 |
+
|
| 43 |
+
the set of $d$ -dimensional vector representations of $\mathfrak { F }$ . A natural characteristic to ask from the class $\mathfrak { F }$ is to be generic enough to approximate any vector representation, a notion that we will denote as universal representation (Hornik et al., 1989).
|
| 44 |
+
|
| 45 |
+
Definition 1. A class of vector representations $\mathfrak { F } \subset \cup _ { d \in \mathbb { N } ^ { * } } \mathcal { F } ( \mathcal { X } , \mathbb { R } ^ { d } )$ is called a universal representation of $\mathcal { X }$ if for any compact subset $K \subset { \mathcal { X } }$ and $d \in \mathbb { N } ^ { * }$ , $\mathcal { F }$ is uniformly dense in $\mathcal { C } ( K , \mathbb { R } ^ { d } )$ .
|
| 46 |
+
|
| 47 |
+
In other words, $\mathfrak { F }$ is a universal representation of a normed space $\mathcal { X }$ if and only if, for any continuous function $\phi : \mathcal { X } \mathbb { R } ^ { d }$ , any compact $K \subset { \mathcal { X } }$ and any $\varepsilon > 0$ , there exists $f \in \mathfrak { F }$ such that
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\forall x \in K , \ \| \phi ( x ) - f ( x ) \| \leq \varepsilon .
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
One of the most fundamental theorems of neural network theory states that one hidden layer MLPs are universal representations of the $m$ -dimensional vector space $\mathbb { R } ^ { m }$ .
|
| 54 |
+
|
| 55 |
+
Theorem 1 (Pinkus, 1999, Theorem 3.1). Let $\varphi : \mathbb { R } \mathbb { R }$ be a continuous non polynomial activation function. For any compact $K \subset \mathbb { R } ^ { m }$ and $d \in \mathbb { N } ^ { * }$ , two layers neural networks with activation $\varphi$ are uniformly dense in the set $\mathcal { C } ( K , \mathbb { R } ^ { d } )$ .
|
| 56 |
+
|
| 57 |
+
However, for graphs and structured objects, universal representations are hard to obtain due to their complex structure and invariance to a group of transformations (e.g. permutations of the node labels). We show in this paper that a key topological property, separability, may lead to universal representations of those structures.
|
| 58 |
+
|
| 59 |
+
# 3.3 SEPARABILITY IS (ALMOST) ALL YOU NEED
|
| 60 |
+
|
| 61 |
+
Loosely speaking, universal representations can approximate any vector-valued function. It is thus natural to require that these representations are expressive enough to separate each pair of dissimilar elements of $\mathcal { X }$ .
|
| 62 |
+
|
| 63 |
+
Definition 2 (Separability). A set of functions $\mathfrak { F } \subset \mathcal { F } ( \mathcal { X } , \mathcal { Y } )$ is said to separate points of $\mathcal { X }$ if for every pair of distinct points $x$ and $y$ , there exists $f \in \mathfrak { F }$ such that $f ( x ) \neq { \bar { f } } ( y )$ .
|
| 64 |
+
|
| 65 |
+
For a class of vector representations $\mathfrak { F } \subset \cup _ { d \in \mathbb { N } ^ { * } } \mathcal { F } ( \mathcal { X } , \mathbb { R } ^ { d } )$ , we will say that $\mathfrak { F }$ is separable if its 1-dimensional representations $\mathfrak { F } _ { 1 }$ separates points of $\mathcal { X }$ . Separability is rather weak, as we only require the existence of different outputs for every pair of inputs. Unsurprisingly, we now show that it is a necessary condition for universality (see Appendix A for all the detailed proofs).
|
| 66 |
+
|
| 67 |
+
Proposition 1. Let $\mathfrak { F }$ be a universal representation of $\mathcal { X }$ , then $\mathfrak { F } _ { 1 }$ separates points of $\mathcal { X }$
|
| 68 |
+
|
| 69 |
+
While separability is necessary for universal representations, it is also key to designing neural network architectures that can be extended into universal representations. More specifically, under technical assumptions, separable representations can be composed with a universal representation of $\mathbb { R } ^ { d }$ (such as MLPs) to become universal.
|
| 70 |
+
|
| 71 |
+
Theorem 2. For all $d \geq 0 ,$ , let $\mathcal { M } _ { d }$ be a universal approximation of $\mathbb { R } ^ { d }$ . Let $\mathfrak { F }$ be a class of vector representations of $\mathcal { X }$ such that:
|
| 72 |
+
|
| 73 |
+
(i) Continuity: every $f \in \mathfrak { F }$ is continuous, (ii) Stability by concatenation: for all $f , g \in { \mathfrak { F } }$ , $x \mapsto ( f ( x ) , g ( x ) ) \in \mathfrak { F } ,$ ,
|
| 74 |
+
|
| 75 |
+
# (iii) Separability: $\mathfrak { F } _ { 1 }$ separates points of $\mathcal { X }$
|
| 76 |
+
|
| 77 |
+
Then $\{ \psi \circ f : \exists d \geq 1$ s.t. $\psi \in \mathcal { M } _ { d } , f \in \mathfrak { F } \}$ is a universal representation of $\mathcal { X }$ .
|
| 78 |
+
|
| 79 |
+
Stability by concatenation is verified by most neural networks architectures, as illustrated for MLPs in Figure 1. The proof of Theorem 2 relies on the Stone-Weierstrass theorem (see e.g. Rudin, 1987, Theorem 7.32) whose assumptions are continuity, separability, and the fact that the class of functions is an algebra. Fortunately, composing a separable and concatenable representation with a universal representation automatically leads to an algebra, and thus the applicability of the StoneWeierstrass theorem and the desired result. A complete derivation is available in Appendix A. Since MLPs are universal representations of $\mathbb { R } ^ { d }$ , Theorem 2 implies a convenient way to design universal representations of more complex object spaces: create a separable representation and compose it with a simple MLP (see Figure 2).
|
| 80 |
+
|
| 81 |
+
Corollary 1. A continuous, concatenable and separable representation of $\mathcal { X }$ composed with an MLP is universal.
|
| 82 |
+
|
| 83 |
+
Note that many neural networks of the deep learning literature have this two steps structure, including classical image CNNs such as AlexNet (Krizhevsky et al., 2012) or Inception (Szegedy et al., 2016). In this paper, we use Corollary 1 to design universal graph and neighborhood representations, although the method is much more generic and may be applied to other objects.
|
| 84 |
+
|
| 85 |
+
# 4 LIMITATIONS OF EXISTING REPRESENTATIONS
|
| 86 |
+
|
| 87 |
+
In this section, we first provide a proper definition for graphs with node attributes, and then show that message passing neural networks are not sufficiently expressive to be universal.
|
| 88 |
+
|
| 89 |
+
# 4.1 GRAPHS WITH NODE ATTRIBUTES
|
| 90 |
+
|
| 91 |
+
Consider a dataset of $n$ interacting objects (e.g. users of a social network) in which each object $i \in [ [ 1 , n ] ]$ has a vector attribute $v _ { i } \in \mathbb { R } ^ { m }$ and is a node in an undirected graph $G$ with adjacency J Kmatrix A ∈ Rn×n.
|
| 92 |
+
|
| 93 |
+
Definition 3. The space of graphs of size $n$ with $m$ -dimensional node attributes is the quotient space
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\mathbf { G r a p h } _ { m , n } = \left\{ ( v , A ) \in \mathbb { R } ^ { n \times m } \times \mathbb { R } ^ { n \times n } \right\} / \mathcal { P } _ { n } ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $A$ is the adjacency matrix of the graph, $v$ contains the $m$ -dimensional representation of each node in the graph and the set of permutations matrices $\mathcal { P } _ { n }$ is acting on $( v , A )$ by
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\forall P \in \mathcal { P } _ { n } , \quad P \cdot ( v , A ) = ( P v , P A P ^ { \top } ) .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Moreover, we limit ourselves to graphs of maximum size $n _ { \mathrm { m a x } }$ , where $n _ { \mathrm { m a x } }$ is a large integer. This allows us to consider functions on graphs of different sizes without obtaining infinite dimensional spaces and infinitely complex functions that would be impossible to learn via a finite number of samples. We thus define Graphm = Sn≤nmax . More details on the technical topological aspects of the definition are available in Appendix B, as well as a proof that $\mathbf { G r a p h } _ { m }$ is Hausdorff.
|
| 106 |
+
|
| 107 |
+
# 4.2 MESSAGE PASSING NEURAL NETWORKS
|
| 108 |
+
|
| 109 |
+
A common method for designing graph representations is to rely on local iterative procedures. Following the notations of $\mathrm { X u }$ et al. (2019), a message passing neural network (MPNN) (Gilmer et al., 2017) is made of three consecutive phases that will create intermediate node representations $x _ { i , t }$ for each node $i \in [ [ 1 , n ] ]$ and a final graph representation $x _ { G }$ as described by the following J Kprocedure: 1) Initialization: All node representations are initialized with their node attributes $x _ { i , 0 } = v _ { i }$ . 2) Aggregation and combination: $T$ local iterative steps are performed in order to capture larger and larger structural characteristics of the graph. 3) Readout: This step combines all final node representations into a single graph representation: $x _ { G } = \mathtt { R E A D O U T } \big ( \{ x _ { i , T } \} _ { i \in [ [ 1 , n ] ] } \big )$ , where READOUT is permutation invariant.
|
| 110 |
+
|
| 111 |
+

|
| 112 |
+
Figure 3: Example of two valid colorings of the same attributed graph. Note that each $V _ { k }$ contains nodes with identical attributes.
|
| 113 |
+
|
| 114 |
+
Unfortunately, while MPNNs are very efficient in practice and proven to be as expressive as the Weisfeiler-Lehman algorithm (Weisfeiler and Lehman, 1968; Xu et al., 2019), they are not sufficiently expressive to construct isomorphism tests or separate all graphs (for example, consider $k$ -regular graphs without node attributes, for which a small calculation shows that any MPNN representation will only depend on the number of nodes and degree $k$ (Xu et al., 2019)). As a direct application of Proposition 1, MPNNs are thus not expressive enough to create universal representations.
|
| 115 |
+
|
| 116 |
+
# 5 EXTENDING MPNNS USING A SIMPLE COLORING SCHEME
|
| 117 |
+
|
| 118 |
+
In this section, we present Colored Local Iterative Procedure (CLIP), an extension of MPNNs using colors to differentiate identical node attributes, that is able to capture more complex structural graph characteristics than traditional MPNNs. This is proved theoretically through a universal approximation theorem in Section 5.3 and experimentally in Section 6. CLIP is based on three consecutive steps: 1) graphs are colored with several different colorings, 2) a neighborhood aggregation scheme provides a vector representation for each colored graph, 3) all vector representations are combined to provide a final output vector. We now provide more information on the coloring scheme.
|
| 119 |
+
|
| 120 |
+
# 5.1 COLORS TO DIFFERENTIATE NODES
|
| 121 |
+
|
| 122 |
+
In order to distinguish non-isomorphic graphs, our approach consists in coloring nodes of the graph with identical attributes. This idea is inspired by classical graph isomorphism algorithms that use colors to distinguish nodes (McKay, 1981), and may be viewed as an extension of one-hot encodings used for graphs without node attributes $\mathrm { { X u } }$ et al., 2019).
|
| 123 |
+
|
| 124 |
+
For any $k \in \mathbb N$ , let $C _ { k }$ be a finite set of $k$ colors. These colors may be represented as one-hot encodings ( $C _ { k }$ is the natural basis of $\mathbb { R } ^ { k }$ ) or more generally any finite set of $k$ elements. At initialization, we first partition the nodes into groups of identical attributes $V _ { 1 } , . . . , V _ { K } \subset [ [ 1 , n ] ]$ . Then, for a subset $V _ { k }$ of size $| V _ { k } |$ , we give to each of its nodes a distinct color from $C _ { k }$ J K(hence a subset of size $| V _ { k } | )$ . For example, Figure 3 shows two colorings of the same graph, which is decomposed in three groups $V _ { 1 }$ , $V _ { 2 }$ and $V _ { 3 }$ containing nodes with attributes $a , b$ and $c$ respectively. Since $V _ { 1 }$ contains only two nodes, a coloring of the graph will attribute two colors $( ( 1 , 0 )$ and $( 0 , 1 )$ , depicted as blue and red) to these nodes. More precisely, the set of colorings $ { \mathcal { C } } ( v , A )$ of a graph ${ \cal { G } } = ( v , A )$ are defined as
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\mathcal { C } ( v , A ) = \Big \{ ( c _ { 1 } , . . . , c _ { n } ) : \forall k \in [ [ 1 , K ] ] , ( c _ { i } ) _ { i \in V _ { k } } \mathrm { { i s } a p e r m u t a t i o n { o f } } C _ { | V _ { k } | } \Big \} .
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
# 5.2 THE CLIP ALGORITHM
|
| 131 |
+
|
| 132 |
+
In the CLIP algorithm, we add a coloring scheme to an MPNN in order to distinguish identical node attributes. This is achieved by modifying the initialization and readout phases of MPNNs as follows.
|
| 133 |
+
|
| 134 |
+
1. Colored initialization: We first select a set ${ \mathcal { C } } _ { k } \subseteq { \mathcal { C } } ( v , A )$ of $k$ distinct colorings uniformly at random (see Eq. (4)). Then, for each coloring $c \in { \mathcal { C } } _ { k }$ , node representations are initialized with their node attributes concatenated with their color: $\boldsymbol { x } _ { i , 0 } ^ { c } = \left( \boldsymbol { v } _ { i } , \boldsymbol { c } _ { i } \right)$ .
|
| 135 |
+
|
| 136 |
+
2. Aggregation and combination: This step is performed for all colorings $c \in { \mathcal { C } } _ { k }$ using a universal set representation as the aggregation function: $\begin{array} { r } { \boldsymbol { x } _ { i , t + 1 } ^ { c } = \psi ^ { ( t ) } \big ( \boldsymbol { x } _ { i , t } ^ { c } , \sum _ { j \in \mathcal { N } _ { i } } \varphi ^ { ( t ) } \bar { ( } \boldsymbol { x } _ { j , t } ^ { c } ) \big ) } \end{array}$ , where $\psi$ and $\varphi$ are MLPs with continuous non-polynomial activation functions and $\psi ( x , y )$ denotes the result of $\psi$ applied to the concatenation of $x$ and $y$ . The aggregation scheme we propose is closely related to DeepSet (Zaheer et al., 2017), and a direct application of Corollary 1 proves the universality of our architecture. More details, as well as the proof of universality, are available in Appendix C.
|
| 137 |
+
|
| 138 |
+
3. Colored readout: This step performs a maximum over all possible colorings in order to obtain a final coloring-independent graph representation. In order to keep the stability by concatenation, the maximum is taken coefficient-wise
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
x _ { G } = \psi \left( \operatorname* { m a x } _ { c \in \mathcal { C } _ { k } } \sum _ { i = 1 } ^ { n } x _ { i , T } ^ { c } \right) ,
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
where $\psi$ is an MLP with continuous non polynomial activation functions.
|
| 145 |
+
|
| 146 |
+
We treat $k$ as a hyper-parameter of the algorithm and call $k$ -CLIP (resp. $\infty$ -CLIP) the algorithm using $k$ colorings (resp. all colorings, i.e. $\boldsymbol { \bar { k } } = | \mathcal { C } ( \boldsymbol { v } , \boldsymbol { A } ) | )$ . Note that, while our focus is graphs with node attributes, the approach used for CLIP is easily extendable to similar data structures such as directed or weighted graphs with node attributes, graphs with node labels, graphs with edge attributes or graphs with additional attributes at the graph level.
|
| 147 |
+
|
| 148 |
+
# 5.3 UNIVERSAL REPRESENTATION THEOREM
|
| 149 |
+
|
| 150 |
+
As the colorings are chosen at random, the CLIP representation is itself random as soon as $k <$ $| \mathcal { C } ( v , A ) |$ , and the number of colorings $k$ will impact the variance of the representation. However, $\infty$ -CLIP is deterministic and permutation invariant, as MPNNs are permutation invariant. The separability is less trivial and is ensured by the coloring scheme.
|
| 151 |
+
|
| 152 |
+
Theorem 3. The $\infty$ -CLIP algorithm with one local iteration $T = 1 .$ ) is a universal representation of the space $\mathbf { G r a p h } _ { m }$ of graphs with node attributes.
|
| 153 |
+
|
| 154 |
+
The proof of Theorem 3 relies on showing that $\infty$ -CLIP is separable and applying Corollary 1. This is achieved by fixing a coloring on one graph and identifying all nodes and edges of the second graph using the fact that all pairs $( v _ { i } , c _ { i } )$ are dissimilar (see Appendix D). Similarly to the case of MLPs, only one local iteration is necessary to ensure universality of the representation. This rather counter-intuitive result is due to the fact that all nodes can be identified by their color, and the readout function can aggregate all the structural information in a complex and non-trivial way. However, as for MLPs, one may expect poor generalization capabilities for CLIP with only one local iteration, and deeper networks may allow for more complex representations and better generalization. This point is addressed in the experiments of Section 6. Moreover, $\infty$ -CLIP may be slow in practice due to a large number of colorings, and reducing $k$ will speed-up the computation. Fortunately, while $k$ -CLIP is random, a similar universality theorem still holds even for $k = 1$ .
|
| 155 |
+
|
| 156 |
+
Theorem 4. The 1-CLIP algorithm with one local iteration $T = 1 .$ ) is a random representation whose expectation is a universal representation of the space $\mathbf { G r a p h } _ { m }$ of graphs with node attributes.
|
| 157 |
+
|
| 158 |
+
The proof of Theorem 4 relies on using $\infty$ -CLIP on the augmented node attributes $\boldsymbol { v } _ { i } ^ { \prime } = \left( v _ { i } , c _ { i } \right)$ . As all node attributes are, by design, different, the max over all colorings in Eq. (5) disappears and, for any coloring, 1-CLIP returns an $\varepsilon$ -approximation of the target function (see Appendix D).
|
| 159 |
+
|
| 160 |
+
Remark 1. Note that the variance of the representation may be reduced by averaging over multiple samples. Moreover, the proof of Theorem 4 shows that the variance can be reduced to an arbitrary precision given enough training epochs, although this may lead to very large training times in practice.
|
| 161 |
+
|
| 162 |
+
# 5.4 COMPUTATIONAL COMPLEXITY
|
| 163 |
+
|
| 164 |
+
As the local iterative steps are performed $T$ times on each node and the complexity of the aggregation depends on the number of neighbors of the considered node, the complexity is proportional to the number of edges of the graph $E$ and the number of steps $T$ . Moreover, CLIP performs this iterative aggregation for each coloring, and its complexity is also proportional to the number of chosen colorings $k = | \mathcal { C } _ { k } |$ . Hence the complexity of the algorithm is in $O ( k E T )$ .
|
| 165 |
+
|
| 166 |
+
Note that the number of all possible colorings for a given graph depends exponentially in the size of the groups $V _ { 1 } , . . . , V _ { K }$ ,
|
| 167 |
+
|
| 168 |
+
$$
|
| 169 |
+
| { \mathcal C } ( v , A ) | = \prod _ { k = 1 } ^ { K } | V _ { k } | ! ,
|
| 170 |
+
$$
|
| 171 |
+
|
| 172 |
+
and thus $\infty$ -CLIP is practical only when most node attributes are dissimilar. This worst case exponential dependency in the number of nodes can hardly be avoided for universal representations. Indeed, a universal graph representation should also be able to solve the graph isomorphism problem. Despite the existence of polynomial time algorithms for a broad class of graphs (Luks, 1982; Bodlaender, 1990), graph isomorphism is still quasi-polynomial in general (Babai, 2016). As a result, creating a universal graph representation with polynomial complexity for all possible graphs and functions to approximate is highly unlikely, as it would also induce a graph isomorphism test of polynomial complexity and thus solve a very hard and long standing open problem of theoretical computer science.
|
| 173 |
+
|
| 174 |
+
# 6 EXPERIMENTS
|
| 175 |
+
|
| 176 |
+
In this section we show empirically the practical efficiency of CLIP and its relaxation. We run two sets of experiments to compare CLIP w.r.t. state-of-the-art methods in supervised learning settings: i) on 5 real-world graph classification datasets and ii) on 4 synthetic datasets to distinguish structural graph properties and isomorphism. Both experiments follow the same experimental protocol as described in $\mathrm { X u }$ et al. (2019): 10-fold cross validation with grid search hyper-parameter optimization. More details on the experimental setup are provided in Appendix E.
|
| 177 |
+
|
| 178 |
+
# 6.1 CLASSICAL BENCHMARK DATASETS
|
| 179 |
+
|
| 180 |
+
We performed experiments on five benchmark datasets extracted from standard social networks (IMDBb and IMDBm) and bio-informatics databases (MUTAG, PROTEINS and PTC). All dataset characteristics (e.g. size, classes), as well as the experimental setup, are available in Appendix E. Following standard practices for graph classification on these datasets, we use one-hot encodings of node degrees as node attributes for IMDBb and IMDBm (Xu et al., 2019), and perform singlelabel multi-class classification on all datasets. We compared CLIP with six state-of-the-art baseline algorithms: 1) WL: Weisfeiler-Lehman subtree kernel (Shervashidze et al., 2011), 2) AWL: Anonymous Walk Embeddings (Ivanov and Burnaev, 2018), 3) DCNN: Diffusion-convolutional neural networks (Atwood and Towsley, 2016), 4) PS: PATCHY-SAN (Niepert et al., 2016), 5) DGCNN: Deep Graph CNN (Zhang et al., 2018) and 6) GIN: Graph Isomorphism Network (Xu et al., 2019). WL and AWL are representative of unsupervised methods coupled with an SVM classifier, while DCNN, PS, DGCNN and GIN are four deep learning architectures. As the same experimental protocol as that of Xu et al. (2019) was used, we present their reported results on Table 1.
|
| 181 |
+
|
| 182 |
+
Table 1: Classification accuracies of the compared methods on benchmark datasets. The best performer w.r.t. the mean is highlighted with an asterisk. We perform an unpaired t-test with asymptotic significance of 0.1 w.r.t. the best performer and highlight with boldface the ones for which the difference is not statistically significant. 0-CLIP is the CLIP architecture without any colorings.
|
| 183 |
+
|
| 184 |
+
<table><tr><td>Dataset</td><td>PTC</td><td>IMDBb</td><td>IMDBm</td><td>PROTEINS</td><td>MUTAG</td></tr><tr><td>WL DCNN</td><td>59.9±4.3</td><td>73.8±3.9</td><td>50.9±3.8</td><td>75.0±3.1</td><td>90.4±5.7</td></tr><tr><td>PS</td><td>56.6 60.0±4.8</td><td>49.1</td><td>33.5</td><td>61.3</td><td>67.0</td></tr><tr><td></td><td></td><td>71.0±2.2</td><td>45.2±2.8</td><td>75.9±2.8</td><td>92.6±4.2</td></tr><tr><td>DGCNN</td><td>58.6</td><td>70.0</td><td>47.8</td><td>75.5</td><td>85.8</td></tr><tr><td>AWL</td><td>=</td><td>74.5±5.9</td><td>51.5±3.6</td><td>/</td><td>87.9±9.8</td></tr><tr><td>GIN</td><td>64.6±7.0</td><td>75.1±5.1</td><td>52.3±2.8</td><td>76.2±2.8</td><td>89.4±5.6</td></tr><tr><td>0-CLIP</td><td>65.9±4.0</td><td>75.4±2.0</td><td>52.5±2.6*</td><td>77.0±3.2</td><td>90.0±5.1</td></tr><tr><td>CLIP</td><td>67.9±7.1*</td><td>76.0±2.7*</td><td>52.5±3.0*</td><td>77.1±4.4*</td><td>93.9±4.0*</td></tr></table>
|
| 185 |
+
|
| 186 |
+
As Table 1 shows, CLIP can achieve state-of-the-art performance on the five benchmark datasets. Moreover, CLIP is consistent across all datasets, while all other competitors have at least one weak performance. This is a good indicator of the robustness of the method to multiple classification tasks and dataset types. Finally, the addition of colors does not improve the accuracy for these graph classification tasks, except on the MUTAG dataset. This may come from the small dataset sizes (leading to high variances) or an inherent difficulty of these classification tasks, and contrasts with the clear improvements of the method for property testing (see Section 6.2). More details on the performance of CLIP w.r.t. the number of colors $k$ are available in Appendix E.
|
| 187 |
+
|
| 188 |
+
Remark 2. In three out of five datasets, none of the recent state-of-the-art algorithms have statistically significantly better results than older methods (e.g. WL). We argue that, considering the high variances of all classification algorithms on classical graph datasets, graph property testing may be better suited to measure the expressiveness of graph representation learning algorithms in practice.
|
| 189 |
+
|
| 190 |
+
# 6.2 GRAPH PROPERTY TESTING
|
| 191 |
+
|
| 192 |
+
We now investigate the ability of CLIP to identify structural graph properties, a task which was previously used to evaluate the expressivity of graph kernels and on which the Weisfeiler-Lehman subtree kernel has been shown to fail for bounded-degree graphs (Kriege et al., 2018). The performance of our algorithm is evaluated for the binary classification of four different structural properties: 1) connectivity, 2) bipartiteness, 3) triangle-freeness, 4) circular skip links (Murphy et al., 2019) (see Appendix E for precise definitions of these properties) against three competitors: a) GIN, arguably the most efficient MPNN variant yet published (Xu et al., 2019), b) Ring-GNN, a permutation invariant network that uses the ring of matrix addition and multiplication (Chen et al., 2019), c) RP-GIN, the Graph Isomorphism Network combined with Relational Pooling, as described by Murphy et al. (2019), which is able to distinguish certain cases of non-isomorphic regular graphs. We provide all experimental details in Appendix E.
|
| 193 |
+
|
| 194 |
+
Table 2: Classification accuracies of the synthetic datasets. $k$ -RP-GIN refers to a relational pooling averaged over $k$ random permutations. We report Ring-GNN results from Chen et al. (2019).
|
| 195 |
+
|
| 196 |
+
<table><tr><td>Property</td><td>Connectivity</td><td>Bipartiteness</td><td>Triangle-freeness</td><td colspan="3">Circular skip links</td></tr><tr><td></td><td>mean ± std</td><td>mean ± std</td><td>mean ± std</td><td>mean ± std</td><td>max</td><td>min</td></tr><tr><td>GIN</td><td>55.2 ± 4.4</td><td>53.1 ±4.7</td><td>50.7±6.1</td><td>10.0 ± 0.0</td><td>10.0</td><td>10.0</td></tr><tr><td>Ring-GNN</td><td>=</td><td>=</td><td>1</td><td>(?) ± 15.7</td><td>80.0</td><td>10.0</td></tr><tr><td>1-RP-GIN</td><td>66.1±5.2</td><td>66.0±5.1</td><td>63.0±3.6</td><td>20.0 ± 7.0</td><td>28.6</td><td>10.0</td></tr><tr><td>16-RP-GIN</td><td>83.3±7.9</td><td>64.9±4.1</td><td>65.7±3.3</td><td>37.6 ± 12.9</td><td>53.3</td><td>10.0</td></tr><tr><td>0-CLIP</td><td>56.5 ± 4.0</td><td>55.4 ± 5.7</td><td>59.6 ± 3.8</td><td>10.0 ± 0.0</td><td>10.0</td><td>10.0</td></tr><tr><td>1-CLIP</td><td>73.3 ± 2.2</td><td>63.3 ±1.9</td><td>63.5 ±7.3</td><td>61.9 ±11.9</td><td>80.7</td><td>36.7</td></tr><tr><td>16-CLIP</td><td>99.7 ± 0.5</td><td>99.2 ± 0.9</td><td>94.2±3.4</td><td>90.8 ± 6.8</td><td>98.7</td><td>76.0</td></tr></table>
|
| 197 |
+
|
| 198 |
+
Table 2 shows that CLIP is able to capture the structural information of connectivity, bipartiteness, triangle-freeness and circular skip links, while MPNN variants fail to identify these graph properties. Furthermore, we observe that CLIP outperforms RP-GIN, that was shown to provide very expressive representations for regular graphs (Murphy et al., 2019), even with a high number of permutations (the equivalent of colors in their method is set to $k = 1 6$ ). Moreover, both for $k$ -RP-GIN and $k$ -CLIP, the increase of permutations and colorings respectively lead to higher accuracies. In particular, CLIP can capture almost perfectly the different graph properties with as little as $k = 1 6$ colorings.
|
| 199 |
+
|
| 200 |
+
# 7 CONCLUSION
|
| 201 |
+
|
| 202 |
+
In this paper, we showed that a simple coloring scheme can improve the expressive power of MPNNs. Using such a coloring scheme, we extended MPNNs to create CLIP, the first universal graph representation. Universality was proven using the novel concept of separable neural networks, and our experiments showed that CLIP is state-of-the-art on both graph classification datasets and property testing tasks. The coloring scheme is especially well suited to hard classification tasks that require complex structural information to learn. The framework is general and simple enough to extend to other data structures such as directed, weighted or labeled graphs. Future work includes more detailed and quantitative approximation results depending on the parameters of the architecture such as the number of colors $k$ , or number of hops of the iterative neighborhood aggregation.
|
| 203 |
+
|
| 204 |
+
# REFERENCES
|
| 205 |
+
|
| 206 |
+
Atwood, J. and Towsley, D. (2016). Diffusion-convolutional neural networks. In Advances in Neural Information Processing Systems.
|
| 207 |
+
|
| 208 |
+
Babai, L. (2016). Graph isomorphism in quasipolynomial time. In Proceedings of the forty-eighth annual ACM symposium on Theory of Computing, pages 684–697. ACM.
|
| 209 |
+
|
| 210 |
+
Bartlett, P., Helmbold, D., and Long, P. (2018). Gradient descent with identity initialization efficiently learns positive definite linear transformations. In International Conference on Machine Learning, pages 520–529.
|
| 211 |
+
|
| 212 |
+
Baum, E. B. and Haussler, D. (1989). What size net gives valid generalization? In Advances in neural information processing systems, pages 81–90.
|
| 213 |
+
|
| 214 |
+
Bengio, Y., Courville, A., and Vincent, P. (2013). Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828.
|
| 215 |
+
|
| 216 |
+
Bodlaender, H. L. (1990). Polynomial algorithms for graph isomorphism and chromatic index on partial k-trees. Journal of Algorithms, 11(4):631–643.
|
| 217 |
+
|
| 218 |
+
Bourbaki, N. (1998). General Topology: Chapters 1-4. Number vol. 4 in Addison-Wesley series in mathematics. Springer.
|
| 219 |
+
|
| 220 |
+
Bruna, J., Zaremba, W., Szlam, A., and Lecun, Y. (2014). Spectral networks and locally connected networks on graphs. ICLR.
|
| 221 |
+
|
| 222 |
+
Chen, Z., Villar, S., Chen, L., and Bruna, J. (2019). On the equivalence between graph isomorphism testing and function approximation with gnns. NeurIPS 2019, abs/1905.12560.
|
| 223 |
+
|
| 224 |
+
Cybenko, G. (1989). Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303–314.
|
| 225 |
+
|
| 226 |
+
Defferrard, M., Bresson, X., and Vandergheynst, P. (2016). Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, pages 3844–3852.
|
| 227 |
+
|
| 228 |
+
Duvenaud, D. K., Maclaurin, D., Iparraguirre, J., Bombarell, R., Hirzel, T., Aspuru-Guzik, A., and Adams, R. P. (2015). Convolutional networks on graphs for learning molecular fingerprints. In Advances in neural information processing systems, pages 2224–2232.
|
| 229 |
+
|
| 230 |
+
Erdös, P. and Rényi, A. (1959). On random graphs i. Publicationes Mathematicae Debrecen, 6:290.
|
| 231 |
+
|
| 232 |
+
Frasconi, P., Gori, M., and Sperduti, A. (1998). A general framework for adaptive processing of data structures. IEEE transactions on Neural Networks, 9(5):768–786.
|
| 233 |
+
|
| 234 |
+
Geman, S., Bienenstock, E., and Doursat, R. (1992). Neural networks and the bias/variance dilemma. Neural computation, 4(1):1–58.
|
| 235 |
+
|
| 236 |
+
Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., and Dahl, G. E. (2017). Neural message passing for quantum chemistry. ICML.
|
| 237 |
+
|
| 238 |
+
Gori, M., Monfardini, G., and Scarselli, F. (2005). A new model for learning in graph domains. In Neural Networks, 2005. IJCNN’05. Proceedings. 2005 IEEE International Joint Conference on, volume 2, pages 729–734. IEEE.
|
| 239 |
+
|
| 240 |
+
Grover, A. and Leskovec, J. (2016). node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pages 855–864. ACM.
|
| 241 |
+
|
| 242 |
+
Guttenberg, N., Virgo, N., Witkowski, O., Aoki, H., and Kanai, R. (2016). Permutation-equivariant neural networks applied to dynamics prediction. arXiv preprint arXiv:1612.04530.
|
| 243 |
+
|
| 244 |
+
Hamilton, W., Ying, Z., and Leskovec, J. (2017). Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pages 1024–1034.
|
| 245 |
+
|
| 246 |
+
Henaff, M., Bruna, J., and LeCun, Y. (2015). Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163.
|
| 247 |
+
|
| 248 |
+
Hornik, K. (1991). Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2):251–257.
|
| 249 |
+
|
| 250 |
+
Hornik, K., Stinchcombe, M., and White, H. (1989). Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366.
|
| 251 |
+
|
| 252 |
+
Ivanov, S. and Burnaev, E. (2018). Anonymous walk embeddings. ICML.
|
| 253 |
+
|
| 254 |
+
Kipf, T. N. and Welling, M. (2017). Semi-supervised classification with graph convolutional networks. ICLR.
|
| 255 |
+
|
| 256 |
+
Kriege, N. M., Morris, C., Rey, A., and Sohler, C. (2018). A property testing framework for the theoretical expressivity of graph kernels. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI-18, pages 2348–2354. International Joint Conferences on Artificial Intelligence Organization.
|
| 257 |
+
|
| 258 |
+
Krizhevsky, A., Sutskever, I., and Hinton, G. E. (2012). Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, pages 1097–1105.
|
| 259 |
+
|
| 260 |
+
Lei, T., Jin, W., Barzilay, R., and Jaakkola, T. (2017). Deriving neural architectures from sequence and graph kernels. ICML.
|
| 261 |
+
|
| 262 |
+
Luks, E. M. (1982). Isomorphism of graphs of bounded valence can be tested in polynomial time. Journal of Computer and System Sciences, 25(1):42 – 65.
|
| 263 |
+
|
| 264 |
+
Maron, H., Ben-Hamu, H., Serviansky, H., and Lipman, Y. (2019a). Provably powerful graph networks. NeurIPS.
|
| 265 |
+
|
| 266 |
+
Maron, H., Ben-Hamu, H., Shamir, N., and Lipman, Y. (2019b). Invariant and equivariant graph networks. In International Conference on Learning Representations.
|
| 267 |
+
|
| 268 |
+
Maron, H., Fetaya, E., Segol, N., and Lipman, Y. (2019c). On the universality of invariant networks. ICML 2019.
|
| 269 |
+
|
| 270 |
+
McKay, B. D. (1981). Practical graph isomorphism. Congressus Numerantium, 30:45–87.
|
| 271 |
+
|
| 272 |
+
Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A. A., Veness, J., Bellemare, M. G., Graves, A., Riedmiller, M., Fidjeland, A. K., Ostrovski, G., Petersen, S., Beattie, C., Sadik, A., Antonoglou, I., King, H., Kumaran, D., Wierstra, D., Legg, S., and Hassabis, D. (2015). Human-level control through deep reinforcement learning. Nature, 518(7540):529–533.
|
| 273 |
+
|
| 274 |
+
Murphy, R., Srinivasan, B., Rao, V., and Ribeiro, B. (2019). Relational pooling for graph representations. In Chaudhuri, K. and Salakhutdinov, R., editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 4663–4673, Long Beach, California, USA. PMLR.
|
| 275 |
+
|
| 276 |
+
Niepert, M., Ahmed, M., and Kutzkov, K. (2016). Learning convolutional neural networks for graphs. In International conference on machine learning.
|
| 277 |
+
|
| 278 |
+
Perozzi, B., Al-Rfou, R., and Skiena, S. (2014). Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 701–710. ACM.
|
| 279 |
+
|
| 280 |
+
Pinkus, A. (1999). Approximation theory of the mlp model in neural networks. Acta numerica, 8:143–195.
|
| 281 |
+
|
| 282 |
+
Qi, C. R., Su, H., Mo, K., and Guibas, L. J. (2017). Pointnet: Deep learning on point sets for 3d classification and segmentation. CVPR.
|
| 283 |
+
|
| 284 |
+
Rudin, W. (1987). Real and Complex Analysis, 3rd Ed. McGraw-Hill, Inc., New York, NY, USA.
|
| 285 |
+
|
| 286 |
+
Saxe, A. M., McClelland, J. L., and Ganguli, S. (2014). Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. ICLR.
|
| 287 |
+
Scarselli, F., Gori, M., Tsoi, A. C., Hagenbuchner, M., and Monfardini, G. (2009). The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80.
|
| 288 |
+
Shervashidze, N., Schweitzer, P., Leeuwen, E. J. v., Mehlhorn, K., and Borgwardt, K. M. (2011). Weisfeiler-lehman graph kernels. Journal of Machine Learning Research.
|
| 289 |
+
Sperduti, A. and Starita, A. (1997). Supervised neural networks for the classification of structures. IEEE Transactions on Neural Networks, 8(3):714–735.
|
| 290 |
+
Szegedy, C., Vanhoucke, V., Ioffe, S., Shlens, J., and Wojna, Z. (2016). Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2818–2826.
|
| 291 |
+
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, ł., and Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems, pages 5998–6008. Curran Associates, Inc.
|
| 292 |
+
Velickovic, P., Cucurull, G., Casanova, A., Romero, A., Lio, P., and Bengio, Y. (2018). Graph attention networks. ICLR.
|
| 293 |
+
Verma, S. and Zhang, Z.-L. (2019). Graph capsule convolutional neural networks. ICLR.
|
| 294 |
+
Weisfeiler, B. and Lehman, A. (1968). A reduction of a graph to a canonical form and an algebra arising during this reduction. Nauchno-Technicheskaya Informatsia, 2(9):12–16.
|
| 295 |
+
Xu, K., Hu, W., Leskovec, J., and Jegelka, S. (2019). How powerful are graph neural networks? ICLR.
|
| 296 |
+
Ying, R., You, J., Morris, C., Ren, X., Hamilton, W. L., and Leskovec, J. (2018). Hierarchical graph representation learning with differentiable pooling. In Advances in Neural Information Processing Systems, pages 4805–4815.
|
| 297 |
+
Zaheer, M., Kottur, S., Ravanbakhsh, S., Póczos, B., Salakhutdinov, R., and Smola, A. J. (2017). Deep sets. In Advances in Neural Information Processing Systems.
|
| 298 |
+
Zhang, M., Cui, Z., Neumann, M., and Chen, Y. (2018). An end-to-end deep learning architecture for graph classification. In Proceedings of AAAI Conference on Artificial Inteligence.
|
| 299 |
+
|
| 300 |
+
# A PROOFS OF THE UNIVERSALITY OF SEPARABLE NEURAL NETWORKS
|
| 301 |
+
|
| 302 |
+
Proof of Theorem 2. The proof relies on the Stone-Weierstrass theorem we recall below. We refer to (Rudin, 1987, Theorem 7.32) for a detailed proof of the following classical theorem.
|
| 303 |
+
|
| 304 |
+
Theorem 5 (Stone-Weierstrass). Let $\mathcal { A }$ be an algebra of real functions on a compact Hausdorff set $K$ . If $\mathcal { A }$ separates points of $K$ and contains a non-zero constant function, then $\mathcal { A }$ is uniformly dense in ${ \mathcal { C } } ( K , \mathbb { R } )$ .
|
| 305 |
+
|
| 306 |
+
We verify that under the assumptions of Theorem 2 the Stone-Weierstrass theorem applies. In this setting, we first prove the theorem for $m = 1$ and use induction for the general case.
|
| 307 |
+
|
| 308 |
+
Let $K \subset { \mathcal { X } }$ be a compact subset of $\mathcal { X }$ . We will denote
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\begin{array} { r } { \mathcal { A } _ { 0 } = \left\{ \psi \circ f \ : \ \exists d \geq 1 \mathrm { ~ s . t . ~ } \psi \in \mathcal { C } ( \mathbb { R } ^ { d } , \mathbb { R } ) , f \in \mathfrak { F } \right\} , } \end{array}
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
and will proceed in two steps: we first show that $\mathcal { A } _ { \mathrm { 0 } }$ is uniformly dense in ${ \mathcal { C } } ( K , \mathbb { R } )$ , then that $\mathcal { A }$ is dense in $\mathcal { A } _ { 0 }$ , hence proving Theorem 2.
|
| 315 |
+
|
| 316 |
+
Lemma 1. $\mathcal { A } _ { 0 }$ is a subalgebra of ${ \mathcal { C } } ( K , \mathbb { R } )$ .
|
| 317 |
+
|
| 318 |
+
Proof. The subset $\mathcal { A } _ { \mathrm { 0 } }$ contains zero and all constants. Let $f , g \in { \mathcal { A } } _ { 0 }$ so that
|
| 319 |
+
|
| 320 |
+
$$
|
| 321 |
+
f ( x ) = \psi _ { f } \circ \varphi _ { f } ( x ) , g ( x ) = \psi _ { g } \circ \varphi _ { g } ( x ) ,
|
| 322 |
+
$$
|
| 323 |
+
|
| 324 |
+
with $\psi _ { f } : \mathbb { R } ^ { d _ { f } } \mathbb { R }$ and $\psi _ { g } : \mathbb { R } ^ { d _ { g } } \mathbb { R }$ . Consider $\psi : \mathbb { R } ^ { d _ { f } + d _ { g } } \mathbb { R }$ such that $\psi ( a , b ) = $ $\psi _ { f } ( a ) + \psi _ { g } ( b )$ . We define $\varphi ( \bar { \boldsymbol { x } } ) = ( \varphi _ { f } ( \boldsymbol { x } ) , \varphi _ { g } ( \boldsymbol { x } ) ) \in \mathbb { R } ^ { d _ { f } + d _ { g } }$ and by assumption $\varphi \in { \mathfrak { F } }$ . We have
|
| 325 |
+
|
| 326 |
+
$$
|
| 327 |
+
\begin{array} { r l } { ( f + g ) ( x ) = \psi ( \varphi _ { f } ( x ) , \varphi _ { g } ( x ) ) } & { { } } \\ { \qquad = \psi \circ \varphi ( x ) } & { { } } \end{array}
|
| 328 |
+
$$
|
| 329 |
+
|
| 330 |
+
so that $f + g \in { \mathcal { A } } _ { 0 }$ and we conclude that $\mathcal { A } _ { 0 }$ is a vectorial subspace of ${ \mathcal { C } } ( K , \mathbb { R } )$ . We proceed similarly for the product in order to finish the proof of the lemma. □
|
| 331 |
+
|
| 332 |
+
Because $\mathfrak { F } _ { 1 }$ separates the points of $\mathcal { X }$ by assumption, $A _ { 0 }$ also separates the points of $\mathcal { X }$ . Indeed, let $x \neq y$ two distinct points of $X$ so that $\exists f \in \mathfrak { F }$ such that $f ( x ) \neq f ( y )$ . There exists $g \in \mathcal { C } ( \mathbb { R } ^ { d } , \mathbb { R } )$ such that $g ( f ( x ) ) \bar { \neq } g ( f ( y ) )$ . From Theorem 5 we deduce that $A _ { 0 }$ is uniformly dense in ${ \mathcal { C } } ( K , \mathbb { R } )$ for all compact subsets $K \subset { \mathcal { X } }$ .
|
| 333 |
+
|
| 334 |
+
Finally we state that:
|
| 335 |
+
|
| 336 |
+
Lemma 2. For any compact subset $K \subset { \mathcal { X } }$ , $\mathcal { A }$ is uniformly dense in $\mathcal { A } _ { \mathrm { 0 } }$
|
| 337 |
+
|
| 338 |
+
Proof. Let $\epsilon > 0$ and $h = \psi _ { 0 } \circ f \in \mathcal { A } _ { 0 }$ with $f \in { \mathfrak { F } }$ and $\psi _ { 0 } \in \mathcal { C } ( \mathbb { R } ^ { d } , \mathbb { R } )$ . Thanks to the continuity of $f$ , the image $\tilde { K } = f ( K )$ is a compact of $\mathbb { R } ^ { d }$ . By Theorem 1 there exists an MLP $\psi$ such that $\| \psi - \psi _ { 0 } \| _ { \tilde { K } , \infty } \le \epsilon .$ . We have $\psi \circ f \in { \mathcal { A } }$ and $\| \psi _ { 0 } \circ f - \psi \circ f \| _ { K , \infty } \leq \epsilon$ which concludes the proof.
|
| 339 |
+
|
| 340 |
+
This last lemma completes the proof in the case $m = 1$ . For $m \geq 2$ consider $\mathcal { A } _ { 0 } = \{ \psi \circ f : \exists d \geq$ 1 s.t. $\psi \in \mathcal { C } ( \mathbb { R } ^ { d } , \mathbb { R } ^ { m } ) , f \in \mathfrak { F } \}$ and proceed in a similar manner than Lemma 2 by decomposing $\psi \in \mathcal { C } ( \mathbb { R } ^ { d } , \mathbb { R } ^ { m } )$ as
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\psi ( x ) = \left( \begin{array} { c } { { \psi _ { 1 } ( x ) } } \\ { { \psi _ { 2 } ( x ) } } \\ { { \vdots } } \\ { { \psi _ { m } ( x ) } } \end{array} \right) ,
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
and applying Lemma 1 for each coefficient function $\psi _ { i } \in \mathcal { C } ( \mathbb { R } ^ { d } , \mathbb { R } )$ .
|
| 347 |
+
|
| 348 |
+
Proof of Proposition $^ { l }$ . Assume that there exists $x , y \in { \mathcal { X } }$ s.t. $\forall f \in \mathfrak { F } _ { 1 }$ , $f ( x ) = f ( y )$ . Then $K =$ $\{ x , y \}$ is a compact subset of $\mathcal { X }$ and let $\phi \in \mathcal { C } ( K , \mathbb { R } )$ be such that $\phi ( x ) = 1$ and $\phi ( y ) = 0$ . Thus, for all $f \in \mathfrak { F } _ { 1 }$ , $\begin{array} { r } { \operatorname* { m a x } _ { z \in \{ x , y \} } \| \phi ( z ) - f ( z ) \| \ge 1 / 2 } \end{array}$ which contradicts universality (see Definition 1).
|
| 349 |
+
|
| 350 |
+
# B GROUP ACTION ON HAUSDORFF SPACES
|
| 351 |
+
|
| 352 |
+
In what follows, $\mathcal { X }$ is always a topological set and $G$ a group of transformations acting on $\mathcal { X }$ . The orbits of $\mathcal { X }$ under the action of $G$ are the sets $G x = { \bar { \{ g \cdot x : g \in G \} } }$ . Moreover, we denote as $\mathcal { X } / G$ the quotient space of orbits, also defined by the equivalence relation: $x \sim y \iff \exists g \in G$ s.t. $x = g \cdot y$ . As stated in Section 5, graphs with node attributes can be defined using invariance by permutation of the labels. We prove here that the resulting spaces are Hausdorff.
|
| 353 |
+
|
| 354 |
+
Definition 4 (Group invariance). Let $G$ a group, a function $f : \mathcal { X } \mathcal { Y }$ is $G$ -invariant if
|
| 355 |
+
|
| 356 |
+
$$
|
| 357 |
+
\forall x \in { \mathcal { X } } , \forall g \in G , f ( x ) = f ( g \cdot x ) .
|
| 358 |
+
$$
|
| 359 |
+
|
| 360 |
+
Lemma 3 ((Bourbaki, 1998, I, $\ S 8 . 3 )$ ). Let $\mathcal { X }$ be a Hausdorff space and $\mathcal { R }$ an equivalence relation of $\mathcal { X }$ . Then $\mathcal { X } / \mathcal { R }$ is Hausdorff if and only if any two distinct equivalence classes in $\mathcal { X }$ are contained in disjoints saturated open subsets of $\mathcal { X }$ .
|
| 361 |
+
|
| 362 |
+
Thanks to this lemma we prove the following proposition.
|
| 363 |
+
|
| 364 |
+
Proposition 2. Let $G$ a finite group acting on an Hausdorff space $\mathcal { X }$ , then the orbit space $\mathcal { X } / G$ is Hausdorff.
|
| 365 |
+
|
| 366 |
+
Proof. Let $G x$ and $G y$ two distinct classes with disjoint open neighbourhood $U$ and $V$ . By finiteness of $G$ , the application $\pi : \mathcal { X } \to \mathcal { X } / G$ is open, hence the saturated sets $\tilde { U } ~ = ~ \pi ^ { - 1 } [ \pi ( U ) ]$ and $\tilde { V } = \pi ^ { - 1 } [ \pi ( V ) ]$ are open. Suppose that there exists $z \in \tilde { U } \cap \tilde { V }$ , then $\pi ( z ) \in \pi ( U ) \cap \pi ( V )$ and we finally get that $G z \subset U \cap V = \emptyset$ . Therefore $\tilde { U } \cap \tilde { V }$ is empty and $\mathcal { X } / G$ is Hausdorff by Lemma 3.
|
| 367 |
+
|
| 368 |
+
Proposition 2 directly implies that the spaces $\mathbf { G r a p h } _ { m }$ and Neighborhood $_ m$ are Hausdorff.
|
| 369 |
+
|
| 370 |
+
# C UNIVERSALITY OF THE NODE AGGREGATION SCHEME
|
| 371 |
+
|
| 372 |
+
We now provide more details on the aggregation and combination scheme of CLIP, and show that a simple application of Corollary 1 is sufficient to prove its universality for node neighborhoods. Each local aggregation step takes as input a couple $( x _ { i } , \bar { \{ x _ { j } \} } _ { j \in \mathcal { N } _ { i } } )$ where $x _ { i } \in \mathbb { R } ^ { m }$ is the representation of node $i$ , and $\{ x _ { j } \} _ { j \in \mathcal { N } _ { i } }$ is the set of vector representations of the neighbors of node $i$ . In the following, we show how to use Corollary 1 to design universal representations for node neighborhoods.
|
| 373 |
+
|
| 374 |
+
Definition 5. The set of node neighborhoods for $m$ -dimensional node attributes is defined as
|
| 375 |
+
|
| 376 |
+
$$
|
| 377 |
+
\mathbf { N e i g h b o r h o o d } _ { m } = \mathbb { R } ^ { m } \times \bigcup _ { n \leq n _ { \operatorname* { m a x } } } \left( \mathbb { R } ^ { n \times m } / \mathcal { P } _ { n } \right) ,
|
| 378 |
+
$$
|
| 379 |
+
|
| 380 |
+
where the set of permutation matrices $\mathcal { P } _ { n }$ is acting on $\mathbb { R } ^ { \times m }$ by $P \cdot v = P v$ .
|
| 381 |
+
|
| 382 |
+
The main difficulty to design universal neighborhood representations is that the node neighborhoods of Definition 5 are permutation invariant w.r.t. neighboring node attributes, and hence require permutation invariant representations. The graph neural network literature already contains several deep learning architectures for permutation invariant sets (Guttenberg et al., 2016; Qi et al., 2017; Zaheer et al., 2017; Xu et al., 2019), among which PointNet and DeepSet have the notable advantage of being provably universal for sets. Following Corollary 1, we compose a separable permutation invariant network with an MLP that will aggregate both information from the node itself and its neighborhood. While our final architecture is similar to Deepset (Zaheer et al., 2017), this section emphasizes that the general universality theorems of Section 3 are easily applicable in many settings including permutation invariant networks. The permutation invariant set representation used for the aggregation step of CLIP is as follows:
|
| 383 |
+
|
| 384 |
+
$$
|
| 385 |
+
\mathrm { N O D E A G G R E G A T I O N } ( x , S ) = \psi \left( x , \sum _ { y \in S } \varphi ( y ) \right) ,
|
| 386 |
+
$$
|
| 387 |
+
|
| 388 |
+
where $\psi$ and $\varphi$ are MLPs with continuous non-polynomial activation functions and $\psi ( x , y )$ denotes the result of the MLP $\psi$ applied to the concatenation of $x$ and $y$ .
|
| 389 |
+
|
| 390 |
+
Theorem 6. The set representation described in Eq. (9) is a universal representation of Neighborhoodm.
|
| 391 |
+
|
| 392 |
+
Proof. By construction, NODEAGGREGATION is a continuous and concatenable representation. Moreover, its final stage is an MLP, and we thus only have to prove separability in order to use Corollary 1 and prove universality. Let $( x ^ { 1 } , S ^ { 1 } ) , ( x ^ { 2 } , \mathbf { \bar { \xi } } S ^ { 2 } ) \in \mathbf { N e i g h b o r h o o d } _ { m }$ and suppose that $( x ^ { 1 } , S ^ { 1 } ) { \overset { . } { \neq } } ( x ^ { 2 } , { \bar { S } } ^ { 2 } )$ . First, if $x ^ { 1 } \neq x ^ { 2 }$ , the final MLP $\psi$ can separate $x ^ { 1 }$ and $x ^ { 2 }$ . Otherwise, $\dot { S } ^ { 1 } \neq S ^ { 2 }$ , and let us assume that $S ^ { 1 } \setminus S ^ { 2 } \ne \emptyset$ (otherwise $S ^ { 2 } \setminus S ^ { 1 } \ne \emptyset$ and the argument is identical). Since MLPs are universal representations of $\mathbb { R } ^ { m }$ , there exists an MLP $\varphi$ such that, $\forall s \in S ^ { 1 } \cup S ^ { 2 }$ ,
|
| 393 |
+
|
| 394 |
+
$$
|
| 395 |
+
\begin{array} { c } { { \varphi ( s ) \geq 1 \mathrm { i f } s \in S ^ { 1 } \setminus S ^ { 2 } , } } \\ { { | \varphi ( s ) | \leq \varepsilon \mathrm { o t h e r w i s e } , } } \end{array}
|
| 396 |
+
$$
|
| 397 |
+
|
| 398 |
+
Taking $\psi ( x , y ) = y$ and $\varepsilon = 1 / 3 \operatorname* { m a x } \{ | S ^ { 1 } | , | S ^ { 2 } | \}$ , we have
|
| 399 |
+
|
| 400 |
+
$$
|
| 401 |
+
\begin{array} { r l } & { \mathrm { N O D E A G G R E G A T I O N } ( x ^ { 1 } , S ^ { 1 } ) \ge 2 / 3 , } \\ & { \mathrm { N O D E A G G R E G A T I O N } ( x ^ { 2 } , S ^ { 2 } ) \le 1 / 3 , } \end{array}
|
| 402 |
+
$$
|
| 403 |
+
|
| 404 |
+
which proves separability and, using Corollary 1, the universality of the representation.
|
| 405 |
+
|
| 406 |
+
# D PROOF OF THE UNIVERSALITY OF CLIP
|
| 407 |
+
|
| 408 |
+
Proof of Theorem 3. First of all, as the activation functions of the MLPs are continuous, CLIP is made of continuous and concatenable functions, and is thus also continuous and concatenable. Second, as the node aggregation step (denoted NODEAGGREGATION below) is a universal set representation (see Appendix C), it is capable of approximating any continuous function. We will thus first replace this function by a continuous function $\phi$ , and then show that the result still holds for NODEAGGREGATION(1) by a simple density argument. Let $G ^ { 1 } = ( v ^ { 1 } , A ^ { 1 } )$ and $G ^ { 2 } = ( \underline { { { v } } } ^ { 2 } , A ^ { 2 } )$ be two distinct graphs of respective sizes $n _ { 1 }$ and $n _ { 2 }$ (up to a permutation). If $n ^ { 1 } \neq n ^ { 2 }$ , then $\psi ( x ) = x$ and $\phi ( x ) = 1$ returns the number of nodes, and hence $\dot { x _ { G ^ { 1 } } } = n ^ { 1 } \neq n ^ { 2 } = x _ { G ^ { 2 } }$ . Otherwise, let $V = \{ v _ { i } ^ { k } \} _ { i \in [ [ 1 , n ^ { 1 } ] ] , k \in \{ 1 , 2 \} }$ be the set of node attributes of $G ^ { 1 }$ and $G ^ { 2 }$ , $c ^ { 1 }$ be a coloring of $G ^ { 1 }$ , $\psi ( x ) = x$ and $\phi$ J Kbe a continuous function such that, $\forall x \in V$ and $S \subset V$ ,
|
| 409 |
+
|
| 410 |
+
$$
|
| 411 |
+
\phi ( x , S ) = \sum _ { i = 1 } ^ { n ^ { 1 } } \mathbb { 1 } \{ x = ( v _ { i } ^ { 1 } , c _ { i } ^ { 1 } ) \} \prod _ { j \neq i } \mathbb { 1 } \left\{ A _ { i j } ^ { 1 } = \mathbb { 1 } \{ ( v _ { j } ^ { 1 } , c _ { j } ^ { 1 } ) \in S \} \right\} .
|
| 412 |
+
$$
|
| 413 |
+
|
| 414 |
+
The existence of $\phi \in \mathcal { C } ( \mathbb { R } ^ { m } , \mathbb { R } )$ is assured by Urysohn’s lemma (see e.g. (Rudin, 1987, lemma 2.12)). Then, $x _ { G }$ counts the number of matching neighborhoods for the best coloring, and we have $x _ { G ^ { 1 } } = n ^ { 1 }$ and $x _ { G ^ { 2 } } \leq n ^ { 1 } - 1$ . Finally, taking $\varepsilon \stackrel { - } { < } 1 / 2 n ^ { 1 }$ in the definition of universal representation leads to the desired result, as then, using an $\varepsilon$ -approximation of $\phi$ as NODEAGGREGATION(1), we have $x _ { G ^ { 1 } } > n ^ { 1 } - 1 / 2 > x _ { G ^ { 2 } }$ . □
|
| 415 |
+
|
| 416 |
+
Proof of Theorem 4. Consider a continuous function $\psi : { \bf G r a p h } _ { m } \mathbb { R } ^ { d }$ and a compact $K ^ { \prime } \subset$ Graphm. Let extend K0 with K = K0 × [0, 1]nmax and we define φ : Graphm+nmax with $\phi ( ( v , c ) , { \overset { . . . } { A } } ) = \psi ( v , A )$ for all $c \in \mathcal { C } ( v , A )$ . Since $\infty$ -CLIP is universal there exists $\ddot { f } \in \infty$ -CLIP such that, for all $( ( v , c ) , A ) \in K$ ,
|
| 417 |
+
|
| 418 |
+
$$
|
| 419 |
+
\begin{array} { r } { \| \phi ( ( v , c ) , A ) - f ( ( v , c ) , A ) \| \le \varepsilon , } \end{array}
|
| 420 |
+
$$
|
| 421 |
+
|
| 422 |
+
hence
|
| 423 |
+
|
| 424 |
+
$$
|
| 425 |
+
\| \psi ( v , A ) - f ( ( v , c ) , A ) \| \leq \varepsilon .
|
| 426 |
+
$$
|
| 427 |
+
|
| 428 |
+
Moreover, observe that for any coloring $c \in \mathcal { C } ( v , A )$ , $\infty$ -CLIP and 1-CLIP applied to $( ( v , c ) , A )$ returns the same result, as all node attributes are dissimilar (by definition of the colorings) and ${ \mathcal { C } } ( ( v , c ) , A ) = \emptyset$ . Finally, 1-CLIP applied to $( v , A )$ is equivalent to applying 1-CLIP to $( ( v , C ) , A )$ where $C$ is a random coloring in $\mathcal { C } ( v , A )$ , and Eq. (12) thus implies that any random sample of 1-CLIP is within an $\varepsilon$ error of the target function $\psi$ . As a result, its expectation is also within an $\varepsilon$ error of the target function $\psi$ , which proves the universality of the expectation of 1-CLIP. □
|
| 429 |
+
|
| 430 |
+
# E EXPERIMENTAL DETAILS
|
| 431 |
+
|
| 432 |
+
# E.1 REAL-WORLD DATASETS
|
| 433 |
+
|
| 434 |
+
Table 3 summarizes the characteristics of all benchmark graph classification datasets used in Section 6.1. We now provide complementary information on these datasets.
|
| 435 |
+
|
| 436 |
+
Social Network Datasets (IMDBb, IMDBm): These datasets refer to collaborations between actors/actresses, where each graph is an ego-graph of every actor and the edges occur when the connected nodes/actors are playing in the same movie. The task is to classify the genre of the movie that the graph derives from. IMDBb is a single-class classification dataset, while IMDBm is multi-class. For both social network datasets, we used one-hot encodings of node degrees as node attribute vectors.
|
| 437 |
+
|
| 438 |
+
Bio-informatics Datasets (MUTAG, PROTEINS, PTC): MUTAG consists of mutagenic aromatic and heteroaromatic nitrocompounds with 7 discrete labels. PROTEINS consists of nodes, which correspond to secondary structureelements and the edges occur when the connected nodes are neighbors in the amino-acidsequence or in 3D space. It has 3 discrete labels. PTC consists of chemical compounds that reports the carcinogenicity for male and female rats and it has 19 discrete labels. For all bio-informatics datasets we used the node labels as node attribute vectors.
|
| 439 |
+
|
| 440 |
+
Experimentation protocol: We follow the same experimental protocol as described in $\mathrm { X u }$ et al. (2019), and thus report the results provided in this paper corresponding to the accuracy of our six baselines in Table 1. We optimized the CLIP hyperparameters by grid search according to 10-fold cross-validated accuracy means. We use 2-layer MLPs, an initial learning rate of 0.001 and decreased the learning rate by 0.5 every 50 epochs for all possible settings. For all datasets the hyperparameters we tested are: the number of hidden units within $\{ 3 2 , 6 4 \}$ , the number of colorings $\bar { c } \in \bar { \{ 1 , 2 , 4 , 8 \} }$ , the number of MPNN layers within $\{ 1 , 3 , 5 \}$ , the batch size within $\{ 3 2 , 6 4 \}$ , and the number of epochs, that means, we select a single epoch with the best cross-validation accuracy averaged over the 10 folds. Note that standard deviations are fairly high for all models due to the small size of these classic datasets.
|
| 441 |
+
|
| 442 |
+
Table 3: Characteristics of the benchmark graph classification datasets used in Section 6.1.
|
| 443 |
+
E.1.1 CLIP PERFORMANCES W.R.T. THE NUMBER OF COLORINGS $k$
|
| 444 |
+
|
| 445 |
+
<table><tr><td>Dataset</td><td>PTC</td><td>IMDBb</td><td>IMDBm</td><td>PROTEINS</td><td>MUTAG</td></tr><tr><td># graphs</td><td>344</td><td>1000</td><td>1500</td><td>1113</td><td>188</td></tr><tr><td>#classes</td><td>2</td><td>2</td><td>3</td><td>2</td><td>2</td></tr><tr><td>Avg # nodes</td><td>14.29</td><td>19.77</td><td>13.00</td><td>39.06</td><td>17.93</td></tr><tr><td>Avg degree</td><td>2.05</td><td>9.76</td><td>10.14</td><td>3.72</td><td>2.21</td></tr></table>
|
| 446 |
+
|
| 447 |
+
Table 4 summarizes the performances of CLIP while increasing the number of colorings $k$ . Overall we can see a small increase in performances and a reduction of the variances when $k$ is increasing. Nevertheless we should not jump to any conclusions since none of the models are statistically significantly better than the others.
|
| 448 |
+
|
| 449 |
+
Table 4: Ablation study: classification accuracies of $k$ -CLIP on benchmark datasets w.r.t $k$
|
| 450 |
+
|
| 451 |
+
<table><tr><td>Dataset</td><td>PTC</td><td>IMDBb</td><td>IMDBm</td><td>PROTEINS</td><td>MUTAG</td></tr><tr><td>0-CLIP</td><td>65.9±4.0</td><td>75.4±2.0</td><td>52.5±2.6</td><td>77.0±3.2</td><td>90.0±5.1</td></tr><tr><td>1-CLIP</td><td>65.3±12.8</td><td>75.2±3.9</td><td>52.2±4.0</td><td>75.1±4.5</td><td>91.1±7.0</td></tr><tr><td>4-CLIP</td><td>65.9±5.7</td><td>75.8±5.0</td><td>51.8±2.9</td><td>77.1±4.4</td><td>92.2±7.0</td></tr><tr><td>8-CLIP</td><td>67.9±7.1</td><td>75.7±3.8</td><td>52.5±3.0</td><td>76.8±4.8</td><td>93.9±4.1</td></tr><tr><td>16-CLIP</td><td>66.5±5.4</td><td>76.0±2.7</td><td>52.5±4.5</td><td>76.6±2.8</td><td>91.7±6.0</td></tr></table>
|
| 452 |
+
|
| 453 |
+
We note that on the IMDBb and PROTEINS datasets the difference between using or not a coloring scheme does not have a big impact on the performances. However, adding colors increases the performances of the algorithm on three out of five real world datasets. The property testing section (Section 6.2) shows empirically that the color scheme improves the expressiveness of CLIP.
|
| 454 |
+
|
| 455 |
+
# E.2 GRAPH PROPERTY TESTING
|
| 456 |
+
|
| 457 |
+
In Section 6.2 we evaluate the expressive power of CLIP on benchmark synthetic datasets. Our goal is to show that CLIP is able to distinguish basic graph properties, where classical MPNN cannot. We considered a binary classification task and we constructed balanced synthetic datasets2 for each of the examined graph properties. The 20-node graphs are generated using Erdös-Rényi model (Erdös and Rényi, 1959) (and its bipartite version for the bipartiteness) with different probabilities $p$ for edge creation. All nodes share the same (scalar) attribute. We thus have uninformative feature vectors.
|
| 458 |
+
|
| 459 |
+
In particular, we generated datasets for different classical tasks Kriege et al. (2018): 1) connectivity, 2) bipartiteness, 3) triangle-freeness, and 4) circular skip links (Murphy et al., 2019). In the following, we present the generating protocol of the synthetic datasets and the experimentation setup we used for the experiments.
|
| 460 |
+
|
| 461 |
+
# Synthetic datasets:
|
| 462 |
+
|
| 463 |
+
In every case of synthetic dataset we follow the same pattern: we generate a set of random graphs using Erdös-Rényi model, which contain a specific graph property and belong to the same class and by proper edge addition we remove this property, thus creating the second class of graphs. By this way, we assure that we do not change different structural characteristics other than the examined graph property.
|
| 464 |
+
|
| 465 |
+
- Connectivity dataset: this dataset consists of 1000 (20-node) graphs with 500 positive samples and 500 negative ones. The positive samples correspond to disconnected graphs with two 10-node connected components selected among randomly generated graphs with an Erdös-Rényi model probability of $p = 0 . 5$ . We constructed negative samples by adding to positive samples a random edge between the two connected components.
|
| 466 |
+
|
| 467 |
+
- Bipartiteness dataset: this dataset consists of 1000 (20-node) graphs with 500 positive samples and 500 negative ones. The positive samples correspond to bipartite graphs generated with an Erdös-Rényi (bipartite) model probability of $p = 0 . 5$ . For the negative samples (non-bipartite graphs) we chose the positive samples and for each of them we added an edge between randomly selected nodes from the same partition, in order to form odd cycles 3.
|
| 468 |
+
|
| 469 |
+
- Triangle-freeness dataset: this dataset consists of 1000 (20-node) graphs with 500 positive samples and 500 negative ones. The positive samples correspond to triangle-free graphs selected among randomly generated graphs with an Erdös-Rényi model probability of $p \ = \ 0 . 1$ . We constructed negative samples by randomly adding new edges to positive samples until it creates at least one triangle.
|
| 470 |
+
|
| 471 |
+
- Circular skip links: this dataset consists of 150 graphs of 41 nodes as described in (Murphy et al., 2019; Chen et al., 2019). The Circular Skip Links graphs are undirected regular graphs with node degree 4. We denote a Circular skip link graph by $G _ { n , k }$ an undirected graph of $n$ nodes, where $( i , { \bar { j } } ) \in E$ holds if and only if $| i - j | \equiv 1$ or $k ( { \bmod { n } } )$ This is a 10-class multiclass classification task whose objective is to classify each graph according to its isomorphism class.
|
| 472 |
+
|
| 473 |
+
Experimentation protocol: We evaluate the different configurations of CLIP and its competitors GIN and RP-GIN based on their hyper-parameters. For the architecture implementation of the GIN, we followed the best performing architecture, presented in $\mathrm { X u }$ et al. (2019). In particular, we used the summation as the aggregation operator, MLPs as the combination level for the node embedding generation and the sum operator for the readout function along with its refined version of concatenated graph representations across all iterations/layers of GIN, as described in $\mathrm { X u }$ et al. (2019).
|
| 474 |
+
|
| 475 |
+
In all the tested configurations for CLIP and its competitors (GIN, RP-GIN) we fixed the number of layers of the MLPs and the learning rate: we chose 2-layer MLPs and we used the Adam optimizer with initial learning rate of 0.001 along with a scheduler decaying the learning rate by 0.5 every 50 epochs. Concerning the other hyper-parameters, we optimized: the number of hidden units within $\{ \bar { 1 6 } , 3 2 , 6 4 \}$ (except for the CSL task where we only use 16 hidden units to be fair w.r.t. RP-GIN and Ring-GNN benchmarks), the number of MPNN layers within $\{ 1 , 2 , 3 , 5 \}$ , the batch size within $\{ 3 2 , 6 4 \}$ , and ran the model over 400 epochs. Regarding the RP-GIN architecture (Murphy et al., 2019) we optimized the one-hot encoding dimension of the first update within $\{ 5 , 1 0 , 1 5 , 2 0 , 2 5 , 3 0 \}$ and the number of inference permutations within $\{ 1 , 5 , 1 6 \}$ . Regarding the CLIP algorithm, we optimized the number of colorings $c \in \{ 1 , 2 , 4 , 8 , 1 6 \}$ . We then performed a 10-fold cross validation with early stopping for the hyper-parameter optimization and we reported the best 10-fold crossvalidated mean accuracy with its associated standard deviation.
|
md/train/rJzIBfZAb/rJzIBfZAb.md
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOWARDS DEEP LEARNING MODELS RESISTANT TO ADVERSARIAL ATTACKS
|
| 2 |
+
|
| 3 |
+
Aleksander M ˛adry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, Adrian Vladu∗
|
| 4 |
+
|
| 5 |
+
Department of Electrical Engineering and Computer Science
|
| 6 |
+
Massachusetts Institute of Technology
|
| 7 |
+
Cambridge, MA 02139, USA
|
| 8 |
+
{madry,amakelov,ludwigs,tsipras,avladu}@mit.ed
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Recent work has demonstrated that neural networks are vulnerable to adversarial examples, i.e., inputs that are almost indistinguishable from natural data and yet classified incorrectly by the network. To address this problem, we study the adversarial robustness of neural networks through the lens of robust optimization. This approach provides us with a broad and unifying view on much prior work on this topic. Its principled nature also enables us to identify methods for both training and attacking neural networks that are reliable and, in a certain sense, universal. In particular, they specify a concrete security guarantee that would protect against a well-defined class of adversaries. These methods let us train networks with significantly improved resistance to a wide range of adversarial attacks. They also suggest robustness against a first-order adversary as a natural security guarantee. We believe that robustness against such well-defined classes of adversaries is an important stepping stone towards fully resistant deep learning models.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Recent breakthroughs in computer vision and speech recognition are bringing trained classifiers into the center of security-critical systems. Important examples include vision for autonomous cars, face recognition, and malware detection. These developments make security aspects of machine learning increasingly important. In particular, resistance to adversarially chosen inputs is becoming a crucial design goal. While trained models tend to be very effective in classifying benign inputs, recent work (Dalvi et al., 2004; Szegedy et al., 2013; Goodfellow et al., 2014; Nguyen et al., 2015; Sharif et al., 2016) shows that an adversary is often able to manipulate the input so that the model produces an incorrect output.
|
| 17 |
+
|
| 18 |
+
This phenomenon has received particular attention in the context of deep neural networks, and there is now a quickly growing body of work on this topic (Fawzi et al., 2015; Kurakin et al., 2016; Papernot & McDaniel, 2016; Rozsa et al., 2016; Torkamani, 2016; Sokolic et al., 2016; Tramèr et al., 2017b). Computer vision presents a particularly striking challenge: very small changes to the input image can fool state-of-the-art neural networks with high probability (Szegedy et al., 2013; Goodfellow et al., 2014; Nguyen et al., 2015; Sharif et al., 2016; Moosavi-Dezfooli et al., 2016). This holds even when the benign example was classified correctly, and the change is imperceptible to a human. Apart from the security implications, this phenomenon also demonstrates that our current models are not learning the underlying concepts in a robust manner. All these findings raise a fundamental question:
|
| 19 |
+
|
| 20 |
+
# How can we learn models robust to adversarial inputs?
|
| 21 |
+
|
| 22 |
+
There are now many proposed defense mechanisms for the adversarial setting. Examples include defensive distillation (Papernot et al., 2016a; Papernot & McDaniel, 2016), feature squeezing (Xu et al., 2017), and several detection approaches for adversarial inputs (see Carlini & Wagner (2017) for references). While these works constitute important first steps in exploring the realm of possibilities, they do not offer a good understanding of the guarantees they provide. We can never be certain that a particular defense mechanism prevents the existence of some well-defined class of adversarial attacks. This makes it difficult to navigate the landscape of adversarial robustness or to fully evaluate the possible security implications. Moreover, subsequent work (Carlini & Wagner, 2016a; He et al., 2017) has shown that most of these defenses can be bypassed by stronger, adaptive adversaries.
|
| 23 |
+
|
| 24 |
+
In this paper, we study the adversarial robustness of neural networks through the lens of robust optimization. We use a natural saddle point (min-max) formulation to capture the notion of security against adversarial attacks in a principled manner. This formulation allows us to be precise about the type of security guarantee we would like to achieve, i.e., the broad class of attacks we want to be resistant to (in contrast to defending only against specific known attacks). The formulation also enables us to cast both attacks and defenses into a common theoretical framework. Most prior work on adversarial examples naturally fits into this framework. In particular, adversarial training directly corresponds to optimizing this saddle point problem. Similarly, prior methods for attacking neural networks correspond to specific algorithms for solving the underlying optimization problem.
|
| 25 |
+
|
| 26 |
+
Equipped with this perspective, we make the following contributions.
|
| 27 |
+
|
| 28 |
+
1. We conduct a careful experimental study of the optimization landscape corresponding to this saddle point formulation. Despite the non-convexity and non-concavity of its constituent parts, we find that the underlying optimization problem is tractable after all. In particular, we provide strong evidence that first-order methods can reliably solve this problem and motivate projected gradient descent (PGD) as a universal “first-order adversary”, i.e., the strongest attack utilizing the local first order information about the network. We supplement these insights with ideas from real analysis to further motivate adversarial training against a PGD adversary as a strong and natural defense.
|
| 29 |
+
|
| 30 |
+
2. We explore the impact of network architecture on adversarial robustness and find that model capacity plays an important role. To reliably withstand strong adversarial attacks, networks require a significantly larger capacity than for correctly classifying benign examples only. This shows that a robust decision boundary of the saddle point problem can be significantly more complicated than a decision boundary that simply separates the benign data points.
|
| 31 |
+
|
| 32 |
+
3. Building on the above insights, we train networks on MNIST and CIFAR10 that are robust to a wide range of adversarial attacks against adversaries bounded by 0.3 and 8 in $\ell _ { \infty }$ norm respectively. Our approach is based on optimizing the aforementioned saddle point formulation and uses our optimal “first-order adversary”. Our best MNIST model achieves an accuracy of more than $89 \%$ against the strongest adversaries in our test suite. In particular, our MNIST network is even robust against white box attacks of an iterative adversary. Our CIFAR10 model achieves an accuracy of $46 \%$ against the same adversary. Furthermore, in case of the weaker black box (transfer) attacks, our MNIST and CIFAR10 networks achieve an accuracy of more than $9 5 \%$ and $64 \%$ , respectively (a more detailed overview can be found in Tables 1 and 2). To the best of our knowledge, we are the first to achieve these levels of robustness on MNIST and CIFAR10 against a broad set of attacks.
|
| 33 |
+
|
| 34 |
+
Overall, these findings suggest that secure neural networks are within reach. In order to further support this claim, we have invited the community to attempt attacks against our MNIST and CIFAR10 networks in the form of an open challenge1,2. At the time of writing, we received about fifteen submissions to the MNIST challenge and the best submission achieved roughly $93 \%$ accuracy in a black box attack. We received no submissions for the CIFAR10 challenge that went beyond the $64 \%$ accuracy of our attack. Considering that other proposed defenses were often quickly broken (Carlini & Wagner, 2017), we believe that our robust models are significant progress on the defense side. Furthermore, recent work (Carlini et al., 2017) on verifiable adversarial examples showed that our proposed defense reliably increased the robustness to any $\ell _ { \infty }$ -bounded attack.
|
| 35 |
+
|
| 36 |
+
# 2 AN OPTIMIZATION VIEW ON ADVERSARIAL ROBUSTNESS
|
| 37 |
+
|
| 38 |
+
Much of our discussion will revolve around an optimization view of adversarial robustness. This perspective not only captures the phenomena we want to study in a precise manner, but will also inform our investigations. To this end, let us consider a standard classification task with an underlying data distribution $\mathcal { D }$ over pairs of examples $\boldsymbol { x } \in \mathbb { R } ^ { d }$ and corresponding labels $y \in [ k ]$ . We also assume that we are given a suitable loss function $L ( \theta , x , y )$ , for instance the cross-entropy loss for a neural network. As usual, $\theta \in \mathbb { R } ^ { p }$ is the set of model parameters. Our goal then is to find model parameters $\theta$ that minimize the risk $\mathbb { E } _ { ( x , y ) \sim \mathcal { D } } [ L ( x , y , \theta ) ]$ .
|
| 39 |
+
|
| 40 |
+
Empirical risk minimization (ERM) has been tremendously successful as a recipe for finding classifiers with small population risk. Unfortunately, ERM often does not yield models that are robust to adversarially crafted examples (Goodfellow et al., 2014; Kurakin et al., 2016; Moosavi-Dezfooli et al., 2016; Tramèr et al., 2017b). Formally, there are efficient algorithms (“adversaries”) that take an example $x$ belonging to class $c _ { 1 }$ as input and find examples $x ^ { \mathrm { a d v } }$ such that $x ^ { \mathrm { a d v } }$ is very close to $x$ but the model incorrectly classifies $x ^ { \mathrm { a d v } }$ as belonging to class $c _ { 2 } \neq c _ { 1 }$ .
|
| 41 |
+
|
| 42 |
+
In order to reliably train models that are robust to adversarial attacks, it is necessary to augment the ERM paradigm. Instead of resorting to methods that directly focus on improving the robustness to specific attacks, our approach is to first propose a concrete guarantee that an adversarially robust model should satisfy. We then adapt our training methods towards achieving this guarantee.
|
| 43 |
+
|
| 44 |
+
The first step towards such a guarantee is to specify an threat model, i.e., a precise definition of the attacks our models should be resistant to. For each data point $x$ , we introduce a set of allowed perturbations $S \subseteq \mathbb { R } ^ { d }$ that formalizes the manipulative power of the adversary. In image classification, we choose $s$ so that it captures perceptual similarity between images. For instance, the $\ell _ { \infty }$ -ball around $x$ has recently been studied as a natural notion for adversarial perturbations (Goodfellow et al., 2014). While we focus on robustness against $\ell _ { \infty }$ -bounded attacks in this paper, we remark that more comprehensive notions of perceptual similarity are an important direction for future research.
|
| 45 |
+
|
| 46 |
+
Next, we modify the definition of population risk $\mathbb { E } _ { \mathcal { D } } [ L ]$ by incorporating the above adversary. Instead of computing the loss $L$ directly on samples from the distribution $\mathcal { D }$ , we allow the adversary to perturb the input first. This gives rise to the following saddle point problem, which is our central object of study:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\operatorname* { m i n } _ { \theta } \rho ( \theta ) , \quad \mathrm { w h e r e } \quad \rho ( \theta ) = \mathbb { E } _ { ( x , y ) \sim \mathcal { D } } \left[ \operatorname* { m a x } _ { \delta \in \mathcal { S } } L ( \theta , x + \delta , y ) \right] \ .
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
Formulations of this type (and their finite-sample counterparts) have a long history in robust optimization, going back to Wald (Wald, 1939; 1945; 1992). It turns out that this formulation is also particularly useful in our context. We will refer to the quantity $\rho ( \theta )$ as the adversarial loss of the network with parameters $\theta$ .
|
| 53 |
+
|
| 54 |
+
First, this formulation gives us a unifying perspective that encompasses much prior work on adversarial robustness. Our perspective stems from viewing the saddle point problem as the composition of an inner maximization problem and an outer minimization problem. Both of these problems have a natural interpretation in our context. The inner maximization problem aims to find an adversarial version of a given data point $x$ that achieves a high loss. This is precisely the problem of attacking a given neural network. On the other hand, the goal of the outer minimization problem is to find model parameters so that the adversarial loss given by the inner attack problem is minimized. This is precisely the problem of training a robust classifier using adversarial training techniques.
|
| 55 |
+
|
| 56 |
+
Second, the saddle point problem specifies a clear goal that a robust classifier should achieve, as well as a quantitative measure of its robustness. In particular, when the parameters $\theta$ yield a (nearly) vanishing risk, the corresponding model is perfectly robust to attacks specified by our threat model.
|
| 57 |
+
|
| 58 |
+
Our paper investigates the structure of this saddle point problem in the context of deep neural networks. This formulation will be the main drive of our investigations that will lead us to training techniques that produce models with high resistance to a wide range of adversarial attacks.
|
| 59 |
+
|
| 60 |
+
# 3 TOWARDS ADVERSARIALLY ROBUST NETWORKS
|
| 61 |
+
|
| 62 |
+
Current work on adversarial examples usually focuses on specific defensive mechanisms, or on attacks against such defenses. An important feature of formulation (2.1) is that attaining small adversarial loss gives a guarantee that no allowed attack will fool the network. By definition, no adversarial perturbations are possible because the loss is small for all perturbations allowed by our threat model. This perspective allows us to reduce the task of finding truly robust models to an optimization problem. Hence, we can now focus our attention solely on obtaining a good solution to Problem (2.1).
|
| 63 |
+
|
| 64 |
+
Gradients from attacks. Since Stochastic Gradient Descent (SGD) and its variants are by far the most successful algorithms for training neural networks, we also want to apply SGD to Problem (2.1). This raises the question how we can compute gradients $\nabla _ { \boldsymbol { \theta } } \rho ( \boldsymbol { \theta } )$ for the outer minimization problem. Since the adversarial loss function $\rho ( \theta )$ corresponds to a maximization problem, we cannot simply apply the usual backpropagation algorithm. Instead, a natural approach is to compute the gradient at the maximizer of the inner maximization problem. A priori, it is not clear that this is a valid descent direction for the saddle point problem. However, for the case of continuously differentiable functions, Danskin’s theorem – a classic theorem in optimization – states that this is indeed true and gradients at maximizers of the inner problem correspond to descent directions for the saddle point problem (see Appendix C for details).
|
| 65 |
+
|
| 66 |
+
Leveraging this connection, our goal now is to find a reliable algorithm for solving the inner maximization problem, i.e., to evaluate $\rho ( \theta )$ . When instantiated for a batch of examples (instead of the expectation over the entire distribution $\mathcal { D }$ ), finding a maximizer $\delta \in S$ of $\rho ( \theta )$ corresponds exactly to finding an attack on the neural network. This allows us to employ known attacks as inner maximization algorithms. Prior work has proposed methods such as the Fast Gradient Sign Method (FGSM) and multiple variations of it (Goodfellow et al., 2014). FGSM is an attack for an $\ell _ { \infty }$ -bounded adversary and computes an adversarial example as
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
x + \varepsilon \operatorname { s g n } ( \nabla _ { x } L ( \theta , x , y ) ) .
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
One can interpret this attack as a simple one-step scheme for maximizing the inner part of the saddle point formulation. A more powerful adversary is the multi-step variant $\bar { \mathrm { F G S M } } ^ { k }$ , which is essentially projected gradient descent (PGD) on the negative loss function (Kurakin et al., 2016):3
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
x ^ { t + 1 } = \operatorname { P r o j } _ { x + S } \left( x ^ { t } + \alpha \operatorname { s g n } ( \nabla _ { x ^ { t } } L ( \theta , x ^ { t } , y ) ) \right) .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
Loss landscape. While PGD is a well-motivated approach for the inner maximization problem, it is not clear whether we can actually find a good solution in a reasonable amount of time. The problem is non-concave, so a priori we have no guarantees on the solution quality of PGD. One of our contributions is demonstrating that, in practice, the inner maximization problem is indeed well-behaved. In particular, we experimentally explore the structure given by the non-concave inner problem and find that its loss landscape has a surprisingly tractable structure of local maxima (see Appendix A). This structure also points towards projected gradient descent as the “ultimate” first-order adversary (see Section 5).
|
| 79 |
+
|
| 80 |
+
Despite the fact that the exact assumptions of Danskin’s theorem do not hold for our problem (the function is not continuously differentiable due to ReLU activations, and we only compute approximate maximizers of the inner problem), our experiments suggest that we can still use these gradients to optimize our problem. By applying SGD using the gradient of the loss at adversarial examples, we can consistently reduce the loss of the saddle point problem during training (e.g., see Figure 1 in Section 4). These observations suggest that we reliably optimize the saddle point formulation (2.1) and thus train robust classifiers.
|
| 81 |
+
|
| 82 |
+
Model capacity. Before we proceed to our main experiment results in the next section, we briefly mention another important insight from our robust optimization perspective. Solving the problem from Equation (2.1) successfully is not sufficient to guarantee robust and accurate classification. We also require that the value of the problem (i.e., the final loss we achieve against adversarial examples) is small, which then provides guarantees for the performance of our classifier. In particular, achieving a very small value corresponds to a perfect classifier, which is robust to adversarial inputs. In Appendix B, we show experimentally that network capacity plays a crucial role in enabling robustness. In particular, training a robust classifier requires a significantly larger network than only achieving high accuracy on natural examples.
|
| 83 |
+
|
| 84 |
+
# 4 EXPERIMENTS: ADVERSARIALLY ROBUST DEEP LEARNING MODELS?
|
| 85 |
+
|
| 86 |
+
Following our understanding developed in the previous section, we can now apply our proposed approach to train robust classifiers. For both MNIST and CIFAR10, our adversary of choice will be projected gradient descent starting from a random perturbation around the natural example. As our experiments suggest (Appendix A) this algorithm is very efficient at reliably producing examples of (near) maximal loss. In a sense, it seems to correspond to a “ultimate” f irst order adversary. Since we are training the model for multiple epochs, we did not see any benefit in restarting PGD multiple times per batch – a new start is chosen each time the same example is encountered.
|
| 87 |
+
|
| 88 |
+
During the training procedure against the PGD adversary, we observe a steady decrease in the training loss of adversarial examples, illustrated in Figure 1. This behavior indicates that we are consistently decreasing the adversarial loss and indeed successfully solving our original optimization problem.
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 1: Cross-entropy loss on adversarial examples during training. The plots show how the adversarial loss on training examples evolves during training the MNIST and CIFAR10 networks against a PGD adversary. The sharp drops in the CIFAR10 plot correspond to decreases in training learning rate. These plots illustrate that we can consistently reduce the value of the inner problem of the saddle point formulation (2.1), thus producing an increasingly robust classifier.
|
| 92 |
+
|
| 93 |
+
We evaluate the trained models against a range of adversaries. We illustrate our results in Table 1 for MNIST and Table 2 for CIFAR10. The adversaries we consider are:
|
| 94 |
+
|
| 95 |
+
• White-box attacks with PGD for a different number of of iterations and restarts, denoted by source A.
|
| 96 |
+
White-box attacks from Carlini & Wagner (2016b). We use their suggested loss function and minimize it using PGD. This is denoted as CW, where the corresponding attack with a high confidence parameter $\kappa = 5 0$ ) is denoted as $\mathrm { C W } +$ .
|
| 97 |
+
• Black-box attacks from an independently trained copy of the network, denoted A’.
|
| 98 |
+
• Black-box attacks from a version of the same network trained only on natural examples, denoted $A _ { n a t }$ .
|
| 99 |
+
• Black-box attacks from a different convolution architecture, denoted B, described in Tramèr et al. (2017a).
|
| 100 |
+
|
| 101 |
+
MNIST. We run 40 iterations of projected gradient descent as our adversary, with a step size of 0.01 (we choose to take gradient steps in the $\ell _ { \infty }$ norm, i.e. adding the sign of the gradient, since this makes the choice of the step size simpler). We train and evaluate against perturbations of size $\varepsilon = 0 . 3$ We use a network consisting of two convolutional layers with 32 and 64 filters respectively, each followed by $2 \times 2$ max-pooling, and a fully connected layer of size 1024. When trained with natural examples, this network reaches $9 9 . 2 \%$ accuracy on the evaluation set. However, when evaluating on examples perturbed with FGSM the accuracy drops to $6 . 4 \%$ . Given that the resulting MNIST model is very robust, we investigated the learned parameters in order to understand how they affect adversarial robustness. The results of the investigation are presented in Appendix E.
|
| 102 |
+
|
| 103 |
+
CIFAR10. For the CIFAR10 dataset, we use the two architectures described in $\mathbf { B }$ (the original Resnet and its $1 0 \times$ wider variant). We trained the network against a PGD adversary with $\ell _ { \infty }$ projected
|
| 104 |
+
|
| 105 |
+
Table 1: MNIST: Performance of the adversarially trained network against different adversaries for $\varepsilon = 0 . 3$ . For each model of attack we show the most successful attack with bold. The source networks used for the attack are: the network itself (A) (white-box attack), an indepentenly initialized and trained copy of the network (A’), architecture B from Tramèr et al. (2017a) (B).
|
| 106 |
+
|
| 107 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Steps</td><td rowspan=1 colspan=1>Restarts</td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Natural</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>98.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>95.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>93.2%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>91.8%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>90.4%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>89.3%</td></tr><tr><td rowspan=1 colspan=1>Targeted</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>92.7%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>94.0%</td></tr><tr><td rowspan=1 colspan=1>CW+</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>93.9%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>96.8%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>96.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>95.7%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>97.0%</td></tr><tr><td rowspan=1 colspan=1>CW+</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>96.4%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>95.4%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>96.4%</td></tr><tr><td rowspan=1 colspan=1>CW+</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>95.7%</td></tr></table>
|
| 108 |
+
|
| 109 |
+
gradient descent again, this time using 7 steps of size 2, and a total $\varepsilon = 8$ . For our hardest adversary we chose 20 steps with the same settings, since other hyperparameter choices didn’t offer a significant decrease in accuracy. The results of our experiments appear in Table 2. The adversarial robustness of our network is significant, given the power of iterative adversaries, but still far from satisfactory. We believe that further progress is possible along these lines by understanding how adversarial training works and what techniques can complement it leading to robust models.
|
| 110 |
+
|
| 111 |
+
Table 2: CIFAR10: Performance of the adversarially trained network against different adversaries for $\varepsilon = 8$ . For each model of attack we show the most effective attack in bold. The source networks considered for the attack are: the network itself (A) (white-box attack), an independtly initialized and trained copy of the network (A’), a copy of the network trained on natural examples $( \mathrm { A } _ { n a t } )$ .
|
| 112 |
+
|
| 113 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Steps</td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Natural</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>87.3%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>56.1%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>50.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>45.8%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>46.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>67.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>64.2%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>78.7%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>Anat</td><td rowspan=1 colspan=1>85.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>Anat</td><td rowspan=1 colspan=1>86.0%</td></tr></table>
|
| 114 |
+
|
| 115 |
+
Resistance for different values of $\varepsilon$ and $\ell _ { 2 }$ -bounded attacks. In order to perform a broader evaluation of the adversarial robustness of our models, we run two kinds of additional experiments. On one hand, we investigate the resistance to $\ell _ { \infty }$ -bounded attacks for different values of $\varepsilon$ . On the other hand, we examine the resistance of our model to attacks that are bounded in $\ell _ { 2 }$ as opposed to $\ell _ { \infty }$ norm. The results appear in Figure 2. We emphasize that the models we are examining here correspond to training against $\ell _ { \infty }$ -bounded attacks with the original value of $\varepsilon = 0 . 3$ , for
|
| 116 |
+
|
| 117 |
+
MNIST, and $\varepsilon = 8$ for CIFAR10. In particular, our MNIST model retains significant resistance to $\ell _ { 2 }$ -norm-bounded perturbations too – it has good accuracy even for $\varepsilon = 4 . 5 . \mathrm { W e }$ provide a sample of corresponding adversarial examples in Figure 12 of Appendix F. One can observe that some of the underlying perturbations are large enough that even a human could be confused.
|
| 118 |
+
|
| 119 |
+
Training Accuracy. It is worth noting our MNIST and (wide) CIFAR10 networks reached $100 \%$ adversarial accuracy on the training set. That is we can fit the training set even against a PGD adversary of $\varepsilon = 0 . 3$ and $\varepsilon = 8$ respectively. This shows that the landscape of the underlying optimization problem is tractable and does not present a significant barrier to our techniques.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 2: Performance of our adversarially trained networks against PGD adversaries of different strength. The MNIST and CIFAR10 networks were trained against $\varepsilon = 0 . 3$ and $\varepsilon = 8$ PGD $\ell _ { \infty }$ adversaries respectively (the training $\varepsilon$ is denoted with a red dashed lines in the $\ell _ { \infty }$ plots). We notice that for $\varepsilon$ less or equal to the value used during training, the performance is equal or better.
|
| 123 |
+
|
| 124 |
+
Running Time. Unfortunately, solving the robust version of the problem instead of the standard one imposes a significant computational overhead. Standard training requires one forward and one backward pass through the network for each training batch. Instead, adversarial training with a $k$ -step PGD adversary, requires additionally $k$ forward and $k$ backward passes through the network to compute the adversarial version of the training batch. This implies an increase in running time of a factor of $( k + 1 )$ . We hope that future research will propose ways to mitigate this drawback.
|
| 125 |
+
|
| 126 |
+
# 5 FIRST-ORDER ADVERSARIES.
|
| 127 |
+
|
| 128 |
+
Our exploration of the loss landscape (Appendix A) shows that the local maxima found by PGD all have similar loss values, both for normally trained networks and adversarially trained networks. This concentration phenomenon suggests an intriguing view on the problem in which robustness against the PGD adversary yields robustness against all first-order adversaries, i.e., attacks that rely only on first-order information. As long as the adversary only uses gradients of the loss function with respect to the input, we conjecture that it will not find significantly better local maxima than PGD. This hypothesis is validated by the experimental evidence provided in Section 4: if we train a network to be robust against PGD adversaries, it becomes robust against a wide range of other attacks as well.
|
| 129 |
+
|
| 130 |
+
Of course, our exploration with PGD does not preclude the existence of some isolated maxima with much larger function value. However, our experiments suggest that such better local maxima are hard to find with first order methods: even a large number of random restarts did not find function values with significantly different loss values (see Appendix A). Incorporating the computational power of the adversary into the threat model should be reminiscent of the notion of polynomially bounded adversary that is a cornerstone of modern cryptography. There, this classic threat model allows the adversary to only solve problems that require at most polynomial computation time. Here, we employ an optimization-based view on the power of the adversary as it is more suitable in the context of machine learning. After all, we have not yet developed a thorough understanding of the computational complexity of many recent machine learning problems. However, the vast majority of optimization problems in ML is solved with first-order methods, and variants of SGD are the most effective way of training deep learning models in particular. Hence we believe that the class of attacks relying on first-order information is, in some sense, universal for the current practice of deep learning.
|
| 131 |
+
|
| 132 |
+
Put together, these two ideas chart the way towards machine learning models with guaranteed robustness. If we train the network to be robust against PGD adversaries, it will be robust against a wide range of attacks that encompasses all current approaches.
|
| 133 |
+
|
| 134 |
+
In fact, this robustness guarantee would become even stronger in the context of transfer attacks, i.e., attacks in which the adversary does not have a direct access to the target network. Instead, the adversary only has less specific information such as the (rough) model architecture and the training data set. One can view this threat model as an example of “zero order” attacks, i.e., attacks in which the adversary has no direct access to the classifier and is only able to evaluate it on chosen examples without gradient feedback. Still, even for the case of zero-order attacks, the gradient of the network can be estimated using a finite differences method, rendering first-order attacks also relevant in this context.
|
| 135 |
+
|
| 136 |
+
We discuss transferability in Appendix D. We observe that increasing network capacity and strengthening the adversary we train against (FGSM or PGD training, rather than natural training) improves resistance against transfer attacks. Also, as expected, the resistance of our best models to such attacks tends to be significantly larger than to the (strongest) first order attacks.
|
| 137 |
+
|
| 138 |
+
# 6 RELATED WORK
|
| 139 |
+
|
| 140 |
+
Due to the growing body of work on adversarial examples in the context of deep learning networks (Gu & Rigazio, 2014; Fawzi et al., 2015; Torkamani, 2016; Papernot et al., 2016b; Carlini & Wagner, 2016a; Tramèr et al., 2017b; Goodfellow et al., 2014; Kurakin et al., 2016), we focus only on the most related papers here. Before we compare our contributions, we remark that robust optimization has been studied outside deep learning for multiple decades. We refer the reader to Ben-Tal et al. (2009) for an overview of this field.
|
| 141 |
+
|
| 142 |
+
To the best of our knowledge, in the context of adversarial examples, an explicit formulation of the min-max optimization first appeared in Huang et al. (2015), Shaham et al. (2015), and Lyu et al. (2015). All of these works, however, consider very weak adversaries/methods for solving the maximization problem, mainly relying on linearizing the loss and performing a single step, similar to FGSM. These adversaries do not capture the full range of possible attacks and thus training only against them leaves the resulting classifier vulnerable to more powerful, iterative attacks.
|
| 143 |
+
|
| 144 |
+
Recent work on adversarial training on ImageNet also observed that the model capacity is important for adversarial training Kurakin et al. (2016). However, their work was focused on FGSM attacks, since they report the iterative attacks are too expensive computationally and don’t provide any significant benefits. In contrast to that, we discover that for the datasets we considered training against iterative adversaries does result in a model that is robust against such adversaries.
|
| 145 |
+
|
| 146 |
+
A more recent paper (Tramèr et al., 2017b) also explores the transferability phenomenon. This exploration focuses mostly on the region around natural examples where the loss is (close to) linear. When large perturbations are allowed, this region does not give a complete picture of the adversarial landscape. This is confirmed by our experiments, as well as pointed out by Tramèr et al. (2017a).
|
| 147 |
+
|
| 148 |
+
Another recent paper (Tramèr et al., 2017a), considers adversarial training using black-box attacks from similar networks in order to increase the robustness of the network against such adversaries. However, this is not an effective defense against the white-box setting we consider, since a PGD adversary can reliably produce adversarial examples for such networks.
|
| 149 |
+
|
| 150 |
+
# 7 CONCLUSION
|
| 151 |
+
|
| 152 |
+
Our findings provide evidence that deep neural networks can be made resistant to adversarial attacks. As our theory and experiments indicate, we can design reliable adversarial training methods. One of the key insights behind this is the unexpectedly regular structure of the underlying optimization task: even though the relevant problem corresponds to the maximization of a highly non-concave function with many distinct local maxima, their values are highly concentrated. Overall, our findings give us hope that adversarially robust deep learning models may be within current reach.
|
| 153 |
+
|
| 154 |
+
For the MNIST dataset, our networks are very robust, achieving high accuracy for a wide range of powerful adversaries and large perturbations. Our experiments on CIFAR10 have not reached the same level of performance yet. However, our results already show that our techniques lead to significant increase in the robustness of the network. We believe that further exploring this direction will lead to adversarially robust networks for this dataset.
|
| 155 |
+
|
| 156 |
+
# ACKNOWLEDGMENTS
|
| 157 |
+
|
| 158 |
+
Aleksander M ˛adry, Aleksandar Makelov, and Dimitris Tsipras were supported by the NSF Grant No. 1553428, a Google Research Fellowship, and a Sloan Research Fellowship. Ludwig Schmidt was supported by a Google PhD Fellowship. Adrian Vladu was supported by the NSF Grants No. 1111109 and No. 1553428.
|
| 159 |
+
|
| 160 |
+
We thank Wojciech Matusik for kindly providing us with computing resources to perform this work.
|
| 161 |
+
|
| 162 |
+
# REFERENCES
|
| 163 |
+
|
| 164 |
+
Tensor flow models repository. https://github.com/tensorflow/models/tree/ master/resnet, 2017.
|
| 165 |
+
Aharon Ben-Tal, Laurent El Ghaoui, and Arkadi Nemirovski. Robust optimization. Princeton University Press, 2009.
|
| 166 |
+
Nicholas Carlini and David Wagner. Defensive distillation is not robust to adversarial examples. arXiv preprint arXiv:1607.04311, 2016a.
|
| 167 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. arXiv preprint arXiv:1608.04644, 2016b.
|
| 168 |
+
Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. arXiv preprint arXiv:1705.07263, 2017.
|
| 169 |
+
Nicholas Carlini, Guy Katz, Clark Barrett, and David L Dill. Ground-truth adversarial examples. arXiv preprint arXiv:1709.10207, 2017.
|
| 170 |
+
Nilesh Dalvi, Pedro Domingos, Mausam, Sumit Sanghai, and Deepak Verma. Adversarial classification. In International Conference on Knowledge Discovery and Data Mining (KDD), 2004.
|
| 171 |
+
Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Analysis of classifiers’ robustness to adversarial perturbations. arXiv preprint arXiv:1502.02590, 2015.
|
| 172 |
+
Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 173 |
+
Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
|
| 174 |
+
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.
|
| 175 |
+
Warren He, James Wei, Xinyun Chen, Nicholas Carlini, and Dawn Song. Adversarial example defenses: Ensembles of weak defenses are not strong. arXiv preprint arXiv:1706.04701, 2017.
|
| 176 |
+
Ruitong Huang, Bing Xu, Dale Schuurmans, and Csaba Szepesvári. Learning with a strong adversary. arXiv preprint arXiv:1511.03034, 2015.
|
| 177 |
+
Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016.
|
| 178 |
+
Chunchuan Lyu, Kaizhu Huang, and Hai-Ning Liang. A unified gradient regularization family for adversarial examples. In Data Mining (ICDM), 2015 IEEE International Conference on, pp. 301–309. IEEE, 2015.
|
| 179 |
+
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.
|
| 180 |
+
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.
|
| 181 |
+
|
| 182 |
+
Nicolas Papernot and Patrick D. McDaniel. On the effectiveness of defensive distillation. arXiv preprint arXiv:1607.05113, 2016.
|
| 183 |
+
|
| 184 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016a.
|
| 185 |
+
|
| 186 |
+
Nicolas Papernot, Patrick D. McDaniel, Somesh Jha, Matt Fredrikson, Z. Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In IEEE European Symposium on Security and Privacy, EuroS&P 2016, Saarbrücken, Germany, March 21-24, 2016, pp. 372–387, 2016b.
|
| 187 |
+
|
| 188 |
+
Andras Rozsa, Manuel Günther, and Terrance E. Boult. Towards robust deep neural networks with BANG. arXiv preprint arXiv:1612.00138, 2016.
|
| 189 |
+
|
| 190 |
+
Uri Shaham, Yutaro Yamada, and Sahand Negahban. Understanding adversarial training: Increasing local stability of neural nets through robust optimization. arXiv preprint arXiv:1511.05432, 2015.
|
| 191 |
+
|
| 192 |
+
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.
|
| 193 |
+
|
| 194 |
+
Jure Sokolic, Raja Giryes, Guillermo Sapiro, and Miguel RD Rodrigues. Robust large margin deep neural networks. arXiv preprint arXiv:1605.08254, 2016.
|
| 195 |
+
|
| 196 |
+
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.
|
| 197 |
+
|
| 198 |
+
MohamadAli Torkamani. Robust Large Margin Approaches for Machine Learning in Adversarial Settings. PhD thesis, University of Oregon, 2016.
|
| 199 |
+
|
| 200 |
+
Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick D. McDaniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017a.
|
| 201 |
+
|
| 202 |
+
Florian Tramèr, Nicolas Papernot, Ian J. Goodfellow, Dan Boneh, and Patrick D. McDaniel. The space of transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017b. URL http://arxiv.org/abs/1704.03453.
|
| 203 |
+
|
| 204 |
+
Abraham Wald. Contributions to the theory of statistical estimation and testing hypotheses. The Annals of Mathematical Statistics, 10(4):299–326, 1939.
|
| 205 |
+
|
| 206 |
+
Abraham Wald. Statistical decision functions which minimize the maximum risk. Annals of Mathematics, pp. 265–280, 1945.
|
| 207 |
+
|
| 208 |
+
Abraham Wald. Statistical decision functions. In Breakthroughs in Statistics, pp. 342–357. Springer, 1992.
|
| 209 |
+
|
| 210 |
+
Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. arXiv preprint arXiv:1704.01155, 2017.
|
| 211 |
+
|
| 212 |
+
# A THE LANDSCAPE OF ADVERSARIAL EXAMPLES
|
| 213 |
+
|
| 214 |
+
The inner problem of the saddle point formulation (2.1) corresponds to finding an adversarial example for a given network and data point (subject to our attack model). As this problem requires us to maximize a highly non-concave function, one would expect it to be intractable. Indeed, this is the conclusion reached by prior work which then resorted to linearizing the inner maximization problem (Huang et al., 2015; Shaham et al., 2015). As pointed out above, this linearization approach yields well-known methods such as FGSM. While training against FGSM adversaries has shown some successes, recent work also highlights important shortcomings of this one-step approach (Tramèr et al., 2017a).
|
| 215 |
+
|
| 216 |
+
To understand the inner problem in more detail, we investigate the landscape of local maxima for multiple models on MNIST and CIFAR10. The main tool in our experiments is projected gradient descent (PGD), since it is the standard method for large-scale constrained optimization. In order to explore a large part of the loss landscape, we re-start PGD from many points in the $\ell _ { \infty }$ balls around data points from the respective evaluation sets.
|
| 217 |
+
|
| 218 |
+
Surprisingly, our experiments show that the inner problem is tractable after all, at least from the perspective of first-order methods. While there are many local maxima spread widely apart within $x _ { i } + \mathcal { S }$ , they tend to have very well-concentrated loss values. This echoes the folklore belief that training neural networks is possible because the loss (as a function of model parameters) typically has many local minima with very similar values.
|
| 219 |
+
|
| 220 |
+
Specifically, in our experiments we found the following phenomena:
|
| 221 |
+
|
| 222 |
+
• We observe that the loss achieved by the adversary increases in a fairly consistent way and plateaus rapidly when performing projected $\ell _ { \infty }$ gradient descent for randomly chosen starting points inside $x + { \mathcal { S } }$ (see Figure 3).
|
| 223 |
+
|
| 224 |
+

|
| 225 |
+
Figure 3: Cross-entropy loss values while creating an adversarial example from the MNIST and CIFAR10 evaluation datasets. The plots show how the loss evolves during 20 runs of projected gradient descent (PGD). Each run starts at a uniformly random point in the $\ell _ { \infty }$ -ball around the same natural example (additional plots for different examples appear in Figure 11). The adversarial loss plateaus after a small number of iterations. The optimization trajectories and final loss values are also fairly clustered, especially on CIFAR10. Moreover, the final loss values on adversarially trained networks are significantly smaller than on their naturally trained counterparts.
|
| 226 |
+
|
| 227 |
+
• Investigating the concentration of maxima further, we observe that over a large number of random restarts, the loss of the final iterate follows a well-concentrated distribution without extreme outliers (see Figure 4; we verified this concentration based on $1 0 ^ { 5 }$ restarts). To demonstrate that maxima are noticeably distinct, we also measured the $\ell _ { 2 }$ distance and angles between all pairs of them and observed that distances are distributed close to the expected distance between two random points in the $\ell _ { \infty }$ ball, and angles are close to $9 0 °$ . Along the line segment between local maxima, the loss is convex, attaining its maximum at the endpoints and is reduced by a constant factor in the middle. Nevertheless, for the entire segment, the loss is considerably higher than that of a random point.
|
| 228 |
+
• Finally, we observe that the distribution of maxima suggests that the recently developed subspace view of adversarial examples is not fully capturing the richness of attacks (Tramèr et al., 2017b). In particular, we observe adversarial perturbations with negative inner product with the gradient
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
Figure 4: Values of the local maxima given by the cross-entropy loss for five examples from the MNIST and CIFAR10 evaluation datasets. For each example, we start projected gradient descent (PGD) from $1 0 ^ { 5 }$ uniformly random points in the $\ell _ { \infty }$ -ball around the example and iterate PGD until the loss plateaus. The blue histogram corresponds to the loss on a naturally trained network, while the red histogram corresponds to the adversarially trained counterpart. The loss is significantly smaller for the adversarially trained networks, and the final loss values are very concentrated without any outliers.
|
| 232 |
+
|
| 233 |
+
of the example, and deteriorating overall correlation with the gradient direction as the scale of perturbation increases.
|
| 234 |
+
|
| 235 |
+
# B NETWORK CAPACITY AND ADVERSARIAL ROBUSTNESS
|
| 236 |
+
|
| 237 |
+
For a fixed set $s$ of possible perturbations, the value of the problem (2.1) is entirely dependent on the architecture of the classifier we are learning. Consequently, the architectural capacity of the model becomes a major factor affecting its overall performance. At a high level, classifying examples in a robust way requires a stronger classifier, since the presence of adversarial examples changes the decision boundary of the problem to a more complicated one (see Figure 5 for an illustration).
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
Figure 5: A conceptual illustration of “natural” vs. “adversarial” decision boundaries. Left: A set of points that can be easily separated with a simple (in this case, linear) decision boundary. Middle: The simple decision boundary does not separate the $\ell _ { \infty }$ -balls (here, squares) around the data points. Hence there are adversarial examples (the red stars) that will be misclassified. Right: Separating the $\ell _ { \infty }$ -balls requires a significantly more complicated decision boundary. The resulting classifier is robust to adversarial examples with bounded $\ell _ { \infty }$ -norm perturbations.
|
| 241 |
+
|
| 242 |
+
Our experiments verify that capacity is crucial for robustness, as well as for the ability to successfully train against strong adversaries. For the MNIST dataset, we consider a simple convolutional network and study how its behavior changes against different adversaries as we keep doubling the size of network (i.e. double the number of convolutional filters and the size of the fully connected layer). The initial network has a convolutional layer with 2 filters, followed by another convolutional layer with 4 filters, and a fully connected hidden layer with 64 units. Convolutional layers are followed by $2 \times 2$ max-pooling layers and adversarial examples are constructed with $\varepsilon = 0 . 3$ . The results are in Figure 6.
|
| 243 |
+
|
| 244 |
+
For the CIFAR10 dataset, we used the Resnet model He et al. (2016); TFM (2017). We performed data augmentation using random crops and flips, as well as per image standarization. To increase the capacity, we modified the network incorporating wider layers by a factor of 10. This results in a network with 5 residual units with (16, 160, 320, 640) filters each. This network can achieve an accuracy of $9 5 . 2 \%$ when trained with natural examples. Adversarial examples were constructed with $\varepsilon = 8$ . Results on capacity experiments appear in Figure 6.
|
| 245 |
+
|
| 246 |
+
We observe the following phenomena:
|
| 247 |
+
|
| 248 |
+
Capacity alone helps. We observe that increasing the capacity of the network when training using only natural examples (apart from increasing accuracy on these examples) increases the robustness against one-step perturbations. This effect is greater when considering adversarial examples with smaller $\varepsilon$ .
|
| 249 |
+
|
| 250 |
+
FGSM adversaries don’t increase robustness (for large $\varepsilon$ ). When training the network using adversarial examples generated with the FGSM, we observe that the network overfits to these adversarial examples. This behavior is known as label leaking Kurakin et al. (2016) and stems from the fact that the adversary produces a very restricted set of adversarial examples that the network can overfit to. These networks have poor performance on natural examples and don’t exhibit any kind of robustness against PGD adversaries. For the case of smaller $\varepsilon$ the loss is ofter linear enough in the $\ell _ { \infty }$ ball around natural examples, that FGSM finds adversarial examples close to those found by PGD thus being a reasonable adversary to train against.
|
| 251 |
+
|
| 252 |
+
Weak models may fail to learn non-trivial classifiers. In the case of small capacity networks, attempting to train against a strong adversary (PGD) prevents the network from learning anything meaningful. The network converges to always predicting a fixed class, even though it could converge to an accurate classifier through natural training. The small capacity of the network forces the training procedure to sacrifice performance on natural examples in order to provide any kind of robustness against adversarial inputs.
|
| 253 |
+
|
| 254 |
+
The value of the saddle point problem decreases as we increase the capacity. Fixing an adversary model, and training against it, the value of (2.1) drops as capacity increases, indicating the the model can fit the adversarial examples increasingly well.
|
| 255 |
+
|
| 256 |
+
More capacity and stronger adversaries decrease transferability. Either increasing the capacity of the network, or using a stronger method for the inner optimization problem reduces the effectiveness of transferred adversarial inputs. We validate this experimentally by observing that the correlation between gradients from the source and the transfer network, becomes less significant as capacity increases. We describe our experiments in Appendix D.
|
| 257 |
+
|
| 258 |
+
# C STATEMENT AND APPLICATION OF DANSKIN’S THEOREM
|
| 259 |
+
|
| 260 |
+
Recall that our goal is to minimize the value of the saddle point problem
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\operatorname* { m i n } _ { \theta } \rho ( \theta ) , \quad \mathrm { w h e r e } \quad \rho ( \theta ) = \mathbb { E } _ { ( x , y ) \sim \mathcal { D } } \left[ \operatorname* { m a x } _ { \delta \in \mathcal { S } } L ( \theta , x + \delta , y ) \right] \ .
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
In practice, we don’t have access to the distribution $\mathcal { D }$ so both the gradients and the value of $\rho ( \theta )$ will be computed using sampled input points. Therefore we can consider –without loss of generality– the case of a single random example $x$ with label $y$ , in which case the problem becomes
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \delta \in S } g ( \theta , \delta ) , \quad \mathrm { w h e r e } \quad g ( \theta , \delta ) = L ( \theta , x + \delta , y ) ~ .
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
If we assume that the loss $L$ is continuously differentiable in $\theta$ , we can compute a descent direction for $\theta$ by utilizing the classical theorem of Danskin.
|
| 273 |
+
|
| 274 |
+

|
| 275 |
+
|
| 276 |
+
Figure 6: The effect of network capacity on the performance of the network. We trained MNIST and CIFAR10 networks of varying capacity on: (a) natural examples, (b) with FGSM-made adversarial examples, (c) with PGD-made adversarial examples. In the first three plots/tables of each dataset, we show how the natural and adversarial accuracy changes with respect to capacity for each training regime. In the final plot/table, we show the value of the cross-entropy loss on the adversarial examples the networks were trained on. This corresponds to the value of our saddle point formulation (2.1) for different sets of allowed perturbations.
|
| 277 |
+
|
| 278 |
+
Theorem C.1 (Danskin). Let $s$ be nonempty compact topological space and $g : \mathbb { R } ^ { n } \times S \mathbb { R }$ be such that $g ( \cdot , \delta )$ is differentiable for every $\delta \in S$ and $\nabla _ { \boldsymbol { \theta } } g ( \boldsymbol { \theta } , \boldsymbol { \delta } )$ is continuous on $\mathbb { R } ^ { n } \times S$ . Also, let $\delta ^ { * } ( \theta ) = \{ \delta \in \arg \operatorname* { m a x } _ { \delta \in { \mathcal { S } } } g ( \theta , \delta ) \}$ .
|
| 279 |
+
|
| 280 |
+
Then the corresponding max-function
|
| 281 |
+
|
| 282 |
+
$$
|
| 283 |
+
\phi ( \theta ) = \operatorname* { m a x } _ { \delta \in { \mathcal { S } } } g ( \theta , \delta )
|
| 284 |
+
$$
|
| 285 |
+
|
| 286 |
+
is locally Lipschitz continuous, directionally differentiable, and its directional derivatives satisfy
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
\phi ^ { \prime } ( \theta , h ) = \operatorname* { s u p } _ { \delta \in \delta ^ { * } ( \theta ) } h ^ { \top } \nabla _ { \theta } g ( \theta , \delta ) .
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
In particular, if for some $\theta \in \mathbb { R } ^ { n }$ the set $\delta ^ { * } ( \theta ) = \{ \delta _ { \theta } ^ { * } \}$ is a singleton, the the max-function is differentiable at $\theta$ and
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\nabla \phi ( \theta ) = \nabla _ { \theta } g ( \theta , \delta _ { \theta } ^ { * } ) .
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
The intution behind the theorem is that since gradients are local objects, and the function $\phi ( \theta )$ is locally the same as $g ( \theta , \delta _ { \theta } ^ { * } )$ their gradients will be the same. The theorem immediately gives us the following corollary, stating the we can indeed compute gradients for the saddle point by computing gradients at the inner optimizers.
|
| 299 |
+
|
| 300 |
+
Corollary C.2. Let $\overline { { \delta } }$ be such that $\bar { \delta } \in \mathcal { S }$ and is a maximizer for maxδ $L ( \theta , x + \delta , y )$ . Then, as long as it is nonzero, $- \nabla _ { \boldsymbol { \theta } } L ( \boldsymbol { \theta } , \boldsymbol { x } + \overline { { \boldsymbol { \delta } } } , y )$ is a descent direction for $\phi ( \theta ) = \mathrm { m a x } _ { \delta \in { \cal S } } { \cal L } ( \theta , x + \delta , y )$ .
|
| 301 |
+
|
| 302 |
+
Proof of Corollary C.2. We apply Theorem C.1 to $g ( \theta , \delta ) : = L ( \theta , x + \delta , y )$ and $S = B _ { \parallel \cdot \parallel } ( \varepsilon )$ . We see that the directional derivative in the direction of $h = \nabla _ { \boldsymbol { \theta } } L ( \boldsymbol { \theta } , x + \overline { { \boldsymbol { \delta } } } , y )$ satisfies
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
\phi ^ { \prime } ( \theta , h ) = \operatorname* { s u p } _ { \delta \in \delta ^ { * } ( \theta ) } h ^ { \top } \nabla _ { \theta } L ( \theta , x + \delta , y ) \geq h ^ { \top } h = \| \nabla _ { \theta } L ( \theta , x + \bar { \delta } , y ) \| _ { 2 } ^ { 2 } \geq 0 .
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
If this gradient is nonzero, then the inequality above is strict. Therefore it gives a descent direction.
|
| 309 |
+
|
| 310 |
+
A technical issue is that, since we use ReLU and max-pooling units in our neural network architecture, the loss function is not continuously differentiable. Nevertheless, since the set of discontinuities has measure zero, we can assume that this will not be an issue in practice, as we will never encounter the problematic points.
|
| 311 |
+
|
| 312 |
+
Another technical issue is that, due to the not concavity of the inner problem, we are not able to compute global maximizers, since PGD will converge to local maxima. In such cases, we can consider a subset $S ^ { \prime }$ of $s$ such that the local maximum is a global maximum in the region $S ^ { \prime }$ . Applying the theorem for $S ^ { \prime }$ gives us that the gradient corresponds to a descent direction for the saddle point problem when the adversary is constrained in $S ^ { \prime }$ . Therefore if the inner maximum is a true adversarial example for the network, then SGD using the gradient at that point will decrease the loss value at this particular adversarial examples, thus making progress towards a robust model.
|
| 313 |
+
|
| 314 |
+
These arguments suggest that the conclusions of the theorem are still valid in our saddle point problem, and –as our experiments confirm– we can solve it reliably.
|
| 315 |
+
|
| 316 |
+
# D TRANSFERABILITY
|
| 317 |
+
|
| 318 |
+
A lot of recent literature on adversarial training discusses the phenomenon of transferability Goodfellow et al. (2014); Kurakin et al. (2016); Tramèr et al. (2017b), i.e. adversarial examples transfer between differently trained networks. This raises concerns for practical applications, since it suggests that deep networks are extremely vulnerable to attacks, even when there is no direct access to the target network.
|
| 319 |
+
|
| 320 |
+
This phenomenon is further confirmed by our current experiments. 4 Moreover, we notice that the extent to which adversarial examples transfer decreases as we increase either network capacity or the power of the adversary used for training the network. This serves as evidence for the fact that the transferability phenomenon can be alleviated by using high capacity networks in conjunction with strong oracles for the inner optimization problem.
|
| 321 |
+
|
| 322 |
+
MNIST. In an attempt to understand these phenomena we inspect the loss functions corresponding to the trained models we used for testing transferability. More precisely, we compute angles between gradients of the loss functions evaluated over a large set of input examples, and plot their distribution. Similarly, we plot the value of the loss functions between clean and perturbed examples for both the source and transfer networks. In Figure 8 we plot our experimental findings on the MNIST dataset for $\varepsilon = 0 . 3$ . We consider a naturally trained large network (two convolutional layers of sizes 32 and 64, and a fully connected layer of size 1024), which we train twice starting with different initializations. We plot the distribution of angles between gradients for the same test image in the two resulting networks (orange histograms), noting that they are somewhat correlated. As opposed to this, we see that pairs of gradients for random pairs of inputs for one architecture are as uncorrelated as they can be (blue histograms), since the distribution of their angles looks Gaussian.
|
| 323 |
+
|
| 324 |
+
Next, we run the same experiment on a naturally trained very large network (two convolutional layers of sizes 64 and 128, and a fully connected layer of size 1024). We notice a mild increase in classification accuracy for transferred examples.
|
| 325 |
+
|
| 326 |
+
Finally, we repeat the same set of experiments, after training the large and very large networks against the FGSM adversary. We notice that gradients between the two architectures become significantly less correlated. Also, the classification accuracy for transferred examples increases significantly compared to the naturally trained networks.
|
| 327 |
+
|
| 328 |
+
We further plot how the value of the loss function changes when moving from the natural input towards the adversarially perturbed input (in Figure 8 we show these plots for four images in the MNIST test dataset), for each pair of networks we considered. We observe that, while for the naturally trained networks, when moving towards the perturbed point, the value of the loss function on the transfer architecture tends to start increasing soon after it starts increasing on the source architecture. In contrast, for the stronger models, the loss function on the transfer network tends to start increasing later, and less aggressively.
|
| 329 |
+
|
| 330 |
+
CIFAR10. For the CIFAR10 dataset, we investigate the transferability of the FGSM and PGD adversaries between our simple and wide architectures, each trained on natural, FGSM and PGD examples. Transfer accuracies for the FGSM adversary and PGD adversary between all pairs of such configurations (model $^ +$ training method) with independently random weight initialization are given in tables 3 and 4 respectively. The results exhibit the following trends:
|
| 331 |
+
|
| 332 |
+
• Stronger adversaries decrease transferability: In particular, transfer attacks between two PGD-trained models are less successful than transfer attacks between their naturally-trained counterparts. Moreover, adding PGD training helps with transferability from all adversarial datasets, except for those with source a PGD-trained model themselves. This applies to both FGSM attacks and PGD attacks. Capacity decreases transferability: In particular, transfer attacks between two PGDtrained wide networks are less successful than transfer attacks between their simple PGDtrained counterparts. Moreover, with few close exceptions, changing the architecture from simple to wide (and keeping the training method the same) helps with transferability from all adversarial datasets.
|
| 333 |
+
|
| 334 |
+
We additionally plotted how the loss of a network behaves in the direction of FGSM and PGD examples obtained from itself and an independently trained copy; results for the simple naturally trained network and the wide PGD trained network are given in Table 7. As expected, we observe the following phenomena:
|
| 335 |
+
|
| 336 |
+
• sometimes, the FGSM adversary manages to increase loss faster near the natural example, but as we move towards the boundary of the $\ell _ { \infty }$ box of radius $\varepsilon$ , the PGD attack always achieves higher loss.
|
| 337 |
+
• the transferred attacks do worse than their white-box counterparts in terms of increasing the loss;
|
| 338 |
+
• and yet, the transferred PGD attacks dominate the white-box FGSM attacks for the naturally trained network (and sometimes for the PGD-trained one too).
|
| 339 |
+
|
| 340 |
+
Table 3: CIFAR10: black-box FGSM attacks. We create FGSM adversarial examples with $\varepsilon = 8$ from the evaluation set on the source network, and then evaluate them on an independently initialized target network.
|
| 341 |
+
|
| 342 |
+
<table><tr><td rowspan=1 colspan=1>SourceTarget</td><td rowspan=1 colspan=1>Simple(naturaltraining)</td><td rowspan=1 colspan=1>Simple(FGSMtraining)</td><td rowspan=1 colspan=1>Simple(PGDtraining)</td><td rowspan=1 colspan=1>Wide(naturaltraining)</td><td rowspan=1 colspan=1>Wide(FGSMtraining)</td><td rowspan=1 colspan=1>Wide(PGDtraining)</td></tr><tr><td rowspan=1 colspan=1>Simple(natural training)</td><td rowspan=1 colspan=1>32.9%</td><td rowspan=1 colspan=1>74.0%</td><td rowspan=1 colspan=1>73.7%</td><td rowspan=1 colspan=1>27.6%</td><td rowspan=1 colspan=1>71.8%</td><td rowspan=1 colspan=1>76.6%</td></tr><tr><td rowspan=1 colspan=1>Simple(FGSM training)</td><td rowspan=1 colspan=1>64.2%</td><td rowspan=1 colspan=1>90.7%</td><td rowspan=1 colspan=1>60.9%</td><td rowspan=1 colspan=1>61.5%</td><td rowspan=1 colspan=1>90.2%</td><td rowspan=1 colspan=1>67.3%</td></tr><tr><td rowspan=1 colspan=1>Simple(PGD training)</td><td rowspan=1 colspan=1>77.1%</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>60.2%</td><td rowspan=1 colspan=1>77.0%</td><td rowspan=1 colspan=1>77.9%</td><td rowspan=1 colspan=1>66.3%</td></tr><tr><td rowspan=1 colspan=1>Wide(natural training)</td><td rowspan=1 colspan=1>34.9%</td><td rowspan=1 colspan=1>78.7%</td><td rowspan=1 colspan=1>80.2%</td><td rowspan=1 colspan=1>21.3%</td><td rowspan=1 colspan=1>75.8%</td><td rowspan=1 colspan=1>80.6%</td></tr><tr><td rowspan=1 colspan=1>Wide(FGSM training)</td><td rowspan=1 colspan=1>64.5%</td><td rowspan=1 colspan=1>93.6%</td><td rowspan=1 colspan=1>69.1%</td><td rowspan=1 colspan=1>53.7%</td><td rowspan=1 colspan=1>92.2%</td><td rowspan=1 colspan=1>72.8%</td></tr><tr><td rowspan=1 colspan=1>Wide(PGD training)</td><td rowspan=1 colspan=1>85.8%</td><td rowspan=1 colspan=1>86.6%</td><td rowspan=1 colspan=1>73.3%</td><td rowspan=1 colspan=1>85.6%</td><td rowspan=1 colspan=1>86.2%</td><td rowspan=1 colspan=1>67.0%</td></tr></table>
|
| 343 |
+
|
| 344 |
+
Table 4: CIFAR10: black-box PGD attacks. We create PGD adversarial examples with $\varepsilon = 8$ for 7 iterations from the evaluation set on the source network, and then evaluate them on an independently initialized target network.
|
| 345 |
+
|
| 346 |
+
<table><tr><td rowspan=1 colspan=1>SourceTarget</td><td rowspan=1 colspan=1>Simple(naturaltraining)</td><td rowspan=1 colspan=1>Simple(FGSMtraining)</td><td rowspan=1 colspan=1>Simple(PGDtraining)</td><td rowspan=1 colspan=1>Wide(naturaltraining)</td><td rowspan=1 colspan=1>Wide(FGSMtraining)</td><td rowspan=1 colspan=1>Wide(PGDtraining)</td></tr><tr><td rowspan=1 colspan=1>Simple(natural training)</td><td rowspan=1 colspan=1>6.6%</td><td rowspan=1 colspan=1>71.6%</td><td rowspan=1 colspan=1>71.8%</td><td rowspan=1 colspan=1>1.4%</td><td rowspan=1 colspan=1>51.4%</td><td rowspan=1 colspan=1>75.6%</td></tr><tr><td rowspan=1 colspan=1>Simple(FGSM training)</td><td rowspan=1 colspan=1>66.3%</td><td rowspan=1 colspan=1>40.3%</td><td rowspan=1 colspan=1>58.4%</td><td rowspan=1 colspan=1>65.4%</td><td rowspan=1 colspan=1>26.8%</td><td rowspan=1 colspan=1>66.2%</td></tr><tr><td rowspan=1 colspan=1>Simple(PGD training)</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>78.2%</td><td rowspan=1 colspan=1>57.7%</td><td rowspan=1 colspan=1>77.9%</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>65.2%</td></tr><tr><td rowspan=1 colspan=1>Wide(natural training)</td><td rowspan=1 colspan=1>10.9%</td><td rowspan=1 colspan=1>79.6%</td><td rowspan=1 colspan=1>79.1%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>51.3%</td><td rowspan=1 colspan=1>79.7%</td></tr><tr><td rowspan=1 colspan=1>Wide(FGSM training)</td><td rowspan=1 colspan=1>67.6%</td><td rowspan=1 colspan=1>51.7%</td><td rowspan=1 colspan=1>67.4%</td><td rowspan=1 colspan=1>56.5%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>71.6%</td></tr><tr><td rowspan=1 colspan=1>Wide(PGD training)</td><td rowspan=1 colspan=1>86.4%</td><td rowspan=1 colspan=1>86.8%</td><td rowspan=1 colspan=1>72.1%</td><td rowspan=1 colspan=1>86.0%</td><td rowspan=1 colspan=1>86.3%</td><td rowspan=1 colspan=1>64.2%</td></tr></table>
|
| 347 |
+
|
| 348 |
+
Table 5: CIFAR10: white-box attacks for $\varepsilon = 8$ . For each architecture and training method, we list the accuracy of the resulting network on the full CIFAR10 evaluation set of 10,000 examples. The FGSM random method is the one suggested by Tramèr et al. (2017a), whereby we first do a small random perturbation of the natural example, and the apply FGSM to that.
|
| 349 |
+
|
| 350 |
+
<table><tr><td rowspan=1 colspan=1>AdversaryModel</td><td rowspan=1 colspan=1>Natural</td><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>FGSM random|PGD (7 steps)</td><td rowspan=1 colspan=1>FGSM random|PGD (7 steps)</td><td rowspan=1 colspan=1>PGD (20 steps)</td></tr><tr><td rowspan=1 colspan=1>Simple(natural training)</td><td rowspan=1 colspan=1>92.7%</td><td rowspan=1 colspan=1>27.5%</td><td rowspan=1 colspan=1>19.6%</td><td rowspan=1 colspan=1>1.2%</td><td rowspan=1 colspan=1>0.8%</td></tr><tr><td rowspan=1 colspan=1>Simple(FGSM training)</td><td rowspan=1 colspan=1>87.4%</td><td rowspan=1 colspan=1>90.9%</td><td rowspan=1 colspan=1>90.4%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>0.0%</td></tr><tr><td rowspan=1 colspan=1>Simple(PGD training)</td><td rowspan=1 colspan=1>79.4%</td><td rowspan=1 colspan=1>51.7%</td><td rowspan=1 colspan=1>55.9%</td><td rowspan=1 colspan=1>47.1%</td><td rowspan=1 colspan=1>43.7%</td></tr><tr><td rowspan=1 colspan=1>Wide(natural training)</td><td rowspan=1 colspan=1>95.2%</td><td rowspan=1 colspan=1>32.7%</td><td rowspan=1 colspan=1>25.1%</td><td rowspan=1 colspan=1>4.1%</td><td rowspan=1 colspan=1>3.5%</td></tr><tr><td rowspan=1 colspan=1>Wide(FGSM training)</td><td rowspan=1 colspan=1>90.3%</td><td rowspan=1 colspan=1>95.1%</td><td rowspan=1 colspan=1>95.0%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>0.0%</td></tr><tr><td rowspan=1 colspan=1>Wide(PGD training)</td><td rowspan=1 colspan=1>87.3%</td><td rowspan=1 colspan=1>56.1%</td><td rowspan=1 colspan=1>60.3%</td><td rowspan=1 colspan=1>50.0%</td><td rowspan=1 colspan=1>45.8%</td></tr></table>
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 7: CIFAR10: change of loss function in the direction of white-box and black-box FGSM and PGD examples with $\varepsilon = 8$ for the same five natural examples. Each line shows how the loss changes as we move from the natural example to the corresponding adversarial example. Top: simple naturally trained model. Bottom: wide PGD trained model. We plot the loss of the original network in the direction of the FGSM example for the original network (red lines), 5 PGD examples for the original network obtained from 5 random starting points (blue lines), the FGSM example for an independently trained copy network (green lines) and 5 PGD examples for the copy network obtained from 5 random starting points (black lines). All PGD attacks use 100 steps with step size 0.3.
|
| 354 |
+
|
| 355 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>99.2%</td><td rowspan=1 colspan=1>99.2%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>3.9%</td><td rowspan=1 colspan=1>41.9%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>26.0%</td></tr></table>
|
| 356 |
+
|
| 357 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>92.9%</td><td rowspan=1 colspan=1>96.1%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>99.9%</td><td rowspan=1 colspan=1>62.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>54.1%</td></tr></table>
|
| 358 |
+
|
| 359 |
+
Large network, FGSM training
|
| 360 |
+
|
| 361 |
+
Very large network, natural training
|
| 362 |
+
|
| 363 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>99.2%</td><td rowspan=1 colspan=1>99.3%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>7.2%</td><td rowspan=1 colspan=1>44.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>35.0%</td></tr></table>
|
| 364 |
+
|
| 365 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>96.4%</td><td rowspan=1 colspan=1>97.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>99.4%</td><td rowspan=1 colspan=1>71.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>60.6%</td></tr></table>
|
| 366 |
+
|
| 367 |
+

|
| 368 |
+
Figure 8: Transferability experiments for four different instances (naturally trained large and very large networks, and FGSM-trained large and very large networks, respectively). For each instance we ran the same training algorithm twice, starting from different initializations. Tables on the left show the accuracy of the networks against three types of input (clean, perturbed with FGSM, perturbed with PGD ran for 40 steps); the first column shows the resilience of the first network against examples produced using its own gradients, the second column shows resilience of the second network against examples transferred from the former network. The histograms reflect angles between pairs of gradients corresponding to the same inputs versus the baseline consisting of angles between gradients from random pairs of points. Images on the right hand side reflect how the loss functions of the native and the transfer network change when moving in the direction of the perturbation; the perturbation is at 1 on the horizontal axis. Plots in the top row are for FGSM perturbations, plots in the bottom row are for PGD perturbations produced over 40 iterations.
|
| 369 |
+
|
| 370 |
+
Very large network, FGSM training
|
| 371 |
+
|
| 372 |
+
Large network, natural training
|
| 373 |
+
|
| 374 |
+
# E MNIST INSPECTION
|
| 375 |
+
|
| 376 |
+
The robust MNIST model described so far is small enough that we can visually inspect most of its parameters. Doing so will allow us to understand how it is different from a naturally trained variant and what are the general characteristics of a network that is robust against $\ell _ { \infty }$ adversaries. We will compare three different networks: a naturally trained model, and two adversarially trained ones. The latter two models are identical, modulo the random weight initialization, and were used as the public and secret models used for our robustness challenge.
|
| 377 |
+
|
| 378 |
+
Initially, we examine the first convolutional layer of each network. We observe that the robust models only utilize 3 out of the total 32 filters, and for each of these filters only one weight is non-zero. By doing so, the convolution degrades into a scaling of the original image. Combined with the bias and the ReLU that follows, this results in a thresholding filter, or equivalently $\mathrm { R e L U } ( \alpha x - \beta )$ for some constants $\alpha$ , $\beta$ . From the perspective of adversarial robustness, thresholding filters are immune to any perturbations on pixels with value less than $\beta - \varepsilon$ . We visualize a sample of the filters in Figure 9 (plots a, c, and e).
|
| 379 |
+
|
| 380 |
+
Having observed that the first layer of the network essentially maps the original image to three copies thresholded at different values, we examine the second convolutional layer of the classifier. Again, the filter weights are relatively sparse and have a significantly wider value range than the naturally trained version. Since only three channels coming out of the first layer matter, is follows (and is verified) that the only relevant convolutional filters are those that interact with these three channels. We visualize a sample of the filters in Figure 9 (plots b, d, and f).
|
| 381 |
+
|
| 382 |
+
Finally, we examine the softmax/output layer of the network. While the weights seem to be roughly similar between all three version of the network, we notice a significant difference in the class biases. The adversarially trained networks heavily utilize class biases (far from uniform), and do so in a way very similar to each other. A plausible explanation is that certain classes tend to be very vulnerable to adversarial perturbations, and the network learns to be more conservative in predicting them. The plots can be found in Figure 10.
|
| 383 |
+
|
| 384 |
+
All of the “tricks” described so far seem intuitive to a human and would seem reasonable directions when trying to increase the adversarial robustness of a classifier. We emphasize the none of these modifications were hard-coded in any way and they were all learned solely through adversarial training. We attempted to manually introduce these modifications ourselves, aiming to achieve adversarial robustness without adversarial training, but with no success. A simple PGD adversary could fool the resulting models on all the test set examples.
|
| 385 |
+
|
| 386 |
+

|
| 387 |
+
(a) Natural Model First Conv. Layers
|
| 388 |
+
(b) Natural Model Second Conv. Layer
|
| 389 |
+
Figure 9: Visualizing a sample of the convolutional filters. For the natural model (a,b) we visualize random filters, since there is no observable difference in any of them. For the first layer of robust networks we make sure to include the 3 non-zero filters. For the second layer, the first three columns represent convolutional filters that utilize the 3 non-zero channels, and we choose the most interesting ones (larger range of values). We observe that adversarially trained networks have significantly more concentrated weights. Moreover, the first convolutional layer degrades into a few thresholding filters.
|
| 390 |
+
|
| 391 |
+

|
| 392 |
+
Figure 10: Softmax layer examination. For each network we create a histogram of the layer’s weights and plot the per-class bias. We observe that while weights are similar (slightly more concentrated for the natural one) the biases are far from uniform and with a similar pattern for the two adversarially trained networks.
|
| 393 |
+
|
| 394 |
+

|
| 395 |
+
Figure 11: Loss function value over PGD iterations for 20 random restarts on random examples. The 1st and 3rd rows correspond to naturally trained networks, while the 2nd and 4th to adversarially trained ones.
|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
Figure 12: Sample adversarial examples with $\ell _ { 2 }$ norm bounded by 4. The perturbations are significant enough to cause misclassification by humans too.
|
md/train/rJzLciCqKm/rJzLciCqKm.md
ADDED
|
@@ -0,0 +1,572 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING FROM POSITIVE AND UNLABELED DATA WITH A SELECTION BIAS
|
| 2 |
+
|
| 3 |
+
Masahiro Kato1,2, Takeshi Teshima1,2, and Junya Honda1,2
|
| 4 |
+
|
| 5 |
+
1The University of Tokyo, Tokyo, Japan 2RIKEN, Tokyo, Japan {mkato, teshima}@ms.k.u-tokyo.ac.jp, honda@edu.k.u-tokyo.ac.jp
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We consider the problem of learning a binary classifier only from positive data and unlabeled data (PU learning). Recent methods of PU learning commonly assume that the labeled positive data are identically distributed as the unlabeled positive data. However, this assumption is unrealistic in many instances of PU learning because it fails to capture the existence of a selection bias in the labeling process. When the data has selection bias, it is difficult to learn the Bayes optimal classifier by conventional methods of PU learning. In this paper, we propose a method to partially identify the classifier. The proposed algorithm learns a scoring function that preserves the order induced by the class posterior under mild assumptions, which can be used as a classifier by setting an appropriate threshold. Through experiments, we show that the method outperforms previous methods for PU learning on various real-world datasets.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
We consider a situation that there are only positive and unlabeled data, and train a binary classifier only from them (PU learning). This problem arises in various practical situations, such as information retrieval and outlier detection (Elkan & Noto, 2008; Ward et al., 2009; Scott & Blanchard, 2009; Blanchard et al., 2010; Li et al., 2009; Nguyen et al., 2011). One of the milestones of PU learning is Elkan & Noto (2008), who proposed a practically useful algorithm with theoretical analysis, and there is subsequent research called unbiased PU learning (du Plessis & Sugiyama, 2014; du Plessis et al., 2015) where an unbiased estimator of the classification risk is minimized.
|
| 14 |
+
|
| 15 |
+
We focus on the case-control scenario (a.k.a. the problem setting based on two samples of data; Ward et al., 2009; Niu et al., 2016). In this scenario, positive data are obtained separately from unlabeled data, and unlabeled data are sampled from the whole population. As Elkan & Noto (2008) explained, we cannot identify a classifier without an assumption on how positive data are labeled. Therefore “selected completely at random” (SCAR) is traditionally assumed, i.e., the positive labeled data are identically distributed as the positive unlabeled data (Elkan & Noto, 2008; du Plessis et al., 2015). The assumption of SCAR is, however, unrealistic in many instances of PU learning, e.g., a patient’s electronic health record (Bekker & Davis, 2018a) and a recommendation system (Marlin & Zemel, 2009; Schnabel et al., 2016). In these cases, there is a selection bias (Heckman, 1979; Manski, 2008; Angrist & Pischke, 2008); the distribution of the positive data may differ between the labeled data and the unlabeled data.
|
| 16 |
+
|
| 17 |
+
Several recent related works have proposed alternative assumptions (Bekker & Davis, 2018a;b). However, in order to weaken SCAR, they impose other additional assumptions. In this work, we consider a more natural assumption such that SCAR becomes its special case. We assume that $p ( o = + 1 | x , y = + 1 )$ and $p ( y = + 1 | x )$ induce the same ordering on the input space $\mathcal { X }$ , where $y \in \{ - 1 , + 1 \}$ is the data label and $o = + 1$ (resp. $o = 0$ ) denotes the event that the data is observed (resp. not observed). We call this property the invariance of order. In the real-world application, there are many situations with a selection bias which follows the invariance of order. Among them, we list the following two examples.
|
| 18 |
+
|
| 19 |
+
# Example 1: (Anomaly Detection)
|
| 20 |
+
|
| 21 |
+
The goal of anomaly detection is to find anomaly data in an unlabeled dataset based on another dataset that consists only of anomaly data. When the anomaly data is collected, the more likely a datum is an anomaly, the more likely it is noticed and gets labeled.
|
| 22 |
+
|
| 23 |
+
Example 2: (Face Recognition)
|
| 24 |
+
|
| 25 |
+
The goal of this task is to identify a user from a set of face images based on some pictures of the user. In this case, the positive data are the face images identified with the user, and the unlabeled data consist of all the unidentified face images. The user may more likely provide pictures in which the face can be seen clearly, while in the unlabeled data there may be many unclear images.
|
| 26 |
+
|
| 27 |
+
Our problem setting is similar to the problem called learning from instance-dependent noisy labels (Du & Cai, 2015; Bootkrajang, 2016). In this problem setting, positive and negative data are available, but the labels are subject to the noise that flips the label with instance-dependent probability. Besides, there are existing works putting assumption similar to the invariance order (Du & Cai, 2015; Bootkrajang, 2016). We explain the difference between their works and ours around Assumption 1 in Section 2.1. We name our problem setting PU learning with a Selection Bias (PUSB).
|
| 28 |
+
|
| 29 |
+
In this paper, we propose a novel framework to deal with this problem setting. The experimental results show that our proposed method is appropriate for real-world applications compared to existing approaches for PU learning.
|
| 30 |
+
|
| 31 |
+
# 2 PROBLEM SETTING OF PU LEARNING WITH A SELECTION BIAS
|
| 32 |
+
|
| 33 |
+
We consider a binary classification problem to classify $\pmb { x } \in \mathcal { X } \subset \mathbb { R } ^ { d }$ into one of the two classes $\{ - 1 , + 1 \}$ . We assume that there exists a joint distribution $p ( { \pmb x } , y , o )$ , where $y \in \{ - 1 , + 1 \}$ is the class label of $_ { \textbf { \em x } }$ , and $o \in \{ 0 , + 1 \}$ is the observation status of $y$ (observed if $o = + 1$ and unobserved if $o = 0$ ). In other words, $_ { \textbf { \em x } }$ is labeled if $o = + 1$ , and it is unlabeled otherwise.
|
| 34 |
+
|
| 35 |
+
In PU learning, there are two distinguished sampling schemes called one sample and two samples of data (Niu et al., 2016). They are also called the censoring scenario and case-control scenario, respectively (Elkan & Noto, 2008). In the censoring scenario, a set of unlabeled data is sampled from the marginal density $p ( { \pmb x } )$ . Then, if a data point $_ { \textbf { \em x } }$ is positive, it gets labeled with probability $p ( o = + 1 | x , \bar { y } = + 1 )$ ; if $_ { \textbf { \em x } }$ is negative, it is never labeled. In the case-control scenario, a set of positive data is drawn from the positive conditional density $p ( { \pmb x } | y = + 1 )$ and a set of unlabeled data is drawn from $p ( { \pmb x } )$ . As Niu et al. (2016) stated, the case-control scenario is slightly more general than the censoring scenario setting. It is because the censoring scenario assumes the access to samples generated by $p ( { \pmb x } )$ , $p ( { \pmb x } | o = + 1 )$ , and $p ( { \pmb x } | o = 0 )$ whereas the case-control scenario only assumes the access to samples generated by $p ( { \pmb x } )$ and $p ( { \pmb x } | o = + 1 )$ ). Therefore we focus on the case-control scenario.
|
| 36 |
+
|
| 37 |
+
Suppose that we have a positive dataset $\{ { \pmb x } _ { i } \} _ { i = 1 } ^ { n }$ and an unlabeled dataset $\{ { \pmb x } _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } }$
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\{ \pmb { x } _ { i } \} _ { i = 1 } ^ { n } \stackrel { \mathrm { i . i . d . } } { \sim } p ( \pmb { x } | y = + 1 , o = + 1 ) , \{ \pmb { x } _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } } \stackrel { \mathrm { i . i . d . } } { \sim } p ( \pmb { x } ) .
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
We assume that negative data are never labeled.
|
| 44 |
+
|
| 45 |
+
Note that we do not assume SCAR. Therefore, $p ( { \pmb x } | y = + 1 )$ may differ from $p ( { \pmb x } | y = + 1 , o = + 1$ ).
|
| 46 |
+
In the case they differ, we say that there is a selection bias.
|
| 47 |
+
|
| 48 |
+
The quantity $\pi = p ( y = + 1 ) $ is called the class-prior. In our problem setting, we assume that $\pi$ is known. For example, in anomaly detection, the percentage of anomaly in the whole batch of products can be reported based on past experiences. Although there are various methods for estimating the class-prior in the traditional framework of the case-control scenario (du Plessis et al., 2016; Ramaswamy et al., 2016; Jain et al., 2016; Kato et al., 2018), we cannot estimate the class-prior in our problem setting under a theoretical guarantee. In Section 5, we show how misspecified class priors affect the performance of a classifier. As we explain later, even if we do not know the class-prior, we only have to change the last step of our algorithm. In summary, our goal is to obtain a classifier $h : \mathcal { X } \{ - 1 , 1 \}$ only from $\{ { \pmb x } _ { i } \} _ { i = 1 } ^ { n }$ , $\{ { \pmb x } _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } }$ , and $\pi$ under a weaker assumption than SCAR.
|
| 49 |
+
|
| 50 |
+
# 2.1 IDENTIFICATION STRATEGY
|
| 51 |
+
|
| 52 |
+
As stated by Elkan & Noto (2008), even if the class prior is given, we cannot estimate $p ( y = + 1 | x )$ only from positive data and unlabeled data without any assumption in PU learning. In the case-control scenario, a standard assumption is SCAR, i.e. $p ( { \pmb x } | y = + 1 , o = + 1 ) = p ( { \pmb x } | y = + 1 , o = 0 )$ , so that $p ( y = + 1 | x )$ can be estimated from the data in principle. However, in many instances of PU learning, the SCAR assumption is unreasonable as discussed before. Therefore, we relax SCAR and accommodate a selection bias. We can see how SCAR makes the class posterior identifiable in the following equation:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
p ( y = + 1 | x ) = \frac { p ( \pmb { x } , y = + 1 ) } { p ( \pmb { x } ) } = \frac { p ( \pmb { x } | y = + 1 ) \pi } { p ( \pmb { x } ) } \overset { = } \underset { \mathrm { s c a R } } { \underbrace { = } } \frac { p ( \pmb { x } | y = + 1 , o = + 1 ) \pi } { p ( \pmb { x } ) } .
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
Here, $p ( { \pmb x } | y = + 1 , o = + 1 )$ can be estimated from the sample. This estimate can be used to obtain an estimate of $p ( { \pmb x } | y = + 1 )$ and hence that of $p ( y = + 1 | x )$ if we assume SCAR. However, without assuming SCAR, $p ( { \pmb x } | y = + 1 )$ ) may differ from $p ( { \pmb x } | y = + 1 , o = + 1 )$ ), and $p ( y = + 1 | x )$ is not identifiable.
|
| 59 |
+
|
| 60 |
+
Therefore, instead of estimating $p ( y = + 1 | x )$ , we consider extracting some useful information of $p ( y = + 1 | x )$ to learn a classifier. This kind of approach is known as “partial identification” (Manski, 2008) in statistics and economics. First, we introduce an assumption that is weaker than SCAR.
|
| 61 |
+
|
| 62 |
+
Assumption 1 (Invariance of Order). For any $\pmb { x } _ { i } , \pmb { x } _ { j } \in \mathcal { X }$ , we have
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
p ( y = + 1 | \boldsymbol { x } _ { i } ) \leq p ( y = + 1 | \boldsymbol { x } _ { j } ) \Leftrightarrow p ( o = + 1 | \boldsymbol { x } _ { i } ) \leq p ( o = + 1 | \boldsymbol { x } _ { j } ) .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
Although Assumption 1 does not allow one to construct an unbiased estimator of the risk functional, we try to partially identify $p ( y = + 1 | x )$ under this assumption. Our problem setting can be regarded as a generalization of the traditional case-control scenario because SCAR is a special case of the invariance of order.
|
| 69 |
+
|
| 70 |
+
# 2.2 RELATED WORKS
|
| 71 |
+
|
| 72 |
+
A similar assumption can be found in the literature of learning from instance-dependent noisy labels (Du & Cai, 2015; Bootkrajang, 2016), which considers a probabilistic label flipping that is proportional to $p ( y = + 1 | x )$ . However, in order to apply methods of learning from noisy labels to PU learning, we need to assume the censoring scenario and these methods cannot be applied to our problem setting based on the case-control scenario. The censoring scenario is a special case of learning from noisy labels where only negative data is contaminated, i.e., some positive labels flip to negative labels. Thus, in the censoring scenario, unlabeled data can be regarded as negative-labeled data contaminated by positive data. On the other hand, in the case-control scenario, unlabeled data is generated from the marginal distribution $p ( { \pmb x } )$ , i.e., we cannot observe samples generated from $p ( { \pmb x } | o = 0 )$ . Therefore, our problem setting, namely the case-control scenario with invariance of order, is different from the existing works of learning from instance-dependent noisy labels. In addition, our method is also applicable to the censoring scenario when the invariance of order holds because the unlabeled data of the case-control scenario can be made from positive and unlabeled data of the censoring scenario.
|
| 73 |
+
|
| 74 |
+
In Example 1, $p ( y = + 1 | x )$ is the probability that a given input $_ { \textbf { \em x } }$ is anomaly, while $p ( o = + 1 | x )$ is the probability that a given input $_ { \textbf { \em x } }$ gets labeled in the dataset. In Example 2, a positively labeled data is an image $_ { \textbf { \em x } }$ that is known to belong to a user. Here, $p ( o = + 1 | x )$ is the probability that the user provides the picture $_ { \textbf { \em x } }$ as a training datum.
|
| 75 |
+
|
| 76 |
+
# 3 STRATEGY FOR PARTIAL IDENTIFICATION AND CLASSIFICATION
|
| 77 |
+
|
| 78 |
+
As discussed in Section 2.1, we cannot estimate $p ( y = + 1 | x )$ when there is a selection bias even if the class prior is given. Our idea of partial identification is based on the following theorem with the density ratio
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
r ( { \pmb x } ) = \frac { p ( { \pmb x } | y = + 1 , o = + 1 ) } { p ( { \pmb x } ) } .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
# Algorithm 1 Conceptual Algorithm in Population
|
| 85 |
+
|
| 86 |
+
Input: $p ( { \pmb x } | y = + 1 )$ , $p ( { \pmb x } )$ and the class-pror $\pi$ .
|
| 87 |
+
Using $p ( { \pmb x } | y = + 1 )$ and $p ( { \pmb x } )$ , calculate $r ( { \pmb x } )$ by minimization of either (4) or (7).
|
| 88 |
+
Using $r ( { \pmb x } )$ , calculate $\theta _ { \pi }$ in (2).
|
| 89 |
+
Using the density ratio $r ( { \pmb x } )$ and the threshold $\theta _ { \pi }$ , obtain a classifier $h ( \pmb { x } ) = \mathtt { s i g n } ( r ( \pmb { x } ) - \theta _ { \pi } )$ .
|
| 90 |
+
|
| 91 |
+
Theorem 1 (Order Preserving Property of the score Function). Suppose that Assumption $I$ holds. Then, for any $\pmb { x } _ { i } , \pmb { x } _ { j } \in \mathcal { X }$ ,
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
p ( y = + 1 | { \boldsymbol x } _ { i } ) \leq p ( y = + 1 | { \boldsymbol x } _ { j } ) \Leftrightarrow r ( { \boldsymbol x } _ { i } ) \leq r ( { \boldsymbol x } _ { j } ) .
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
A proof is provided in Appendix A.
|
| 98 |
+
|
| 99 |
+
Even though we cannot estimate $p ( y = + 1 | \cdot )$ , Theorem 1 implies that we can still extract the total order in $\mathcal { X }$ induced by $p ( y = + 1 | \cdot )$ if we can estimate $r ( \cdot )$ . Therefore, we propose to estimate $r$ and use it as a score function that captures the total order induced by $p ( y = + 1 | \cdot )$ . After obtaining an estimator of $r$ (denoted by $\hat { r }$ ), we set a threshold $\theta \in \mathbb { R }$ and use $h ( \pmb { x } ) = \mathtt { s i g n } ( r ( \pmb { x } ) - \theta )$ as a classifier. There are various ways of determining the threshold. For instance, we put labels from data with the highest density ratio under a constraint on the number of data to which we can put labels (Hido et al., 2011). Here, we introduce one useful principle for choosing $\theta$ . We consider using a threshold $\theta _ { \pi }$ defined by the following equation,
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\pi = \int \mathbf { 1 } [ r ( \pmb { x } ) \geq \theta _ { \pi } ] p ( \pmb { x } ) d \pmb { x } .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
The intuition behind the definition of $\theta _ { \pi }$ is that the proportion of the positive data in the test data points should not deviate so much from the class-prior. This intuition becomes clearer in Section 4.3.
|
| 106 |
+
|
| 107 |
+
In Section 4, we discuss detailed methods for estimating $r$ and setting $\theta$ based on data. Our approach is summarized in the form of a pseudo-code in Algorithm 1. In the rest of this section, we theoretically justify $\theta _ { \pi }$ defined in (2).
|
| 108 |
+
|
| 109 |
+
Property of $\theta _ { \pi }$ : Let us consider the case where a classifier is given as $h ( \pmb { x } ) = \mathtt { s i g n } ( r ( \pmb { x } ) - \theta )$ . Then four population quantities, true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN) (Lipton et al., 2014), that depend on $r ( \cdot )$ and $\theta$ is written as follows:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { l r } { { T P = \displaystyle \int _ { \{ { \bf x } : r ( { \bf x } ) \geq \theta } \} } p ( y = + 1 | x ) p ( { \bf x } ) d x , } & { { F P = \displaystyle \int _ { \{ { \bf x } : r ( { \bf x } ) \geq \theta } \} } p ( y = - 1 | x ) p ( x ) d x , } \\ { { T N = \displaystyle \int _ { \{ { \bf x } : r ( { \bf x } ) < \theta } \} } p ( y = - 1 | x ) p ( { \bf x } ) d x , } & { { F N = \displaystyle \int _ { \{ { \bf x } : r ( { \bf x } ) < \theta \} } p ( y = + 1 | x ) p ( x ) d x . } } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
Then, the precision and the recall of a classifier are expressed as precision $\begin{array} { r l r } { \mathrm { ~ } } & { { } } & { = \mathrm { ~ \left( \frac { { \cal T } P } { { \cal T } P + { \cal F } P } \right) } } \end{array}$ and $\begin{array} { r } { \mathrm { r e c a l l } = \left( \frac { T P } { T P + F N } \right) } \end{array}$ , respectively. For $\theta _ { \pi }$ , we have the following result.
|
| 116 |
+
|
| 117 |
+
Theorem 2. If we use $\theta = \theta _ { \pi }$ , then precision $=$ recall holds.
|
| 118 |
+
|
| 119 |
+
A proof is shown in Appendix B. The threshold $\theta _ { \pi }$ is known as precision–recall breakeven point (BEP) (Sammut & Webb, 2010), which makes the precision and the recall the same. BEP is originally used to evaluate a generic classification model with a score function and a threshold. Besides, we can interpret BEP as a point which balances a prediction result; as explained by Powers (2015), a classifier using BEP as a threshold puts the same cost to the false positives and false negatives. Knowing BEP is also useful for deciding on a threshold which put unbalanced weight on the precision and the recall because we can tell if we are weighing precision more or recall more.
|
| 120 |
+
|
| 121 |
+
# 4 ALGORITHM
|
| 122 |
+
|
| 123 |
+
Here, we propose two directions for estimating r(x) = p(x|y=+1,o=+1)p(x) under the assumption of invariance of order, namely minimizing a pseudo classification risk and direct density ratio estimation. We discuss how to set $\theta$ based on the data. A pseudo-code of our algorithm is shown in Algorithm 2.
|
| 124 |
+
|
| 125 |
+
# Algorithm 2 PUSB
|
| 126 |
+
|
| 127 |
+
Input: A class-pror sitive dataset . $\{ { \pmb x } _ { i } \} _ { i = 1 } ^ { n }$ , an unlabeled dataset $\{ { \pmb x } _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } }$ , a test dataset $\{ \pmb { x } _ { i } ^ { \mathrm { t e } } \} _ { i = 1 } ^ { n ^ { \mathrm { t e } } }$ and the $\pi$
|
| 128 |
+
Using $\{ { \pmb x } _ { i } \} _ { i = 1 } ^ { n }$ and $\{ { \pmb x } _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } }$ , estimate $r ( { \pmb x } )$ by any of (5), (6) or (8) and obtain $\hat { r } ( { \pmb x } )$ .
|
| 129 |
+
Using $\hat { r } ( { \pmb x } )$ , estimate $\theta _ { \pi }$ by (9) and obtain $\hat { \theta } _ { \pi }$ .
|
| 130 |
+
Using an estimator $\hat { r } ( { \pmb x } )$ and $\hat { \theta }$ , obtain a classifier $h ( \pmb { x } ) = \mathtt { s i g n } ( \hat { r } ( \pmb { x } ) - \hat { \theta } _ { \pi } ) .$
|
| 131 |
+
|
| 132 |
+
# 4.1 ESTIMATION OF $r$ BY MINIMIZING PSEUDO CLASSIFICATION RISK
|
| 133 |
+
|
| 134 |
+
First, we introduce the minimization of the pseudo classification risk. The idea is to minimize the classification risk used in traditional PU learning (du Plessis et al., 2014; 2015) as if there is no selection bias. Under a selection bias, we cannot construct unbiased risk function, but the minimizer can be substituted for the density ratio in (1).
|
| 135 |
+
|
| 136 |
+
Conventional PU risk formulation: Let $\ell : \mathbb { R } \times \{ \pm 1 \} \to \mathbb { R } ^ { + }$ be a loss function, where $\mathbb { R } ^ { + }$ is the set of non-negative real values, and $\mathcal { F }$ be the set of measurable functions from $\mathcal { X }$ to $[ \epsilon , 1 - \epsilon ]$ , where $\epsilon \in ( 0 , 1 / 2 )$ is a small positive value. This constant $\epsilon$ is introduced to make the following optimization problem well-defined.
|
| 137 |
+
|
| 138 |
+
du Plessis et al. (2015) showed that the classification risk of $f \in { \mathcal { F } }$ in the traditional PU problem setting with SCAR can be expressed as
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
R _ { \mathrm { P U } } ( f ) = \pi \mathbb { E } _ { \mathrm { p } } [ \ell ( f ( X ) , + 1 ) ] - \pi \mathbb { E } _ { \mathrm { p } } [ \ell ( f ( X ) , - 1 ) ] + \mathbb { E } _ { \mathrm { u } } [ \ell ( f ( X ) , - 1 ) ] ,
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
where $\mathbb { E } _ { \mathrm { p } }$ and $\mathbb { E } _ { \mathrm { u } }$ are the expectations over $p ( { \pmb x } | y = + 1 )$ and $p ( { \pmb x } )$ , respectively. When there is no selection bias, we can replace the expectations with the corresponding sample averages to obtain an unbiased estimator of the classification risk.
|
| 145 |
+
|
| 146 |
+
The pseudo classification risk: In our problem setting, we only have samples from $p ( { \pmb x } | { \pmb y } =$ $+ 1 , o = + 1 \rangle$ and not from $p ( { \pmb x } | y = + 1 )$ . Therefore, we cannot use our sample to obtain an empirical version of $R _ { \mathrm { P U } }$ . However, we still consider the pseudo classification risk of $f \in { \mathcal { F } }$ :
|
| 147 |
+
|
| 148 |
+
$$
|
| 149 |
+
\begin{array} { r } { R _ { \mathrm { P U } } ^ { \mathrm { b i a s } } ( f , \ell ) = \pi \mathbb { E } _ { \mathrm { p } } ^ { \mathrm { b i a s } } [ \ell ( f ( X ) , + 1 ) ] - \pi \mathbb { E } _ { \mathrm { p } } ^ { \mathrm { b i a s } } [ \ell ( f ( X ) , - 1 ) ] + \mathbb { E } _ { \mathrm { u } } [ \ell ( f ( X ) , - 1 ) ] , } \end{array}
|
| 150 |
+
$$
|
| 151 |
+
|
| 152 |
+
where $\mathbb { E } _ { \mathrm { p . } } ^ { \mathtt { b i a s } }$ is the expectation over $p ( \pmb { x } | y = + 1 , o = + 1 )$ . We call this functional the pseudo classification risk because it is not the true classification risk. An unbiased estimator for the pseudo classification risk can be obtained by replacing the expectations with the corresponding sample averages even if there is a selection bias. For the loss function, we use the logarithmic loss: $\ell ( f ( \pmb { x } ) , + 1 ) ) = - \log ( f ( \pmb { x } ) )$ and $\ell ( f ( \pmb { x } ) , - 1 ) = - \log ( 1 - f ( \pmb { x } ) )$ . In this case, the pseudo classification risk of $f \in { \mathcal { F } }$ becomes
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
R _ { \mathrm { P U } } ^ { \mathrm { b i a s } } ( f ) = - \pi \mathbb { E } _ { \mathrm { p } } ^ { \mathrm { b i a s } } [ \log ( f ( X ) ) ] + \pi \mathbb { E } _ { p } ^ { \mathrm { b i a s } } [ \log ( 1 - f ( X ) ) ] - \mathbb { E } _ { \mathrm { u } } [ \log ( 1 - f ( X ) ) ] .
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
Justification for minimizing the pseudo classification risk: For the pseudo classification risk with the logarithmic loss function, the following theorem justifies its use. Let us denote a minimizer of (4) by $f ^ { * }$ , that is,
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
f ^ { * } \in \arg \operatorname* { m i n } _ { f \in \mathcal { F } } R _ { \mathrm { P U } } ^ { \mathrm { b i a s } } ( f ) .
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
For the minimizer of (4), we show the following theorem.
|
| 165 |
+
|
| 166 |
+
Theorem 3. It holds almost everywhere that
|
| 167 |
+
|
| 168 |
+
$$
|
| 169 |
+
f ^ { * } ( \pmb { x } ) = \left\{ \begin{array} { l l } { \epsilon } & { ( \pmb { x } \notin D _ { 1 } ) , } \\ { \frac { \pi p ( \pmb { x } | y = + 1 , o = + 1 ) } { p ( \pmb { x } ) } } & { ( \pmb { x } \in D _ { 1 } \cap D _ { 2 } ) , } \\ { 1 - \epsilon } & { ( \pmb { x } \notin D _ { 2 } ) , } \end{array} \right.
|
| 170 |
+
$$
|
| 171 |
+
|
| 172 |
+
where $D _ { 1 } \ = \ \{ { \pmb x } | \pi p ( { \pmb x } | y = 1 , o = + 1 ) \ \geq \ \epsilon p ( { \pmb x } ) \}$ and $D _ { 2 } \ = \ \{ { \pmb x } | \pi p ( { \pmb x } | y = 1 , o \ = \ + 1 ) \ \leq$ $( 1 - \epsilon ) p ( { \pmb x } ) \}$ .
|
| 173 |
+
|
| 174 |
+
A proof is provided in Appendix C. Theorem 3 implies that the minimization of the empirical version of the pseudo classification risk allows us to estimate $r$ .
|
| 175 |
+
|
| 176 |
+
Empirical Estimation: When we train a classifier with training samples, we can naively replace the expectations with the corresponding sample averages. For a hypothesis set $\mathcal { H }$ , which is a set of measurable functions, let us define the following risk minimization problem,
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
\hat { f } _ { 1 } = \underset { f \in \mathcal { H } } { \arg \operatorname* { m i n } } \left[ - \pi \hat { \mathbb { E } } _ { p } ^ { \mathrm { b i a s } } [ \log ( f ( X ) ) ] + \pi \hat { \mathbb { E } } _ { p } ^ { \mathrm { b i a s } } [ \log ( 1 - f ( X ) ) ] - \hat { \mathbb { E } } _ { u } [ \log ( 1 - f ( X ) ) ] + \mathcal { R } ( f ) \right] ,
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
where $\hat { \mathbb { E } } _ { p } ^ { \mathrm { { b i a s } } }$ denotes the averaging operator over positive data with a selection bias, $\hat { \mathbb { E } } _ { u }$ denotes the averaging over the unlabeled data, and $\mathcal { R }$ is a regularization term. du Plessis et al. (2015) showed that, under SCAR, the empirical version of the risk becomes unbiased toward the classification risk.
|
| 183 |
+
|
| 184 |
+
However, Kiryo et al. (2017) pointed out that unbiased PU learning does not work with deep neural networks. Minimizing an empirical risk of (3) with deep neural networks easily causes over-fitting because the risk is not bounded from below by 0. In order to implement PU learning with deep neural networks, Kiryo et al. (2017) proposed the following non-negative risk,
|
| 185 |
+
|
| 186 |
+
$$
|
| 187 |
+
\begin{array} { r } { \hat { \bar { \mathfrak { c } } } _ { 2 } = \underset { f \in \mathcal { H } } { \mathrm { a r g } } \operatorname* { m i n } \left[ - \pi \hat { \mathbb { E } } _ { p } ^ { \mathrm { b i a s } } [ \mathrm { l o g } ( f ( X ) ) ] + \left( \pi \hat { \mathbb { E } } _ { p } ^ { \mathrm { b i a s } } [ \mathrm { l o g } ( 1 - f ( X ) ) ] - \hat { \mathbb { E } } _ { u } [ \mathrm { l o g } ( 1 - f ( X ) ) ] \right) _ { + } + \mathcal { R } ( f ) \right] , } \end{array}
|
| 188 |
+
$$
|
| 189 |
+
|
| 190 |
+
where $( \cdot ) _ { + } : = \operatorname* { m a x } \{ 0 , \cdot \}$ . After obtaining $\hat { f }$ , we construct an estimator of the density ratio $r$ by $\begin{array} { r } { \hat { r } = \frac { 1 } { \pi } \hat { f } _ { 1 } } \end{array}$ or $\begin{array} { r } { \hat { r } = \frac { 1 } { \pi } \hat { f } _ { 2 } } \end{array}$ .
|
| 191 |
+
|
| 192 |
+
# 4.2 ESTIMATION OF $r$ BY DIRECT DENSITY RATIO ESTIMATION
|
| 193 |
+
|
| 194 |
+
For another approach, we consider estimating the density ratio $\begin{array} { r } { r ( \pmb { x } ) = \frac { p ( \pmb { x } | y = + 1 , o = + 1 ) } { p ( \pmb { x } ) } } \end{array}$ directly. We can estimate the probability density functions of the numerator and the denominator. However, as known as Vapnik’s principle, we should avoid solving more difficult intermediate problems than the target problem. Sugiyama et al. (2012) summarized methods estimating the density ratio directly. Among existing methods, we employ Least-squares importance fitting (LSIF), which uses the squared loss for density-ratio function fitting. The reason for this choice is that there is an algorithm called unconstrained Least-Squares Importance Fitting (uLSIF) with a computational advantage. We can obtain the closed-form solution just by solving the linear equations. Thus, uLSIF is numerically stable when it is regularized properly. Moreover, the leave-one-out cross-validation score for uLSIF can also be computed analytically, which significantly improves the computational efficiency in model selection.
|
| 195 |
+
|
| 196 |
+
Here, we introduce the formulation of LSIF. Let $s$ be the class of non-negative measurable functions $s : \mathcal { X } \to \mathbb { R } ^ { + }$ . We consider minimizing the following squared error between $s$ and $r$ :
|
| 197 |
+
|
| 198 |
+
$$
|
| 199 |
+
R _ { \mathrm { D R } } ( s ) = \mathbb { E } _ { \mathrm { u } } [ ( s ( X ) - r ( X ) ) ^ { 2 } ] = \mathbb { E } _ { \mathrm { u } } [ ( r ( X ) ) ^ { 2 } ] - 2 \mathbb { E } _ { \mathrm { p } } ^ { \mathrm { b i a s } } [ s ( X ) ] + \mathbb { E } _ { \mathrm { u } } [ ( s ( X ) ) ^ { 2 } ] .
|
| 200 |
+
$$
|
| 201 |
+
|
| 202 |
+
The first term of the last equation does not affect the result of minimization and we can ignore the term, i.e., the density ratio is estimated through the following minimization problem:
|
| 203 |
+
|
| 204 |
+
$$
|
| 205 |
+
s ^ { * } = \underset { s \in \cal S } { \arg \operatorname* { m i n } } R _ { \mathrm { D R } } ( s ) = \underset { s \in \cal S } { \arg \operatorname* { m i n } } \left[ \frac { 1 } { 2 } \mathbb { E } _ { \mathrm { u } } [ ( s ( X ) ) ^ { 2 } ] - \mathbb { E } _ { \mathrm { p } } ^ { \tt b i a s } [ s ( X ) ] \right] .
|
| 206 |
+
$$
|
| 207 |
+
|
| 208 |
+
Empirical Estimation: As mentioned above, to minimize the empirical version of (7), we use uLSIF (Kanamori et al., 2009). Given a hypothesis class $\mathcal { H }$ , we obtain $\hat { r }$ by
|
| 209 |
+
|
| 210 |
+
$$
|
| 211 |
+
\hat { r } = \underset { s \in \mathcal { H } } { \arg \operatorname* { m i n } } \left[ \frac { 1 } { 2 } \hat { \mathbb { E } } _ { \mathrm { u } } [ ( s ( X ) ) ^ { 2 } ] - \hat { \mathbb { E } } _ { \mathrm { p } } ^ { \mathrm { b i a s } } [ s ( X ) ] + \mathcal { R } ( s ) \right] ,
|
| 212 |
+
$$
|
| 213 |
+
|
| 214 |
+
where $\mathcal { R }$ is a regularization term.
|
| 215 |
+
|
| 216 |
+
# 4.3 ESTIMATION OF $\theta _ { \pi }$
|
| 217 |
+
|
| 218 |
+
We consider replacing the threshold defined by (2) with samples. By using the test inputs or held-out training data, $\{ \pmb { x } _ { i } ^ { \mathrm { t e } } \} _ { i = 1 } ^ { n ^ { \mathrm { t e } } } \sim p ( \pmb { x } )$ be calcu, we find $\hat { \theta } _ { \pi }$ ed only fromthat satisfies
|
| 219 |
+
|
| 220 |
+
Table 1: Dataset statistics (Pos. frac.: Positive fraction, Dim: Dimension).
|
| 221 |
+
|
| 222 |
+
<table><tr><td>Dataset</td><td>#of samples</td><td>Pos.frac.</td><td>Dim.</td></tr><tr><td>mushrooms</td><td>8,124</td><td>0.517</td><td>112</td></tr><tr><td>shuttle</td><td>58.000</td><td>0.786</td><td>9</td></tr><tr><td>pageblocks</td><td>5,473</td><td>0.898</td><td>10</td></tr><tr><td>usps</td><td>9,298</td><td>0.524</td><td>256</td></tr><tr><td>connect-4</td><td>67,557</td><td>0.658</td><td>126</td></tr><tr><td>spambase</td><td>4.601</td><td>0.394</td><td>57</td></tr><tr><td>MNIST</td><td>70.000</td><td>0.511</td><td>784</td></tr><tr><td>CIFAR-10</td><td>60,000</td><td>0.400</td><td>3,072</td></tr></table>
|
| 223 |
+
|
| 224 |
+
the following equation,
|
| 225 |
+
|
| 226 |
+
$$
|
| 227 |
+
\lceil \pi n ^ { \mathrm { t e } } \rceil = \sum _ { i = 1 } ^ { n ^ { \mathrm { t e } } } { \bf 1 } [ \hat { r } ( { \bf x } _ { i } ^ { \mathrm { t e } } ) > \hat { \theta } _ { \pi } ] .
|
| 228 |
+
$$
|
| 229 |
+
|
| 230 |
+
Here, we used the knowledge of $\pi$ , the class-prior. This choice of $\hat { \theta } _ { \pi }$ amounts to classifying top- $\pi$ test data as positive after ranking the inputs by $\hat { r }$ .
|
| 231 |
+
|
| 232 |
+
# 5 EXPERIMENTS
|
| 233 |
+
|
| 234 |
+
In this section, we report experimental results which were conducted using synthetic data and realworld datasets1). We used seven classification datasets, mushrooms, shuttle, pageblocks, usps, connect-4, spambase, and MNIST, from UCI repository2), $\mathsf { C I F A R } - \mathsf { 1 0 } ^ { 3 } )$ and a document dataset obtained from SwissProt (Boeckmann et al., $2 0 0 3 ) ^ { 4 ) }$ . MNIST and $\mathtt { C I F A R - 1 0 }$ originally have 10 and 10 classes, respectively, and we constructed the positive and negative datasets from them as follows: MNIST was preprocessed in such a way that 0, 2, 4, 6, 8 constitute the positive class, while 1, 3, 5, 7, 9 constitute the negative class; for CIFAR-10, the positive dataset is formed by ‘airplane’, ‘automobile’, ‘ship’ and ‘truck’, and the negative dataset is formed by ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’ and ‘horse’. Except for the document dataset, we show the details of datasets in Table 1 and made positive data with a selection bias based on estimators of $p ( y = + 1 | x )$ as we show in each experiments. For six datasets of the UCI repository and the CIFAR-10, we made positive datasets with a selection bias artificially, but, for the document dataset, we have an unlabeled dataset and a positive dataset, which is gathered for classifying the labels in the unlabeled dataset.
|
| 235 |
+
|
| 236 |
+
We call unbiased PU learning proposed by du Plessis et al. (2015) “PU”, unbiased PU learning with a threshold estimated by (9) “PUSB”, uLSIF with a threshold estimated by (9) “DRSB”, nonnegative PU learning “nnPU” and nonnegative PU learning with a threshold estimated by (9) “nnPUSB”.
|
| 237 |
+
|
| 238 |
+
For the hypothesis class $\mathcal { H }$ in the density ratio estimation (8), we use the linear-in-parameter model:
|
| 239 |
+
|
| 240 |
+
$$
|
| 241 |
+
\begin{array} { r } { \mathcal { H } : = \left. \ : s ( \pmb { x } ) = \beta ^ { \top } \varphi ( \pmb { x } ) \right. \beta \in \mathbb { R } ^ { m + 1 } \} , } \end{array}
|
| 242 |
+
$$
|
| 243 |
+
|
| 244 |
+
where $\pmb { \varphi } ( \pmb { x } ) = [ 1 , \varphi _ { 1 } ( \pmb { x } ) , . . . , \varphi _ { m } ( \pmb { x } ) ] ^ { \top }$ is a vector of basis functions. For basis functions, we used the Gaussian kernel located at sample points $\varphi _ { \ell } ( \pmb { x } ) = \exp \left( - \| \pmb { x } - \pmb { c } _ { \ell } \| ^ { 2 } / ( 2 \sigma ^ { 2 } ) \right)$ , where $\{ \pmb { c } _ { 1 } , . . . , \pmb { c } _ { m } \} =$ $\left\{ { \pmb x } _ { 1 } , . . . , { \pmb x } _ { n } , { \pmb x } _ { 1 } ^ { \prime } , . . . , { \pmb x } _ { n ^ { \prime } } ^ { \prime } \right\}$ and $m = n + n ^ { \prime }$ . For the hypothesis class $\mathcal { H }$ in the risk minimization of PU learning (5), we use the following model with the sigmoid function:
|
| 245 |
+
|
| 246 |
+
$$
|
| 247 |
+
\mathcal { H } : = \left. \left. f ( \pmb { x } ) = \frac { 1 } { 1 + \exp ( - \beta ^ { \top } \varphi ( \pmb { x } ) ) } \right| \beta \in \mathbb { R } ^ { m + 1 } \right. .
|
| 248 |
+
$$
|
| 249 |
+
|
| 250 |
+
In this case, the loss is the same as the logistic loss and unbiased PU learning becomes convex. For the hypothesis class $\mathcal { H }$ in the risk minimization of nonnegative PU learning (6), we use deep neural networks. The specifications of deep neural networks are given in the following sections for each dataset. We mainly used the same structure proposed in Kiryo et al. (2017) in order to compare the performances. For the regularization term $\mathcal { R }$ , we used the $\ell _ { 2 }$ norm of the parameters scaled by a positive scalar $\lambda$ . For the linear models, hyperparameters were selected via cross-validation.
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
Figure 1: Two Gaussians: The horizontal axis is the value of $_ { \textbf { \em x } }$ and the vertical axis is the probability density. The vertical lines represent the decision boundaries of the classifiers. The distribution of positive data, negative data, unlabeled data and $p ( \pmb { x } | o = + 1 , y = + 1 )$ are plotted.
|
| 254 |
+
|
| 255 |
+
# 5.1 TEST WITH SYNTHETIC DATA
|
| 256 |
+
|
| 257 |
+
This experiment shows the classifier given by PUSB. We used samples from a mixture distribution of the following two class-conditional distributions:
|
| 258 |
+
|
| 259 |
+
$$
|
| 260 |
+
p ( { \pmb x } | y = + 1 ) = \mathcal { N } ( 1 , 2 ^ { 2 } ) \mathrm { a n d } p ( { \pmb x } | y = - 1 ) = \mathcal { N } ( - 1 , 2 ^ { 2 } ) ,
|
| 261 |
+
$$
|
| 262 |
+
|
| 263 |
+
where ${ \mathcal { N } } ( \mu , \sigma ^ { 2 } )$ denotes the univariate normal distribution with mean $\mu$ and variance $\sigma ^ { 2 }$ . A positive dataset with a selection bias was sampled from
|
| 264 |
+
|
| 265 |
+
$$
|
| 266 |
+
p ( \pmb { x } | o = + 1 , y = + 1 ) \propto ( p ( y = + 1 | \pmb { x } ) ) ^ { 1 0 } .
|
| 267 |
+
$$
|
| 268 |
+
|
| 269 |
+
We generated 1, 000 positive samples and $1 0 , 0 0 0$ unlabeled samples. We made two datasets with different class-priors $\pi = 0 . 3$ and $\pi = 0 . 7$ . Figure 1 shows classifiers constructed by PU and PUSB along with the Bayes optimal classifier $\mathtt { s i g n } ( \bar { p } ( y = + 1 | x ) - 1 / 2 )$ . The classifier of PUSB is closer to the Bayes optimal classifier than that of PU.
|
| 270 |
+
|
| 271 |
+
# 5.2 TEST WITH BENCHMARK DATA
|
| 272 |
+
|
| 273 |
+
Here, we investigate the experimental performance in detail.
|
| 274 |
+
|
| 275 |
+
Linear-in-parameter model: We used the mushrooms, shuttle, pageblocks, usps, connect-4 and spambase datasets. First, we estimated $p ( y = + 1 | x )$ using the logistic regression with the same linear model. Then, we obtained the labeled positive data by labeling some instances of the positive data following
|
| 276 |
+
|
| 277 |
+
$$
|
| 278 |
+
p ( o = + 1 | x , y = + 1 ) \propto ( p ( y = + 1 | x ) ) ^ { 2 0 } .
|
| 279 |
+
$$
|
| 280 |
+
|
| 281 |
+
Then, we trained a classifier by minimizing the empirical risk of PU learning (4) and the density ratio estimation (7).
|
| 282 |
+
|
| 283 |
+
For each binary labeled dataset, we made 12 different pairs of positive and unlabeled data with 4 different class-priors, $\{ 0 . 2 , 0 . 4 , 0 . 6 , 0 . 8 \}$ , and 3 different numbers of unlabeled data, $\{ 8 0 0 , 1 6 0 0 , 3 2 0 0 \}$ . The number of positive data was fixed at 400. We used 1000 test data sampled from the same distribution as the unlabeled data. We ran the experiments 100 times and calculated the mean and standard deviation for the test dataset with PU, PUSB, and DRSB. The results are shown in Table 2. The classifiers obtained by our algorithm always show preferable performance to existing methods.
|
| 284 |
+
|
| 285 |
+
Neural network model: We used the MNIST and CIFAR-10 datasets. For MNIST, a 3-layer multilayer perceptron (MLP) with ReLU activation (Nair & Hinton, 2010) was used. For CIFAR-10, an all convolutional net (Springenberg et al., 2015) was used. Details of the network structure are shown in Appendix D.
|
| 286 |
+
|
| 287 |
+
Table 2: The error rate of classification in test data $( \% )$ are shown for the different class-priors and the different number of samples. For all experiments, the linear-in-parameter model was used. Best and equivalent methods (under $5 \%$ t-test) are bold.
|
| 288 |
+
|
| 289 |
+
<table><tr><td colspan="2"></td><td colspan="3">PU</td><td colspan="3">PUSB</td><td colspan="3">DRSB</td></tr><tr><td>Dataset</td><td>π</td><td>800</td><td>1600</td><td>3200</td><td>800</td><td>1600</td><td>3200</td><td>800</td><td>1600</td><td>3,200</td></tr><tr><td>mushrooms</td><td>0.2</td><td>5.1(.076)</td><td>5.0(.055)</td><td>5.5 (.083)</td><td>4.1 (.007)</td><td>3.8 (.007)</td><td>4.0 (.007)</td><td>10.7 (.010)</td><td>9.9 (.011)</td><td>9.9 (.012)</td></tr><tr><td></td><td>0.4</td><td>7.0 (.012)</td><td>6.6(.010)</td><td>6.8(.025)</td><td>6.9 (.012)</td><td>6.7 (.010)</td><td>6.8 (.010)</td><td>15.8 (.014)</td><td>15.0 (.016)</td><td>15.2 (.012)</td></tr><tr><td></td><td>0.6</td><td>10.8 (.020)</td><td>11.3 (.015)</td><td>11.3 (.016)</td><td>8.2(.013)</td><td>8.5 (.010)</td><td>8.3 (.011)</td><td>18.5 (.014)</td><td>18.8(.012)</td><td>18.5 (.013)</td></tr><tr><td></td><td>0.8</td><td>21.1 (.022)</td><td>21.6(.021)</td><td>21.7 (.016)</td><td>8.1(.015)</td><td>8.0 (.012)</td><td>7.6(.014)</td><td>14.2 (.013)</td><td>14.3 (.014)</td><td>14.4(.011)</td></tr><tr><td>shuttle</td><td>0.2</td><td>23.8 (.006)</td><td>23.8 (.007)</td><td>23.8(.007)</td><td>5.2 (.008)</td><td>5.0 (.007)</td><td>5.0 (.007)</td><td>5.1(.008)</td><td>5.1(.008)</td><td>5.1 (.007)</td></tr><tr><td></td><td>0.4</td><td>15.5 (.023)</td><td>15.5 (.019)</td><td>15.0 (.016)</td><td>7.8 (.011)</td><td>7.7 (.011)</td><td>7.6(.012)</td><td>6.7 (.025)</td><td>7.6 (.029)</td><td>7.2 (.027)</td></tr><tr><td></td><td>0.6</td><td>26.1 (.018)</td><td>26.4 (.017)</td><td>26.4(.016)</td><td>11.1 (.015)</td><td>10.8 (.012)</td><td>11.0 (.015)</td><td>7.8 (.028)</td><td>7.4 (.028)</td><td>7.1(.028)</td></tr><tr><td></td><td>0.8</td><td>14.6(.006)</td><td>14.6 (.005)</td><td>14.8 (.007)</td><td>12.3 (.014)</td><td>12.4 (.014)</td><td>12.3 (.012)</td><td>7.9 (.021)</td><td>7.6(.023)</td><td>7.4 (.022)</td></tr><tr><td>pageblocks</td><td>0.2</td><td>39.5 (.009)</td><td>39.6 (.010)</td><td>39.6(.008)</td><td>41.6 (.021)</td><td>42.5 (.022)</td><td>43.7 (.019)</td><td>23.1 (.016)</td><td>23.1 (.015)</td><td>22.2 (.012)</td></tr><tr><td></td><td>0.4</td><td>56.5 (.011)</td><td>56.7 (.011)</td><td>56.6(.008)</td><td>33.7 (.020)</td><td>33.7 (.019)</td><td>33.5 (.024)</td><td>23.6 (.012)</td><td>23.7(.014)</td><td>23.6 (.014)</td></tr><tr><td></td><td>0.6</td><td>22.4 (.023)</td><td>23.4(.033)</td><td>28.1(.028)</td><td>20.9 (.016)</td><td>21.1 (.016)</td><td>21.5 (.020)</td><td>18.7 (.011)</td><td>18.6(.012)</td><td>18.1 (.017)</td></tr><tr><td></td><td>0.8</td><td>19.8 (.003)</td><td>20.0 (.001)</td><td>20.0 (.001)</td><td>13.9 (.022)</td><td>13.6 (.023)</td><td>16.7 (.043)</td><td>15.4 (.011)</td><td>14.8 (.014)</td><td>14.3 (.019)</td></tr><tr><td>usps</td><td>0.2</td><td>9.0 (.011)</td><td>8.5 (.009)</td><td>8.2 (.010)</td><td>8.0 (.009)</td><td>7.7 (.007)</td><td>7.4 (.009)</td><td>18.2 (.016)</td><td>19.6 (.013)</td><td>19.7 (.014)</td></tr><tr><td></td><td>0.4</td><td>10.5 (.012)</td><td>10.3 (.013)</td><td>10.0 (.010)</td><td>10.5 (.013)</td><td>10.2 (.012)</td><td>10.0 (.010)</td><td>30.5 (.029)</td><td>30.2(.022)</td><td>29.9 (.023)</td></tr><tr><td></td><td>0.6</td><td>12.5 (.015)</td><td>12.3 (.015)</td><td>12.1 (.013)</td><td>11.2 (.016)</td><td>10.9 (.015)</td><td>10.6 (.013)</td><td>32.9 (.026)</td><td>33.2(.031)</td><td>33.1(.030)</td></tr><tr><td></td><td>0.8</td><td>19.8 (.020)</td><td>19.8 (.016)</td><td>19.5 (.017)</td><td>10.3 (.016)</td><td>9.8 (.014)</td><td>9.6 (.014)</td><td>25.9 (.028)</td><td>25.3(.027)</td><td>25.8 (.030)</td></tr><tr><td>connect-4</td><td>0.2</td><td>22.3 (0.017)</td><td>21.9 (.014)</td><td>21.6 (.013)</td><td>21.8 (.013)</td><td>21.5 (.012)</td><td>21.2 (.011)</td><td>26.7(.012)</td><td>26.6(.012)</td><td>26.4(.011)</td></tr><tr><td></td><td>0.4</td><td>31.2 (.015)</td><td>31.0 (.015)</td><td>30.7(.016)</td><td>31.2 (.015)</td><td>31.0 (.015)</td><td>30.7 (.016)</td><td>39.4 (.016)</td><td>39.6(.018)</td><td>39.2 (.016)</td></tr><tr><td></td><td>0.6</td><td>32.0 (.017)</td><td>32.1 (.013)</td><td>31.9 (.015</td><td>31.7 (.016)</td><td>31.7 (.013)</td><td>31.4 (.016)</td><td>40.9 (.015)</td><td>41.1 (.017)</td><td>41.0 (.017)</td></tr><tr><td>spambase</td><td>0.8</td><td>33.6(.018)</td><td>33.5 (.016)</td><td>33.4(.017)</td><td>24.2 (.013)</td><td>23.9 (.013)</td><td>23.8(.013)</td><td>29.8 (.011)</td><td>29.6(.013)</td><td>29.5 (.012)</td></tr><tr><td></td><td>0.2</td><td>20.1 (0.002)</td><td>20.1(.002)</td><td>20.1(.003)</td><td>13.6 (.013)</td><td>13.8 (.014)</td><td>14.0 (.014)</td><td>18.1 (.026)</td><td>18.3 (.025)</td><td>17.9 (.023)</td></tr><tr><td></td><td>0.4</td><td>36.2 (.024)</td><td>35.9 (.025)</td><td>30.7 (.024)</td><td>19.0 (.020)</td><td>18.7 (.021)</td><td>18.9 (.018)</td><td>27.4(.042)</td><td>27.8 (.043)</td><td>27.7 (.039)</td></tr><tr><td></td><td>0.6</td><td>40.0 (.001)</td><td>39.9 (.001)</td><td>31.9 (.001</td><td>20.8 (.019)</td><td>20.7(.018)</td><td>20.0 (.017)</td><td>31.2 (.037)</td><td>30.3 (.035)</td><td>31.2 (.035)</td></tr><tr><td></td><td>0.8</td><td>20.0 (.000)</td><td>20.0 (.000)</td><td>20.0 (.000)</td><td>18.0 (.015)</td><td>17.7 (.013)</td><td>17.3 (.013)</td><td>24.5 (.058)</td><td>23.9 (.017)</td><td>24.2(.017)</td></tr></table>
|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
Figure 2: Experimental results of training deep neural networks. Left: MNIST; Center: $\mathrm { C I F A R } { - } 1 0$ ; Right: RealData: All measures are calculated for test data sampled from the marginal distribution $p ( { \pmb x } )$ . The horizontal axis is the epoch of training the network, the vertical axes of the top figures are the error rates and the vertical axes of the bottom figures are the precision and the recall.
|
| 293 |
+
|
| 294 |
+
First, we estimated $p ( y = + 1 | x )$ using the logistic regression with the same network structure using the positive and negative datasets in the unlabeled dataset. Next, from the positive dataset, we resampled positive dataset with an observation, which follows
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
p ( o = + 1 | x , y = + 1 ) \propto ( p ( y = + 1 | x ) ) ^ { 1 0 } .
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
Then, we trained a classifier by minimizing (6) with the model defined above. We used 10, 000 test data sampled from the same distribution as the unlabeled data. We ran the experiments 100 times and calculated the mean of the error rate, the standard deviation of the error rate, the mean of recall and the mean of precision for each epoch in training with nnPU and nnPUSB. The results are shown on the left side and center of Figure 2. In the upper row, we show the mean and standard deviation of the error rate. In the lower row, we show the mean of recall and the mean of precision. As shown in Figure 2, the mean of the error rate of our algorithm is lower and the variance is also lower than the existing method. As we discussed in Section 4.3, $\mathrm { F P = F N }$ is also empirically observed.
|
| 301 |
+
|
| 302 |
+

|
| 303 |
+
Figure 3: Results of the second experiment of Section 5.4 using the RealData dataset with the estimated class prior 0.1095 (the true class prior is 0.0709). The horizontal axes are the epochs of training the network, the vertical axis of the right figure is the error rate and the vertical axis of the left figure is the value of the precision and the recall.
|
| 304 |
+
|
| 305 |
+
# 5.3 TEST WITH REAL-WORLD DATA
|
| 306 |
+
|
| 307 |
+
In the previous sections, we artificially made positive data with a selection bias. Here we demonstrate the effectiveness of our algorithm in real-world data with a selection bias. We used a document dataset based on the SwissProt database released by Elkan & Noto (2008). We call this dataset RealData. The dataset originally contained 2,453 labeled positive examples (P) and 4,906 unlabeled examples (U). The unlabeled examples were labeled later by Das et al. (2007). As a result, the dataset is likely to have a natural observation bias in the $\mathrm { \bf P }$ data while it allows an access to the ground-truth labels for all data. Out of the U data, 348 examples are positive and the rest are negative. The class prior is $\pi = 3 4 8 / 4 , 9 0 6 = 0 . 0 7 0 9$ . We used Bag-of-Words to represent the documents as 78, 894-dimensional vectors.
|
| 308 |
+
|
| 309 |
+
Details of the network structure are shown in Appendix D. We trained a classifier using positive and unlabeled data. Then, after finding a threshold estimated by (9), we evaluated the same evaluation measures as the previous experiments by classifying U, i.e., we regarded the unlabeled data as test data. As shown on the right of Figure 2, the result of our algorithm outperforms the existing method.
|
| 310 |
+
|
| 311 |
+
# 5.4 TEST FOR UNKNOWN CLASS PRIOR
|
| 312 |
+
|
| 313 |
+
In order to evaluate how our algorithm works for the case that the class prior is unknown, we empirically tested our algorithm with an estimator of the class prior. We used the RealData dataset in Section 5.3, whose class prior is 0.0709. For the class prior estimator, we used the KM2 method by Ramaswamy et al. (2016), which is considered to be the state-of-the-art method in the case-control scenario under SCAR. The estimated class prior was 0.1095 and the result is shown in Figure 3. We can see from the figure that our method works well with an estimated class prior in so far as RealData dataset is concerned. We also show results for the classifiers trained under misspecified class priors in Appendix E, which also shows that our method works stably for misspecified class priors.
|
| 314 |
+
|
| 315 |
+
# 6 CONCLUSION
|
| 316 |
+
|
| 317 |
+
In this paper, we proposed a novel framework for PU learning with a selection bias in positive data. We put the assumption of the invariance of order and showed the density ratio of labeled positive data and unlabeled data has the same order as the class-conditional distribution for inputs. Based on this result, we proposed a method based on partial identification in which we first estimate the density ratio and then use it as a classifier by setting a threshold. We conducted experiments to confirm the effectiveness of our approach. As we showed in the experiments, our method outperforms previous PU methods on real-world data.
|
| 318 |
+
|
| 319 |
+
# ACKNOWLEDGMENTS
|
| 320 |
+
|
| 321 |
+
This work was supported by JSPS KAKENHI 16H00881 and the AIP challenge program, Japan.
|
| 322 |
+
|
| 323 |
+
# REFERENCES
|
| 324 |
+
|
| 325 |
+
Joshua D. Angrist and Jörn-Steffen Pischke. Mostly Harmless Econometrics: An Empiricist’s Companion. Princeton University Press, December 2008.
|
| 326 |
+
|
| 327 |
+
Jessa Bekker and Jesse Davis. Learning from positive and unlabeled data under the selected at random assumption. In Proceedings of the Second International Workshop on Learning with Imbalanced Domains: Theory and Applications, volume 94 of Proceedings of Machine Learning Research, pp. 8–22. PMLR, 10 Sep 2018a.
|
| 328 |
+
|
| 329 |
+
Jessa Bekker and Jesse Davis. Beyond the selected completely at random assumption for learning from positive and unlabeled data. arXiv:1809.03207, 2018b.
|
| 330 |
+
|
| 331 |
+
Gilles Blanchard, Gyemin Lee, and Clayton Scott. Semi-supervised novelty detection. Journal of Machine Learning Research, 11(Nov):2973–3009, 2010.
|
| 332 |
+
|
| 333 |
+
Brigitte Boeckmann, Amos Bairoch, Rolf Apweiler, Marie-Claude Blatter, Anne Estreicher, Elisabeth Gasteiger, Maria J Martin, Karine Michoud, Claire O’donovan, Isabelle Phan, et al. The SWISSPROT protein knowledgebase and its supplement trembl in 2003. Nucleic acids research, 31(1): 365–370, 2003.
|
| 334 |
+
|
| 335 |
+
Jakramate Bootkrajang. A generalised label noise model for classification in the presence of annotation errors. Neurocomputing, 192(C):61–71, 2016.
|
| 336 |
+
|
| 337 |
+
Sanmay Das, Milton H Saier, and Charles Elkan. Finding transport proteins in a general protein database. In European Conference on Principles of Data Mining and Knowledge Discovery, pp. 54–66. Springer, 2007.
|
| 338 |
+
|
| 339 |
+
Jun Du and Zhihua Cai. Modelling class noise with symmetric and asymmetric distributions. In AAAI Conference on Artificial Intelligence, AAAI’15, pp. 2589–2595. AAAI Press, 2015.
|
| 340 |
+
|
| 341 |
+
M. C. du Plessis, Gang. Niu, and Masashi Sugiyama. Analysis of learning from positive and unlabeled data. In NIPS, pp. 703–711, 2014.
|
| 342 |
+
|
| 343 |
+
Marthinus Christoffel du Plessis and Masashi Sugiyama. Class prior estimation from positive and unlabeled data. IEICE Transactions on Information and Systems, E97-D(5):1358–1362, 2014.
|
| 344 |
+
|
| 345 |
+
Marthinus Christoffel du Plessis, Gang. Niu, and Masashi Sugiyama. Convex formulation for learning from positive and unlabeled data. In ICML, pp. 1386–1394, 2015.
|
| 346 |
+
|
| 347 |
+
Marthinus Christoffel du Plessis, Gang Niu, and Masashi Sugiyama. Class-prior estimation for learning from positive and unlabeled data. In ACML, pp. 221–236, 2016.
|
| 348 |
+
|
| 349 |
+
Charles Elkan and Keith Noto. Learning classifiers from only positive and unlabeled data. In ICDM, pp. 213–220, 2008.
|
| 350 |
+
|
| 351 |
+
James Heckman. Sample selection bias as a specification error. Econometrica, 47(1):153–61, 1979.
|
| 352 |
+
|
| 353 |
+
Shohei Hido, Yuta Tsuboi, Hisashi Kashima, Masashi Sugiyama, and Takafumi Kanamori. Statistical outlier detection using direct density ratio estimation. Knowledge and Information Systems, 26(2): 309–336, Feb 2011.
|
| 354 |
+
|
| 355 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 448–456, 2015.
|
| 356 |
+
|
| 357 |
+
Shantanu Jain, Martha White, Michael W Trosset, and Predrag Radivojac. Nonparametric semisupervised learning of class proportions. In NIPS, 2016.
|
| 358 |
+
|
| 359 |
+
Takafumi. Kanamori, Shohei Hido, and Masashi Sugiyama. A least-squares approach to direct importance estimation. Journal of Machine Learning Research, 10(Jul.):1391–1445, 2009.
|
| 360 |
+
|
| 361 |
+
Masahiro Kato, Liyuan Xu, Gang Niu, and Masashi Sugiyama. Alternate estimation of a classifier and the class-prior from positive and unlabeled data. arXiv:1809.05710, 2018.
|
| 362 |
+
|
| 363 |
+
Ryuichi Kiryo, Gang Niu, Marthinus Christoffel du Plessis, and Masashi Sugiyama. Positiveunlabeled learning with non-negative risk estimator. In NIPS, pp. 1675–1685, 2017.
|
| 364 |
+
|
| 365 |
+
Xiao-Li Li, Philip S Yu, Bing Liu, and See-Kiong Ng. Positive unlabeled learning for data stream classification. In ICDM, pp. 259���270, 2009.
|
| 366 |
+
|
| 367 |
+
Zachary C. Lipton, Charles Elkan, and Balakrishnan Naryanaswamy. Optimal thresholding of classifiers to maximize F1 measure. In Machine Learning and Knowledge Discovery in Databases, pp. 225–239, 2014.
|
| 368 |
+
|
| 369 |
+
Charles Manski. Partial Identification in Econometrics. Palgrave-Macmillan, 2 edition, 2008.
|
| 370 |
+
|
| 371 |
+
Benjamin M. Marlin and Richard S. Zemel. Collaborative prediction and ranking with non-random missing data. In ACM Conference on Recommender Systems, RecSys ’09, pp. 5–12, 2009.
|
| 372 |
+
|
| 373 |
+
Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
|
| 374 |
+
|
| 375 |
+
Minh Nhut Nguyen, Xiaoli-Li Li, and See-Kiong Ng. Positive unlabeled leaning for time series classification. In IJCAI, pp. 1421–1426, 2011.
|
| 376 |
+
|
| 377 |
+
Gang Niu, Marthinus Christoffel du Plessis, Tomoya. Sakai, Y. Ma, and Masashi Sugiyama. Theoretical comparisons of positive-unlabeled learning against positive-negative learning. In NIP, pp. 1199–1207, 2016.
|
| 378 |
+
|
| 379 |
+
David M. W. Powers. Visualization of tradeoff in evaluation: from precision-recall & PN to LIFT, ROC & BIRD. arXiv:1505.00401, 2015.
|
| 380 |
+
|
| 381 |
+
Harish Ramaswamy, Clayton Scott, and Ambuj Tewari. Mixture proportion estimation via kernel embeddings of distributions. In ICML, pp. 2052–2060, 2016.
|
| 382 |
+
|
| 383 |
+
Claude Sammut and Geoffrey I. Webb (eds.). Breakeven Point, pp. 137–138. Springer US, Boston,MA, 2010. ISBN 978-0-387-30164-8. doi: 10.1007/978-0-387-30164-8_88.
|
| 384 |
+
|
| 385 |
+
Tobias Schnabel, Adith Swaminathan, Ashudeep Singh, Navin Chandak, and Thorsten Joachims. Recommendations as treatments: Debiasing learning and evaluation. In ICML, volume 48, pp. 1670–1679, New York, New York, USA, 20–22 Jun 2016.
|
| 386 |
+
|
| 387 |
+
Clayton Scott and Gilles Blanchard. Novelty detection: Unlabeled data definitely help. In AISTATS, pp. 464–471, 2009.
|
| 388 |
+
|
| 389 |
+
J.T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. In ICLR (workshop track), 2015.
|
| 390 |
+
|
| 391 |
+
Masashi Sugiyama, Taiji Suzuki, and Takafumi Kanamori. Density Ratio Estimation in Machine Learning. Cambridge University Press, New York, NY, USA, 1st edition, 2012.
|
| 392 |
+
|
| 393 |
+
Gill Ward, Trevor Hastie, Simon Barry, Jane Elith, and John R Leathwick. Presence-only data and the em algorithm. Biometrics, 65(2):554–563, 2009.
|
| 394 |
+
|
| 395 |
+
# A PROOF OF THEOREM 1
|
| 396 |
+
|
| 397 |
+
Proof. We assumed that no negative data can be labeled. As a result, we have $p ( o = + 1 | x , y =$ $- 1 ) = 0$ for arbitrary $x \in \mathcal { X }$ . Therefore,
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
\begin{array} { c } { { p ( o = + 1 | x ) = p ( y = + 1 | x ) p ( o = + 1 | x , y = + 1 ) + p ( y = - 1 | x ) p ( o = + 1 | x , y = - 1 ) } } \\ { { { } } } \\ { { = p ( y = + 1 | x ) p ( o = + 1 | x , y = + 1 ) . } } \end{array}
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
By Bayes’ theorem, we can expand the density ratio in (1) as follows:
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
{ \begin{array} { r l } & { \cdot ( \mathbf { x } ) = { \frac { p ( x | o = + 1 , y = + 1 ) } { p ( \mathbf { x } ) } } } \\ & { \quad = { \frac { p ( y = + 1 | x , o = + 1 ) p ( \mathbf { x } | o = + 1 ) } { p ( y = + 1 | o = + 1 ) } } { \frac { 1 } { p ( \mathbf { x } ) } } } \\ & { \quad = p ( y = + 1 | x , o = + 1 ) { \frac { 1 } { p ( y = + 1 | o = + 1 ) } } { \frac { p ( \mathbf { x } | o = + 1 ) } { p ( \mathbf { x } ) } } } \\ & { \quad = { \frac { p ( y = + 1 | x ) p ( o = + 1 | x , y = + 1 ) } { p ( o = + 1 | x ) } } { \frac { 1 } { p ( y = + 1 | o = + 1 ) } } { \frac { p ( o = + 1 ) p ( x | o = + 1 ) } { p ( o = + 1 ) } } . } \end{array} }
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
Because $\begin{array} { r } { \frac { p ( y = + 1 | \pmb { x } ) p ( o = + 1 | \pmb { x } , y = + 1 ) } { p ( o = + 1 | \pmb { x } ) } = 1 } \end{array}$ from (11), this is equivalent to
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
\begin{array} { r } { r ( { \pmb x } ) = C p ( o = + 1 | { \pmb x } ) , } \end{array}
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
where $\begin{array} { r } { C = \frac { 1 } { p ( y = + 1 , o = + 1 ) } } \end{array}$ . Hence, if Assumption 1 holds, for any $\pmb { x } _ { i } , \pmb { x } _ { j } \in \mathcal { X }$
|
| 416 |
+
|
| 417 |
+
$$
|
| 418 |
+
p ( y = + 1 | { \boldsymbol { \mathbf { x } } } _ { i } ) \leq p ( y = + 1 | { \boldsymbol { \mathbf { x } } } _ { j } ) \Leftrightarrow r ( { \boldsymbol { \mathbf { x } } } _ { i } ) \leq r ( { \boldsymbol { \mathbf { x } } } _ { j } ) .
|
| 419 |
+
$$
|
| 420 |
+
|
| 421 |
+
# B PROOF OF THEOREM 2
|
| 422 |
+
|
| 423 |
+
Before proving Theorem 2, we consider a threshold defined as follows:
|
| 424 |
+
|
| 425 |
+
$$
|
| 426 |
+
\pi = \int \mathbf { 1 } [ p ( y = + 1 | \pmb { x } ) \geq \gamma ] p ( \pmb { x } ) d \pmb { x } .
|
| 427 |
+
$$
|
| 428 |
+
|
| 429 |
+
Then, we state the following lemma on the relationship between $\gamma$ and $\theta _ { \pi }$
|
| 430 |
+
|
| 431 |
+
Lemma 1. The equation $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ $\begin{array} { r } { \ell , ( r ( { \pmb x } ) - \theta _ { \pi } ) ( p ( { \pmb y } = + 1 | { \pmb x } ) - \gamma ) \ge 0 } \end{array}$ holds almost everywhere with respect to $p ( { \pmb x } )$ .
|
| 432 |
+
|
| 433 |
+
Proof. By (2) and (12), the following equation also hold,
|
| 434 |
+
|
| 435 |
+
$$
|
| 436 |
+
\int \mathbf { 1 } [ r ( \pmb { x } ) > \theta _ { \pi } ] p ( \pmb { x } ) d \pmb { x } = \int \mathbf { 1 } [ p ( y = + 1 | \pmb { x } ) > \gamma ] p ( \pmb { x } ) d \pmb { x } .
|
| 437 |
+
$$
|
| 438 |
+
|
| 439 |
+
Hence, we can derive
|
| 440 |
+
|
| 441 |
+
$$
|
| 442 |
+
\int ( \mathbf { 1 } [ r ( \pmb { x } ) > \theta _ { \pi } ] - \mathbf { 1 } [ p ( y = + 1 | \pmb { x } ) > \gamma ] ) p ( \pmb { x } ) d \pmb { x } = 0 .
|
| 443 |
+
$$
|
| 444 |
+
|
| 445 |
+
This is equivalent to
|
| 446 |
+
|
| 447 |
+
$$
|
| 448 |
+
\int ( \mathbf { 1 } [ ( r ( x ) - \theta _ { \pi } ) ( p ( y = + 1 | x ) - \gamma ) < 0 ] p ( x ) d x = 0 .
|
| 449 |
+
$$
|
| 450 |
+
|
| 451 |
+
From this equation, $( r ( { \pmb x } ) - \theta _ { \pi } ) ( p ( { \pmb y } = + 1 | { \pmb x } ) - \gamma ) \geq 0$ holds almost surely.
|
| 452 |
+
|
| 453 |
+
Using Lemma 1 we prove Theorem 2.
|
| 454 |
+
|
| 455 |
+
Proof. $\begin{array} { r } { \pi = \int \mathbf { 1 } [ p ( y = + 1 | \pmb { x } ) \geq \gamma ] p ( \pmb { x } ) d \pmb { x } } \end{array}$ is equivalent to
|
| 456 |
+
|
| 457 |
+
$$
|
| 458 |
+
\int p ( y = + 1 | x ) p ( x ) d x = \int \mathbf { 1 } [ p ( y = + 1 | x ) \geq \gamma ] p ( x ) d x ,
|
| 459 |
+
$$
|
| 460 |
+
|
| 461 |
+
where the left hand side is equal to
|
| 462 |
+
|
| 463 |
+
$$
|
| 464 |
+
\int _ { \{ x | p ( y = + 1 | x ) < \gamma \} } p ( y = + 1 | x ) p ( x ) d x + \int _ { \{ x | p ( y = + 1 | x ) \geq \gamma \} } p ( y = + 1 | x ) p ( x ) d x ,
|
| 465 |
+
$$
|
| 466 |
+
|
| 467 |
+
and the right hand side is equal to
|
| 468 |
+
|
| 469 |
+
$$
|
| 470 |
+
\int _ { \{ x | p ( y = + 1 | x ) \geq \gamma \} } p ( y = + 1 | x ) p ( x ) d x + \int _ { \{ x | p ( y = + 1 | x ) \geq \gamma \} } p ( y = - 1 | x ) p ( x ) d x .
|
| 471 |
+
$$
|
| 472 |
+
|
| 473 |
+
Hence, (12) is equivalent to the following equation,
|
| 474 |
+
|
| 475 |
+
$$
|
| 476 |
+
\int _ { \{ x | p ( y = + 1 | x ) < \gamma \} } p ( y = + 1 | x ) p ( x ) d x = \int _ { \{ x | p ( y = + 1 | x ) \geq \gamma \} } p ( y = - 1 | x ) p ( x ) d x .
|
| 477 |
+
$$
|
| 478 |
+
|
| 479 |
+
From the definitions of TP, FP, TN, and FN, the left hand side of the above equation is equal to $F P$ and the right hand side of the above equation is equal to $F N$ . Hence, $F P = F N$ . We showed $F P = F N$ for a threshold $\gamma$ , but we can also insist that the same result holds when we use $r ( { \pmb x } )$ as a score function and $\theta _ { \pi }$ as a threshold. According to Lemma 1, the sign of $p ( y = + 1 + x ) - \gamma$ and $r ( { \pmb x } ) - \theta _ { \pi }$ are the same almost everywhere with respect to $p ( { \pmb x } )$ . Therefore,
|
| 480 |
+
|
| 481 |
+
$$
|
| 482 |
+
\begin{array} { l } { \displaystyle \int _ { \{ x | p ( y = + 1 | x ) < \gamma \} } p ( y = + 1 | x ) p ( x ) d x = \int _ { \{ x | r ( x ) < \theta _ { \pi } \} } p ( y = + 1 | x ) p ( x ) d x } \\ { \displaystyle \int _ { \{ x | p ( y = + 1 | x ) \geq \gamma \} } p ( y = - 1 | x ) p ( x ) d x = \int _ { \{ x | r ( x ) \geq \theta _ { \pi } \} } p ( y = - 1 | x ) p ( x ) d x . } \end{array}
|
| 483 |
+
$$
|
| 484 |
+
|
| 485 |
+
In these equations, the right hand sides mean $F P$ and $F N$ of a score function $r ( { \pmb x } )$ with a threshold $\theta _ { \pi }$ , respectively. Because precision $\begin{array} { r } { \mathbf { \Phi } = \left( \frac { T P } { T P + F P } \right) } \end{array}$ and $\begin{array} { r } { \mathrm { r e c a l l } = \left( \frac { T P } { T P + F N } \right) } \end{array}$ , $F P = F N$ means that precision $=$ recall. □
|
| 486 |
+
|
| 487 |
+
# C PROOF OF THEOREM 3
|
| 488 |
+
|
| 489 |
+
Proof. We first consider minimizing $R _ { \mathrm { P U } } ^ { \tt b i a s }$ in the space of all functions from $\mathcal { X }$ to $[ \epsilon , 1 - \epsilon ]$ instead of minimizing it in . Later, we will see that the minimizer matches $f ^ { * }$ as stated in Theorem 3 which belongs to $\mathcal { F }$ . The minimization of
|
| 490 |
+
|
| 491 |
+
$$
|
| 492 |
+
R _ { \mathtt { P U } } ^ { \mathtt { b i a s } } ( f ) = \int \big ( - \pi p ( x | y = + 1 , o = + 1 ) ( \log f ( x ) - \log ( 1 - f ( x ) ) ) - \log ( 1 - f ( x ) ) p ( x ) \big ) d x
|
| 493 |
+
$$
|
| 494 |
+
|
| 495 |
+
over all functions $f$ taking values in $[ \epsilon , 1 - \epsilon ]$ is reduced to the following point-wise minimization problem
|
| 496 |
+
|
| 497 |
+
$$
|
| 498 |
+
\operatorname * { a r g m i n } _ { z \in [ \epsilon , 1 - \epsilon ] } C ( z , x ) : = - \pi p ( x | y = + 1 , o = + 1 ) ( \log z - \log ( 1 - z ) ) - \log ( 1 - z ) p ( x ) .
|
| 499 |
+
$$
|
| 500 |
+
|
| 501 |
+
Denoting the solution by $z ^ { * }$ , the Karush-Kuhn-Tucker (KKT) condition of this minimization problem is
|
| 502 |
+
|
| 503 |
+
$$
|
| 504 |
+
\begin{array} { l l } & { \pi p ( \pmb { x } | y = + 1 , o = + 1 ) \left( \cfrac { 1 } { z ^ { * } } + \cfrac { 1 } { 1 - z ^ { * } } \right) - \cfrac { p ( \pmb { x } ) } { 1 - z ^ { * } } - \lambda + \mu = 0 , } \\ & { \lambda ( z ^ { * } - 1 - \epsilon ) = 0 , \mu z ^ { * } = 0 , } \\ & { \lambda , \mu \geq 0 , } \\ & { z ^ { * } \in [ \epsilon , 1 - \epsilon ] , } \end{array}
|
| 505 |
+
$$
|
| 506 |
+
|
| 507 |
+
where $\lambda$ and $\mu$ are the Lagrange multipliers. The first equation is equivalent to
|
| 508 |
+
|
| 509 |
+
$$
|
| 510 |
+
( \mu - \lambda ) ( z ^ { * } ) ^ { 2 } + ( p ( { \pmb x } ) + \lambda - \mu ) z ^ { * } - \pi p ( { \pmb x } | y = + 1 , o = + 1 ) = 0 .
|
| 511 |
+
$$
|
| 512 |
+
|
| 513 |
+
We investigate the solution by dividing the KKT condition into the following four cases.
|
| 514 |
+
|
| 515 |
+
1. If we assume $\lambda = \mu = 0$ , then the KKT condition is reduced to
|
| 516 |
+
|
| 517 |
+
$$
|
| 518 |
+
\begin{array} { l } { { z ^ { * } } = \frac { \pi p ( \pmb { x } | y = + 1 , o = + 1 ) } { p ( \pmb { x } ) } , } \\ { { z ^ { * } } \in [ \epsilon , 1 - \epsilon ] . } \end{array}
|
| 519 |
+
$$
|
| 520 |
+
|
| 521 |
+
In this case, $z ^ { * } \in [ \epsilon , 1 - \epsilon ]$ is equivalent to $\pmb { x } \in D _ { 1 } \cap D _ { 2 }$ .
|
| 522 |
+
|
| 523 |
+
2. If we assume $\lambda > 0$ and $\mu = 0$ , the KKT condition is reduced to
|
| 524 |
+
|
| 525 |
+
$$
|
| 526 |
+
\begin{array} { l } { z ^ { \ast } = 1 - \epsilon , } \\ { \lambda = \frac { ( 1 - \epsilon ) p ( { \pmb x } ) - \pi p ( { \pmb x } | y = + 1 , o = + 1 ) } { ( 1 - \epsilon ) ^ { 2 } + ( 1 - \epsilon ) } . } \end{array}
|
| 527 |
+
$$
|
| 528 |
+
|
| 529 |
+
In this case, $\lambda > 0$ is equivalent to $\pmb { x } \notin D _ { 2 }$ .
|
| 530 |
+
|
| 531 |
+
3. If we assume $\lambda = 0$ and $\mu > 0$ , the KKT condition is reduced to
|
| 532 |
+
|
| 533 |
+
$$
|
| 534 |
+
\begin{array} { l } { { z ^ { * } = \epsilon , } } \\ { { \mu = \frac { p ( { \pmb x } ) \epsilon - \pi p ( { \pmb x } | y = + 1 , o = + 1 ) } { \epsilon ^ { 2 } - \epsilon } . } } \end{array}
|
| 535 |
+
$$
|
| 536 |
+
|
| 537 |
+
In this case, $\lambda > 0$ is equivalent to $\pmb { x } \notin D _ { 1 }$
|
| 538 |
+
|
| 539 |
+
4. If $\lambda , \mu > 0$ , there is no feasible solution.
|
| 540 |
+
|
| 541 |
+
In summary, the solution for the optimization problem arg $\begin{array} { r } { \operatorname* { m i n } _ { z \in [ \epsilon , 1 - \epsilon ] } C ( z , \pmb { x } ) } \end{array}$ is
|
| 542 |
+
|
| 543 |
+
$$
|
| 544 |
+
z ^ { * } = \left\{ \begin{array} { l l } { \epsilon } & { ( x \notin D _ { 1 } ) , } \\ { \frac { \pi p ( x \mid y = + 1 , o = + 1 ) } { p ( x ) } } & { ( x \in D _ { 1 } \cap D _ { 2 } ) , } \\ { 1 - \epsilon } & { ( x \notin D _ { 2 } ) . } \end{array} \right.
|
| 545 |
+
$$
|
| 546 |
+
|
| 547 |
+
Finally, we define $f ^ { * } ( x ) : = \arg \operatorname* { m i n } _ { z \in [ \epsilon , 1 - \epsilon ] } C ( z , x )$ . It can be confirmed that $f ^ { * } \in { \mathcal { F } }$ because $p ( { \pmb x } | y = 1 , o = + 1 )$ and $p ( { \pmb x } )$ are measurable and $f ^ { * }$ takes values in $[ \epsilon , 1 - \epsilon ]$ . Therefore, the solution of the original optimization problem
|
| 548 |
+
|
| 549 |
+
$$
|
| 550 |
+
\arg \operatorname* { m i n } _ { f \in \mathcal { F } } R _ { \mathtt { P U } } ^ { \mathtt { b i a s } } ( f )
|
| 551 |
+
$$
|
| 552 |
+
|
| 553 |
+
is equal to $f ^ { * }$ almost everywhere.
|
| 554 |
+
|
| 555 |
+
# D NETWORK STRUCTURE USED IN SECTIONS 5.2 AND SECTIONS 5.3
|
| 556 |
+
|
| 557 |
+
In Section 5.2, we used the MNIST and CIFAR-10 datasets. The model for the MNIST dataset was a 3-layer multilayer perceptron (MLP) with ReLU (Nair & Hinton, 2010) (more specifically, 784-100-1). The model for the CIFAR-10 dataset was an all convolutional net (Springenberg et al., 2015): $( 3 2 \times 3 2 \times 3 )$ $| - [ C ( 3 \times 3 , 9 6 ) ] \times 2 - C ( 3 \times 3 , 9 6 , 2 ) - [ C ( 3 \times 3 , 1 9 2 ) ] \times 2 - C ( 3 \times 3 , 1 9 2 , 2 ) - C ( 3 \times 3 , 1 9 2 , 2 ) + \ldots$ 3, 192) $\begin{array} { r } { - C ( 1 \times 1 , 1 9 2 ) - C ( 1 \times 1 , 1 0 ) - 1 0 0 0 - 1 0 0 0 - 1 , } \end{array}$ where the input is a $3 2 \times 3 2$ RGB image, $C ( 3 \times$ 3, 96) means 96 channels of $3 \times 3$ convolutions followed by ReLU, $[ \cdot ] \times 2$ means there are two such layers, $C ( 3 \times 3 , 9 6 , 2 )$ means a similar layer but with stride 2, etc.; it is one of the best architectures for CIFAR-10. Batch normalization (Ioffe & Szegedy, 2015) was applied before hidden layers.
|
| 558 |
+
|
| 559 |
+
In Section 5.3, the model for this dataset was a 5-layer multilayer perceptron (MLP) with ReLU (more specifically, 78894-300-300-300-300-1).
|
| 560 |
+
|
| 561 |
+
# E EXPERIMENTAL RESULTS OF THE FIRST EXPERIMENT OF SECTION 5.4
|
| 562 |
+
|
| 563 |
+
In the first experiment, we trained a classifier under misspecified class priors, $0 . 0 2 0 9 ( = 0 . 0 7 0 9 -$ 0.0500), $0 . 1 \hat { 2 0 } 9 ( = 0 . 0 7 0 9 + 0 . 0 5 0 0 )$ , $0 . 1 7 0 9 ( = 0 . 0 7 0 9 + 0 . 1 0 0 0 )$ , and $0 . 2 7 0 9 ( = 0 . 0 7 0 9 + 0 . 2 0 0 0 )$ . The results are shown in Figures 4–6. In Figure 4, the test error in each misspecified class priors are shown. In Figure 5, the precision and recall in each misspecified class prior is shown. In both the existing method and our method, misspecified class priors had a bad influence. However, our method was less influenced by the misspecification and showed better performance than the existing method. Besides, the difference between the precision and recall of our algorithm is narrower than that of the existing method as expected. In order to discuss how misspecified class prior affects the precision and recall, we show the difference the recall from the precision and show the values in Figure 6. This result shows how the difference broadens as the class prior is misspecified worse.
|
| 564 |
+
|
| 565 |
+

|
| 566 |
+
Figure 4: Experimental results of training deep neural networks using the RealData dataset with misspecified class priors (the true class prior is 0.0709). Upper Left: $\pi = 0 . 0 2 0 9$ ; Upper Right: $\pi = 0 . 1 2 0 9$ ; Lower Left: $\pi = 0 . 1 7 0 9$ ; Lower Right: $\pi = 0 . 2 7 0 9$ : All measures are calculated for test data sampled from the marginal distribution $p ( { \pmb x } )$ . The horizontal line is epoch of training the network, the vertical line of the upper is error rate.
|
| 567 |
+
|
| 568 |
+

|
| 569 |
+
Figure 5: Experimental results of training deep neural networks using the RealData dataset with misspecified class priors (the true class prior is 0.0709). Upper Left: $\pi = 0 . 0 2 0 9$ ; Upper Right: $\pi = 0 . 1 2 0 9$ ; Lower Left: $\pi = 0 . 1 7 0 9$ ; Lower Right: $\pi = 0 . 2 7 0 9$ : All measures are calculated for test data sampled from the marginal distribution $p ( { \pmb x } )$ . The horizontal line is epoch of training the network, the vertical line of the upper is value of the precision and the recall.
|
| 570 |
+
|
| 571 |
+

|
| 572 |
+
Figure 6: Experimental results of training deep neural networks using the RealData dataset, whose true class prior is 0.0709, with misspecified class priors, 0.0209, 0.1209, 0.1709, and 0.2709.: All measures are calculated for test data sampled from the marginal distribution $p ( { \pmb x } )$ . The horizontal line is epoch of training the network, the vertical line of the right graph is value of the precision − recall.
|
md/train/rYhBGWYm6AU/rYhBGWYm6AU.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Intriguing Properties of Contrastive Losses
|
| 2 |
+
|
| 3 |
+
Ting Chen Google Research iamtingchen@google.com
|
| 4 |
+
|
| 5 |
+
Calvin Luo Google Research calvinluo@google.com
|
| 6 |
+
|
| 7 |
+
Lala Li Google Research lala@google.com
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
We study three intriguing properties of contrastive learning. First, we generalize the standard contrastive loss to a broader family of losses, and we find that various instantiations of the generalized loss perform similarly under the presence of a multi-layer non-linear projection head. Second, we study if instance-based contrastive learning (with a global image representation) can learn well on images with multiple objects present. We find that meaningful hierarchical local features can be learned despite the fact that these objectives operate on global instancelevel features. Finally, we study the phenomenon of feature suppression among competing features shared across augmented views, such as “color distribution” vs “object class”. We construct datasets with explicit and controllable competing features and show that, for contrastive learning, a few bits of easy-to-learn shared features can suppress, and even fully prevent, the learning of other sets of competing features. In scenarios where there are multiple objects in an image, the dominant object would suppress the learning of smaller objects. Existing contrastive learning methods critically rely on data augmentation to favor certain sets of features over others, and could suffer from learning saturation for scenarios where existing augmentations cannot fully address the feature suppression. This poses open challenges to existing contrastive learning techniques 1.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Contrastive learning [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] has recently achieved great successes in learning visual representations without supervision. As shown in [13, 14], contrastive learning can learn representations that rival supervised learning, and significantly improve the state-of-the-art in semi-supervised learning on ImageNet. One successful use case of contrastive loss for self-supervised learning is to make augmented views of the same example agree [1, 2, 13]. A widely used contrastive loss to encourage agreement is based on cross entropy [15, 3, 4, 13]. Given an augmented view of an example, the contrastive prediction task aims to classify a set of candidates into the positive example (i.e. the other augmented view of the same example) and negative ones via the cross entropy loss.
|
| 16 |
+
|
| 17 |
+
In this work, to understand the effectiveness and limitation of existing contrastive learning methods, we study three intriguing aspects. First, we propose a generalization of the standard contrastive loss, and systematically study their performance differences. Second, we study if the instance-based contrastive learning, for which the contrastive loss operates on global representation of an input image, can learn well on images with multiple objects present, and whether or not it leads to meaningful local features. Finally, we systematically study the feature suppression phenomenon in contrastive learning. The suppression effect occurs among competing features shared across augmented views. For example, with random cropping as the augmentation, “color distribution” and “object class” are often competing features as they are likely shared between two augmented views. The suppression effect among competing features can significantly degenerate the representation quality, or even completely disable the learning of certain features, as shown in our experiments. Existing methods critically rely on hand-crafted data augmentation to favor certain sets of competing features than others.
|
| 18 |
+
|
| 19 |
+
Our main findings and contributions are summarized below.
|
| 20 |
+
|
| 21 |
+
• We propose a generalized contrastive loss, and show that differences between contrastive losses are small with a deep projection head.
|
| 22 |
+
• We show that the instance-based objective widely used in existing contrastive learning methods can learn on images with multiple objects, and also learn meaningful local features despite operating on global image representation.
|
| 23 |
+
• We construct three datasets with explicit and controllable competing features to systematically study the feature suppression effect in contrastive learning.
|
| 24 |
+
• We show that a few bits of easy-to-learn shared features can suppress, and even fully prevent, the learning of other sets of competing features. In scenarios where there are multiple objects in an image, the dominant object would suppress the learning of smaller objects. This poses open challenges to existing contrastive learning.
|
| 25 |
+
|
| 26 |
+
# 2 Generalized contrastive loss and differences among its instantiations
|
| 27 |
+
|
| 28 |
+
The common contrastive loss used in most recent work is based on cross entropy [15, 3, 4]. Following the notation in [13], the contrastive loss can be defined between two augmented views $( i , j )$ of the same example for a mini-batch of size of $n$ , and can be written as the following.
|
| 29 |
+
|
| 30 |
+
$$
|
| 31 |
+
\mathcal { L } ^ { \mathrm { N T - X e n t } } = - \frac { 1 } { n } \sum _ { i , j \in \mathcal { M B } } \log \frac { \exp ( \sin ( z _ { i } , z _ { j } ) / \tau ) } { \sum _ { k = 1 } ^ { 2 n } \mathbb { 1 } _ { [ k \neq i ] } \exp ( \sin ( z _ { i } , z _ { k } ) / \tau ) }
|
| 32 |
+
$$
|
| 33 |
+
|
| 34 |
+
where $z _ { i } , z _ { j }$ are hidden representations of two augmented views of the same example; $\sin ( { \boldsymbol { \mathbf { u } } } , { \boldsymbol { \mathbf { v } } } ) =$ $\pmb { u } ^ { T } \pmb { v } / ( \lVert \pmb { u } \rVert \lVert \pmb { v } \rVert )$ is the cosine similarity between two vectors; $\tau$ is a temperature scalar and $\mathcal { M } \mathcal { B }$ is a randomly sampled mini-batch consisting of augmented pairs of images. In [13], a MLP projection head is introduced between intermediate layer $^ { h }$ (e.g. output of ResNet encoder) and final output $_ { z }$ . It is shown that the projection head is very beneficial and $^ { h }$ is a much better feature representation than $_ { z }$ .
|
| 35 |
+
|
| 36 |
+
In this work, we generalize the standard contrastive loss to the following form.
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\boxed { \mathcal { L } _ { \mathrm { g e n e r a l i z e d c o n t r a s t i v e } } = \mathcal { L } _ { \mathrm { a l i g n m e n t } } + \lambda \mathcal { L } _ { \mathrm { d i s t r i b u t i o n } } }
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
Both terms are defined on hidden representations. $\mathcal { L } _ { \mathrm { a l i g n m e n t } }$ encourages representations of augmented views to be consistent, while ${ \mathcal { L } } _ { \mathrm { d i s t r i b u t i o n } }$ encourages representations (or a random subset of them) to match a prior distribution (of high entropy). It is not difficult to see that the standard contrastive loss in Eq. 1 is a special case as it can be re-written as follows (scaled by a constant $\tau$ ).
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\tau \mathcal { L } ^ { \mathrm { N T - X e n t } } = \underbrace { - \frac { 1 } { n } \sum _ { i , j } \sin ( z _ { i } , z _ { j } ) } _ { \mathcal { L } _ { \mathrm { a l i g n m e n t } } } + \underbrace { \frac { \tau } { n } \sum _ { i } \log \sum _ { k = 1 } ^ { 2 n } \mathbb { 1 } _ { [ k \neq i ] } \exp ( \sin ( z _ { i } , z _ { k } ) / \tau ) } _ { \mathcal { L } _ { \mathrm { d i s t r i b u t i o n } } }
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
This form of factorization in Eq. 3 has been proposed in [16], where the second LogSumExp term is referred to as uniformity since it encourages representation to uniformly distributed in the hypersphere. Different from [16], here we generalize the hypersphere uniform distribution and study a wider set of prior distributions for their effectiveness in learning representations.
|
| 49 |
+
|
| 50 |
+
SWD for supporting diverse prior distributions. One issue of using more diverse set of priors is we cannot rely on LogSumExp for matching the distribution. To this end, we resort to the theory of optimal transport, via Sliced Wasserstein Distance (SWD) [17, 18, 19]. For two sets of equalsized samples from two 1-D distributions, the optimal transport can be obtained by computing two permutations that order the values of both sets of samples respectively. The 1-D Wasserstein distance can then be computed with $\ell _ { 2 }$ distance between the ordered values. For n-D distributions, we first project the samples to $n$ randomly-generated orthogonal 1-D subspaces, and then compute the sum of 1-D Wasserstein distance across all 1-D subspaces. By adjusting the network weights to minimize the SWD, we are able to reduce the mismatch between the distribution of hidden vectors and a known prior distribution. The detailed algorithm can be found in Algorithm 1. With SWD loss, we are able to use a wider set of priors, and Table 1 summarizes instantiations of the generalized contrastive loss with different prior distributions and distribution matching loss.
|
| 51 |
+
|
| 52 |
+
Algorithm 1 Sliced Wasserstein Distance (SWD) loss.
|
| 53 |
+
|
| 54 |
+
<table><tr><td>input: activation vectors H ∈ Rb×d, ,a prior distribution (e.g. Gaussian) sampler S draw prior vectors P ∈ Rb×d using S</td></tr><tr><td></td></tr><tr><td>generate random orthogonal matrix W ∈ Rd×d'</td></tr><tr><td>make projections: H-= HW; P⊥ = PW</td></tr><tr><td>initializeSWDlossl=0</td></tr><tr><td>forj∈{1,2,.,d'} do l =l+ |lsort(H:j)-sort(P:j)|l²</td></tr><tr><td></td></tr><tr><td>end for return l/(dd')</td></tr></table>
|
| 55 |
+
|
| 56 |
+
Table 1: Instantiations of the generalized contrastive loss, i.e. $\mathcal { L } _ { \mathrm { a l i g n m e n t } } + \lambda \mathcal { L } _ { \mathrm { d i s t r i b u t i o n } }$ , that we use in this work. $\tilde { z }$ denotes $\ell _ { 2 }$ -normalized $z \in \mathbb { R } ^ { d }$ , and is only used for uniform hypersphere prior.
|
| 57 |
+
|
| 58 |
+
<table><tr><td>Laign</td><td>Prior distribution</td><td>Ldistribution</td></tr><tr><td>nd∑i, |lzi - zj|l²Uniform hypersphere</td><td></td><td>e∑log∑exp(Tzj/T)</td></tr><tr><td>nd∑ij |lz- zjll2Uniform hypersphere</td><td></td><td>SWD(Z, zprior)</td></tr><tr><td>d∑ij|lz-zjll²Uniform hypercube</td><td></td><td>SWD(Z, Zprior)</td></tr><tr><td>nd∑i,j |lzi - zjll2Normal distribution</td><td></td><td>SWD(Z, Zprior)</td></tr></table>
|
| 59 |
+
|
| 60 |
+
Connection with mutual information. The connection between the standard contrastive loss and mutual information has been shown before [3, 20], where the contrastive loss (a.k.a. InfoNCE loss [3]) is shown to be a lower bound of the mutual information. To connect the generalized contrastive loss to mutual information, we start by the definition of mutual information between two latent variables $U , V$ , which is $I ( U ; V ) = H ( U ) - H ( U | V )$ . Comparing this factorization of mutual information with generalized contrastive loss, it is not difficult to see that: 1) the alignment term $\mathcal { L } _ { \mathrm { a l i g n m e n t } }$ is directly related to $H ( U | V )$ which aims to reduce uncertainty of the other views given one view of the example; and 2) the distribution matching term ${ \mathcal { L } } _ { \mathrm { d i s t r i b u t i o n } }$ can be considered as a proxy to $H ( u )$ for maximizing the entropy in the representation. It is perhaps worth noting that different from mutual information, the generalized contrastive loss (Eq. 2) allows a tunable weight $( \lambda )$ between the alignment and distribution matching term. The weighting scalar $\lambda$ is (inversely) related to the temperature $\tau$ (details in Appendix A.2).
|
| 61 |
+
|
| 62 |
+
Comparing different instantiations of generalized contrastive loss. Here we ask: Is it essential to use a uniform hypersphere prior for the effectiveness of contrastive loss? How much difference does it make when distinct generalized contrastive losses are used? To answer this question, we conduct experiments following SimCLR settings [13, 14], and use the linear evaluation protocol. Detailed experimental setup can be found in Appendix A.1.
|
| 63 |
+
|
| 64 |
+
Figure 1 shows linear evaluation results of models trained with different losses under different training epochs. On CIFAR-10, we see little difference in terms of linear evaluation for variants of the generalized contrastive losses, especially when trained longer than 200 epochs. As for ImageNet, there are some discrepancies between different losses, but they disappear when a deeper 3-layer non-linear projection head is used.
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 1: Linear evaluation accuracy of ResNet-50 trained with different losses on CIFAR-10 and ImageNet datasets. Numbers of projection head layers are in parentheses. Differences between variants of generalized contrastive loss are small with a deep projection head. Decoupled NT-Xent loss is introduced in A.2. Numerical results can be found in Appendix A.3.
|
| 68 |
+
|
| 69 |
+
Furthermore, we find that deep projection head not only reduces the differences among different generalized contrastive losses, but has a similar effect for batch size. With proper learning rate scaling across batch sizes (e.g. square root scaling with LARS optimizer [21]), the impact of batch size on representation quality is small. Table 2 demonstrate this phenomenon for the standard contrastive loss, and more results on other losses can be found in Appendix A.3.
|
| 70 |
+
|
| 71 |
+
Table 2: Linear eval accuracy of ResNet-50 on ImageNet.
|
| 72 |
+
|
| 73 |
+
<table><tr><td rowspan="2">Projection head</td><td rowspan="2">Batch size</td><td colspan="4">Epoch</td></tr><tr><td>100</td><td>200</td><td>400</td><td>800</td></tr><tr><td rowspan="3">2 layers</td><td>512</td><td>65.4</td><td>67.3</td><td>68.7</td><td>69.3</td></tr><tr><td>1024</td><td>65.6</td><td>67.6</td><td>68.8</td><td>69.8</td></tr><tr><td>2048</td><td>65.3</td><td>67.6</td><td>69.0</td><td>70.1</td></tr><tr><td rowspan="3">3 layers</td><td>512</td><td>66.6</td><td>68.4</td><td>70.0</td><td>71.0</td></tr><tr><td>1024</td><td>66.8</td><td>68.9</td><td>70.1</td><td>70.9</td></tr><tr><td>2048</td><td>66.8</td><td>69.1</td><td>70.4</td><td>71.3</td></tr><tr><td rowspan="3">4 layers</td><td>512</td><td>66.8</td><td>68.8</td><td>70.0</td><td>70.7</td></tr><tr><td>1024</td><td>67.0</td><td>69.0</td><td>70.4</td><td>70.9</td></tr><tr><td>2048</td><td>67.0</td><td>69.3</td><td>70.4</td><td>71.3</td></tr></table>
|
| 74 |
+
|
| 75 |
+
# 3 Instance-based objective can learn on images with multiple objects and learn good local features
|
| 76 |
+
|
| 77 |
+
Most existing contrastive learning methods [13, 10, 22, 4] define their objectives at the instance level where each image is encoded into a single vector representation (e.g. representations of two random crops of the same image instance are treated as a positive pair). In other words, the objective operates on a global representation of its input rather than on some local regions (of its input). We pose two questions regarding instance-based global objective: 1) when there is only a single (dominant) object in the image, the objective seems reasonable as it encourages the model to learn features relevant to object class, but when there are multiple objects present in the image, can instance-based objective still learn well? 2) Since the instance-based objective uses a global summary of its input, can it still learn good local features (e.g. parts of an object, or multiple objects in the same scheme)? To answer these questions, we use SimCLR as representative for the instance-based objective.
|
| 78 |
+
|
| 79 |
+
# 3.1 SimCLR can learn on images with multiple objects
|
| 80 |
+
|
| 81 |
+
Commonly used self-supervised learning datasets, such as MNIST, CIFAR-10, ImageNet, are object centered, i.e. the image is mainly occupied by a single (dominant) object. To experiment with multiple objects in a controllable setting, we propose a new dataset setting by composing multiple digits as follows.
|
| 82 |
+
|
| 83 |
+
MultiDigits dataset. We place MNIST digits ( $2 8 \times 2 8$ size) on a shared canvas $1 1 2 \times 1 1 2$ size). We vary the number of digits placed on the canvas. One factor that could interfere with learning of multiple digits is overlapping digits, therefore we use two placement strategies: random vs in-grid (Figure 2). Random placement of digits incurs no constraint on where digits can be placed on the canvas, whereas in-grid placement puts each digit in one of the $4 \times 4$ grid cells the canvas is divided into, and no two digits can fall in the same cell. In-grid placement ensures no overlapping of digits.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 2: MultiDigit dataset. More digits lead to more overlapping in random placement.
|
| 87 |
+
|
| 88 |
+
We first pretrain a ResNet-18 with SimCLR or supervised learning with the same augmentation policy (random cropping and resize) on MultiDigits dataset. To access the representation quality, we then train linear classifiers for images with a single digit of size $2 8 \times 2 8$ on the canvas. Similarly during evaluation, we place only one digit of size $2 8 \times 2 8$ on the canvas.
|
| 89 |
+
|
| 90 |
+
As shown in Table 3, representations learned using supervised loss maintains its quality when up to 8 digits are placed in the image. After that the representation becomes worse as the canvas gets more crowded. Notably, representations learned using SimCLR display a similar phenomenon. Regardless of placement strategy, top-1 accuracy stays at the same level up to 8 digits, demonstrating that SimCLR can learn from images with multiple objects. In addition, the increased performance gap between the two placement strategies with increased number of digits shows that object overlapping makes it harder for contrastive losses to learn from multiple objects.
|
| 91 |
+
|
| 92 |
+
Table 3: Top-1 linear evaluation accuracy $( \% )$ for pretrained ResNet-18 on the MultiDigits dataset. We vary the number of digits placed on the canvas during training from 1 to 16. During evaluation only 1 digit is present. As a baseline, a network with random weights gives $18 \%$ top-1 accuracy.
|
| 93 |
+
|
| 94 |
+
<table><tr><td rowspan="2"></td><td rowspan="2">Placing of digits</td><td colspan="6">Number of digits (size 28 × 28)</td></tr><tr><td>1</td><td>2</td><td>4</td><td>8</td><td>12</td><td>16</td></tr><tr><td rowspan="2">Supervised</td><td>Random</td><td>99.5</td><td>99.5</td><td>99.3</td><td>99.4</td><td>98.9</td><td>98.3</td></tr><tr><td>In-grid</td><td>99.5</td><td>99.6</td><td>99.5</td><td>99.3</td><td>98.6</td><td>92.4</td></tr><tr><td rowspan="2">SimCLR</td><td>Random</td><td>98.9</td><td>98.9</td><td>99.0</td><td>98.9</td><td>98.2</td><td>96.4</td></tr><tr><td>In-grid</td><td>98.3</td><td>98.6</td><td>99.1</td><td>99.2</td><td>99.1</td><td>98.3</td></tr></table>
|
| 95 |
+
|
| 96 |
+
# 3.2 SimCLR learns local features that exhibit hierarchical properties
|
| 97 |
+
|
| 98 |
+
To understand the local features learned by SimCLR, we apply K-means on intermediate features of the pretrained ResNet with SimCLR, and see how local regions of an image are grouped together. For good representations, we expect that regions of similar objects or object parts should be grouped together.
|
| 99 |
+
|
| 100 |
+
Specifically, we take a pretrained Resnet- $5 0 2 \times$ on ImageNet, and run inference on images (from ImageNet validation set and COCO [23]) of size $4 4 8 \times 4 4 8$ . We run K-means with various numbers of clusters on the l2-normalized hidden features from middle layers of the network (e.g. block group 2,3,4 of the ResNet). We also compare SimCLR learned features with supervised learned features, as well as the raw pixel (RGB) features extracted from each $1 4 \times 1 4$ patch.
|
| 101 |
+
|
| 102 |
+
Figure 3a shows that as the number of clusters increases, the learned representations tend to group image regions based on parts of the object (i.e. facial components of the dog). This phenomenon appears in both SimCLR and supervised learned features, but not with raw pixel features, indicating meaningful local features learned by SimCLR and supervised learning. In Figure 3b, we compare ResNet intermediate features at different layers, and it suggests that earlier layers contain more edge-related features, while later layers contain more object/part features.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 3: Visualizing features on a ImageNet validation image with K-means clustering. Each row denotes a type of local features used, and each column denotes the number of K-means clusters. Later layers of SimCLR/supervised ResNet tend to group by object parts. More visualization examples can be found in https://contrastive-learning.github.io/intriguing.
|
| 106 |
+
|
| 107 |
+

|
| 108 |
+
Figure 4: Visualizing features on two images from COCO. Each row denotes a type of local features (SimCLR, Supervised, and raw pixels; both SimCLR and Supervised are trained on ImageNet), and each column denotes the number of K-means clusters. Region grouping by SimCLR/supervised features tend to overlap with object class.
|
| 109 |
+
|
| 110 |
+
Region grouping results on two COCO images for SimCLR and supervised learning (trained on ImageNet) are shown in Figure 4. Again, region grouping by local features tend to overlap with object class, indicating good local features learned.
|
| 111 |
+
|
| 112 |
+
# 4 Feature suppression limits the potential of contrastive learning
|
| 113 |
+
|
| 114 |
+
Contrastive learning requires good design of data augmentation to work well. As shown in [13], without color augmentations that randomly shift color distribution (while maintaining information regarding object class), the quality of learned representations are significantly worse. In other words, the presence of “color distribution” features suppresses their competing feature of “object class”, and is addressed by color augmentation. However, there may be scenarios where the known augmentations cannot fully address this feature suppression effect, and it can thus limit the potential of contrastive learning. Here we quantitatively study the feature suppression phenomenon by constructing datasets with explicit and controllable competing features, and see how well contrastive learning method could learn.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
|
| 118 |
+
(a) ImageNet images overlaid with MNIST digits. The left most column is original image, and others are augmented views via random crop and color distortion. MNIST digits and ImageNet classes are competing features. We vary the number of unique MNIST digits to control the competing features.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
|
| 122 |
+
(b) Two MNIST digits randomly placed on a shared canvas (of size $1 1 2 \times 1 1 2 )$ . The two digits can have the same size (upper row) or different sizes (lower row), and digits of different sizes can be considered as competing features. We fix the size of one digit and vary the other.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 5: Probing datasets with explicit and controllable competing features.
|
| 126 |
+
|
| 127 |
+
(c) Images (of RGB channels) are concatenated with additional channels of random integer sampled from range of $[ 1 , \log _ { 2 } ( n ) ]$ . The integer, shared between two views, is replicated for spatial dimension and represented as $n$ binary channels. RGB channels and random bits are competing features.
|
| 128 |
+
|
| 129 |
+
# 4.1 Datasets with explicit and controllable competing features
|
| 130 |
+
|
| 131 |
+
To construct datasets with controllable competing features, we leverage two strategies: channel addition that adds different feature information in a shared canvas, and channel concatenation that expand the RGB channels to include additional features. With these strategies, we construct three datasets below.
|
| 132 |
+
|
| 133 |
+
DigitOnImageNet dataset. We overlay MNIST digits on ImageNet images via channel addition/summation (Figure 5a). For each ImageNet image, we assign a unique MNIST digit and replicate it in nine fixed locations before the standard SimCLR augmentations [13] are applied to create augmented views. Therefore the original ImageNet images and added MNIST digits are competing features. Although it is difficult to quantify information in MNIST digits, we can manually control the number of unique MNIST digits used. Ideally, we want the model to learn both set of features so that it could perform well for both MNIST digit and ImageNet object recognition.
|
| 134 |
+
|
| 135 |
+
MultiDigits dataset (varying the size of one digit). This dataset is modified from MultiDigits introduced above. Here we only consider two digits, and vary the size of one of them (Figure 5b). In this work, we place two digits on a canvas of size $1 1 2 \times 1 1 2$ . We fix the size of one of the digits to be $2 0 \times 2 0$ while varying the other from $2 0 \times 2 0$ to $8 0 \times 8 0$ . Digits of different sizes can be considered as competing features. Ideally, we want the model to learn features for digits of all sizes appeared during training.
|
| 136 |
+
|
| 137 |
+
RandBit dataset. We concatenate a real image with an image of a random integer in the channel dimension (Figure 5c). The random integer is randomly sampled from range of $[ 1 , \log _ { 2 } ( n ) ]$ where $n$ is a parameter to control. It is replicated across spatial dimension (i.e. all pixel location shares the same value), and it is also represented as $n$ binary bits/channels instead of an integer or floating number to make it easily learnable. Furthermore, unlike RGB channels, these additional channels of random bits will not be altered by augmentation, so they are identical for both augmented views of the same image. The RGB channels and the added channels of random bits are competing features, and this construction allows us to control the amount of information in the added competing feature, which is $n$ bits. Also, we know that the mutual information between two views given this construction is at least $\log _ { 2 } ( n )$ .
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
4.2 Easy-to-learn features (MNIST digit) suppress the learning of other features (ImageNet object class)
|
| 141 |
+
Figure 6: (a) Supervised learning accuracy on ImageNet classification. (b) Linear evaluation of learned features for both MNIST classification and ImageNet classification on the DigitOnImageNet dataset. Batch size of 1024 and 2-layer projection head is used. Different batch sizes and projection head layers have negligible influence on the trade-off between ImageNet vs MNIST accuracy.
|
| 142 |
+
|
| 143 |
+
On DigitOnImageNet datasets, we vary the number of unique MNIST digits used in the training set, and all MNIST digits are used in the validation/test set. As a baseline, we train supervised ResNet-50 on the created datasets with ImageNet labels, and the number of unique MNIST digits has little impact on the top-1 ImageNet classification accuracy (Figure 6a).
|
| 144 |
+
|
| 145 |
+
We then train SimCLR on the datasets with different temperatures. As shown in Figure 6b, when we increase the number of unique MNIST digits, the linear evaluation performance of the learned features for MNIST classes increases accordingly, while the accuracy for ImageNet classes decreases dramatically. The trade-off between digit recognition ability and object recognition ability shows that simple features suppress the learning of difficult features, when both are shared between two augmented views. Different batch sizes and projection head depths have negligible influence to the outcome we observe here. Therefore, it is difficult to learn both of the competing features using existing contrastive losses (e.g. SimCLR).
|
| 146 |
+
|
| 147 |
+
# 4.3 The presence of dominant object suppresses the learning of features of smaller objects
|
| 148 |
+
|
| 149 |
+
On the MultiDigits dataset, as mentioned, we fix one digit to be size of $2 0 \times 2 0$ while varying the other from $2 0 \times 2 0$ to $8 0 \times 8 0$ , on a canvas of $1 1 2 \times 1 1 2$ . We first pretrain a ResNet-18 with SimCLR or supervised learning with the same augmentation policy (random cropping and resize) and batch size of 1024. To access the representation quality, we then train linear classifiers for each of the digit sizes that appeared during pretraining. For training of the linear classifier, we only place a single digit at a time on the canvas of the same size as during pretraining.
|
| 150 |
+
|
| 151 |
+
The results are summarized in Table 4. For supervised learning, the learned representations for the smaller digit do not change much as the other digit increases its size, and the model perform well for both small and large digits (accuracy $> 9 9 \%$ ). However, for SimCLR, the learned representations of the smaller digit degenerate significantly when the size of the other digit increases, almost to the level of a random untrained network. The dominant object can be learned very well (accuracy $> 9 9 \%$ ) while suppressing the learning of the smaller object. Although tuning temperature has some effects on reducing the feature suppression, the trend stays unchanged.
|
| 152 |
+
|
| 153 |
+
Table 4: Top-1 linear evaluation accuracy $( \% )$ for pretrained ResNet-18 on the MultiDigits dataset. We fix the size of 1st digit while increasing the size of the 2nd digit. For SimCLR, results are presented for two temperatures. Accuracies suffered from a significant drop when increasing 2nd digit size are red colored.
|
| 154 |
+
|
| 155 |
+
<table><tr><td></td><td></td><td colspan="7">2nd digit size (1st digit is kept the same size of 20 × 20)</td></tr><tr><td></td><td></td><td>20×20</td><td>30×30</td><td>40×40</td><td>50×50</td><td>60×60</td><td>70×70</td><td>80×80</td></tr><tr><td rowspan="2">Supervised</td><td>1st digit</td><td>99.1</td><td>99.2</td><td>99.2</td><td>99.2</td><td>99.1</td><td>99.1</td><td>99.0</td></tr><tr><td>2nd digit</td><td>99.1</td><td>99.5</td><td>99.5</td><td>99.6</td><td>99.5</td><td>99.5</td><td>99.6</td></tr><tr><td rowspan="2">SimCLR (t = 0.05)</td><td>1st digit</td><td>97.8</td><td>97.6</td><td>96.2</td><td>96.5</td><td>88.5</td><td>74.5</td><td>39.9</td></tr><tr><td>2nd digit</td><td>97.8</td><td>97.9</td><td>97.8</td><td>98.3</td><td>98.2</td><td>97.7</td><td>98.2</td></tr><tr><td rowspan="2">SimCLR (T = 0.2)</td><td>1st digit</td><td>98.7</td><td>98.8</td><td>98.3</td><td>87.5</td><td>24.9</td><td>19.8</td><td>20.3</td></tr><tr><td>2nd digit</td><td>98.7</td><td>99.2</td><td>99.2</td><td>99.0</td><td>99.1</td><td>98.9</td><td>99.4</td></tr><tr><td rowspan="2">Random net (untrained)</td><td>1st digit</td><td>16.5</td><td>16.7</td><td>16.6</td><td>16.6</td><td>16.6</td><td>16.9</td><td>16.5</td></tr><tr><td>2nd digit</td><td>16.5</td><td>19.1</td><td>21.9</td><td>24.1</td><td>26.5</td><td>28.1</td><td>29.0</td></tr></table>
|
| 156 |
+
|
| 157 |
+
# 4.4 Extra channels with a few bits of easy-to-learn mutual information suppress the learning of all features in RGB channels
|
| 158 |
+
|
| 159 |
+
In the RandBit datasets, we add additional channels (identical across pixels) of random bits to MNIST and ImageNet. As mentioned above, SimCLR augmentation is only applied to RGB channels so extra added channels will be shared among two view.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 7: Linear evaluation of learned features when a few bits of competing features added (on MNIST). Adding a few bits completely disables contrastive learning (across various batch size or losses). Interestingly, it has little effects on a generative model (VAE). The detrimental effects are just as strong for larger datasets such as CIFAR-10 and ImageNet (Appendix B.1).
|
| 163 |
+
|
| 164 |
+
Figure 7 shows the linear evaluation accuracy of models trained on MNIST (with additional random bits added). We observe that the linear evaluation accuracy quickly drops with a few bits of competing feature added. This detrimental effect on the representation quality persists on bigger datasets like CIFAR-10 and ImageNet as well, and cannot be avoided by using different contrastive losses, batch sizes, or memory mechanism based on momentum contrast (details in Appendix B.1). We believe the fact that just a few bits of easy-to-learn features can completely disable the good representation learning is related to the saturation of the distribution matching loss. As shown in Appendix B.2, the linear increase in bits requires an exponential increase in batch size, which is not sustainable as the required batch size can quickly go beyond the size of the dataset size. In practice, we rely on using data augmentation to remove those uninformative easy-to-learn features so that contrastive learning can learn useful representations. Interestingly, the extra bits do not affect a generative model, variational autoencoder [24, 25], nearly as much, despite other settings such as model size are held the same, prompting a potential direction of addressing the issue.
|
| 165 |
+
|
| 166 |
+
# 5 Related Work
|
| 167 |
+
|
| 168 |
+
Our work studies the contrastive loss based on cross entropy loss [15, 3, 4, 13]. This loss is widely used in recent successful contrastive learning methods [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]. In terms of the contrastive loss, our work is perhaps most related to [16], which shows that formulating contrastive loss as alignment and uniformity in the hypersphere gives similar performance as the standard contrastive loss. We further generalize this factorization, and show other distribution matching losses can be used, and they could achieve similar results. Other than standard contrastive loss that directly utilize negative examples, BYOL [22] demonstrates another way to maintain representation distribution/entropy without directly relying on distribution matching, and SWAV [26] shows clustering-based method equipped with proper data augmentations could also achieve similar performance. We conduct preliminary experiments of BYOL on RandBit and found that it also suffers from feature suppression as generalized contrastive loss. It is expected that SWAV would exhibit similar behaviors on RandBit as those random bits could fuel representations for perfect clustering.
|
| 169 |
+
|
| 170 |
+
The connection between contrastive loss and mutual information has been studied before [3, 20]. We show that for the generalized contrastive loss, it can also be related to mutual information. Despite the connection between contrastive loss and mutual information, it has been pointed out that mutual information estimation may suffer from certain limitations [27, 28]. Moreover, [29, 12] show that higher mutual information learned by the network does not warrant better representation quality. In our work, we find adding mutual information bits between two views which are irrelevant to downstream tasks can be harmful for the quality of learned representations. Data augmentation plays an important role at favoring certain bits of mutual information than others.
|
| 171 |
+
|
| 172 |
+
There is a growing number of recent work on the topic of understanding contrastive learning, both theoretically [30, 31, 32, 33, 34] and empirically [16, 12, 35, 36]. However, little work has been done to study the phenomenon of feature suppression. To our knowledge, we are the first one to quantitatively and systematically study this problem. We believe this is still a very open question and could benefit from more future investigation. Finally, the feature suppression effect in unsupervised contrastive learning that we study in this work may also exist in standard supervised learning (“contrastive loss” between examples and class labels), as suggested by [37, 38], though the specific form would be different.
|
| 173 |
+
|
| 174 |
+
# 6 Conclusion
|
| 175 |
+
|
| 176 |
+
In this work, we study three intriguing properties of contrastive losses. In particular, our results highlight that feature suppression is still an open challenge in contrastive learning. While there is a plethora of work on improving contrastive learning, few of them directly aim to address feature suppression. This limitation of contrastive learning becomes a bottleneck for scenarios where existing augmentation cannot fully address the feature suppression phenomenon, and learning would saturate at a level of dissatisfaction.
|
| 177 |
+
|
| 178 |
+
We would also like to point out some limitations of our study. Firstly, we focus mostly on contrastive learning with explicit negatives (e.g. SimCLR and MoCo). We believe other methods based on clustering and/or without negative pairs would exhibit similar phenomenon but we leave that as future work. Secondly, many of our proposed image datasets are not fully realistic despite being composed from some (challenging) natural image datasets such as ImageNet. We admit it is very hard to explore competing features or multiple objects in a controllable fashion on realistic large scale image datasets.
|
| 179 |
+
|
| 180 |
+
# Acknowledgements
|
| 181 |
+
|
| 182 |
+
We specially thank Geoffrey Hinton for many inspiring discussions and helpful advice. We would also like to thank David Fleet, Simon Kornblith, Mohammad Norouzi, Kevin Swersky and Katherine Hermann for insightful discussions. In addition, we are thankful to William Chan and Sara Sabour for ideas on implementation of sorting on TPUs. We also thank the anonymous reviewers for their constructive feedback.
|
| 183 |
+
|
| 184 |
+
References
|
| 185 |
+
[1] Suzanna Becker and Geoffrey E Hinton. Self-organizing neural network that discovers surfaces in randomdot stereograms. Nature, 355(6356):161–163, 1992.
|
| 186 |
+
[2] 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, pages 766–774, 2014.
|
| 187 |
+
[3] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 188 |
+
[4] 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.
|
| 189 |
+
[5] R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670, 2018.
|
| 190 |
+
[6] Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In Advances in Neural Information Processing Systems, pages 15509–15519, 2019.
|
| 191 |
+
[7] Olivier J Hénaff, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019.
|
| 192 |
+
[8] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
|
| 193 |
+
[9] Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. arXiv preprint arXiv:1912.01991, 2019.
|
| 194 |
+
[10] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722, 2019.
|
| 195 |
+
[11] Junnan Li, Pan Zhou, Caiming Xiong, Richard Socher, and Steven CH Hoi. Prototypical contrastive learning of unsupervised representations. arXiv preprint arXiv:2005.04966, 2020.
|
| 196 |
+
[12] 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.
|
| 197 |
+
[13] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020.
|
| 198 |
+
[14] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big selfsupervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029, 2020.
|
| 199 |
+
[15] Kihyuk Sohn. Improved deep metric learning with multi-class n-pair loss objective. In Advances in neural information processing systems, pages 1857–1865, 2016.
|
| 200 |
+
[16] Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. arXiv preprint arXiv:2005.10242, 2020.
|
| 201 |
+
[17] Julien Rabin, Gabriel Peyré, Julie Delon, and Marc Bernot. Wasserstein barycenter and its application to texture mixing. In International Conference on Scale Space and Variational Methods in Computer Vision, pages 435–446. Springer, 2011.
|
| 202 |
+
[18] Nicolas Bonneel, Julien Rabin, Gabriel Peyré, and Hanspeter Pfister. Sliced and radon wasserstein barycenters of measures. Journal of Mathematical Imaging and Vision, 51(1):22–45, 2015.
|
| 203 |
+
[19] Soheil Kolouri, Kimia Nadjahi, Umut Simsekli, Roland Badeau, and Gustavo Rohde. Generalized sliced wasserstein distances. In Advances in Neural Information Processing Systems, pages 261–272, 2019.
|
| 204 |
+
[20] Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A Alemi, and George Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019.
|
| 205 |
+
[21] Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
|
| 206 |
+
[22] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent: A new approach to selfsupervised learning, 2020.
|
| 207 |
+
[23] 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 European conference on computer vision, pages 740–755. Springer, 2014.
|
| 208 |
+
[24] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 209 |
+
[25] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
|
| 210 |
+
[26] Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
|
| 211 |
+
[27] David McAllester and Karl Stratos. Formal limitations on the measurement of mutual information. In International Conference on Artificial Intelligence and Statistics, pages 875–884, 2020.
|
| 212 |
+
[28] Jiaming Song and Stefano Ermon. Understanding the limitations of variational mutual information estimators. arXiv preprint arXiv:1910.06222, 2019.
|
| 213 |
+
[29] 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.
|
| 214 |
+
[30] Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis, and Nikunj Saunshi. A theoretical analysis of contrastive unsupervised representation learning. arXiv preprint arXiv:1902.09229, 2019.
|
| 215 |
+
[31] Yao-Hung Hubert Tsai, Yue Wu, Ruslan Salakhutdinov, and Louis-Philippe Morency. Demystifying self-supervised learning: An information-theoretical framework. arXiv preprint arXiv:2006.05576, 2020.
|
| 216 |
+
[32] Christopher Tosh, Akshay Krishnamurthy, and Daniel Hsu. Contrastive learning, multi-view redundancy, and linear models. arXiv preprint arXiv:2008.10150, 2020.
|
| 217 |
+
[33] Yuandong Tian, Lantao Yu, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning with dual deep networks. arXiv preprint arXiv:2010.00578, 2020.
|
| 218 |
+
[34] Jason D Lee, Qi Lei, Nikunj Saunshi, and Jiacheng Zhuo. Predicting what you already know helps: Provable self-supervised learning. arXiv preprint arXiv:2008.01064, 2020.
|
| 219 |
+
[35] Nanxuan Zhao, Zhirong Wu, Rynson WH Lau, and Stephen Lin. What makes instance discrimination good for transfer learning? arXiv preprint arXiv:2006.06606, 2020.
|
| 220 |
+
[36] Senthil Purushwalkam and Abhinav Gupta. Demystifying contrastive self-supervised learning: Invariances, augmentations and dataset biases. arXiv preprint arXiv:2007.13916, 2020.
|
| 221 |
+
[37] Katherine L Hermann and Andrew K Lampinen. What shapes feature representations? exploring datasets, architectures, and training. arXiv preprint arXiv:2006.12433, 2020.
|
| 222 |
+
[38] Harshay Shah, Kaustav Tamuly, Aditi Raghunathan, Prateek Jain, and Praneeth Netrapalli. The pitfalls of simplicity bias in neural networks. arXiv preprint arXiv:2006.07710, 2020.
|
| 223 |
+
[39] 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, pages 770–778, 2016.
|
md/train/rbdKZJxDWWx/rbdKZJxDWWx.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Alpha-IoU: A Family of Power Intersection over Union Losses for Bounding Box Regression
|
| 2 |
+
|
| 3 |
+
Jiabo $\mathbf { H e } ^ { 1 , 3 , * }$ , Sarah Erfani1, Xingjun $\mathbf { M } \mathbf { a } ^ { 2 , \dagger }$ , James Bailey1, Ying $\mathbf { C } \mathbf { h } \mathbf { i } ^ { 3 , \dagger }$ , Xian-Sheng $\mathbf { H } \mathbf { u } \mathbf { a } ^ { 3 }$
|
| 4 |
+
|
| 5 |
+
1School of Computing and Information Systems, The University of Melbourne 2School of Computer Science, Fudan University 3DAMO Academy, Alibaba Group {jiaboh@student., sarah.erfani@, baileyj@}unimelb.edu.au
|
| 6 |
+
danxjma@gmail.com, {xinyi.cy, xiansheng.hxs}@alibaba-inc.com
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
Bounding box (bbox) regression is a fundamental task in computer vision. So far, the most commonly used loss functions for bbox regression are the Intersection over Union (IoU) loss and its variants. In this paper, we generalize existing IoUbased losses to a new family of power IoU losses that have a power IoU term and an additional power regularization term with a single power parameter $\alpha$ We call this new family of losses the $\alpha$ -IoU losses and analyze properties such as order preservingness and loss/gradient reweighting. Experiments on multiple object detection benchmarks and models demonstrate that $\alpha$ -IoU losses, 1) can surpass existing IoU-based losses by a noticeable performance margin; 2) offer detectors more flexibility in achieving different levels of bbox regression accuracy by modulating $\alpha$ ; and 3) are more robust to small datasets and noisy bboxes.
|
| 11 |
+
|
| 12 |
+
# 1 Introduction
|
| 13 |
+
|
| 14 |
+
Bounding box (bbox) regression localizes an object in an image/video by predicting a bbox for the object, which is fundamental to object detection, localization, and tracking. For example, the most advanced object detectors often consist of a bbox regression branch and a classification branch with the bbox regression branch generating bboxes to localize objects for classification. In this work, we explore more effective loss functions for bbox regression in the context of object detection.
|
| 15 |
+
|
| 16 |
+
Whilst early works in object detection use $\ell _ { n }$ -norm losses [11] for bbox regression, recent works directly adopt the localization performance metric, i.e., Intersection over Union (IoU), as the localization loss [28, 39]. Compared with $\ell _ { n }$ -norm losses, the IoU loss is invariant to bbox scales, thus helping train better detectors. However, the IoU loss suffers from the gradient vanishing problem when the predicted bboxes are not overlapping with the ground truth, which tends to slow down convergence and result in inaccurate detectors. This has motivated the design of several improved IoU-based losses including Generalized IoU (GIoU), Distance-IoU (DIoU) and Complete IoU (CIoU). GIoU introduces a penalty term into the IoU loss to alleviate the gradient vanishing problem [32], while DIoU and CIoU consider the central point distance and aspect ratio between predicted bboxes and their ground truth in penalty terms [43].
|
| 17 |
+
|
| 18 |
+
In this paper, we present a new family of IoU losses obtained by applying power transformations to existing IoU-based losses. We first apply the Box-Cox transformation [2] to the IoU loss $\mathcal { L } _ { \mathrm { I o U } } =$ $1 - I o U$ and generalize it to a power IoU loss: $\mathcal { L } _ { \alpha \mathrm { - I o U } } = ( 1 - I o U ^ { \alpha } ) / \alpha , ~ \alpha > 0$ , denoted as $\alpha$ -IoU. We further simplify $\alpha$ -IoU to $\mathcal { L } _ { \alpha - \mathrm { I o U } } = 1 - I o U ^ { \alpha }$ for $\alpha \nrightarrow 0$ and extend it to a more general form with an additional power regularization term (see equation (3)). This allows us to generalize existing IoU-based losses, including GIoU, DIoU, and CIoU, to a new family of power IoU losses (see equation (4)) for more accurate bbox regression as well as object detection.
|
| 19 |
+
|
| 20 |
+
We show that, relative to ${ \mathcal { L } } _ { \mathrm { I o U } }$ , ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ up-weights both the loss and gradient of high IoU objects, leading to improved bbox regression accuracy. When $0 < \alpha < 1$ , it down-weights high IoU objects which we find hurts regression accuracy. The power parameter $\alpha$ can serve as a knob to adapt $\alpha$ -IoU losses to meeting different levels of bbox regression accuracy (precision measured under different IoU thresholds), with $\alpha > 1$ for high regression accuracy (i.e., high IoU thresholds) by focusing more on those high IoU objects. We also empirically show that $\alpha$ is not overly sensitive to different models or datasets, with $\alpha = 3$ performing consistently well in most cases. The family of $\alpha$ -IoU losses can be easily applied for improving state-of-the-art detectors under both clean and noisy bbox settings without introducing additional parameters to these models (making any modifications to training algorithms), nor increasing their training/inference time.
|
| 21 |
+
|
| 22 |
+
In summary, our main contributions are as follows:
|
| 23 |
+
|
| 24 |
+
• We propose a new family of power IoU losses called $\alpha$ -IoU for accurate bbox regression and object detection. $\alpha$ -IoU presents a unified power generalization of existing IoU-based losses.
|
| 25 |
+
• We analyze a set of properties of $\alpha$ -IoU, including order preservingness and loss/gradient reweighting, to show that a proper choice of $\alpha$ (i.e., $\alpha > 1$ ) can help improve bbox regression accuracy by adaptively up-weighting the loss and gradient of high IoU objects.
|
| 26 |
+
• We empirically show, on multiple benchmark object detection datasets and models, that $\alpha$ -IoU losses can consistently outperform existing IoU-based losses and provide more robustness for small datasets and noisy bboxes.
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
Object Detection Models. There exist two mainstream types of detection models: anchor-based and anchor-free detectors. Anchor-based detectors can be further divided into two-stage and onestage models. Two-stage anchor-based detectors (e.g., R-CNN series [11, 31, 14, 3], HTC [5], and TSD [33]) are firstly proposed in object detection tasks, which are composed of region proposal networks (RPNs) and classifiers. RPNs generate a large number of foreground and background region proposals, followed by networks to classify objects in the proposals. Towards real-time object detection, one-stage anchor-based detectors (e.g., YOLO series [29, 30, 1], RetinaNet [21], and SSD [24]) are developed to predict bboxes and categories at the same time, thus no longer need RPNs. Anchor boxes with prior scales and aspect ratios should be defined before training anchor-based detectors. Techniques have been proposed to mitigate the sensitivity of these models to hand-picked anchor boxes, for example, attention-based fusion networks [31] and clustering algorithms [30]. These techniques learn prior anchors from the training set for every sliding window or grid cell.
|
| 31 |
+
|
| 32 |
+
Recently, anchor-free detectors such as CornerNet [16], CenterNet1 [8], ExtremeNet [45], and CentripetalNet [7], have also been proposed to get rid of anchor priors. These models first predict locations of keypoints (corners, centroids, or extreme points), then group them into the same bboxes if they are geometrically aligned. There also exist other models that generate pixel-wise results. For example, CenterNet2 estimates pixel-level categories of objects along with their sizes and offsets [44]. FCOS generates pixel-wise classification, centerness, and bbox (top, down, left, right) results using multi-head CNNs [34], followed by the Adaptive Training Sample Selection (ATSS) [40] as an improvement on automatically selecting positive and negative samples. In addition, transformers (e.g., DETR series [4, 46]) have also been developed for object detection without anchor generation or non-maximum suppression (NMS), achieving the performance on par with the above CNN-based detectors. In this work, we propose a new family of generalized IoU losses to improve the performance of these detectors without any architectural modifications, which is orthogonal to the above research.
|
| 33 |
+
|
| 34 |
+
Bounding Box Regression Losses. Anchor-based detectors regress offsets between ground-truth bboxes and their closest anchors, while anchor-free detectors predict keypoints of objects with some frameworks also generating the sizes of the bboxes. The predicted offsets or keypoints (w/ or w/o bbox sizes) are then mapped back to the pixel space for generating the bboxes. Localization losses usually compare the generated bboxes with their ground truth. Early works adopt $\ell _ { n }$ -norm losses [11] for bbox regression, which have been found sensitive to varying bbox scales. Recent works replace them with the IoU loss and its variants such as BIoU, GIoU, DIoU and CIoU for bbox regression, as IoU is the metric for localization and it is scale-invariant [28, 39]. The Bounded IoU (BIoU) loss maximizes the IoU overlap between the region of interest (RoI) and the ground truth based on a set of IoU upper bounds [35]. GIoU is proposed to address the problem of gradient vanishing on non-overlapping examples, which are examples having non-overlapping predicted bboxes with the ground truth (IoU is zero) [32]. DIoU and CIoU [43] losses further consider the overlapping area, central point distance, and aspect ratio in IoU and the regularization terms. These regularization terms can help improve the convergence speed as well as the final detection performance. There are also losses designed to focus more on high IoU objects, for example, the Rectified IoU (RIoU) loss [36], and the Focal and Efficient IoU (Focal-EIoU) loss [41]. These loss functions increase gradients of those examples that are in high bbox regression accuracy. However, RIoU and Focal-EIoU are neither concise nor generalized compared with other IoU-based losses. In this paper, we apply a power transformation to generalize the above vanilla IoU loss and regularized IoU-based losses for both their IoU and regularization terms. The new family of generalized losses improve bbox regression accuracy by adaptively reweighting the loss and gradient of high and low IoU objects.
|
| 35 |
+
|
| 36 |
+
There are also works on AutoML-based loss function search for computer vision tasks [23, 18, 17]. Despite their advantage in saving human efforts, these methods are very expensive in searching qualified loss functions (e.g., days of searching time on multiple GPUs), and probably with limited performance improvement based on existing losses [23]. We will empirically compare with one of these losses in our experiments.
|
| 37 |
+
|
| 38 |
+
# 3 $\alpha$ -IoU Losses for Bounding Box Regression
|
| 39 |
+
|
| 40 |
+
# 3.1 Preliminaries
|
| 41 |
+
|
| 42 |
+
We study the problem of bbox regression in object detection. Let $\pmb { X } \in \mathbb { R } ^ { d _ { x } }$ be the input space and $\pmb { Y } \in \mathbb { R } ^ { \tilde { d } _ { y } }$ be the annotation space, with $d _ { x }$ and $d _ { y }$ denoting the input and annotation dimensions, respectively. Given a dataset $D = \{ ( { \bf x } _ { i } , { \bf y } _ { i } ) \} _ { i = 1 } ^ { n }$ of $n$ training examples with each $( { \pmb x } _ { i } , { \pmb y } _ { i } ) \in$ $( X \times Y )$ , the task is to learn a function $f$ (represented by a detector network) that maps the input space to the annotation space $f : X \to Y$ . In object detection, each $\pmb { y } _ { i } = ( c _ { i , k } , B _ { i , k } ) _ { k = 1 } ^ { m _ { i } }$ , where $m _ { i }$ is the total number of objects in $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , $c _ { i , k }$ is the category of the $k ^ { t h }$ object in $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $B _ { i , k }$ is its bbox.
|
| 43 |
+
|
| 44 |
+
The bbox regression performance is measured by the Intersection over Union (IoU) metric between the predicted bbox $B$ and the ground truth $B ^ { g t }$ $\ d ^ { 3 } \ d ^ { g t } \colon \bar { I o U } = | B \cap B ^ { g t } | / | B \cup B ^ { g t } |$ . Positive examples (both true and false positives) are determined from the set of predictions according to an IoU threshold, based on which the Average Precision (AP) over all categories of objects can be calculated. E.g., $\mathrm { { A P } _ { 5 0 } }$ measures the AP of objects localized by bboxes with an IoU that is above the threshold 0.5. The final performance of a detector is commonly evaluated by the mean Average Precision (mAP) across multiple IoU thresholds. For instance, the popular metric $\mathrm { m A P _ { 5 0 : 9 5 } }$ measures the mAP of examples across the set of IoU thresholds ranging from 0.5 to 0.95 with a stride of 0.05.
|
| 45 |
+
|
| 46 |
+
# 3.2 $\alpha$ -IoU Losses
|
| 47 |
+
|
| 48 |
+
The vanilla IoU loss is defined as $\mathcal { L } _ { \mathrm { I o U } } = 1 - I o U .$ . We first apply the Box-Cox transformation3 [2] and generalize the IoU loss to an $\alpha$ -IoU loss:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\mathcal { L } _ { \alpha \cdot \mathrm { I o U } } = \frac { 1 - I o U ^ { \alpha } } { \alpha } , \alpha > 0 .
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
By modulating the parameter $\alpha$ in $\alpha$ -IoU, one can derive most of the IoU terms in existing losses, e.g., $\log ( I o U )$ , $I o U$ and $I o U ^ { 2 }$ . When $\alpha 0$ , we obtain $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \to 0 } \mathcal { L } _ { \alpha \mathrm { { \cdot } I o U } } = - \mathrm { l o g } ( I o U ) = \mathcal { L } _ { \mathrm { l o g } ( \mathrm { I o U } ) } } \end{array}$ [39] (see the proof in Appendix A). We recover the IoU loss with $\alpha = 1$ : $\mathcal { L } _ { \mathrm { 1 - I o U } } = 1 - I o U = \mathcal { L } _ { \mathrm { I o U } }$ And $\mathcal { L } _ { \mathrm { 2 - I o U } } = \textstyle { \frac { 1 } { 2 } } ( 1 - I o \dot { U } ^ { 2 } ) = \textstyle { \frac { 1 } { 2 } } \mathcal { L } _ { \mathrm { I o U } ^ { 2 } }$ , when $\alpha = 2$ . We can also extend the above $\alpha$ -IoU formula to loss functions with multiple IoU terms (e.g. RIoU [36]) by using multiple $\alpha$ values.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 1: Correlation between IoU and $\mathcal { L } _ { \alpha \mathrm { { - I o U } } } ~ = ~ 1 - ~ I o U ^ { \alpha }$ (left) and its absolute gradient $| \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \alpha - \mathrm { I o U } } |$ (right) with different $\alpha ~ \in ~ [ 0 . 5 , 3 ]$ . According to both plots, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ reweights all objects adaptively and distinctively for $0 < \alpha < 1$ vs. $\alpha > 1$ $\langle \alpha = 1$ marks the IoU loss).
|
| 58 |
+
|
| 59 |
+
We simplify the above $\alpha$ -IoU formula for $\alpha > 0$ and $\alpha \nrightarrow 0$ , as in this case, the denominator $\alpha$ in equation (1) is just a positive constant in the objective. This gives us two cases of the $\alpha$ -IoU loss for $\alpha 0$ and $\alpha \not 0$ , respectively:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\mathcal { L } _ { \alpha \mathrm { - I o U } } = \left\{ { { - \mathrm { l o g } ( I o U ) , ~ \alpha \to 0 } , } \atop { 1 - I o U ^ { \alpha } , ~ \alpha \to 0 . } \right.
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
Here, we are more interested in the case $\alpha \nrightarrow 0$ as most state-of-the-art IoU-based losses have an $\alpha \geq 1$ . We then extend the above $\alpha$ -IoU loss for $\alpha \not 0$ to a more general form by introducing a power penalty/regularization term into the formula:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
{ \mathcal { L } } _ { \alpha - \mathrm { I o U } } = 1 - I o U ^ { \alpha _ { 1 } } + { \mathcal { P } } ^ { \alpha _ { 2 } } ( B , B ^ { g t } ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\alpha _ { 1 } > 0$ , $\alpha _ { 2 } > 0$ , and $\mathcal { P } ^ { \alpha _ { 2 } } ( B , B ^ { g t } )$ denotes any penalty term computed based on $B$ and $B ^ { g t }$ . This simple extension allows a straightforward generalization of existing IoU-based losses to their $\alpha$ -IoU versions. In Appendix B.2.1, we empirically show that ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ is not sensitive to $\alpha _ { 2 }$ . We thus maintain the power consistency between the IoU term and the penalty term and take $\alpha _ { 1 } = \alpha _ { 2 }$ as a simple choice when training the detectors.
|
| 72 |
+
|
| 73 |
+
With the above $\alpha$ -IoU formula, we can now generalize the commonly used IoU-based losses including $\mathcal { L } _ { \mathrm { I o U } } , \mathcal { L } _ { \mathrm { G I o U } } , \mathcal { L } _ { \mathrm { D I o U } }$ , and ${ \mathcal { L } } _ { \mathrm { C I o U } }$ using the same power parameter $\alpha$ for the IoU and penalty terms:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { r l r } & { } & { \mathcal { L } _ { \mathrm { I o U } } = 1 - I o U \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot I o U } } = 1 - I o U ^ { \alpha } , } \\ & { } & { \mathcal { L } _ { \mathrm { G I o U } } = 1 - I o U + \frac { \left| C \setminus ( B \cup B ^ { g t } ) \right| } { \left| C \right| } \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot G I o U } } = 1 - I o U ^ { \alpha } + ( \frac { \left| C \setminus ( B \cup B ^ { g t } ) \right| } { \left| C \right| } ) ^ { \alpha } , } \\ & { } & { \mathcal { L } _ { \mathrm { D I o U } } = 1 - I o U + \frac { \rho ^ { 2 } ( b , b ^ { g t } ) } { c ^ { 2 } } \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot D I o U } } = 1 - I o U ^ { \alpha } + \frac { \rho ^ { 2 \alpha } ( b , b ^ { g t } ) } { c ^ { 2 \alpha } } , \ ~ } \\ & { } & { \mathcal { L } _ { \mathrm { C I o U } } = 1 - I o U + \frac { \rho ^ { 2 } ( b , b ^ { g t } ) } { c ^ { 2 } } + \beta v \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot C I o U } } = 1 - I o U ^ { \alpha } + \frac { \rho ^ { 2 \alpha } ( b , b ^ { g t } ) } { c ^ { 2 \alpha } } + ( \beta v ) ^ { \alpha } , } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $C$ in ${ \mathcal { L } } _ { \mathrm { G I o U } }$ denotes the smallest convex shape enclosing $B$ and $B ^ { g t }$ ; $^ { b }$ and $\mathbf { \delta } _ { b } \mathbf { \mathcal { I } ^ { t } }$ in ${ \mathcal { L } } _ { \mathrm { D I o U } }$ denote central points of $B$ and $B ^ { g t }$ with $\rho ( \cdot )$ being the Euclidean distance and $c$ being the diagonal length of the smallest enclosing box; and in ${ \mathcal { L } } _ { \mathrm { C I o U } }$ , $\begin{array} { r } { v = \frac { 4 } { \pi ^ { 2 } } ( a r c t a n \frac { w ^ { g t } } { h ^ { g t } } - a r c t a n \frac { w } { h } ) ^ { 2 } } \end{array}$ , $\begin{array} { r } { \beta = \frac { v } { ( 1 - I o U ) + v } } \end{array}$ . They give us the family of power IoU losses for bbox regression with their original versions recovered at $\alpha = 1$ . Note that the above $\alpha$ -IoU generalization can be easily extended to more complex loss functions that have multiple IoU or penalty terms (e.g., $\mathcal { L } _ { \alpha - \mathrm { C I o U } } )$ ). Next, we will analyze the properties of $\alpha$ -IoU losses when $\alpha$ takes different values.
|
| 80 |
+
|
| 81 |
+
# 3.3 Properties of $\alpha$ -IoU Losses
|
| 82 |
+
|
| 83 |
+
Here, we focus on the vanilla $\alpha$ -IoU formula $\mathcal { L } _ { \alpha - \mathrm { I o U } } = 1 - I o U ^ { \alpha }$ to analyze its properties, as the penalty terms may affect these properties differently. Figure 1 illustrates the correlation between IoU and ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ (left) and the magnitude of its gradient w.r.t. IoU, i.e., $| \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \alpha - \mathrm { I o U } } |$ (right). One key observation is that the IoU loss (i.e., $\alpha = 1$ ) has a linear correlation with IoU and the gradient is a constant, while ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ reweights objects adaptively (according to their IoU values) following different reweighting schemes with $0 < \alpha < 1$ versus $\alpha > 1$ .
|
| 84 |
+
|
| 85 |
+
The power transformation in ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ preserves key properties of ${ \mathcal { L } } _ { \mathrm { I o U } }$ as a performance metric, including non-negativity, identity of indiscernibles, symmetry, and triangle inequality [32]. Furthermore, we analyze the following important properties of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with detailed derivations deferred to Appendix A. We first let $B _ { i }$ and $B _ { j }$ be two predicted bboxes by two different models $M _ { i }$ and $M _ { j }$ respectively, and $B _ { i }$ and $B _ { j }$ correspond to the same ground truth $B ^ { g t }$ with $I o U ( B _ { i } , B ^ { g t } ) < I o U ( \bar { B _ { j } } , B ^ { g t } )$ . Then we have the first property of ${ \mathcal { L } } _ { \alpha }$ -IoU:
|
| 86 |
+
|
| 87 |
+
Property 1 (Order Preservingness). ${ \mathcal { L } } _ { \alpha }$ -IoU preserves the orders of both IoU and $\mathcal { L } _ { I o U }$ : I ${ } ^ { \circ } o \bar { U } ( B _ { i } , B ^ { g t } ) \ < I o U ( B _ { j } , B ^ { g t } ) ^ { - } \iff \ \mathcal { L } _ { I o U } ( B _ { i } , B ^ { g t } ) > \ \mathcal { L } _ { I o U } ( B _ { j } , B ^ { g t } ) \iff \ \mathcal { L } _ { \alpha \cdot I o U } ( B _ { i } , B ^ { g t } ) >$ $\mathcal { L } _ { \alpha - I o U } ( B _ { j } , B ^ { g t } )$ .
|
| 88 |
+
|
| 89 |
+
The above property indicates that both ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ and ${ \mathcal { L } } _ { \mathrm { I o U } }$ are monotonically decreasing functions w.r.t. $I o U$ . As ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ preserves the order of ${ \mathcal { L } } _ { \mathrm { I o U } }$ strictly, it is guaranteed that arg $\mathrm { m i n } _ { B } \mathcal { L } _ { \alpha \mathrm { - I o U } } ( B , B ^ { g t } )$ is identical to arg $\operatorname* { m a x } _ { B } I o U ( B , B ^ { g t } )$ and arg $\mathrm { m i n } _ { B } \bar { \mathcal { L } } _ { \mathrm { I o U } } ( \bar { B , B ^ { g t } } )$ . In other words, the optimal solution arg $\operatorname* { m a x } _ { B } I o U ( B , \bar { B ^ { g t } } )$ can be obtained by minimizing either ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ or ${ \mathcal { L } } _ { \mathrm { I o U } }$ . Following this, the adaptive relative loss reweighting scheme of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ can be characterized by the second property:
|
| 90 |
+
|
| 91 |
+
Property 2 (Relative Loss Reweighting). Compared with $\mathcal { L } _ { I o U }$ , $\mathcal { L } _ { \alpha - I o U }$ adaptively reweights the relative loss of all objects by $w _ { \mathcal { L } _ { r } } = \mathcal { L } _ { \alpha \cdot I o U } / \mathcal { L } _ { I o U } = 1 + ( I o U - I o U ^ { \alpha } ) / ( 1 - I o U )$ , with $w _ { \mathscr { L } _ { r } } ( I o U =$ $0 ) = 1$ , and $\begin{array} { r } { \operatorname* { l i m } _ { I o U \to 1 } w _ { \mathcal { L } _ { r } } = \alpha } \end{array}$ .
|
| 92 |
+
|
| 93 |
+
The second property indicates that ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ will adaptively down-weight and up-weight the relative loss of all objects according to their IoUs when $0 < \alpha < 1$ and $\alpha > 1$ , respectively. We further note that, when $\alpha > 1$ , the reweighting factor $w _ { \mathcal { L } _ { r } }$ increases monotonically with the increase of IoU $( w _ { \boldsymbol { L } _ { r } }$ grows from 1 to $\alpha$ ) while decreasing monotonically with the increase of IoU when $0 < \alpha < 1 ( w _ { \mathcal { L } _ { r } }$ decays from 1 to $\alpha$ ). We will empirically show that the up-weighting scheme of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ can help the model focus more on high IoU objects to improve both the localization (i.e., predict more high IoU objects) and detection (i.e., more accurate at high APs) performance4. Similarly, we can obtain the third property of adaptive relative gradient reweighting owned by ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ as follows:
|
| 94 |
+
|
| 95 |
+
Property 3 (Relative Gradient Reweighting). Compared with $\mathcal { L } _ { I o U ; }$ , $\mathcal { L } _ { \alpha - I o U }$ adaptively reweights the relative gradient of all objects by $\begin{array} { r } { w _ { \bar { \nabla } _ { r } } = \bar { | } \nabla _ { I o U } \mathcal { L } _ { \alpha - I o U } | / | \nabla _ { I o U } \mathcal { L } _ { I o U } | = \alpha I o U ^ { \bar { \alpha } - 1 } } \end{array}$ , with the turning point at $I o U = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( 0 , \frac { 1 } { e } )$ when $0 < \alpha < 1$ and $I o U = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( \textstyle { \frac { 1 } { e } } , 1 )$ when $\alpha > 1$ .
|
| 96 |
+
|
| 97 |
+
When $\alpha > 1$ , the above reweighting factor $w _ { \nabla _ { r } }$ increases monotonically with the increase of IoU, while decreasing monotonically with the increase of IoU when $0 \textless \alpha \textless 1$ . This relative gradient reweighting scheme is also adaptive to IoU, with the turning point from up-weighting to down-weighting at $\overline { { I o U } } = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( 0 , \frac { 1 } { e } )$ when $0 \textless \alpha \textless 1$ , and from down-weighting to upweighting at $I o U = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( \frac { 1 } { e } , 1 )$ when $\alpha > 1$ . The gradient reweighting scheme is bounded by $w _ { \nabla _ { r } } ( I o U = 1 ) = \alpha$ , i.e., $0 \leq w _ { \nabla _ { r } } \leq \alpha$ when $\alpha > 1$ , and $w _ { \nabla _ { r } } \geq \alpha$ when $0 < \alpha < 1$ . This relative gradient reweighting scheme allows the model to learn objects with adaptive speeds (i.e., different gradients) according to their IoUs. Theoretically, when $\alpha = 2$ , $| \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \alpha - \mathrm { I o U } } | > | \overline { { \nabla } } _ { \mathrm { I o U } } \mathcal { L } _ { \mathrm { I o U } } |$ for $I o U \in ( 0 . 5 , 1 ]$ , which accelerates the learning of all positive IoU objects at $\mathrm { { A P } _ { 5 0 } }$ . However, we empirically show that $\alpha$ -IoU losses with $\alpha = 3$ perform more competitively than those with $\alpha = 2$ in most cases. It is probable that $\alpha \cdot$ -IoU losses with $\alpha = 3$ further up-weight the relative loss of objects with $I o U \in ( 0 . 5 , 1 ]$ , although $\alpha$ -IoU losses with $\alpha = 2$ also beat existing baselines (see Figure 6). This property is both data-agnostic and model-agnostic, so we recommend $\alpha = 3$ or $\alpha \in [ 2 , 3 ]$ in practical use for other datasets and models.
|
| 98 |
+
|
| 99 |
+
The above loss and gradient reweighting schemes can also be inferred from Figure 1, with detailed proofs in Appendix A. To summarize, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ trains better detectors than ${ \mathcal { L } } _ { \mathrm { I o U } }$ for the following reasons. First, the same optimal IoU can be achieved by ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ as that by ${ \mathcal { L } } _ { \mathrm { I o U } }$ (Property 1). Second, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ focuses more on high IoU objects by up-weighting their relative loss (Property
|
| 100 |
+
|
| 101 |
+
2). Third, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ helps detectors learn faster on high IoU objects (here $I o U \in ( \alpha ^ { \frac { 1 } { 1 - \alpha } } , 1 ] )$ through up-weighting their relative gradient (Property 3). In Appendix A, we also provide an analysis of the absolute loss and gradient reweighting properties (Property 4 and 5), showing the additions of $\alpha$ -IoU to IoU. Specifically, when $\alpha > 1$ , ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ adds an absolute loss weight to ${ \mathcal { L } } _ { \mathrm { I o U } }$ (i.e., $w _ { \mathscr { L } _ { a } } = \mathscr { L } _ { \alpha \mathrm { - I o U } } - \mathscr { L } _ { \mathrm { I o U } } = I o U - I o U ^ { \alpha } > 0$ for $I o U \in ( 0 , 1 ) )$ , which creates more space for optimization on all levels of objects (Property 4). Likewise, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ puts an absolute gradient weight for high IoU objects (i.e., $\bar { w } _ { \nabla _ { a } } = | \bar { \nabla } _ { \mathrm { I o U } } \mathcal { L } _ { \alpha \mathrm { - I o U } } | - | \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \mathrm { I o U } } | = \alpha I o U ^ { \alpha - 1 } - 1 \bar { > } 0$ for $I o U \in ( \alpha ^ { \frac { 1 } { 1 - \alpha } } , 1 ] )$ such that the learning of high IoU objects is accelerated (Property 5). Both of the absolute and relative properties of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ are adaptive to the IoU values of the objects. Such reweighting schemes will provide more flexibility in achieving different levels of bbox regression accuracies (AP measured under different IoU thresholds).
|
| 102 |
+
|
| 103 |
+
Learning Dynamics of ${ \mathcal { L } } _ { \alpha \mathbf { - } \mathbf { I 0 } \mathbf { U } }$ . Training with ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ is a dynamic process and should be interpreted based on both the absolute and relative properties. With $\alpha > 1$ , easy examples will be learned first with increasing speed towards $I o U = 1$ , while hard examples will be learned gradually and accelerated later on as their IoU improves. We will empirically show in Figure 3 that up-weighting the loss and gradient of high IoU objects can boost the training at the later stage. As a comparison, we will also show that $\alpha$ -IoU losses with $0 < \alpha < 1$ tend to degrade the final performance in Section 4.4. Reducing the loss and gradient of high IoU objects ends up with more poorly localized objects.
|
| 104 |
+
|
| 105 |
+
# 4 Experiments
|
| 106 |
+
|
| 107 |
+
# 4.1 Datasets and Training Setup
|
| 108 |
+
|
| 109 |
+
We conduct all experiments on two popular benchmarks, i.e., PASCAL VOC [9] and MS COCO [22]. On the PASCAL VOC benchmark, we train all models on the trainval set $2 0 0 7 + 2 0 1 2$ (containing 16, 551 images from 20 categories) and evaluate them on the test set 2007 (containing 4, 952 images) [9]. On the MS COCO benchmark, we train all models on the training set 2017 (containing 118K images from 80 categories) and evaluate them on the val set 2017 (containing 5K images) [22]. We train all state-of-the-art models with the original implementation released by the authors. Specifically, we follow the original implementation’s training protocol with default parameters and the number of training epochs with different losses [31, 32, 43, 4]. Implementation details of all models are given in Appendix B.1. All experiments are run with NVIDIA V100 GPUs. Code is available at https://github.com/Jacobi93/Alpha-IoU.
|
| 110 |
+
|
| 111 |
+
# 4.2 Results and Analysis
|
| 112 |
+
|
| 113 |
+
We first validate the effectiveness of $\alpha$ -IoU losses in training both anchor-based and anchor-free models on the two datasets. We choose YOLOv5s (i.e., YOLOv5 small) and YOLOv5x (i.e., YOLOv5 extra large) as one-stage anchor-based models, and DETR (ResNet-50) as an anchor-free model. Both $\alpha$ -IoU losses (i.e., ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ and $\mathcal { L } _ { \alpha - \mathrm { D I o U } } )$ are generalized from existing baselines following equation (4). From Table 1, we can observe that $\alpha$ -IoU losses surpass existing losses consistently across multiple models and datasets in terms of both mAP and $\mathrm { m A P _ { 7 5 : 9 5 } }$ , especially at the high bbox regression accuracy $\mathrm { m A P _ { 7 5 : 9 5 } }$ . The superiority of $\alpha$ -IoU losses is more pronounced at high accuracy levels, which might reach more than $6 0 \%$ relative improvement at $\mathsf { A P } _ { 9 5 }$ . Interestingly, $\alpha$ -IoU losses tend to help more of light models (e.g., YOLOv5s with 7.3M parameters and 17 GFLOPs) than heavy models (e.g., YOLOv5x with $8 7 . 7 \mathbf { M }$ parameters and 218.8 GFLOPs). This indicates that $\alpha$ -IoU losses hold more advantage while training light models in computing-resource-limited scenarios, such as mobile devices, autonomous vehicles, and robots.
|
| 114 |
+
|
| 115 |
+
The consistent improvements on both PASCAL VOC and MS COCO demonstrate the stability of $\alpha$ -IoU losses across different datasets. In addition, we also verify its robustness to extremely small training sets in Appendix B.2.2, where $\alpha$ -IoU losses beat existing losses at various scales, i.e., from 4K $2 5 \%$ trainval set of PASCAL VOC $2 0 0 7 { + } 2 0 1 2 ,$ ) to 118K (the entire training set of MS COCO 2017) samples. It is possible that $\alpha$ -IoU losses may not perform well if measured by a single low AP metric. For example, there may be less than $0 . 5 \%$ performance drop at $\mathrm { { A P } _ { 5 0 } }$ when $\alpha = 3$ , however, this is compensated by the significant boost at high APs. With some examples from the test set of PASCAL VOC 2007 (Figure 4) and the val set of MS COCO 2017 (Figure 5), we show that $\alpha$ -IoU losses are able to localize objects more accurately than the baselines with more true positives and fewer false positives.
|
| 116 |
+
|
| 117 |
+
Table 1: The performance of YOLOv5s, YOLOv5x and DETR models trained using different localization losses on PASCAL VOC and MS COCO benchmarks. Results are obtained on the test set of PASCAL VOC 2007 and the val set of MS COCO 2017. mAP denotes $\mathrm { m A P _ { 5 0 : 9 5 } }$ ; $\mathrm { m A P _ { 7 5 : 9 5 } }$ denotes the mean AP over $\mathsf { A P } _ { 7 5 }$ , $\mathbf { A P } _ { 8 0 } , \cdot \cdot \cdot , \mathbf { A P } _ { 9 5 }$ . "rela. improv." stands for the relative improvement. $\alpha = 3$ is used for all $\alpha$ -IoU losses in all experiments.
|
| 118 |
+
|
| 119 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Loss</td><td rowspan="2"></td><td colspan="5">PASCAL VOC</td><td colspan="2"></td><td colspan="5">MS COCO</td></tr><tr><td>AP50</td><td>AP75</td><td>AP85 AP95</td><td></td><td>mAP</td><td>mAP75:95l</td><td>AP50</td><td>AP75</td><td>AP85</td><td>AP95</td><td>mAP</td><td>mAP75:95</td></tr><tr><td rowspan="5">YOLOv5s</td><td rowspan="5">LIoU Lα-loU rela. improv.</td><td>78.81 78.62</td><td>58.04 58.78</td><td>35.07 38.16</td><td>2.34 3.64</td><td>52.74 53.61</td><td>32.45 34.46</td><td>55.51</td><td>38.59</td><td>23.58</td><td></td><td>2.07</td><td>36.29</td><td>21.82</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>55.25</td><td>39.69</td><td>25.85</td><td>3.35</td><td>37.01</td><td>23.66</td></tr><tr><td></td><td>-0.24%</td><td>1.27%</td><td>8.81%</td><td>55.56%</td><td>1.65%</td><td>6.21%</td><td>-0.47%</td><td>2.85%</td><td>9.63%</td><td>61.84%</td><td>1.98%</td><td>8.43%</td></tr><tr><td>LDIoU</td><td>78.19</td><td>57.77</td><td>34.89</td><td>2.36</td><td>52.30</td><td>32.17</td><td>55.67</td><td>39.01</td><td>23.56</td><td>2.03</td><td>36.36</td><td>21.95</td></tr><tr><td>Lα-DIoU rela. improv.</td><td>78.33 0.18%</td><td>59.24 38.46</td><td>3.50</td><td></td><td>53.76</td><td>34.66</td><td>55.84</td><td>39.49</td><td>25.49</td><td>3.30</td><td>36.74</td><td>23.34</td></tr><tr><td rowspan="6">YOLOv5x</td><td colspan="10">LIoU</td><td rowspan="6">8.19%</td><td colspan="10">62.56%</td></tr><tr><td></td><td>85.24</td><td>2.54%</td><td>10.23%</td><td>48.31%</td><td>2.79% 63.95</td><td>7.72%</td><td></td><td>0.31%</td><td>1.23%</td><td></td><td></td><td>1.05%</td><td>6.32%</td></tr><tr><td>Lα-IoU</td><td>84.83</td><td>70.08 70.20</td><td>53.08 53.75</td><td>10.88 13.74</td><td>64.25</td><td>46.78 48.06</td><td></td><td>67.36 67.72</td><td>52.15 52.61</td><td>38.22 38.62</td><td>9.31 9.76</td><td>48.42 48.67</td><td>34.42 34.72</td></tr><tr><td>rela. improv.</td><td>-0.48%</td><td>0.17%</td><td>1.26%</td><td>26.29%</td><td>0.47%</td><td></td><td>2.73%</td><td>0.53%</td><td>0.88%</td><td>1.05%</td><td>4.83%</td><td>0.52%</td><td>0.87%</td></tr><tr><td>LDIoU</td><td>85.04</td><td>71.05</td><td>53.71</td><td>11.11</td><td>64.21</td><td>47.30</td><td></td><td>67.54</td><td>52.03</td><td>38.02</td><td>8.58</td><td>48.38</td><td>34.16</td></tr><tr><td>La-DloU rela.improv.</td><td>84.90</td><td>71.34</td><td>54.23</td><td>13.85</td><td>64.49</td><td>48.40</td><td></td><td></td><td>52.65</td><td>39.28</td><td>10.29</td><td>48.81</td><td>35.42</td></tr><tr><td rowspan="8">DETR</td><td rowspan="8">LIoU</td><td>-0.16%</td><td>0.41%</td><td>0.97%</td><td></td><td>24.66%</td><td>0.44%</td><td>2.32%</td><td>67.42 -0.18%</td><td>1.19%</td><td>3.31%</td><td></td><td>19.93%</td><td>0.89%</td><td>3.68%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>76.50</td><td>53.85</td><td>29.54</td><td>1.62</td><td>49.78</td><td>28.82</td><td>59.38</td><td>41.67</td><td>26.13</td><td></td><td>3.52</td><td>39.23</td><td>24.37</td></tr><tr><td>La-loU rela.improv.</td><td>76.22 -0.37%</td><td>55.03 2.19%</td><td>32.30 9.34%</td><td>2.28 40.74%</td><td>51.12 2.69%</td><td>31.08 7.84%</td><td>59.61 0.39%</td><td>42.65 2.35%</td><td>28.57 9.34%</td><td></td><td>5.09 44.60%</td><td>40.18 2.42%</td><td>26.44 8.49%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LDIoU</td><td>76.26 76.44</td><td>54.09</td><td>29.23</td><td>1.56</td><td>49.91</td><td>28.68</td><td></td><td>59.28</td><td>41.62</td><td>26.09</td><td>3.54</td><td>39.25</td><td>24.48</td></tr><tr><td>La-DloU rela. improv.</td><td>0.24%</td><td>54.89 1.48%</td><td>31.48 7.70%</td><td>2.44</td><td>50.96 2.10%</td><td>30.60 6.69%</td><td>59.38</td><td>42.34 1.73%</td><td></td><td>28.23</td><td>5.36</td><td>39.94 1.76%</td><td>26.05</td></tr><tr><td></td><td></td><td></td><td></td><td>56.41%</td><td></td><td></td><td>0.17%</td><td></td><td></td><td>8.20%</td><td>51.41%</td><td></td><td>6.41%</td></tr></table>
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 2: IoU distributions between predicted bboxes and their ground truth after NMS.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 3: Validation mAPs $( \mathrm { m A P _ { 5 0 : 9 5 } } )$ across 300 training epochs.
|
| 126 |
+
|
| 127 |
+
We further analyze the bbox regression accuracy by showing the IoU distributions between the predicted bboxes and their ground truth for YOLOv5s trained using different losses on PASCAL VOC. After NMS with the IoU threshold being 0.5, we visualize the number of positively predicted bboxes under different IoU thresholds from 0.5 to 0.9 in Figure 2, showing that $\alpha$ -IoU losses detect more positive objects than baseline losses across all IoU thresholds. Particularly, $\alpha$ -IoU losses detect approximately $1 \%$ more positive objects than the baselines when $I o U \ge 0 . 5$ , and $1 1 \%$ more high IoU objects when $I o U \ge 0 . 9$ . This demonstrates that $\alpha$ -IoU boosts both the precisions and recalls of detectors. $\alpha$ -IoU is extremely advantageous in pushing low IoU objects to high IoU objects by up-weighting their loss, thus outperforming baseline losses significantly at the high accuracy level and contributing to the improvement of the final detection performance (Table 1).
|
| 128 |
+
|
| 129 |
+
Moreover, Figure 3 shows that $\alpha$ -IoU losses are able to boost the late training stage (e.g., after 200 epochs) through up-weighting the gradient of high IoU objects, while almost having no negative impact on the early training stage (e.g., the first 100 epochs). When $\alpha > 1$ , the relative gradient weight is $0 \leq w _ { \nabla _ { r } } < 1$ for $0 \leq I o U < \alpha ^ { \frac { 1 } { 1 - \alpha } }$ , while $1 \leq w _ { \nabla _ { r } } \leq \alpha$ for $\alpha ^ { \frac { 1 } { 1 - \alpha } } \leq \hat { I o U } \leq 1$ , as analyzed in Property 3 and illustrated in Figure 1 (right). This property helps tune down the gradients of low IoU objects at the early training stage, which has a smoothing effect (reduces the high variance in parameter update caused by hard examples) that helps stabilize the model training when gradients are large at the early stage. On the other hand, the gradient up-weighting is well-bounded by $w _ { \nabla _ { r } } \leq \alpha$ , which makes up-weighting relatively safe for high IoU objects, as the original loss and gradient are small for these examples, so is the learning rate.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 4: Example results on the test set of PASCAL VOC 2007 using YOLOv5s trained by ${ \mathcal { L } } _ { \mathrm { I o U } }$ (top row) and ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha = 3$ (bottom row). ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ performs better than ${ \mathcal { L } } _ { \mathrm { I o U } }$ because it can localize objects more accurately (image 1 and 2), thus can detect more true positive objects (image 3 to 5) and fewer false positive objects (image 6 and 7).
|
| 133 |
+
|
| 134 |
+

|
| 135 |
+
Figure 5: Example results on the val set of MS COCO 2017 using YOLOv5s trained by ${ \mathcal { L } } _ { \mathrm { I o U } }$ (top row) and ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha = 3$ (bottom row). ${ \mathcal { L } } _ { \alpha }$ -IoU performs better than ${ \mathcal { L } } _ { \mathrm { I o U } }$ because it can localize objects more accurately (image 1), thus can detect more true positive objects (image 2 to 5) and fewer false positive objects (image 4 to 7). Note that ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ detects both more true positive and fewer false positive objects in image 4 and 5 than ${ \mathcal { L } } _ { \mathrm { I o U } }$ .
|
| 136 |
+
|
| 137 |
+
We also conduct an experiment to compare our $\alpha$ -IoU with a set of existing IoU-based losses in training a popular two-stage anchor-based model, Faster R-CNN (ResNet-50-FPN). In Table 2, results at the top are reproduced using the MMDetection toolbox [6] while those in the middle are reported results in the original papers [43, 41, 23]. Results at the bottom are obtained by replacing existing losses with their $\alpha$ -IoU versions (i.e., improve based on top results using MMDetection). The results on MS COCO demonstrate that $\alpha$ -IoU losses are quite competitive compared with existing baselines in terms of both mAP and $\mathrm { m A P _ { 7 5 : 9 5 } }$ . Note that the Autoloss searches both the classification loss and the localization loss, thus taking a huge amount of searching time [23]. In contrast, $\alpha$ -IoU losses only need an easy modification of the localization loss and win the Autoloss without causing any additional computational overhead.
|
| 138 |
+
|
| 139 |
+
# 4.3 Robustness to Noisy Bounding Boxes
|
| 140 |
+
|
| 141 |
+
It happens quite often that people annotate inaccurate bboxes in images/videos as the ground truth, even with computer-assisted annotation tools. However, there is little work on the robustness of localization losses to noisy bboxes, even though a number of methods have been proposed for robust learning with noisy labels, anchors, and bboxes [27, 26, 12, 10, 15, 37, 38, 25, 19, 20]. Here, we fill this gap by conducting a set of experiments to evaluate the robustness of different localization losses to noisy bboxes. We show that $\alpha$ -IoU is more robust to noisy bboxes as they focus less on the low IoU objects, creating a suppression effect on the learning of the noisy bbox examples. Considering that open datasets like PASCAL VOC and MS COCO are carefully annotated, we synthesize a set of common noisy bboxes by perturbing normalized bboxes in the entire training set. The perturbations follow a uniform noise distribution in $[ - \eta w , \eta w ]$ at horizontal coordinates $\scriptstyle { \dot { x } }$ and $w$ ) and $[ - \eta h , \eta h ]$ at vertical coordinates $y$ and $h$ ), where $\eta$ is the noise rate [20]. We then constrain all the noisy bboxes by the following boundary conditions:
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
0 < w < 1 , ~ 0 < h < 1 , ~ \frac { 1 } { 2 } w \leq x \leq 1 - \frac { 1 } { 2 } w , ~ \frac { 1 } { 2 } h \leq y \leq 1 - \frac { 1 } { 2 } h .
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
Table 2: The performance of Faster R-CNN (ResNet-50-FPN) with $1 \times$ schedule and single scale training on MS COCO using different localization losses. Results are obtained on the val set of MS COCO 2017. mAP denotes $\mathrm { m A P _ { 5 0 : 9 5 } }$ ; $\mathrm { m A P _ { 7 5 : 9 5 } }$ denotes the mean AP over $\mathsf { A P } _ { 7 5 }$ , $\mathbf { A P } _ { 8 0 } , \cdot \cdot \cdot , \mathbf { A P } _ { 9 5 }$ . $\mathsf { A P } _ { s }$ , $\mathsf { A P } _ { m }$ , and $\mathsf { A P } _ { l }$ denote the AP for small, medium, and large objects, respectively. † marks the reproduced results from the MMDetection toolbox [6], while ∗ marks the results in the original papers. "–" represents the missing results in papers. $\alpha = 3$ is used for all $\alpha$ -IoU losses in all experiments. The top two best results in every column are boldfaced.
|
| 148 |
+
|
| 149 |
+
<table><tr><td>Loss</td><td>AP50</td><td>AP75</td><td>AP80</td><td>AP85</td><td>AP90</td><td>AP95</td><td>mAP</td><td>mAP75:95|</td><td>APs</td><td>APm</td><td>APt</td></tr><tr><td>+e1</td><td>58.13</td><td>40.45</td><td>33.56</td><td>23.39</td><td>11.09</td><td>1.24</td><td>37.37</td><td>21.95</td><td>21.20</td><td>40.96</td><td>48.13</td></tr><tr><td>LIoU</td><td>58.12</td><td>41.23</td><td>34.03</td><td>24.43</td><td>12.42</td><td>1.61</td><td>37.88</td><td>22.74</td><td>21.61</td><td>41.63</td><td>49.11</td></tr><tr><td>LGIoU</td><td>58.18</td><td>41.00</td><td>33.52</td><td>24.13</td><td>11.97</td><td>1.51</td><td>37.62</td><td>22.43</td><td>21.49</td><td>41.07</td><td>48.90</td></tr><tr><td>+LBIoU</td><td>58.05</td><td>40.57</td><td>33.54</td><td>23.85</td><td>11.10</td><td>1.19</td><td>37.43</td><td>22.05</td><td>21.57</td><td>41.00</td><td>48.17</td></tr><tr><td>*LIoU</td><td>/</td><td>40.79</td><td>/</td><td></td><td>1</td><td>1</td><td>37.93</td><td></td><td>21.58</td><td>40.82</td><td>50.14</td></tr><tr><td>*LGIoU</td><td>1</td><td>41.11</td><td></td><td></td><td>1</td><td></td><td>38.02</td><td></td><td>21.45</td><td>41.06</td><td>50.21</td></tr><tr><td>*LDIoU</td><td>1</td><td>41.11</td><td></td><td></td><td>1</td><td>1</td><td>38.09</td><td>1</td><td>21.66</td><td>41.18</td><td>50.32</td></tr><tr><td>*LCIoU</td><td>1</td><td>41.96</td><td></td><td></td><td></td><td></td><td>38.65</td><td></td><td>21.32</td><td>41.83</td><td>51.51</td></tr><tr><td>*LFocal-EIoU</td><td>59.10</td><td>42.40</td><td></td><td></td><td></td><td></td><td>38.90</td><td></td><td>21.20</td><td>41.10</td><td>50.20</td></tr><tr><td>*Autoloss</td><td>58.60</td><td>41.80</td><td>1</td><td>一</td><td>1</td><td>1</td><td>38.50</td><td>1</td><td>22.00</td><td>42.20</td><td>50.20</td></tr><tr><td>Lα-IoU</td><td>58.81</td><td>41.94</td><td>34.81</td><td>25.36</td><td>13.27</td><td>1.81</td><td>38.96</td><td>23.44</td><td>22.14</td><td>42.11</td><td>50.36</td></tr><tr><td>La-GloU</td><td>59.01</td><td>42.00</td><td>35.13</td><td>25.14</td><td>13.09</td><td>2.03</td><td>39.18</td><td>23.46</td><td>22.05</td><td>42.19</td><td>50.08</td></tr><tr><td>Lα-DIoU</td><td>59.27</td><td>42.18</td><td>35.25</td><td>25.47</td><td>13.32</td><td>1.95</td><td>39.43</td><td>23.65</td><td>22.10</td><td>42.10</td><td>50.43</td></tr><tr><td>La-CloU</td><td>59.09</td><td>41.92</td><td>35.01</td><td>25.08</td><td>13.04</td><td>1.98</td><td>39.25</td><td>23.41</td><td>21.94</td><td>41.88</td><td>50.01</td></tr></table>
|
| 150 |
+
|
| 151 |
+
Table 3: The performance of YOLOv5s trained using different localization losses on simulated noisy trainval sets of PASCAL VOC $2 0 0 7 { + } 2 0 1 2$ under noise rates $\eta = 0 . 1 , 0 . 2$ , and 0.3. Results are obtained on the clean test set of PASCAL VOC 2007. mAP denotes $\mathrm { m A P _ { 5 0 : 9 5 } }$ ; $\mathrm { m A P _ { 7 5 : 9 5 } }$ denotes the mean AP over $\mathsf { A P } _ { 7 5 }$ , $\mathbf { A P } _ { 8 0 } , \cdot \cdot \cdot , \mathbf { A P } _ { 9 5 }$ . "rela. improv." stands for the relative improvement. $\alpha = 3$ is used for all $\alpha$ -IoU losses in all experiments.
|
| 152 |
+
|
| 153 |
+
<table><tr><td>Noise</td><td>Loss</td><td>AP50</td><td>AP55</td><td>AP60</td><td>AP65</td><td>AP70</td><td>AP75</td><td>AP80</td><td>AP85</td><td>AP90</td><td>AP95</td><td>mAP</td><td>mAP75:95</td></tr><tr><td rowspan="6">0.1</td><td>LIoU La-IoU</td><td>74.48 74.67</td><td>71.57 71.94</td><td>68.08 68.73</td><td>63.29 64.27</td><td>56.55 57.75</td><td>47.12 48.50</td><td>33.06 36.88</td><td>17.53 21.25</td><td>4.16 6.30</td><td>0.26 0.28</td><td>43.61 45.06</td><td>20.43</td></tr><tr><td>rela. improv.</td><td>0.26%</td><td>0.52%</td><td>0.95%</td><td>1.55%</td><td>2.12%</td><td>2.93%</td><td>11.55%</td><td>21.22%</td><td>51.44%</td><td>7.69%</td><td>3.32%</td><td>22.64 10.85%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LDIoU</td><td>74.09</td><td>71.46</td><td>67.88</td><td>63.09</td><td>56.18</td><td>46.71</td><td>32.67</td><td>17.50</td><td>4.43</td><td>0.23</td><td>43.42</td><td>20.31</td></tr><tr><td>La-DloU</td><td>74.38</td><td>71.95</td><td>68.10</td><td>63.52</td><td>57.18</td><td>48.47</td><td>35.90</td><td>20.89</td><td>6.37</td><td>0.33</td><td>44.71</td><td>22.39</td></tr><tr><td>rela. improv.</td><td>0.39%</td><td>0.69%</td><td>0.32%</td><td>0.68%</td><td>1.78%</td><td>3.77%</td><td>9.89%</td><td>19.37%</td><td>43.79%</td><td>43.48%</td><td>2.97%</td><td>10.26%</td></tr><tr><td rowspan="6">0.2</td><td>LIoU La-loU</td><td>67.82</td><td>63.93</td><td>58.22</td><td>50.11</td><td>39.31</td><td>26.33</td><td>13.51</td><td>4.55</td><td>0.66</td><td>0.05</td><td>32.45</td><td>9.02</td></tr><tr><td></td><td>68.20</td><td>64.21</td><td>58.77</td><td>51.59</td><td>40.66</td><td>29.20</td><td>16.11</td><td>6.06</td><td>1.31</td><td>0.10</td><td>33.62</td><td>10.56</td></tr><tr><td>rela. improv.</td><td>0.56%</td><td>0.44%</td><td>0.94%</td><td>2.95%</td><td>3.43%</td><td>10.90%</td><td>19.25%</td><td>33.19%</td><td>98.48%</td><td>100%</td><td>3.61%</td><td>17.03%</td></tr><tr><td>LDIoU</td><td>67.39</td><td>62.94</td><td>57.29</td><td>49.25</td><td>39.40</td><td>27.13</td><td>13.78</td><td>4.52</td><td>0.68</td><td>0.02</td><td>32.24</td><td>9.23</td></tr><tr><td>La-DloU</td><td>68.26</td><td>64.49</td><td>59.59</td><td>51.99</td><td>41.19</td><td>29.12</td><td>15.77</td><td>5.84</td><td>1.25</td><td>0.21</td><td>33.77</td><td>10.44</td></tr><tr><td>rela.improv.</td><td>1.29%</td><td>2.46%</td><td>4.01%</td><td>5.56%</td><td>4.54%</td><td>7.34%</td><td>14.44%</td><td>29.20%</td><td>83.82%</td><td>950%</td><td>4.75%</td><td>13.14%</td></tr><tr><td rowspan="6">0.3</td><td>LIoU La-IoU</td><td>56.54</td><td>49.69</td><td>40.67</td><td>30.80</td><td>19.99</td><td>11.13</td><td>4.81</td><td>1.43</td><td>0.31</td><td>0.04</td><td>21.54</td><td>3.54</td></tr><tr><td></td><td>58.59</td><td>51.58</td><td>43.23</td><td>32.93</td><td>22.27</td><td>12.52</td><td>5.91</td><td>2.16</td><td>0.73</td><td>0.12</td><td>23.00</td><td>4.29</td></tr><tr><td>rela. improv.</td><td>3.63%</td><td>3.80%</td><td>6.29%</td><td>6.92%</td><td>11.41%</td><td>12.49%</td><td>22.87%</td><td>51.05%</td><td>135%</td><td>200%</td><td>6.78%</td><td>20.99%</td></tr><tr><td>LDIoU</td><td>56.84</td><td>49.82</td><td>41.50</td><td></td><td>20.80</td><td>11.22</td><td>4.84</td><td>1.51</td><td>0.46</td><td></td><td></td><td></td></tr><tr><td></td><td>58.45</td><td>51.94</td><td>43.9</td><td>32.06 33.78</td><td>22.57</td><td>12.89</td><td>6.34</td><td>2.42</td><td>0.65</td><td>0.07</td><td>21.91 23.31</td><td>3.62 4.49</td></tr><tr><td>La-DIoU rela. improv.</td><td>2.83%</td><td>4.26%</td><td>5.78%</td><td>5.36%</td><td>8.51%</td><td>14.88%</td><td>30.99%</td><td>60.26%</td><td>41.30%</td><td>0.16 129%</td><td>6.39%</td><td>24.09%</td></tr></table>
|
| 154 |
+
|
| 155 |
+
We test $\eta = 0 . 1 , 0 . 2 , 0 . 3$ in our experiments, with the average IoU between the noisy bboxes and their clean versions dropping to 0.833, 0.710, and 0.613, respectively. Examples of the synthesized noisy bboxes can be found in Appendix B.4. As shown in Table 3, $\alpha$ -IoU improves the baseline losses (i.e., ${ \mathcal { L } } _ { \mathrm { I o U } }$ and ${ \mathcal { L } } _ { \mathrm { { D I o U } } } ,$ ) considerably in these noisy scenarios. We gain increasing relative improvements from $\mathrm { { A P } _ { 5 0 } }$ to $\mathsf { A P } _ { 9 5 }$ , which accumulate to a more significant improvement in $\mathrm { m A P _ { 7 5 : 9 5 } }$ . Note that $\alpha$ -IoU losses also outperform the baselines at $\mathrm { { A P } _ { 5 0 } }$ across all noisy scenarios, which is not always the case when bboxes are clean (Table 1). Furthermore, $\alpha$ -IoU losses are noticeably more robust against more severe noises. For instance, the relative improvement of $\mathcal { L } _ { \alpha \mathrm { - D I o U } }$ over ${ \mathcal { L } } _ { \mathrm { D I o U } }$ increases from $2 . 9 7 \% / 1 0 . 2 6 \%$ to $6 . 3 9 \% / 2 4 . 0 9 \%$ according to $\mathrm { m A P / m A P _ { 7 5 : 9 5 } }$ when the noise rate $\eta$ rises from 0.1 to 0.3. These results confirm the advantage of $\alpha$ -IoU losses in noisy bbox scenarios.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 6: The performance of YOLOv5 models trained using $\alpha$ -IoU with different $\alpha$ values and evaluated on the clean test set of PASCAL VOC 2007. Black dashed lines denote baselines (i.e., the family of $\alpha$ -IoU with $\alpha = 1$ ) while red dashed lines denote the family of $\alpha$ -IoU with $\alpha = 3$ .
|
| 159 |
+
|
| 160 |
+
# 4.4 Sensitivity to power parameter $\alpha$
|
| 161 |
+
|
| 162 |
+
Here, we evaluate the performance of $\alpha$ -IoU with varying $\alpha$ values $( \alpha \in [ 0 . 5 , 5 ] )$ ) via a set of experiments with ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ and $\mathcal { L } _ { \alpha - \mathrm { D I o U } }$ . The results are shown in Figure 6 for YOLOv5s on PASCAL VOC in both clean and various noisy bbox scenarios. It is evident that $\alpha$ -IoU losses with $\alpha \in [ 2 , 4 ]$ perform competitively well across all scenarios, with $\alpha = 3$ performing the best in most cases. When $\alpha > 3$ , $\alpha$ -IoU losses tend to perform worse on low APs than the baselines (i.e., $\alpha$ -IoU with $\alpha = 1 \AA$ ), although the performance at high APs gains more improvement. We also test an extreme case with $\alpha = 1 0$ , in which the performance drops by $5 . 6 1 \% / 1 \dot { 0 } . 9 2 \% / 2 3 . 8 8 \% / 3 1 . 8 2 \%$ on average compared with $\alpha = 3$ under noise rates $\eta = 0 / 0 . 1 / 0 . 2 / 0 . 3$ , respectively. More specifically, it becomes worse than the baselines according to either mAP or $\mathrm { m A P _ { 7 5 : 9 5 } }$ . This indicates that a proper choice of $\alpha$ is crucial for $\alpha$ -IoU losses. Our recommendation is to tune $\alpha \in [ 2 , 3 ]$ for most applications or directly use $\alpha = 3$ when tuning is too expensive. Note that $\alpha \in [ 3 , 4 ]$ may be a better choice when high levels of bbox regression accuracy is desired, e.g., $\mathrm { m A P _ { 7 5 : 9 5 } }$ is the preferred performance metric. It is possible that $\alpha < 1$ is a better choice for certain applications, although $\alpha$ -IoU losses with $\alpha < 1$ perform consistently worse than the baselines in our experiments.
|
| 163 |
+
|
| 164 |
+
# 5 Conclusions
|
| 165 |
+
|
| 166 |
+
In this paper, we proposed a unified formula $\alpha$ -IoU to generalize existing IoU-based losses to a new family of power IoU losses. By modulating the power parameter $\alpha$ , $\alpha$ -IoU offers the flexibility to achieve different levels of bbox regression accuracy when training an object detector. We analyzed the order preservingness and the loss/gradient reweighting properties of $\alpha$ -IoU, and showed that $\alpha$ -IoU can improve bbox regression accuracy through up-weighting the loss and gradient of high IoU objects. Experiments with multiple detection models and benchmark datasets demonstrated that $\alpha$ -IoU losses can consistently outperform existing IoU-based losses, especially at the high Average Precisions (APs). $\alpha$ -IoU has the potential to be widely applied in real-world object detection applications as 1) it improves existing IoU-based losses, 2) it benefits light models, 3) it is extremely advantageous on small datasets, and 4) it is more robust to noisy bboxes. For future work, we will explore new generalization formulas for other metric-derived loss functions [13], such as Dice, Hausdorff distance, and Chamfer distance losses.
|
| 167 |
+
|
| 168 |
+
# Societal Impacts
|
| 169 |
+
|
| 170 |
+
The proposed loss functions can help train high-performance object detectors for impactful applications such as self-driving, face recognition and video surveillance. While not our initial intention, these models could potentially be manipulated by adversaries or unauthorized users for malicious purposes. This could compromise the safety or privacy of certain individuals. We believe strict regulations should be established to prevent such illegitimate exploitations.
|
| 171 |
+
|
| 172 |
+
# References
|
| 173 |
+
|
| 174 |
+
[1] A. Bochkovskiy, C.-Y. Wang, and H.-Y. M. Liao. Yolov4: Optimal speed and accuracy of object detection. arXiv preprint arXiv:2004.10934, 2020.
|
| 175 |
+
[2] G. E. Box and D. R. Cox. An analysis of transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26(2):211–243, 1964. [3] Z. Cai and N. Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In CVPR, pages 6154–6162, 2018. [4] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko. End-to-end object detection with transformers. In ECCV, pages 213–229. Springer, 2020. [5] K. Chen, J. Pang, J. Wang, Y. Xiong, X. Li, S. Sun, W. Feng, Z. Liu, J. Shi, W. Ouyang, et al. Hybrid task cascade for instance segmentation. In CVPR, pages 4974–4983, 2019.
|
| 176 |
+
[6] K. Chen, J. Wang, J. Pang, Y. Cao, Y. Xiong, X. Li, S. Sun, W. Feng, Z. Liu, J. Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
|
| 177 |
+
[7] Z. Dong, G. Li, Y. Liao, F. Wang, P. Ren, and C. Qian. Centripetalnet: Pursuing high-quality keypoint pairs for object detection. In CVPR, pages 10519–10528, 2020. [8] K. Duan, S. Bai, L. Xie, H. Qi, Q. Huang, and Q. Tian. Centernet: Keypoint triplets for object detection. In ICCV, pages 6569–6578, 2019. [9] M. Everingham, L. Van Gool, C. K. Williams, J. Winn, and A. Zisserman. The pascal visual object classes (voc) challenge. IJCV, 88(2):303–338, 2010.
|
| 178 |
+
[10] J. Gao, J. Wang, S. Dai, L.-J. Li, and R. Nevatia. Note-rcnn: Noise tolerant ensemble rcnn for semi-supervised object detection. In ICCV, pages 9508–9517, 2019.
|
| 179 |
+
[11] R. Girshick. Fast r-cnn. In ICCV, pages 1440–1448, 2015.
|
| 180 |
+
[12] B. Han, Q. Yao, X. Yu, G. Niu, M. Xu, W. Hu, I. W. Tsang, and M. Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, 2018.
|
| 181 |
+
[13] J. He, S. Erfani, S. Wijewickrema, S. O’Leary, and K. Ramamohanarao. Learning non-unique segmentation with reward-penalty dice loss. In IJCNN, pages 1–8. IEEE, 2020.
|
| 182 |
+
[14] K. He, G. Gkioxari, P. Dollár, and R. Girshick. Mask r-cnn. In ICCV, pages 2961–2969, 2017.
|
| 183 |
+
[15] M. Khodabandeh, A. Vahdat, M. Ranjbar, and W. G. Macready. A robust learning approach to domain adaptive object detection. In ICCV, pages 480–490, 2019.
|
| 184 |
+
[16] H. Law and J. Deng. Cornernet: Detecting objects as paired keypoints. In ECCV, pages 734–750, 2018.
|
| 185 |
+
[17] H. Li, T. Fu, J. Dai, H. Li, G. Huang, and X. Zhu. Autoloss-zero: Searching loss functions from scratch for generic tasks. arXiv preprint arXiv:2103.14026, 2021.
|
| 186 |
+
[18] H. Li, C. Tao, X. Zhu, X. Wang, G. Huang, and J. Dai. Auto seg-loss: Searching metric surrogates for semantic segmentation. arXiv preprint arXiv:2010.07930, 2020.
|
| 187 |
+
[19] H. Li, Z. Wu, C. Zhu, C. Xiong, R. Socher, and L. S. Davis. Learning from noisy anchors for one-stage object detection. In CVPR, pages 10588–10597, 2020.
|
| 188 |
+
[20] J. Li, C. Xiong, R. Socher, and S. Hoi. Towards noise-resistant object detection with noisy annotations. arXiv preprint arXiv:2003.01285, 2020.
|
| 189 |
+
[21] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár. Focal loss for dense object detection. In ICCV, pages 2980–2988, 2017.
|
| 190 |
+
[22] T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In ECCV, pages 740–755. Springer, 2014.
|
| 191 |
+
[23] P. Liu, G. Zhang, B. Wang, H. Xu, X. Liang, Y. Jiang, and Z. Li. Loss function discovery for object detection via convergence-simulation driven search. arXiv preprint arXiv:2102.04700, 2021.
|
| 192 |
+
[24] W. Liu, D. Anguelov, D. Erhan, C. Szegedy, S. Reed, C.-Y. Fu, and A. C. Berg. Ssd: Single shot multibox detector. In ECCV, pages 21–37. Springer, 2016.
|
| 193 |
+
[25] X. Ma, H. Huang, Y. Wang, S. Romano, S. Erfani, and J. Bailey. Normalized loss functions for deep learning with noisy labels. In ICML, pages 6543–6553. PMLR, 2020.
|
| 194 |
+
[26] X. Ma, Y. Wang, M. E. Houle, S. Zhou, S. Erfani, S. Xia, S. Wijewickrema, and J. Bailey. Dimensionality-driven learning with noisy labels. In ICML, pages 3355–3364. PMLR, 2018.
|
| 195 |
+
[27] N. Natarajan, I. S. Dhillon, P. K. Ravikumar, and A. Tewari. Learning with noisy labels. NeurIPS, 26:1196–1204, 2013.
|
| 196 |
+
[28] M. A. Rahman and Y. Wang. Optimizing intersection-over-union in deep neural networks for image segmentation. In ISVC, pages 234–244. Springer, 2016.
|
| 197 |
+
[29] J. Redmon and A. Farhadi. Yolo9000: better, faster, stronger. In CVPR, pages 7263–7271, 2017.
|
| 198 |
+
[30] J. Redmon and A. Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
|
| 199 |
+
[31] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. arXiv preprint arXiv:1506.01497, 2015.
|
| 200 |
+
[32] H. Rezatofighi, N. Tsoi, J. Gwak, A. Sadeghian, I. Reid, and S. Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In CVPR, pages 658–666, 2019.
|
| 201 |
+
[33] G. Song, Y. Liu, and X. Wang. Revisiting the sibling head in object detector. In CVPR, pages 11563–11572, 2020.
|
| 202 |
+
[34] Z. Tian, C. Shen, H. Chen, and T. He. Fcos: Fully convolutional one-stage object detection. In ICCV, pages 9627–9636, 2019.
|
| 203 |
+
[35] L. Tychsen-Smith and L. Petersson. Improving object localization with fitness nms and bounded iou loss. In CVPR, pages 6877–6885, 2018.
|
| 204 |
+
[36] K. Wang and L. Zhang. Single-shot two-pronged detector with rectified iou loss. In Proceedings of the 28th ACM International Conference on Multimedia, pages 1311–1319, 2020.
|
| 205 |
+
[37] Y. Wang, X. Ma, Z. Chen, Y. Luo, J. Yi, and J. Bailey. Symmetric cross entropy for robust learning with noisy labels. In ICCV, pages 322–330, 2019.
|
| 206 |
+
[38] Z. Wang, L. Liu, and D. Tao. Deep streaming label learning. In ICML, pages 9963–9972. PMLR, 2020.
|
| 207 |
+
[39] J. Yu, Y. Jiang, Z. Wang, Z. Cao, and T. Huang. Unitbox: An advanced object detection network. In Proceedings of the 24th ACM international conference on Multimedia, pages 516–520, 2016.
|
| 208 |
+
[40] S. Zhang, C. Chi, Y. Yao, Z. Lei, and S. Z. Li. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection. In CVPR, pages 9759–9768, 2020.
|
| 209 |
+
[41] Y.-F. Zhang, W. Ren, Z. Zhang, Z. Jia, L. Wang, and T. Tan. Focal and efficient iou loss for accurate bounding box regression. arXiv preprint arXiv:2101.08158, 2021.
|
| 210 |
+
[42] Z. Zhang and M. R. Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In NeurIPS, 2018.
|
| 211 |
+
[43] Z. Zheng, P. Wang, W. Liu, J. Li, R. Ye, and D. Ren. Distance-iou loss: Faster and better learning for bounding box regression. In AAAI, pages 12993–13000, 2020.
|
| 212 |
+
[44] X. Zhou, D. Wang, and P. Krähenbühl. Objects as points. arXiv preprint, arXiv:1904.07850, 2019.
|
| 213 |
+
[45] X. Zhou, J. Zhuo, and P. Krahenbuhl. Bottom-up object detection by grouping extreme and center points. In CVPR, pages 850–859, 2019.
|
| 214 |
+
[46] X. Zhu, W. Su, L. Lu, B. Li, X. Wang, and J. Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020.
|
md/train/rcQdycl0zyk/rcQdycl0zyk.md
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BEYOND FULLY-CONNECTED LAYERS WITH QUATERNIONS: PARAMETERIZATION OF HYPERCOMPLEX MULTIPLICATIONS WITH $1 / n$ PARAMETERS
|
| 2 |
+
|
| 3 |
+
Aston Zhang†, Yi Tay‡∗, Shuai Zhang, Alvin Chan/
|
| 4 |
+
Anh Tuan Luu/,◦, Siu Cheung $\mathbf { H u i } ^ { \mathrm { q } }$ , Jie $\mathbf { F u } ^ { \bullet }$
|
| 5 |
+
†Amazon Web Services AI
|
| 6 |
+
‡Google Research
|
| 7 |
+
ETH Zurich¨
|
| 8 |
+
/NTU, Singapore
|
| 9 |
+
◦VinAI
|
| 10 |
+
•Mila, Universite de Montr ´ eal ´
|
| 11 |
+
az@astonzhang.com
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Recent works have demonstrated reasonable success of representation learning in hypercomplex space. Specifically, “fully-connected layers with quaternions” (quaternions are 4D hypercomplex numbers), which replace real-valued matrix multiplications in fully-connected layers with Hamilton products of quaternions, both enjoy parameter savings with only $1 / 4$ learnable parameters and achieve comparable performance in various applications. However, one key caveat is that hypercomplex space only exists at very few predefined dimensions (4D, 8D, and 16D). This restricts the flexibility of models that leverage hypercomplex multiplications. To this end, we propose parameterizing hypercomplex multiplications, allowing models to learn multiplication rules from data regardless of whether such rules are predefined. As a result, our method not only subsumes the Hamilton product, but also learns to operate on any arbitrary $n \mathbf { D }$ hypercomplex space, providing more architectural flexibility using arbitrarily $1 / n$ learnable parameters compared with the fully-connected layer counterpart. Experiments of applications to the LSTM and transformer models on natural language inference, machine translation, text style transfer, and subject verb agreement demonstrate architectural flexibility and effectiveness of the proposed approach.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
A quaternion is a 4D hypercomplex number with one real component and three imaginary components. The Hamilton product is the hypercomplex multiplication of two quaternions. Recent works in quaternion space and Hamilton products have demonstrated reasonable success (Parcollet et al., 2018b; 2019; Tay et al., 2019). Notably, the Hamilton product enjoys a parameter saving with $1 / 4$ learnable parameters as compared with the real-valued matrix multiplication. It also enables effective representation learning by modeling interactions between real and imaginary components.
|
| 20 |
+
|
| 21 |
+
One of the attractive properties of quaternion models is its high applicability and universal usefulness to one of the most ubiquitous layers in deep learning, i.e., the fully-connected (or feedforward) layer. Specifically, “fully-connected layers with quaternions” replace real-valued matrix multiplications in fully-connected layers with Hamilton products of quaternions, enjoying parameter savings with only $1 / 4$ learnable parameters and achieving comparable performance with their fully-connected layer counterparts (Parcollet et al., 2018b; 2019; Tay et al., 2019).
|
| 22 |
+
|
| 23 |
+
The fully-connected layer is one of the most dominant components in existing deep learning literature (Goodfellow et al., 2016; Zhang et al., 2020). Its pervasiveness cannot be understated, given its centrality to many core building blocks in neural network research. Given widespread adoptions of fully-connected layers, e.g., within LSTM networks (Hochreiter & Schmidhuber, 1997) and transformer models (Vaswani et al., 2017), having flexibility to balance between parameter savings and effectiveness could be extremely useful to many real-world applications.
|
| 24 |
+
|
| 25 |
+
Unfortunately, hypercomplex space only exists at 4D (quaternions), 8D (octonions), and 16D (sedenions), which generalizes the 2D complex space (Rishiyur, 2006). Moreover, custom operators are required at each hypercomplex dimensionality. For instance, the Hamilton product is the hypercomplex multiplication in 4D hypercomplex space. Thus, no operator in such predefined hypercomplex space is suitable for applications that prefer reducing parameters to $1 / n$ , where $n \neq 4 , 8 , 1 6$ .
|
| 26 |
+
|
| 27 |
+
In view of the architectural limitation due to the very few choices of those existing hypercomplex space, we propose parameterization of hypercomplex multiplications, i.e., learning the real and imaginary component interactions from data in a differentiable fashion. Essentially, our method can operate on an arbitrary $n \mathbf { D }$ hypercomplex space, aside from subsuming those predefined hypercomplex multiplication rules, facilitating using up to arbitrarily $1 / n$ learnable parameters while maintaining expressiveness. In practice, the hyperparameter $n$ can be flexibly specified or tuned by users based on applications.
|
| 28 |
+
|
| 29 |
+
Concretely, our prime contribution is a new module that parameterizes and generalizes the hypercomplex multiplication by learning the real and imaginary component interactions, i.e., multiplication rules, from data. Our method, which we call the parameterized hypercomplex multiplication layer, is characterized by a sum of Kronecker products that generalize the vector outer products to higher dimensions in real space. To demonstrate applicability, we equip two well-established models (the LSTM and transformer) with our proposed method. We conduct extensive experiments on different tasks, i.e., natural language inference for LSTM networks and machine translation for transformer models. Additionally, we perform further experiments on text style transfer and subject verb agreement tasks. All in all, our method has demonstrated architectural flexibility through different experimental settings, where it generally can use a fraction of the learnable parameters with minimal degradation or slight improvement in performance.
|
| 30 |
+
|
| 31 |
+
The overall contributions of this work are summarized as follows:
|
| 32 |
+
|
| 33 |
+
We propose a new parameterization of hypercomplex multiplications: the parameterized hypercomplex multiplication (PHM) layer. This layer has $1 / n$ learnable parameters compared with the fully-connected layer counterpart, where $n$ can be flexibly specified by users. The key idea behind PHM layers is to learn the interactions between real and imaginary components, i.e., multiplication rules, from data using a sum of Kronecker products. We demonstrate the applicability of the PHM layers by leveraging them in two dominant neural architectures: the LSTM and transformer models. We empirically show architectural flexibility and effectiveness of PHM layers by conducting extensive experiments on five natural language inference tasks, seven machine translation datasets, together with text style transfer and subject verb agreement tasks.
|
| 34 |
+
|
| 35 |
+
# 2 BACKGROUND ON QUATERNIONS AND HAMILTON PRODUCTS
|
| 36 |
+
|
| 37 |
+
We begin by introducing the background for the rest of the paper. Concretely, we describe quaternion algebra along with Hamilton products, which is at the heart of our proposed approach.
|
| 38 |
+
|
| 39 |
+
Quaternion A quaternion $Q \in \mathbb { H }$ is a hypercomplex number with one real component and three imaginary components as follows:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
Q = Q _ { r } + Q _ { x } { \bf i } + Q _ { y } { \bf j } + Q _ { z } { \bf k } ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
whereby $\mathbf { i j k } = \mathbf { i } ^ { 2 } = \mathbf { j } ^ { 2 } = \mathbf { k } ^ { 2 } = { \mathbf { - } } 1$ . In (2.1), noncommutative multiplication rules hold: $\mathbf { i } \mathbf { j } =$ $\mathbf { k } , \mathbf { j } \mathbf { k } = \mathbf { i } , \mathbf { k } \mathbf { i } = \mathbf { j } , \mathbf { j } \mathbf { i } = - \mathbf { k } , \mathbf { k } \mathbf { j } = - \mathbf { i } , \mathbf { i } \mathbf { k } = - \mathbf { j } .$ Here, $Q _ { r }$ is the real component, $Q _ { x } , Q _ { y } , Q _ { z }$ are real numbers that represent the imaginary components of the quaternion $Q$ .
|
| 46 |
+
|
| 47 |
+
Addition The addition of two quaternions is defined as
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
Q + P = Q _ { r } + P _ { r } + ( Q _ { x } + P _ { x } ) \mathbf { i } + ( Q _ { y } + P _ { y } ) \mathbf { j } + ( Q _ { z } + P _ { z } ) \mathbf { k } ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
here $Q$ and $P$ with subscripts denote the real and imaginary components of quaternions $Q$ and
|
| 54 |
+
|
| 55 |
+
Scalar Multiplication Any scalar $\alpha$ multiplies across all the components:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\alpha Q = \alpha Q _ { r } + \alpha Q _ { x } { \bf i } + \alpha Q _ { y } { \bf j } + \alpha Q _ { z } { \bf k } .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
Hamilton Product The Hamilton product, which represents the multiplication of two quaternions $Q$ and $P$ , is defined as
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\begin{array} { r l } & { Q \otimes P = ( Q _ { r } P _ { r } - Q _ { x } P _ { x } - Q _ { y } P _ { y } - Q _ { z } P _ { z } ) + ( Q _ { x } P _ { r } + Q _ { r } P _ { x } - Q _ { z } P _ { y } + Q _ { y } P _ { z } ) \mathbf { i } } \\ & { \qquad + ( Q _ { y } P _ { r } + Q _ { z } P _ { x } + Q _ { r } P _ { y } - Q _ { x } P _ { z } ) \mathbf { j } + ( Q _ { z } P _ { r } - Q _ { y } P _ { x } + Q _ { x } P _ { y } + Q _ { r } P _ { z } ) \mathbf { k } . } \end{array}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
The multiplication rule in (2.2) forges interactions between real and imaginary components of $Q$ and $P$ . The benefits of Hamilton products have been demonstrated in recent works where the matrix multiplication in fully-connected layers is replaced with the Hamilton product: this reduces $7 5 \%$ parameters with comparable performance (Parcollet et al., 2018b; 2019; Tay et al., 2019).
|
| 68 |
+
|
| 69 |
+
# 3 PARAMETERIZATION OF HYPERCOMPLEX MULTIPLICATIONS
|
| 70 |
+
|
| 71 |
+
The following introduces our proposed parameterized hypercomplex multiplication layer and elaborates on how it parameterizes and generalizes multiplications in hypercomplex space, such as subsuming the multiplication rules of Hamilton products in (2.2).
|
| 72 |
+
|
| 73 |
+
# 3.1 FULLY-CONNECTED (FC) LAYERS
|
| 74 |
+
|
| 75 |
+
Before we delve into our proposed method, recall the fully-connected (FC) layer that transforms an input $\mathbf { x } \in \mathbb { R } ^ { d }$ into an output $\mathbf { \hat { y } } \in \mathbb { R } ^ { k }$ by
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\begin{array} { r } { \mathbf { y } = \operatorname { F C } ( \mathbf { x } ) = \mathbf { W } \mathbf { x } + b , } \end{array}
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where the weight matrix of parameters $\mathbf { W } \in \mathbb { R } ^ { k \times d }$ and the bias vector of parameters $\mathbf { b } \in \mathbb { R } ^ { k }$ . The FC layer in (3.1) is fundamental to many modern and traditional neural network architectures. Note that the degree of freedom for the weight parameters $\mathbf { W }$ in (3.1) is $k d$ . Since W dominates parameterization, the parameter size of the FC layer in (3.1) is $\mathcal { O } ( k d )$ .
|
| 82 |
+
|
| 83 |
+
# 3.2 PARAMETERIZED HYPERCOMPLEX MULTIPLICATION (PHM) LAYERS
|
| 84 |
+
|
| 85 |
+
We propose the parameterized hypercomplex multiplication (PHM) layer that transforms an input $\mathbf { x }$ into an output y by
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\mathbf { y } = \mathbf { P H M } ( \mathbf { x } ) = \mathbf { H x } + b ,
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where the same notation from (3.1) is used but the replaced parameter $\mathbf { H } \in \mathbb { R } ^ { k \times d }$ is constructed by a sum of Kronecker products. For context, the Kronecker product is a generalization of the vector outer product to higher dimensions in real space. For any matrix $\mathbf { X } \in \mathbb { R } ^ { m \times n }$ and $\mathbf { Y } \in \mathbb { R } ^ { p \times q }$ , the Kronecker product $\mathbf { X } \otimes \mathbf { Y }$ is a block matrix:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\mathbf { X } \otimes \mathbf { Y } = \left[ \overset { x _ { 1 1 } \mathbf { Y } } { \mathop { : } } \quad \cdots \quad \overset { x _ { 1 n } \mathbf { Y } } { \mathop { : } } \right] \in \mathbb { R } ^ { m p \times n q } ,
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $x _ { i j }$ is the element of $\mathbf { X }$ at its $i ^ { \mathrm { { t h } } }$ row and $j ^ { \mathrm { t h } }$ column. Note that the symbol $\otimes$ between two matrices is the Kronecker product while the same symbol between two quaternions means the Hamilton product.
|
| 98 |
+
|
| 99 |
+
Now let us revisit (3.2) to explain $\mathbf { H }$ . Suppose that both $k$ and $d$ are divisible by a user-defined hyperparameter $n \in \mathbb { Z } _ { > 0 }$ . For $i = 1 , \ldots , n$ , denote by each parameter matrix $\mathbf { A } _ { i } \in \mathbb { R } ^ { n \times n }$ and $\mathbf { S } _ { i } \in \mathbb { R } ^ { \frac { k } { n } \times \frac { d } { n } }$ . The parameter $\mathbf { H }$ in (3.2) is a sum of $n$ Kronecker products:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\mathbf { H } = \sum _ { i = 1 } ^ { n } \mathbf { A } _ { i } \otimes \mathbf { S } _ { i } .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
Figure 1: Illustration of the PHM layer. It uses a sum of Kronecker products of matrices $\mathbf { A } _ { i }$ and $\mathbf { S } _ { i }$ $( i = 1 , 2 )$ ) to construct $\mathbf { H }$ in (3.2) (here $n = 2 , k = 6 , d = 8 )$ . Best viewed in color.
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 2: PHM layers can learn to perform rotations in 3D real space and Hamilton products in quaternion space on artificial datasets.
|
| 110 |
+
|
| 111 |
+
As illustrated in Figure 1, it is the parameter matrices $\mathbf { A } _ { i }$ and $\mathbf { S } _ { i }$ $( i = 1 , \ldots , n )$ that determine the degree of freedom for $\mathbf { H }$ , which is $\bar { k } d / n + n ^ { 3 }$ . Since H dominates parameterization, the parameter size of the PHM in (3.2) is $\mathcal { O } ( k d / n )$ , where $k d \gtrapprox n ^ { 4 }$ is assumed: this condition is mild for realworld problems, such as in our experiments (e.g., $d = 5 1 2$ , $k = 2 0 4 8$ , $n = 2 , 4 , 8 , 1 6 )$ ). Thus, for the same input and output sizes, the parameter size of a PHM layer is approximately $1 / n$ of that of an FC layer under mild assumptions.
|
| 112 |
+
|
| 113 |
+
The benefit of parameterization reduction of PHM layers is due to reusing elements of both parameter matrices $\mathbf { A } _ { i }$ and $\mathbf { S } _ { i }$ in the Kronecker product. As an alternative perspective, we can equivalently reconstruct $\mathbf { H }$ in (3.3) by reusing parameter matrices in real-valued matrix multiplications, followed by more operations. Due to limited space, this more complicated perspective is offered in Appendix A. Though simply setting $\mathbf { H } = \mathbf { A } _ { 1 } \otimes \mathbf { S } _ { 1 }$ can further save parameters, it does not generalize hypercomplex multiplications hence is out of scope.
|
| 114 |
+
|
| 115 |
+
To show that PHM layers can learn to perform pre-defined multiplication-related operations in practice, we perform experiments to learn rotations in 3D real space using the PHM layer. Using a rotation matrix $\mathbf { W } \in \mathbb { R } ^ { 3 \times 3 }$ we create an artificial dataset $\{ ( \mathbf { x } _ { i } \mathbf { \bar { \epsilon } } ) \mathbf { R } ^ { 3 } , \mathbf { y } _ { i } \mathbf { \bar { \epsilon } } \mathbb { R } ^ { 3 } ) \}$ , where $\mathbf { y } _ { i }$ is generated via the 3D rotation of the input: $\mathbf { y } _ { i } = \mathbf { W } \mathbf { x } _ { i }$ . Figure 2(a) shows that the loss converges to zero: the PHM layer can learn a single rotation of an object in 3D real space.
|
| 116 |
+
|
| 117 |
+
In the following, we show how the proposed PHM layer subsumes and generalizes both hypercomplex multiplications and real-valued matrix multiplications.
|
| 118 |
+
|
| 119 |
+
# 3.3 SUBSUMING HYPERCOMPLEX MULTIPLICATIONS
|
| 120 |
+
|
| 121 |
+
First, we explore how the PHM layer connects to the hypercomplex multiplication. For the sake of illustration, let us take the Hamilton product of two quaternions $Q$ and $P$ in (2.2) as an example,
|
| 122 |
+
|
| 123 |
+
which can be rewritten as
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\left[ { \begin{array} { c c c c } { Q _ { r } } & { - Q _ { x } } & { - Q _ { y } } & { - Q _ { z } } \\ { Q _ { x } } & { Q _ { r } } & { - Q _ { z } } & { Q _ { y } } \\ { Q _ { y } } & { Q _ { z } } & { Q _ { r } } & { - Q _ { x } } \\ { Q _ { z } } & { - Q _ { y } } & { Q _ { x } } & { Q _ { r } } \end{array} } \right] \left[ { \begin{array} { c } { P _ { r } } \\ { P _ { x } } \\ { P _ { y } } \\ { P _ { z } } \end{array} } \right] ,
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
where the 4 output elements are the real values for the quaternion unit basis $[ 1 , \mathbf { i } , \mathbf { j } , \mathbf { k } ] ^ { \top }$ . Note that for models leveraging Hamilton products of quaternions (Parcollet et al., 2018b; 2019; Tay et al., 2019), the components $Q _ { r } , Q _ { x } , Q _ { y } , Q _ { z }$ of (3.4) are learnable parameters while the components $P _ { r } , P _ { x } , P _ { y } , P _ { z }$ are the layer inputs. In practice, such a layer usually has more than 4 inputs $( d > 4 )$ . To apply the Hamilton product, all the inputs are evenly split into 4 segments $( P _ { r } , P _ { x } , P _ { y } , P _ { z } )$ of the right input vector of (3.4). Then each component in the left matrix of (3.4) can be a block matrix (i) where all the elements take the same value; (ii) whose shape is aligned with the input length $d$ and the output length $k$ of the layer. It is noteworthy that the left $4 \times 4$ matrix of (3.4) can be rewritten as a sum of 4 Kronecker products:
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
|
| 133 |
+
According to (3.5), when $n = 4$ , the PHM layer can be learned to express the Hamilton product of quaternions. Specifically, matrices $\mathbf { A } _ { 1 } , \dotsc , \mathbf { A } _ { 4 }$ in (3.3) parameterize the four matrices composed of $- 1 , 0 , 1$ in (3.5) that reflect interactions between real and imaginary components of quaternions, which are the rule of Hamilton products. The single-element “matrices” $\mathbf { S } _ { 1 } , \ldots , \mathbf { S } _ { 4 }$ in (3.3) are equal to the learnable components $Q _ { r } , Q _ { x } , Q _ { y } , Q _ { z }$ in (3.4). Figure 2(b) shows that PHM layers can learn the rule of Hamilton products on artificial data. Likewise, hypercomplex multiplications of octonions or sedenions can also be learned by the PHM layer when $n$ is set to 8 or 16.
|
| 134 |
+
|
| 135 |
+
# 3.4 SUBSUMING REAL-VALUED MATRIX MULTIPLICATIONS
|
| 136 |
+
|
| 137 |
+
Next, we show how the PHM layer subsumes the matrix multiplication in real space. In other words, the PHM layer is a generalization of the FC layer via the hyperparameter $n$ . To explain, referring to (3.2), when $n = 1$ , $\mathbf { \bar { H } } = \mathbf { A _ { 1 } } \otimes \mathbf { S } _ { 1 } = a \mathbf { S } _ { 1 }$ , where the scalar $a$ is the single element of the $1 \times 1$ matrix ${ \bf A } _ { 1 }$ and $\mathbf { S } _ { 1 } \in \mathbb { R } ^ { k \times d }$ . Since learning $a$ and $\mathbf { S } _ { 1 }$ separately is equivalent to learning their multiplication jointly, scalar $a$ can be dropped, which is learning the single weight matrix in an FC layer. Therefore, a PHM layer is degenerated to an FC layer when $n = 1$ .
|
| 138 |
+
|
| 139 |
+
# 3.5 GENERALIZING HYPERCOMPLEX MULTIPLICATIONS
|
| 140 |
+
|
| 141 |
+
Though parameter reusing by component-wise partitioning in quaternion space has demonstrated success (Parcollet et al., 2018b; Zhu et al., 2018; Parcollet et al., 2019; Tay et al., 2019), one key problem is that hypercomplex space only exists at very few predefined dimensionalities, such as 4D (quaternions), 8D (octonions), and 16D (sedenions). Within the context of hypercomplex space, specialized multiplication rules, such as the Hamilton product, have to be devised and encoded in the network as a fixed inductive bias. As described in Section 1, the very few choices over existing hypercomplex space restricts the flexibility of networks that leverage hypercomplex multiplication.
|
| 142 |
+
|
| 143 |
+
In sharp contrast to relying on predefined mathematical rules over limited dimensionality choices, the PHM layer treats the dimensionality $n$ (number of Kronecker products) as a tunable hyperparameter and learns such specialized multiplication rules from data, as manifested in the parameterized matrices $\mathbf { A } _ { i }$ $( i = 1 , \ldots , n )$ in (3.3). On one hand, the PHM layer can express hypercomplex multiplications when $\mathbf { A } _ { i }$ are set to reflect those predefined multiplication rules in hypercomplex space. On the other hand, the PHM layer can be seen as a trainable and parameterized form of $n \mathbf { D }$ hypercomplex multiplications, where $n$ can be values other than 4, 8, or 16. Thus, the PHM layer generalizes multiplications in hypercomplex space. Since $n$ can be 1, the PHM layer also offers a neat way to bridging multiplication between both real space and hypercomplex space.
|
| 144 |
+
|
| 145 |
+
# 4 NEURAL MODELS WITH PHM LAYERS
|
| 146 |
+
|
| 147 |
+
To demonstrate the applicability of the PHM layers, we develop the PHM-LSTM and PHMtransformer by equipping two popular neural network models, LSTMs and transformers, with PHM layers.
|
| 148 |
+
|
| 149 |
+
# 4.1 PHM-LSTM
|
| 150 |
+
|
| 151 |
+
Recurrent neural networks such as LSTMs (Hochreiter & Schmidhuber, 1997) are gated recurrent networks where the gating functions are parameterized by linear transformations. We introduce the PHM-LSTM, which replaces such linear transformations in LSTMs with PHM layers:
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\begin{array} { r } { \mathbf { y } _ { t } = \mathrm { P H M } \left( \mathbf { x } _ { t } \right) + \mathrm { P H M } \left( \mathbf { h } _ { t - 1 } \right) + b } \\ { \mathbf { f } _ { t } , \mathbf { i } _ { t } , \mathbf { o } _ { t } , \mathbf { x } _ { t } ^ { \prime } = \phi ( \mathbf { y } _ { t } ) \qquad } \\ { \mathbf { c } _ { t } = \sigma _ { s } ( \mathbf { f } _ { t } ) \mathbf { c } _ { t - 1 } + \sigma _ { s } ( \mathbf { i } _ { t } ) \sigma _ { t } ( \mathbf { x } _ { t } ^ { \prime } ) \qquad } \\ { \mathbf { h } _ { t } = \mathbf { o } _ { t } \odot \mathbf { c } _ { t } , \qquad } \end{array}
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
where $\sigma _ { s }$ is the sigmoid activation function, $\sigma _ { t }$ is the tanh activation function, $\phi : \mathbb { R } ^ { 1 \times d } \mathbb { R } ^ { 4 \times \frac { d } { 4 } }$ is a four-way split on the last dimension, and $\mathbf { c } _ { t } , \mathbf { h } _ { t }$ are the cell state and the hidden state of the PHM-LSTM unit at any time step $t$ .
|
| 158 |
+
|
| 159 |
+
# 4.2 PHM-TRANSFORMER
|
| 160 |
+
|
| 161 |
+
The transformer is a stacked neural network architecture that aggressively exploits linear transformations (Vaswani et al., 2017). Each self-attention layer comprises of $\mathbf { Q }$ (query), K (key), V (value) linear transformations, along with multiple heads. Each transformer block also has a position-wise feed-forward network composed of two FC layers. Since a large majority of the transformer parameters stem from linear transformations or FC layers, we introduce the PHM-transformer to replace all the linear transformations or FC layers with PHM layers. The single-head self-attention module is rewritten as:
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\begin{array} { r l } { { \mathbf { Q } , \mathbf { K } , \mathbf { V } = \Phi ( \mathrm { P H M } ( \mathbf { X } ) ) } } \\ & { \quad \quad \quad \mathbf { A } = \mathrm { s o f t m a x } ( \frac { \mathbf { Q } \mathbf { K } ^ { \top } } { \sqrt { d _ { k } } } ) \mathbf { V } , } \end{array}
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
where $d _ { k }$ is the key dimension, $\Phi : \mathbb { R } ^ { 1 \times d } \mathbb { R } ^ { 3 \times \frac { d } { 3 } }$ is a three-way split on the last dimension, $\mathbf { X }$ is the input sequence, and $\mathbf { A }$ is the self-attentive representation. For multi-head attention, using PHM layers also enables weight sharing not only among the linear transformations of $\mathbf { Q } , \mathbf { K } , \mathbf { V }$ but also among the linear transformation of multiple heads:
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
\mathbf { X } = \mathrm { P H M } ( [ \mathbf { H } _ { 1 } ; \ldots ; \mathbf { H } _ { N _ { h } } ] ) ,
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
where $N _ { h }$ is the number of heads and $( ; )$ is the column-wise concatenation. Finally, the position-wise feed-forward network is now defined as
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
\mathbf { Y } = \operatorname { P H M } ( \operatorname { R e L U } ( \operatorname { P H M } ( \mathbf { X } ) ) ) ,
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
which transforms $\mathbf { X }$ with two PHM layers.
|
| 180 |
+
|
| 181 |
+
# 5 EXPERIMENTS
|
| 182 |
+
|
| 183 |
+
For context, in the field of representation learning using hypercomplex multiplications, quaternion convolutional neural networks (Zhu et al., 2018), quaternion recurrent neural networks (Parcollet et al., 2018a), and quaternion transformers (Tay et al., 2019) have all compared themselves with only real-valued counterparts. Therefore, to be consistent with the rest of the literature, we evaluate PHM-LSTMs and PHM-transformers that are equipped with PHM layers, and compare them with quaternion LSTMs, quaternion transformers, real-valued LSTMs, or real-valued transformers. Both quaternion LSTMs and quaternion transformers replace linear transformations with Hamilton products of quaternions.
|
| 184 |
+
|
| 185 |
+
Table 1: Experimental results of natural language inference (accuracy) on five different datasets. The PHM-LSTM reduces the parameters of the standard LSTM model and improves or partially matches performance on four out of five datasets.
|
| 186 |
+
|
| 187 |
+
<table><tr><td>Model</td><td>#Params</td><td>MNLI</td><td>QNLI</td><td>SNLI</td><td>DNLI</td><td>SciTail</td></tr><tr><td>LSTM</td><td>721K 180K (-75.0%)</td><td>71.82 /71.89</td><td>84.44</td><td>84.18</td><td>85.16</td><td>74.36</td></tr><tr><td>Quaternion LSTM</td><td></td><td>71.57 / 72.19</td><td>84.73</td><td>84.21</td><td>86.45</td><td>75.58</td></tr><tr><td>PHM-LSTM (n = 2)</td><td>361K (-49.9%)</td><td>71.82 / 72.08</td><td>84.39</td><td>84.38</td><td>85.77</td><td>77.47</td></tr><tr><td>PHM-LSTM(n = 5)</td><td>146K (-79.7%)</td><td>71.80 /71.77</td><td>83.87</td><td>84.58</td><td>86.47</td><td>74.64</td></tr><tr><td>PHM-LSTM (n = 10)</td><td>81K (-88.7%)</td><td>71.59 / 71.59</td><td>84.25</td><td>84.40</td><td>86.21</td><td>77.84</td></tr></table>
|
| 188 |
+
|
| 189 |
+
To demonstrate the architectural flexibility and effectiveness, we evaluate different settings of PHMLSTMs and PHM-transformers to show that allowing for flexible choices of the hyperparameter $n$ in the PHM layer may lead to more effective performance. Details of the setup for the experiments are provided in Appendix B.
|
| 190 |
+
|
| 191 |
+
# 5.1 NATURAL LANGUAGE INFERENCE
|
| 192 |
+
|
| 193 |
+
The task of natural language inference is to determine the logical relationship between two text sequences (MacCartney, 2009). It is a fundamental task pertaining to language understanding. To this end, they serve as a suitable benchmark for evaluating recurrent models.
|
| 194 |
+
|
| 195 |
+
We run experiments on five datasets: (i) MultiNLI (Williams et al., 2017), (ii) QNLI (Quora) (Wang et al., 2017), (iii) SNLI (Bowman et al., 2015), (iv) Dialogue NLI (Welleck et al., 2018), and (v) SciTail (Science Entailment) (Khot et al., 2018). Table 1 reports the results on all these datasets. All in all, such results show that the PHM layer can not only reduce the parameters but also improve performance with flexible choices of $n$ (four out of five datasets show reasonable improvement or partially match). The only exception is on the QNLI dataset, where the performance drop is marginal $( < 1 \% )$ ). This is still decent considering the parameter saving: the parameterization cost of the PHM-LSTM is in the order of $\mathcal { O } ( 1 / n )$ of that of the standard LSTM, where settings of $n = 5$ and $n = 1 0$ do not take values of power of 2. As detailed in Appendix B, since we use the 300D GloVe (Pennington et al., 2014) embeddings to represent input tokens, we choose multiples of 5 instead of 4 for ease of divisibility. It is also noteworthy that on the SNLI, Dialogue NLI, and SciTail datasets, all the PHM-LSTM variants outperform the standard LSTM model. We think that the element reusing properties of the Kronecker product operation, in addition to learning to share such reused components amongst recurrent gating functions, may contribute to both effective and efficient representations.
|
| 196 |
+
|
| 197 |
+
# 5.2 MACHINE TRANSLATION
|
| 198 |
+
|
| 199 |
+
Machine translation is concerned with translating between source-target language pairs. To this end, sequence transduction models are central to this problem domain. In this experiment, the key goal is to compare PHM-transformers against the standard and quaternion transformer models.
|
| 200 |
+
|
| 201 |
+
We run experiments on seven datasets: (i) IWSLT’15 English-Vietnamese (En-Vi), (ii) IWSLT’17 English-Indonesian (En-Id), (iii) IWSLT’14 German-English (De-En), (iv) IWSLT’14 RomanianEnglish (Ro-En), (v) WMT’18 English-Estonian (En-Et), (vi) Setimes English-Macedonian (EnMk), and (vii) WMT’18 English-Romanian (En-Ro).
|
| 202 |
+
|
| 203 |
+
Table 2 reports our results of the machine translation tasks. Overall, these empirical results with different settings demonstrate architectural flexibility and effectiveness of the hypercomplex multiplication parameterization. First and foremost, across six out of seven benchmarks, the PHMtransformer at $n = 4$ makes reasonable gains over the quaternion transformer, signifying that parameterization of hypercomplex multiplications by learning from data can be more effective than predefining Hamilton product rules mathematically. Second, though increasing $n$ leads to more parameter savings, we observe that increasing $n$ all the way to 16 does not cause significant degradation in performance on datasets such as En-Vi. Third, for most datasets, even with significant parameter savings, we find that the decrease in the BLEU score is mostly manageable $\approx 1 - 3$ BLEU points). However, we also note a rare occurrence where $n = 1 6$ results in a significant decrease in the BLEU score, such as on the En-Id dataset. Fourth, on several datasets, the PHM-transformer model improves the performance of the standard transformer model. For example, on datasets such as $\mathrm { E n - V i }$ and En-Et, the PHM-transformer model enjoys a performance boost of about 0.8 BLEU point with $n = 2$ . Finally, by re-scaling with a factor of 2 (doubling the hidden size), we are able to improve the performance on three datasets: En-Vi, En-Id, and En-Mk.
|
| 204 |
+
|
| 205 |
+
Table 2: Experimental results of machine translation (BLEU) on seven different datasets. Symbol $\dagger$ represents re-scaling the parameters with a factor of 2 by doubling the hidden size. The PHMtransformer does not lose much performance despite enjoying parameter savings. Re-scaling can lead to improvement in performance.
|
| 206 |
+
|
| 207 |
+
<table><tr><td>Model</td><td>#Params</td><td>En-Vi</td><td>En-Id</td><td>De-En</td><td>Ro-En</td><td>En-Et</td><td>En-Mk</td><td>En-Ro</td></tr><tr><td>Transformer (Tm)</td><td>44M</td><td>28.43</td><td>47.40</td><td>36.68</td><td>34.60</td><td>14.17</td><td>13.96</td><td>22.79</td></tr><tr><td>Quaternion Tm</td><td>11M (-75.0%)</td><td>28.00</td><td>42.22</td><td>32.83</td><td>30.53</td><td>13.10</td><td>13.67</td><td>18.50</td></tr><tr><td>PHM-Tm n = 2</td><td>22M (-50.0%)</td><td>29.25</td><td>46.32</td><td>35.52</td><td>33.40</td><td>14.98</td><td>13.60</td><td>21.73</td></tr><tr><td>PHM-Tm n = 4</td><td>11M (-75.0%)</td><td>29.13</td><td>44.13</td><td>35.53</td><td>32.74</td><td>14.11</td><td>13.01</td><td>21.19</td></tr><tr><td>PHM-Tm n =8</td><td>5.5M (-87.5%)</td><td>29.34</td><td>40.81</td><td>34.16</td><td>31.88</td><td>13.08</td><td>12.95</td><td>21.66</td></tr><tr><td>PHM-Tm n = 16</td><td>2.9M (-93.4%)</td><td>29.04</td><td>33.48</td><td>33.89</td><td>31.53</td><td>12.15</td><td>11.97</td><td>19.63</td></tr><tr><td>PHM-Tm+ n =2</td><td>44M</td><td>29.54</td><td>49.05</td><td>34.32</td><td>33.88</td><td>14.05</td><td>14.41</td><td>22.18</td></tr><tr><td>PHM-Tm+ n=4</td><td>22M (-50.0%)</td><td>29.17</td><td>46.24</td><td>34.86</td><td>33.80</td><td>14.43</td><td>13.78</td><td>21.91</td></tr><tr><td>PHM-Tm+ n=8</td><td>11M (-75.0%)</td><td>29.47</td><td>43.49</td><td>34.71</td><td>32.59</td><td>13.75</td><td>13.78</td><td>21.43</td></tr></table>
|
| 208 |
+
|
| 209 |
+
Table 3: Training time (seconds per 100 steps) and inference time (seconds to decode test sets) with beam size of 4 and length penalty of 0.6 on the IWSLT’14 German-English dataset.
|
| 210 |
+
|
| 211 |
+
<table><tr><td>Model</td><td>Transformer (Tm)</td><td>Quaternion Tm</td><td>PHM-Tm (n = 4)</td><td>PHM-Tm (n = 8)</td></tr><tr><td>Training time</td><td>7.61</td><td>8.11</td><td>7.92</td><td>7.70</td></tr><tr><td>Inference time</td><td>336</td><td>293</td><td>299</td><td>282</td></tr></table>
|
| 212 |
+
|
| 213 |
+
Table 3 reports the training and inference time for transformer variants. We observe that the PHMtransformer with $n = 8$ has the fastest inference speed amongst all the variants, primarily due to a significant reduction of parameters. All in all, the training speed is also approximately comparable. This ascertains that the PHM layer does not increase much computational cost in practice.
|
| 214 |
+
|
| 215 |
+
# 5.3 TEXT STYLE TRANSFER
|
| 216 |
+
|
| 217 |
+
We continue to experiment with sequence transduction for text style transfer. The goal of this task is to convert text of a certain style to another style. We use the Modern Shakespeare corpus1 in the experiments. Table 4 reports the results on this text style transfer task. We observe that the best performance is achieved with the PHM-transformer $( n = 4$ ). Notably, all except the $n = 1 6$ variant increases or matches the performance of the standard transformer model. This ascertains architectural flexibility and effectiveness of the proposed PHM layer. This not only enables parameter savings but also improves the performance of the transformer.
|
| 218 |
+
|
| 219 |
+
# 5.4 SUBJECT VERB AGREEMENT
|
| 220 |
+
|
| 221 |
+
We conduct additional experiments on the subject-verb agreement task (Linzen et al., 2016). The task predicts if the sentence, e.g., ‘The keys to the cabinet is followed by a plural or a singular. The used dataset can be found online (Linzen et al., 2016). Table 5 reports the results on the subject-verb agreement task. Results are promising, demonstrating that all variants with PHM layers outperform the standard and quaternion transformer models. The best performance peaks at $n = 8$ , despite a parameter saving to up to $1 / 8$ .
|
| 222 |
+
|
| 223 |
+
Table 4: Experimental results of text style transfer. The PHM-transformer may reduce the parameters of the standard transformer model and improve performance.
|
| 224 |
+
|
| 225 |
+
<table><tr><td>Model</td><td>#Params</td><td>BLEU</td></tr><tr><td>Transformer (Tm)</td><td>44M</td><td>11.65</td></tr><tr><td>PHM-Tm (n = 2) PHM-Tm (n = 4) PHM-Tm (n = 8)</td><td>22M (-50.0%) 11M (-75.0%) 5.5M (-87.5%) 2.9M (-93.4%)</td><td>12.20 12.42 11.66</td></tr></table>
|
| 226 |
+
|
| 227 |
+
Table 5: Experimental results of subject verb agreement. The PHM-transformer may reduce the parameters of the standard transformer model and improve performance.
|
| 228 |
+
|
| 229 |
+
<table><tr><td>Model</td><td>#Params</td><td>Acc</td></tr><tr><td>Transformer (Tm) Quaternion Tm</td><td>400K 100K</td><td>94.80 94.70</td></tr><tr><td>PHM-Tm (n = 2) PHM-Tm (n = 4) PHM-Tm (n = 8)</td><td>200K (-50.0%) 101K (-74.8%) 56K (-86.0%)</td><td>95.14 95.05 95.62</td></tr></table>
|
| 230 |
+
|
| 231 |
+
# 6 RELATED WORK
|
| 232 |
+
|
| 233 |
+
While neural networks have been a well-established line of research, progress on hypercomplex representations for deep learning is still in its infancy and most works on this topic are new (Gaudet & Maida, 2017; Parcollet et al., 2018a;b; Zhu et al., 2018; Tay et al., 2019). The hypercomplex Hamilton product provides a greater extent of expressiveness, similar to the complex multiplication, albeit with a 4-fold increase in interactions between real and imaginary components. In the case of quaternion representations, due to parameter savings in the Hamilton product, models also enjoy a $7 5 \%$ reduction in the parameter size (Parcollet et al., 2018a; Tay et al., 2019). A striking caveat is that all quaternions are fundamentally limited to 4D hypercomplex space, which restricts architectural flexibility. The other options would be to scale to octonion (8D) or sedenion (16D) space, given the predefined multiplication rules in such space. To the best of our knowledge, there is no work that attempts to generalize arbitrary $n \mathbf { D }$ hypercomplex multiplications to allow for architectural flexibility, where $n$ can be specified or tuned by users.
|
| 234 |
+
|
| 235 |
+
Our work can also be interpreted as a form of soft parameter sharing, albeit learned from data. Quaternion networks (Zhu et al., 2018; Parcollet et al., 2018b; 2019) are known to possess weight sharing properties via the Hamilton product operation and have demonstrated reasonable success despite having fewer parameters. To the best of our knowledge, there has been no work that attempts to parameterize the hypercomplex Hamilton product for neural networks, i.e., enabling end-to-end learning of real and imaginary component interactions from data.
|
| 236 |
+
|
| 237 |
+
# 7 CONCLUSION
|
| 238 |
+
|
| 239 |
+
We proposed parameterized hypercomplex multiplication (PHM) layers that learn and generalize hypercomplex multiplications. In practice, the PHM layer has $1 / n$ learnable parameters compared with the fully-connected layer counterpart, where $n$ can be flexibly specified by users. PHM layers are applicable to dominant models such as LSTMs and transformers. We evaluated these models equipped by PHM layers on comprehensive tasks to show architectural flexibility and effectiveness of the hypercomplex multiplication parameterization.
|
| 240 |
+
|
| 241 |
+
Acknowledgements. We thank the anonymous reviewers for the insightful comments on this paper. This work was partially supported by the Ministry of Education (MoE) of Singapore under the Academic Research Fund (AcRF) Tier 1 Grant RG135/18.
|
| 242 |
+
|
| 243 |
+
# REFERENCES
|
| 244 |
+
|
| 245 |
+
Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
|
| 246 |
+
|
| 247 |
+
Chase Gaudet and Anthony Maida. Deep quaternion networks. arXiv preprint arXiv:1712.04604, 2017.
|
| 248 |
+
|
| 249 |
+
Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org.
|
| 250 |
+
|
| 251 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 252 |
+
|
| 253 |
+
Tushar Khot, Ashish Sabharwal, and Peter Clark. Scitail: A textual entailment dataset from science question answering. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
|
| 254 |
+
|
| 255 |
+
Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. Assessing the ability of lstms to learn syntaxsensitive dependencies. Transactions of the Association for Computational Linguistics, 4:521– 535, 2016.
|
| 256 |
+
|
| 257 |
+
Bill MacCartney. Natural language inference. Citeseer, 2009.
|
| 258 |
+
|
| 259 |
+
Titouan Parcollet, Mirco Ravanelli, Mohamed Morchid, Georges Linares, Chiheb Trabelsi, Renato \` De Mori, and Yoshua Bengio. Quaternion recurrent neural networks. In International Conference on Learning Representations, 2018a.
|
| 260 |
+
|
| 261 |
+
Titouan Parcollet, Ying Zhang, Mohamed Morchid, Chiheb Trabelsi, Georges Linares, Renato \` De Mori, and Yoshua Bengio. Quaternion convolutional neural networks for end-to-end automatic speech recognition. arXiv preprint arXiv:1806.07789, 2018b.
|
| 262 |
+
|
| 263 |
+
Titouan Parcollet, Mohamed Morchid, and Georges Linares. Quaternion convolutional neural net- \` works for heterogeneous image processing. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 8514–8518. IEEE, 2019.
|
| 264 |
+
|
| 265 |
+
Ankur P Parikh, Oscar Tackstr ¨ om, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention ¨ model for natural language inference. arXiv preprint arXiv:1606.01933, 2016.
|
| 266 |
+
|
| 267 |
+
Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
|
| 268 |
+
|
| 269 |
+
Adityan Rishiyur. Neural networks with complex and quaternion inputs. arXiv preprint cs/0607090, 2006.
|
| 270 |
+
|
| 271 |
+
Yi Tay, Aston Zhang, Luu Anh Tuan, Jinfeng Rao, Shuai Zhang, Shuohang Wang, Jie Fu, and Siu Cheung Hui. Lightweight and efficient neural natural language processing with quaternion networks. arXiv preprint arXiv:1906.04393, 2019.
|
| 272 |
+
|
| 273 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 274 |
+
|
| 275 |
+
Zhiguo Wang, Wael Hamza, and Radu Florian. Bilateral multi-perspective matching for natural language sentences. arXiv preprint arXiv:1702.03814, 2017.
|
| 276 |
+
|
| 277 |
+
Sean Welleck, Jason Weston, Arthur Szlam, and Kyunghyun Cho. Dialogue natural language inference. arXiv preprint arXiv:1811.00671, 2018.
|
| 278 |
+
|
| 279 |
+
Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
|
| 280 |
+
|
| 281 |
+
Aston Zhang, Zachary C. Lipton, Mu Li, and Alexander J. Smola. Dive into Deep Learning. 2020. https://d2l.ai.
|
| 282 |
+
|
| 283 |
+
Xuanyu Zhu, Yi Xu, Hongteng Xu, and Changjian Chen. Quaternion convolutional neural networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 631–647, 2018.
|
| 284 |
+
|
| 285 |
+

|
| 286 |
+
Figure 3: Illustration of reconstructing $\mathbf { H }$ in (3.2) by reusing parameter matrices $\mathbf { B } _ { i }$ $( i \ = \ 1 , 2 )$ ) and $\mathbf { T } _ { j } ~ ( j ~ = ~ 1 , \ldots , 4 )$ in real-valued matrix multiplications, followed by more operations (here $n = 2 , k = 6 , d = 8 )$ . Best viewed in color.
|
| 287 |
+
|
| 288 |
+
# A RECONSTRUCTING THE PARAMETER MATRIX
|
| 289 |
+
|
| 290 |
+
In the paper, the parameter matrix $\mathbf { H }$ in (3.2) is constructed by a sum of $n$ Kronecker products. In the following, we will provide an alternative perspective and show how to equivalently reconstruct $\mathbf { H }$ by reusing parameter matrices in real-valued matrix multiplications, followed by more operations.
|
| 291 |
+
|
| 292 |
+
# A.1 METHOD
|
| 293 |
+
|
| 294 |
+
The key idea is to operate on partitioned weight blocks and learn a dynamic diffusion of weights. There are two key parameter blocks $\mathbf { B }$ and $\mathbf { T }$ that are central to our approach. Intuitively, $\textbf { B } \in$ $\mathbb { R } ^ { n \times n \times n }$ controls the weight diffusion process and learns the soft interactions between $\mathbf { T }$ partitions. Here, $n$ is a user defined hyperparameter.
|
| 295 |
+
|
| 296 |
+
Suppose that both $d$ and $k$ are divisible by $n \in \mathbb { Z } _ { > 0 }$ . For $i = 1 , \ldots , n$ and $j = 1 , \dotsc , \frac { d } { n }$ , denote by each partitioned parameter block $\mathbf { T } _ { j } \in \mathbb { R } ^ { n \times \frac { k } { n } }$ , and $\mathbf { B } _ { i } \in \mathbb { R } ^ { n \times n }$ is the weight diffusion matrix assigned to each partitioned parameter block via real-valued matrix multiplication $\mathbf { B } _ { i } \mathbf { T } _ { j }$ . The parameter $\mathbf { H }$ in (3.2) is now constructed by column-wise concatenation (;):
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
{ \bf H } = [ s ( { \bf B } _ { 1 } ) ; s ( { \bf B } _ { 2 } ) ; \ldots ; s ( { \bf B } _ { n } ) ] ,
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
where each segment $s ( \mathbf { B } _ { i } )$ is also formed by column-wise concatenation:
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
s ( \mathbf { B } _ { i } ) = [ \psi ( \mathbf { B } _ { i } \mathbf { T } _ { 1 } ) ; \psi ( \mathbf { B } _ { i } \mathbf { T } _ { 2 } ) ; \ldots ; \psi ( \mathbf { B } _ { i } \mathbf { T } _ { \frac { d } { n } } ) ] .
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
In (A.2), function $\psi : \mathbb { R } ^ { p \times q } \mathbb { R } ^ { p q }$ , where $\psi ( \mathbf { X } )$ flattens the matrix $\mathbf { X } \in \mathbb { R } ^ { p \times q }$ by concatenating each row of $\mathbf { X }$ then transposes the concatenated row vector into a column vector of dimension $p q$ It is easy to see that, $\psi ( \mathbf { B } _ { i } \mathbf { T } _ { j } ) \in \mathbb { R } ^ { k }$ , $s ( \mathbf { B } _ { i } ) \in \mathbb { R } ^ { k \times { \frac { d } { n } } }$ , thus $\mathbf { H } \in \mathbb { R } ^ { k \times d }$ .
|
| 309 |
+
|
| 310 |
+
It is the partitioned parameter blocks $\mathbf { B } _ { i }$ $( i = 1 , \ldots , n )$ and $\begin{array} { r } { \mathbf { T } _ { j } \left( j = 1 , \ldots , \frac { d } { n } \right) } \end{array}$ that determine the degree of freedom for $\mathbf { H }$ , which is $k d / n + n ^ { 3 }$ . As illustrated in Figure 3, the reuse of parameter matrices $\mathbf { B } _ { 1 } , \ldots , \mathbf { B } _ { n }$ and $\mathbf { T } _ { 1 } , \ldots , \mathbf { T } _ { \frac { d } { n } }$ in real-valued matrix multiplications in (A.2) may reduce the degree of freedom for $\mathbf { H }$ .
|
| 311 |
+
|
| 312 |
+
# A.2 SUBSUMING HYPERCOMPLEX MULTIPLICATIONS
|
| 313 |
+
|
| 314 |
+
Similarly, we show how the PHM layer with the reconstructed $\mathbf { H }$ in (A.1) also subsumes the hypercomplex multiplication. Taking the Hamilton product of two quaternions $Q$ and $P$ as an example, it can be rewritten as
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
( \begin{array} { l l l l l } & & & { } & & { } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \\ { 0 } & { 1 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 1 } \end{array} ) \underbrace { [ \begin{array} { l l l l l } { Q _ { x } } \\ { Q _ { x } } \\ { \vdots } \\ { Q _ { y } } \\ { 1 } \\ { 0 } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace { [ \begin{array} { l l l l l } { 0 } & { - 1 } & & { 0 } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 1 } \\ { 0 } & { 0 } & { - 1 } & { 0 } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace { [ \begin{array} { l l l l l } { Q _ { x } } \\ { Q _ { x } } \\ { \vdots } \\ { Q _ { y } } \\ { 1 } \end{array} ] } _ { \mathbf { B } _ { 3 } } \underbrace { [ \begin{array} { l l l l l } { 0 } & { 0 } & { - 1 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { - 1 } \\ { Q _ { x } } \\ { 1 } & { 0 } & { 0 } & { 0 } \end{array} ] } _ { \mathbf { B } _ { 3 } } \underbrace { [ \begin{array} { l } { Q _ { x } } \\ { Q _ { x } } \\ { Q _ { y } } \\ { \vdots } \\ { Q _ { z } } \end{array} ] } _ { \mathbf { B } _ { 4 } } \underbrace { [ \begin{array} { l l l l l } { 0 } & { 0 } & { 0 } & { - 1 } \\ { 0 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { - 1 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 0 } \end{array} ] } _ { \mathbf { B } _ { 4 } } \underbrace { [ \begin{array} { l } { Q _ { x } } \\ { Q _ { x } } \\ { Q _ { y } } \\ { \vdots } \\ { Q _ { z } } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace { [ \begin{array} { l } { Q _ { y } } \\ { P _ { x } } \\ { P _ { y } } \\ { \vdots } \\ { P _ { z } } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace [ \begin{array} { l l l l } \end{array}
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
where the 4 output elements are the real values for the quaternion unit basis $[ 1 , \mathbf { i } , \mathbf { j } , \mathbf { k } ] ^ { \top }$ . According to (A.3), when $n = 4$ , the PHM layer with the reconstructed parameter matrix can also be learned to exactly express the Hamilton product of quaternions. Likewise, hypercomplex multiplications of octonions or sedenions can also be learned by the PHM layer when $n$ is set to 8 or 16.
|
| 321 |
+
|
| 322 |
+
# A.3 SUBSUMING REAL-VALUED MATRIX MULTIPLICATIONS
|
| 323 |
+
|
| 324 |
+
Now we show how the PHM layer with the reconstructed $\mathbf { H }$ in (A.1) also subsumes the matrix multiplication in real space. Referring to (3.2), when $n = 1$ , $\mathbf { H } = b \mathbf { W }$ , where the scalar $b$ is the single element of the $1 \times 1$ matrix $\mathbf { B } _ { 1 }$ and elements of $\mathbf { W } \in \mathbb { R } ^ { k \times d }$ come from the concatenation of $\mathbf { T } _ { 1 } , \ldots , \mathbf { T } _ { d } \in \mathbb { R } ^ { 1 \times k }$ . Since learning $b$ and W separately is equivalent to learning their multiplication jointly, the scalar $b$ can be dropped, which is learning the single weight matrix in an FC layer. Therefore, a PHM layer is degenerated to an FC layer when $n = 1$ .
|
| 325 |
+
|
| 326 |
+
# B SETUP FOR EXPERIMENTS
|
| 327 |
+
|
| 328 |
+
We describe the setup for the experiments as follows.
|
| 329 |
+
|
| 330 |
+
# B.1 NATURAL LANGUAGE INFERENCE
|
| 331 |
+
|
| 332 |
+
We implement 300D unidirectional encoders with shared parameters for both premises and hypotheses. We take the concatenation of max and mean pooled representations as the input to a two-layer 300D multilayer perceptron for prediction. Our model is trained with the the Adam optimizer with a learning rate of 0.0004 and a batch size of 256. Word embeddings are initialized with GloVe (Pennington et al., 2014) and are fixed. No cross sentence attention (Parikh et al., 2016) is used, mainly to observe the effectiveness of standalone encoders. For PHM-LSTM, we use $n = \{ 2 , 5 , 1 0 \}$ . Note that in this task, since word embeddings are 300D, we select multiples of 5 instead of 4 for ease of divisibility.
|
| 333 |
+
|
| 334 |
+
# B.2 MACHINE TRANSLATION
|
| 335 |
+
|
| 336 |
+
For the IWSLT’15 English-Vietnamese (En-Vi), IWSLT’17 English-Indonesian (En-Id), IWSLT’14 German-English (De-En), and IWSLT’14 Romanian-English (Ro-En) datasets, we run with 50K steps; while for WMT’18 English-Estonian (En-Et), Setimes English-Macedonian (En-Mk), and WMT’18 English-Romanian (En-Ro) datasets, models are trained for 100K steps. For the En-Vi, En-Id, En-Et, En-Mk, and En-Ro datasets, we specify that transformers have 4 layers, 8 heads, and a hidden size 512. For the De-En and Ro-En datasets, we specify that transformers have 2 layers, 4 heads, and a hidden size 256. We use beam size of 5 and $\alpha = 0 . 6$ (length penalty) for decoding. For all PHM models, we benchmark several settings for the hyperparameter $\bar { n } = \{ 2 , 4 , 8 , 1 6 \}$ .
|
| 337 |
+
|
| 338 |
+
# B.3 TEXT STYLE TRANSFER
|
| 339 |
+
|
| 340 |
+
For the used Modern Shakespeare corpus2 in the experiments, the key goal here is to convert modern writing into Shakespeare writing. This dataset comprises of 18, 395 parallel sentences for training, 1, 218 parallel sentences for evaluation (development set), and 1, 462 parallel sentences for testing. We still specify that transformers have 4 layers, 8 heads, and a hidden size 512. Similar to machine translation, we experiment with $n = \{ 2 , 4 , 8 , 1 6 \}$ . We train all the models for 10K steps.
|
| 341 |
+
|
| 342 |
+
# B.4 SUBJECT VERB AGREEMENT
|
| 343 |
+
|
| 344 |
+
In contrast to the previous experimental settings, we use a smaller transformer architecture with 10K training steps. Specifically, transformers here have 2 layers, 4 heads, and a hidden size 128. Since the hidden size is smaller than those in the previous experimental settings, we experiment with $n = \{ 2 , 4 , 8 \}$ .
|
md/train/rdT5GV-LnZU/rdT5GV-LnZU.md
ADDED
|
@@ -0,0 +1,529 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Not All Attention Is All You Need
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Beyond the success story of pre-trained language models (PrLMs) in recent natu
|
| 11 |
+
2 ral language processing, they are susceptible to over-fitting due to unusual large
|
| 12 |
+
3 model size. To this end, dropout serves as a therapy. However, existing methods
|
| 13 |
+
4 like random-based, knowledge-based and search-based dropout are more general
|
| 14 |
+
5 but less effective onto self-attention based models, which are broadly chosen as
|
| 15 |
+
6 the fundamental architecture of PrLMs. In this paper, we propose a novel dropout
|
| 16 |
+
7 method named AttendOut to let self-attention empowered PrLMs capable of more
|
| 17 |
+
8 robust task-specific tuning. We demonstrate that state-of-the-art models with elab
|
| 18 |
+
9 orate training design may achieve much stronger results. We verify the universal
|
| 19 |
+
10 ity of our approach on extensive natural language processing tasks.
|
| 20 |
+
|
| 21 |
+
# 11 1 Introduction
|
| 22 |
+
|
| 23 |
+
12 Self-attention network (SAN) empowered models like Transformer [1] have achieved remarkable
|
| 24 |
+
13 success in recent natural language processing, which have been broadly chosen as basic architec
|
| 25 |
+
14 ture in a series successful pre-trained language models (PrLMs) such as BERT [2], RoBERTa [3],
|
| 26 |
+
15 ALBERT [4], ELECTRA [5], DeBERTa [6] and GPT [7].
|
| 27 |
+
16 SAN has drawn a great deal of curiosity on its conceptually simple but powerful attention mecha
|
| 28 |
+
17 nism. However, SAN still remains a black box and more and more works attempt to unveil its inner
|
| 29 |
+
18 principle, where the biggest mystery lies in its attention matrix. Our work is inspired by several
|
| 30 |
+
19 recent discoveries which turn our views up and down. [8, 9] show that fixed Gaussian or even ran
|
| 31 |
+
20 dom alignment attention matrix may rival standard SAN, while more recently, [10, 11] prove that
|
| 32 |
+
21 SAN may encounter a rank collapse with deepening of layers. A more concrete explanation is in
|
| 33 |
+
22 formation diffusion [12], which states that the input vectors are progressively assimilating through
|
| 34 |
+
23 continuously making self-attention. We attribute these problems to the sever co-adaption [13] be
|
| 35 |
+
24 tween attention elements, a form of over-fitting onto SAN. As a result, self-attention empowered
|
| 36 |
+
25 PrLMs hardly bring into their full play, especially for the fine-tuning stage, where task-specific data
|
| 37 |
+
26 is always with limited capacity.
|
| 38 |
+
27 Dropout [13] serves as a therapy to deal with the problem, by randomly shutting down a set of units
|
| 39 |
+
28 during training stage. When specified on self-attention, dropout is equivalent to adding attention
|
| 40 |
+
29 mask to the attention matrix. However, random-based dropout methods like vanilla Dropout [13] or
|
| 41 |
+
30 DropConnect [14] are all subject to a pre-defined distribution like Bernoulli or Gaussian, longing for
|
| 42 |
+
31 exhaustive grid search for an optimal probability. Thereby a variety of works attempt to utilize man
|
| 43 |
+
32 ual attention mask to obtain a more informative attention matrix [15, 16], whereas all these methods
|
| 44 |
+
33 require prior knowledge on model or data, which could be costly or unavailable. More recently, the
|
| 45 |
+
34 rise of Neural Architecture Search [17, 18] gives birth to search-based dropout [19], which automat
|
| 46 |
+
35 ically chooses an optimal dropout pattern based on additional validation performances. However,
|
| 47 |
+
36 the huge search space brings heavy consumption and more importantly, the obtained dropout pattern
|
| 48 |
+
37 is still fixed with a pre-defined probability, which is static and sample-independent, ignoring the
|
| 49 |
+
38 dynamics within different samples. In this paper, we focus on task-specific tuning of self-attention
|
| 50 |
+
39 empowered PrLMs and propose a novel dropout method named AttendOut onto attention layers,
|
| 51 |
+
40 which leverages self-attention to dynamically generate dropout patterns for each attention layer as
|
| 52 |
+
41 well as each sample through an end-to-end manner. We demonstrate that the previous state-of-the-art
|
| 53 |
+
42 models with elaborate training design may achieve much stronger results. We verify the universality
|
| 54 |
+
43 of our approach on extensive natural language processing tasks. Guided by AttendOut, we pro
|
| 55 |
+
44 pose another two attention regularizers to enable simple but effective performance boost with no
|
| 56 |
+
45 additional cost.
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 1: A diagram of different dropout methods, where $p$ refers to the dropout probabilities while $R$ refers to the reward in reinforcement learning.
|
| 60 |
+
|
| 61 |
+
# 46 2 Related Work
|
| 62 |
+
|
| 63 |
+
47 Dropout is proposed to alleviate over-fitting problem in DNNs. Apart from vanilla Dropout [13]
|
| 64 |
+
48 and DropConnect [14] which randomly shut down a subset of activations or hidden weights, there
|
| 65 |
+
49 are a variety of dropout methods proposed, e.g. Alpha Dropout [20], Variational Dropout [21, 22],
|
| 66 |
+
50 Adversarial Dropout [23], Energy-based Dropout [24]. However, random-based dropout encounters
|
| 67 |
+
51 slow experiment cycle due to inevitable grid search. Inspired by Neural Architecture Search [17, 18],
|
| 68 |
+
52 [19] proposes AutoDropout to automate the process of designing dropout patterns. A similar line of
|
| 69 |
+
53 work is dynamic tuning of dropout, which further allows adaptive dropout probabilities under differ
|
| 70 |
+
54 ent training moments. [25] proposes Concrete Dropout with continuous relaxation under Concrete
|
| 71 |
+
55 distribution, [26] proposes Learnable Bernoulli Dropout under discrete Bernoulli distribution using
|
| 72 |
+
56 Augment-REINFORCE-Merge estimator [27], while [28] proposes Context Dropout by optimizing
|
| 73 |
+
57 the evidence lower bound.
|
| 74 |
+
58 With self-attention network continuously stands out, dropout is being explored onto self-attention
|
| 75 |
+
59 based models. LayerDrop [29] randomly removes entire SAN blocks, while DropHead [30], Head
|
| 76 |
+
60 Mask [31] randomly remove certain attention heads. UniDrop [32] unifies these dropout methods,
|
| 77 |
+
61 which facilitates text classification and machine translation tasks. Additionally, prior knowledge is
|
| 78 |
+
62 shown highly effective for guiding attention dropout as in SG-Net [15] and SIT [16], which inten
|
| 79 |
+
63 tionally discard syntax-unrelated attention units with the help of structural clues.
|
| 80 |
+
|
| 81 |
+
# 64 3 Preliminaries
|
| 82 |
+
|
| 83 |
+
65 In this section, we provide the preliminaries for the proposed approach. We first review the details
|
| 84 |
+
66 of self-attention proposed in [1]. Based on the specific architecture, we elaborate the concerned
|
| 85 |
+
67 attention dropout.
|
| 86 |
+
|
| 87 |
+
# 3.1 Self-Attention
|
| 88 |
+
|
| 89 |
+
69 Generally, a standard SAN block is mainly composed of an attention layer and several feed-forward
|
| 90 |
+
70 layers (actually there are residual connection, layer normalization, etc. as well). The input of it is a
|
| 91 |
+
71 sentence or batch of sentences of length $n$ , which is first embedded through an embedding layer. The
|
| 92 |
+
72 embedded input $E$ may go through three linear projections $W _ { Q }$ , $W _ { K }$ and $W _ { V }$ referring to query, key
|
| 93 |
+
73 and value layers respectively, and then obtain three matrices $Q$ , $K$ and $V$ referring to the query, key
|
| 94 |
+
74 and value components of self-attention. Subsequently, a dot-product of $Q$ and $K$ is taken and then
|
| 95 |
+
75 normalized using Sof tmax function to obtain the attention matrix $A$ . Then another dot-product of
|
| 96 |
+
76 $A$ and $V$ follows. The mentioned calculation can be formalized as follow:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
A t t e n t i o n ( Q , K , V ) = S o f t m a x \left( \frac { Q \cdot K ^ { T } } { \sqrt { d _ { k } } } \right) \cdot V
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where 77 $\sqrt { d _ { k } }$ is a scaling factor. Finally, the self-attention layer ends up with a linear projection $W _ { O }$ 78 to output.
|
| 103 |
+
|
| 104 |
+
79 During the aforementioned process, we highlight a key phases, that is the attention matrix $A$ , which
|
| 105 |
+
80 is a dot-product of $n \times n$ from two separate linear projections $W _ { Q }$ and $W _ { K }$ . $A$ is viewed as a feature
|
| 106 |
+
81 map which stores the node-to-node significance in different scores. Various works show that there
|
| 107 |
+
82 hides implicit but highly needed semantic clues.
|
| 108 |
+
|
| 109 |
+
# 3.2 Dropout on Self-Attention
|
| 110 |
+
|
| 111 |
+
84 Our dropout will apply to the attention matrix of the concerned attention layer. We first define two
|
| 112 |
+
85 specific dropouts onto Eq. 1, where both implementations are just as simple as in standard dropout
|
| 113 |
+
86 via a mask matrix $M$ .
|
| 114 |
+
|
| 115 |
+
Weights Dropout. Weights dropout is applied to the attention matrix after Sof tmax function by default, which is formulated as:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
{ \cal A } t t e n t i o n ( Q , K , V ) = \left( S o f t m a x \left( { \frac { Q \cdot K ^ { T } } { \sqrt { d _ { k } } } } \right) \odot { \cal M } \right) \cdot V
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
9 where $M$ is a binary matrix with elements in $\{ 0 , 1 \}$ and $\odot$ refers to element-wise multiplication.
|
| 122 |
+
|
| 123 |
+
90 Scores Dropout. Different from weights dropout, scores dropout is applied before Sof tmax func
|
| 124 |
+
91 tion, which is formulated as:
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
A t t e n t i o n ( Q , K , V ) = S o f t m a x \left( \frac { Q \cdot K ^ { T } } { \sqrt { d _ { k } } } + M \right) \cdot V
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
92 Since the outer Sof tmax, we conduct an addition instead of multiplication, where elements in $M$
|
| 131 |
+
93 are set to 0 for kept units and $- i n f$ for removed ones. Note that the Sof tmax takes a similar
|
| 132 |
+
94 function as the scaling factor of $1 / p$ in vanilla Dropout [13], which balances the expectation of the
|
| 133 |
+
95 network.
|
| 134 |
+
96 Weights dropout is commonly used in self-attention based models, while scores dropout is less
|
| 135 |
+
97 explored, which is our focus in this paper. For scores dropout, we need to pay attention to a special
|
| 136 |
+
98 case, when all attentions are shut down, that is, all elements in $M$ equal to $- i n f$ at the same time.
|
| 137 |
+
99 Such case can be formulated as follow:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
A t t e n t i o n ( Q , K , V ) = S o f t m a x \left( M \right) \cdot V
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
100 Note that Sof tmax $( M )$ obtains to a constant matrix, where each unit equals to $1 / n$ . In this case,
|
| 144 |
+
101 the attention matrix is fixed and consequently the $W _ { Q }$ , $W _ { K }$ and dot-product in between are skipped.
|
| 145 |
+
|
| 146 |
+
# 102 4 Methodology
|
| 147 |
+
|
| 148 |
+
103 In this paper, we propose Attention differentiable dropOut (AttendOut), which contributes technique
|
| 149 |
+
104 novelty in the following way: (1) dynamic and task-specific tuned; (2) end-to-end trained; (3) gra
|
| 150 |
+
105 dient optimized dropout method onto self-attention empowered PrLMs. We elaborate our approach
|
| 151 |
+
106 with two parts, in which the first is composition, while the second is training algorithm.
|
| 152 |
+
|
| 153 |
+
# 4.1 Elements of AttendOut
|
| 154 |
+
|
| 155 |
+
108 Our training architecture is composed of three modules, A-Net (Attacker), D-Net (Defender) and
|
| 156 |
+
109 G-Net (Generator). D-Net and A-Net are two identical models and trained simultaneously through
|
| 157 |
+
110 standard gradient descent, while G-Net is a learnable dropout maker and trained through policy
|
| 158 |
+
111 gradient. Now we elaborate each of them.
|
| 159 |
+
112 Defender - Attacker As suggested, defender and attacker are two competitors playing a game
|
| 160 |
+
113 with each other on specific criteria, e.g. training accuracy, training loss. Specifically, D-Net and A
|
| 161 |
+
114 Net are two identical self-attention empowered PrLMs, e.g. BERT, RoBERTa. However, they follow
|
| 162 |
+
115 different dropout strategies. D-Net receives regular dropout as default in specific models, while A
|
| 163 |
+
116 Net receives additional dropout decision from G-Net onto its corresponding attention layers.
|
| 164 |
+
117 Generator G-Net acts as a dropout maker through generating a mask matrix for each attention
|
| 165 |
+
118 layer during training stage. As aforementioned, the common dropout strategies rely on randomness,
|
| 166 |
+
119 which intends to shut down the co-adaption but not powerful enough. However, our dropout maker
|
| 167 |
+
120 is an agent which is able to intelligently choose and learn dropout patterns for each sample. Specif
|
| 168 |
+
121 ically, after training for a fixed number of steps, we conduct evaluation for both A-Net and D-Net.
|
| 169 |
+
122 When A-Net obtains a higher score than D-Net, which means attacker wins the game, G-Net will be
|
| 170 |
+
123 rewarded positively. When defender wins, G-Net will be punished with a negative reward. In con
|
| 171 |
+
124 sequence, G-Net learns appropriate dropout patterns through the game between D-Net and A-Net,
|
| 172 |
+
125 while assisting A-Net to win the game. On the other hand, A-Net needs to be stronger when training
|
| 173 |
+
126 under such powerful dropout, which makes it much more robust from over-fitting. Compared to
|
| 174 |
+
127 search-based dropout, G-Net is triggered by the difference between two model derivatives with and
|
| 175 |
+
128 without dropout, instead of the final feedback on validation set, which makes it end-to-end-possible
|
| 176 |
+
129 and sample-dependent.
|
| 177 |
+
130 The design of G-Net is the most delicate part, which is also a self-attention based model with iden
|
| 178 |
+
131 tical number of layers with D-Net and A-Net. However, we make several improvements. 1) G-Net
|
| 179 |
+
132 only exports the attention scores from attention layers with no extra output layers, from which we
|
| 180 |
+
133 apply Gumbel [33, 34] to sample the actions to obtain the dropout mask. 2) G-Net only makes
|
| 181 |
+
134 one-head attention and share one group of parameters for all attention layers. 3) G-Net is excluded
|
| 182 |
+
135 of feed-forward layers, which may obscure the impact of self-attention [11, 10].
|
| 183 |
+
|
| 184 |
+
# 4.2 Training with AttendOut
|
| 185 |
+
|
| 186 |
+
37 The core of training with AttendOut is to find a way to optimize G-Net, which receives signals from
|
| 187 |
+
38 the difference between D-Net and A-Net. Supposing there is a list of dropout actions by G-Net:
|
| 188 |
+
|
| 189 |
+
$$
|
| 190 |
+
a _ { 1 : T } = \{ a _ { 1 } , a _ { 2 } , a _ { 3 } , \cdot \cdot \cdot , a _ { T } \}
|
| 191 |
+
$$
|
| 192 |
+
|
| 193 |
+
139 where $T$ refers to the number of samples, for each action $a _ { t }$ , G-Net may achieve a reward $r _ { t }$ . The
|
| 194 |
+
140 optimization objective is to maximize the overall rewards of list $a _ { 1 : T }$ , denoted as $R$ , that is:
|
| 195 |
+
|
| 196 |
+
$$
|
| 197 |
+
J ( \theta _ { G } ) = E _ { P ( a _ { 1 : T } ; \theta _ { G } ) } [ R ]
|
| 198 |
+
$$
|
| 199 |
+
|
| 200 |
+
where 141 $\begin{array} { r } { R = \sum _ { t = 1 } ^ { T } r _ { t } } \end{array}$ . Since $R$ is non-differentiable, we use policy gradient to update $\theta _ { G }$
|
| 201 |
+
|
| 202 |
+
$$
|
| 203 |
+
\nabla _ { \theta _ { G } } J ( \theta _ { G } ) = \sum _ { t = 1 } ^ { T } E _ { P ( a _ { 1 : T } ; \theta _ { G } ) } [ \nabla _ { \theta _ { G } } \log P ( a _ { t } | a _ { ( t - 1 ) : 1 } ; \theta _ { G } ) r _ { t } ]
|
| 204 |
+
$$
|
| 205 |
+
|
| 206 |
+
142 The above equation could be approximated as:
|
| 207 |
+
|
| 208 |
+
$$
|
| 209 |
+
\frac { 1 } { m } \sum _ { k = 1 } ^ { m } \sum _ { t = 1 } ^ { T } \nabla _ { \theta _ { G } } \log P ( a _ { t } | a _ { ( t - 1 ) : 1 } ; \theta _ { G } ) r _ { t }
|
| 210 |
+
$$
|
| 211 |
+
|
| 212 |
+
143 For a model with $n$ attention layers, each dropout decision is composed of $n$ inner decisions of each
|
| 213 |
+
144 layer. Additionally, each attention layer contains an attention matrix of $l \times l$ , namely $l ^ { 2 }$ elements
|
| 214 |
+
145 dropped or kept. Thus, we denote a dropout unit as $d ^ { i j }$ , where $i$ refers to the $i ^ { t h }$ layer while $j$ refers
|
| 215 |
+
146 to the $j ^ { t h }$ element of the attention matrix.
|
| 216 |
+
147 However, $n l ^ { 2 }$ dropout units bring a huge space, which makes it impossible to calculate the joint prob
|
| 217 |
+
148 ability. To this end, we introduce the independence assumption that each dropout unit is independent
|
| 218 |
+
149 with each other. Under the relaxation, we can make the following probability likelihood:
|
| 219 |
+
|
| 220 |
+
$$
|
| 221 |
+
\log P ( a _ { t } | a _ { ( t - 1 ) : 1 } ; \theta _ { G } ) = \frac { 1 } { n l ^ { 2 } } \sum _ { i , j } \log P ( d _ { t } ^ { i j } | d _ { ( t - 1 ) : 1 } ^ { i j } ; \theta _ { G } )
|
| 222 |
+
$$
|
| 223 |
+
|
| 224 |
+
where the summation 150 $\textstyle \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { l ^ { 2 } }$ is briefly denoted as $\textstyle \sum _ { i , j }$
|
| 225 |
+
|
| 226 |
+
151 Thus, the final gradient could be formalized as:
|
| 227 |
+
|
| 228 |
+
$$
|
| 229 |
+
\nabla _ { \theta _ { G } } J ( \theta _ { G } ) = \frac { 1 } { m } \frac { 1 } { n l ^ { 2 } } \sum _ { k = 1 } ^ { m } \sum _ { t = 1 } ^ { T } \sum _ { i , j } \nabla _ { \theta _ { G } } \log P ( d _ { t } ^ { i j } | d _ { ( t - 1 ) : 1 } ^ { i j } ; \theta _ { G } ) ( r _ { t } - b )
|
| 230 |
+
$$
|
| 231 |
+
|
| 232 |
+
152 where $b$ is a baseline function of moving average [35]. Note that we do not apply additional regular
|
| 233 |
+
153 izers like L0 and L1 penalty, which impose unnecessary bias.
|
| 234 |
+
154 Algorithm 1 summarizes the overall procedure of training PrLMs with AttendOut. We first initialize
|
| 235 |
+
155 all three networks. Note that D-Net and A-Net should be kept identical at the beginning of each
|
| 236 |
+
156 training step. A straightforward strategy is to choose the better one to cover the other. To add
|
| 237 |
+
157 randomness, we sample from D-Net and A-Net based on their evaluation performances, with higher
|
| 238 |
+
158 probability for the better one. Then for each step, D-Net and A-Net are fed with the same mini-batch
|
| 239 |
+
159 data and updated via standard gradient descent, meanwhile each batch will be cached. After training
|
| 240 |
+
160 for $T$ steps, which we denote as a dropout step, both D-Net and A-Net are evaluated on additional
|
| 241 |
+
161 validation samples, which could be development set data, noisy training data or a small split of train
|
| 242 |
+
162 ing data. In this paper, we simply use development set. For efficiency, we make random sampling
|
| 243 |
+
163 on it to retrieve $T$ samples for evaluation. Based on the evaluation scores, G-Net is rewarded with
|
| 244 |
+
164 $\{ r _ { 1 } , r _ { 2 } , r _ { 3 } , \cdot \cdot \cdot , r _ { T } \}$ and updated via Eq. 5. At the end of each dropout step, the cached samples
|
| 245 |
+
165 will be released and D-Net and A-Net will be re-initialized.
|
| 246 |
+
|
| 247 |
+
# Algorithm 1 AttendOut
|
| 248 |
+
|
| 249 |
+
Input: Attacker $A$ , Defender $D$ , Generator $G$ , dropout
|
| 250 |
+
step $T$
|
| 251 |
+
1: initialize $\theta _ { D }$ , $\theta _ { A }$ , $\theta _ { G }$ , where $\theta _ { D } = \theta _ { A }$
|
| 252 |
+
2: for each training step do
|
| 253 |
+
3: $\theta _ { D } \theta _ { D } ^ { \prime }$
|
| 254 |
+
4: dropout $A$ with $G$ via Eq. 3
|
| 255 |
+
5: $\theta _ { A } \theta _ { A } ^ { \prime }$
|
| 256 |
+
6: for each $T$ steps do
|
| 257 |
+
7: evaluate $D$ and $A$ and reward $G$
|
| 258 |
+
8: $\theta _ { G } \theta _ { G } ^ { \prime }$ via Eq. 5
|
| 259 |
+
9: initialize $\theta _ { D }$ , $\theta _ { A }$ for next step
|
| 260 |
+
10: end for
|
| 261 |
+
11: end for
|
| 262 |
+
167 Resource Usage We notice that training PrLMs with AttendOut may sacrifice time and memory
|
| 263 |
+
168 cost. The detailed resource usage is shown in Appendix. Taking RoBERTa as an example, the
|
| 264 |
+
169 algorithm requires two RoBERTa models as well as a smaller self-attention based generator, which
|
| 265 |
+
170 is $\mathrm { { \bar { 1 } / 3 } }$ of RoBERTa size. Considering cached samples, roughly speaking, AttendOut requires twice
|
| 266 |
+
171 graphic memory as well as twice training time compared to a single model, which is a middle speed
|
| 267 |
+
172 line between random-based dropout and neural architecture search (Dropout [13] $<$ AttendOut $\ll$
|
| 268 |
+
173 AutoDropout [19]). However, AttendOut contributes to remarkable performance gain compared to
|
| 269 |
+
174 other attention dropout methods.
|
| 270 |
+
175 Pre-training Our approach is both feasible for both fine-tuning and pre-training stage of PrLMs
|
| 271 |
+
176 but expensive for the latter. However, we try to serve for the most delicate part of concerned issue,
|
| 272 |
+
177 since pre-training is generally done on large-scale data with modest training epochs, which makes it
|
| 273 |
+
178 less susceptible from over-fitting.
|
| 274 |
+
|
| 275 |
+

|
| 276 |
+
Figure 2: Architecture of G-Net.
|
| 277 |
+
|
| 278 |
+
Table 1: Results (test / dev) of GLUE sub-tasks.
|
| 279 |
+
|
| 280 |
+
<table><tr><td>Model</td><td>SST-2 Acc</td><td>MRPC F1</td><td>QNLI Acc</td><td>MNLI-mm Acc</td><td>CoLA Mcc</td></tr><tr><td>BERT</td><td>92.9 / 92.2</td><td>86.6 / 86.3</td><td>89.7 /88.9</td><td>83.3 /84.0</td><td>51.2 / 58.8</td></tr><tr><td>+ AtendOut</td><td>93.6 / 93.8</td><td>88.1 / 87.5</td><td>90.2 / 91.1</td><td>84.2 /84.6</td><td>57.4 / 60.9</td></tr><tr><td>RoBERTa</td><td>95.4 / 94.4</td><td>90.5 /90.2</td><td>92.9 /92.0</td><td>86.1 /86.6</td><td>61.3 / 62.5</td></tr><tr><td>+ AtendOut</td><td>96.2 / 95.1</td><td>91.2 / 90.9</td><td>93.3 /93.0</td><td>87.3 /87.8</td><td>63.0 / 63.8</td></tr></table>
|
| 281 |
+
|
| 282 |
+
Table 2: Results of IMDB, CoNLL03, PTB and SWAG respectively.
|
| 283 |
+
|
| 284 |
+
<table><tr><td>Model</td><td>IMDB Acc</td><td>CoNLL03 F1</td><td>PTB F1</td><td>SWAG Acc</td></tr><tr><td>BERT</td><td>92.2</td><td>94.1</td><td>95.4</td><td>81.1</td></tr><tr><td>+ AttendOut</td><td>92.9</td><td>94.7</td><td>96.5</td><td>81.6</td></tr><tr><td>RoBERTa</td><td>93.6</td><td>94.5</td><td>96.6</td><td>83.8</td></tr><tr><td>+ AttendOut</td><td>94.2</td><td>95.2</td><td>97.3</td><td>84.1</td></tr></table>
|
| 285 |
+
|
| 286 |
+
# 179 5 Experimental Setup
|
| 287 |
+
|
| 288 |
+
180 We demonstrate the universal effectiveness of AttendOut on extensive natural language processing
|
| 289 |
+
181 tasks. For all mentioned tasks, we apply our method on BERT [2] and its stronger variant RoBERTa
|
| 290 |
+
182 [3]. Our implementations are based on PyTorch using transformers [36]. For further training details,
|
| 291 |
+
183 please refer to Appendix.
|
| 292 |
+
184 Our experiments include: (1) natural language understanding: General Language Understanding
|
| 293 |
+
185 Evaluation (GLUE) benchmark [37], a collection of nine natural language understanding tasks (here
|
| 294 |
+
186 we experiment on five of them, SST-2, MRPC, QNLI, MNLI-mm and CoLA; (2) document clas
|
| 295 |
+
187 sification: IMDB [38], a sentiment analysis dataset where about $15 \%$ of the documents are longer
|
| 296 |
+
188 than 512 word-pieces; (3) named entity recognition: CoNLL2003 [39]; (4) part-of-speech tag
|
| 297 |
+
189 ging: English Penn Treebank (PTB) [40]; (5) multiple choices question answering: SWAG [41].
|
| 298 |
+
190 We report both test and development results for GLUE sub-tasks since the large bias between them,
|
| 299 |
+
191 while development results only for all the other tasks.
|
| 300 |
+
192 Note that we only adjust the dropout steps and keep all other parameters the same for strict fair
|
| 301 |
+
193 comparison. For example, the parameters we use in RoBERTa are identical with what we use in
|
| 302 |
+
194 training with AttendOut including both D-Net and A-Net.
|
| 303 |
+
|
| 304 |
+
# 6 Results
|
| 305 |
+
|
| 306 |
+
# 6.1 Significance Analysis
|
| 307 |
+
|
| 308 |
+
97 Pictorially in Table 1, RoBERTa is strong enough as it outperforms BERT by a big margin, while
|
| 309 |
+
98 AttendOut empowered RoBERTa still outperforms it on all five GLUE sub-tasks. For small-scale
|
| 310 |
+
99 datasets, which are more likely to over-fit, AttendOut helps unfold remarkable performance gain
|
| 311 |
+
00 $( 1 2 . 1 \% \ / \ 3 . 5 \%$ over BERT on CoLA, $1 . 7 \% / 1 . 4 \%$ over BERT on MRPC). However, for large
|
| 312 |
+
01 scale one like MNLI, which tends to be more stable, AttendOut still produces considerable boost,
|
| 313 |
+
02 $( 1 . 4 \% / 1 . 4 \%$ over RoBERTa, $1 . 1 \% / 0 . 7 \%$ over BERT).
|
| 314 |
+
203 Furthermore, AttendOut is shown universally effective as in Table 2. For POS Tagging, BERT
|
| 315 |
+
204 and RoBERTa have achieved very strong baselines, while AttendOut empowered ones are even
|
| 316 |
+
205 stronger, $3 . 1 \%$ over BERT on PTB). Similar results are seen on document classification and NER.
|
| 317 |
+
206 For SWAG, however, AttendOut seems weakly effective $\mathbf { 0 . 6 \% }$ over BERT, $0 . 4 \%$ over RoBERTa).
|
| 318 |
+
|
| 319 |
+

|
| 320 |
+
Figure 3: Dropout probabilities on specific attention layers over training steps.
|
| 321 |
+
|
| 322 |
+

|
| 323 |
+
Figure 4: Convergence over training epochs.
|
| 324 |
+
|
| 325 |
+
# 207 6.2 Visual Analysis
|
| 326 |
+
|
| 327 |
+
Dropout Patterns Another concerned issue is the dropout proportions by AttendOut. Figure 3 depicts the patterns on several datasets. We may find several interesting phenomenons. First, the overall patterns largely differ from datasets, which is fair since AttendOut is sample-dependent. However, we may observe something in common. Overall, the lower layers take higher dropout probabilities. For example on QNLI, the first layer almost remains steady with the probability of 0.55 during the training process, while the fourth one continuously decays in a higher rate. Intuitively, the first three layers undertake a similar trend in each dataset, while there might be an up and down for the fourth one as in SST-2 and CoLA. Especially for CoLA, we see unusual high dropout probabilities in the final period (around 0.9), which are close to complete dropout. We notice that CoLA is a small set with 8500 training samples, on which SAN model is more inclined to suffer from over-fitting. Therefore, PrLM on CoLA encounters more intensive dropout through AttendOut.
|
| 328 |
+
|
| 329 |
+
219 Convergence Figure 4 depicts the accuracy trends of RoBERTa on SST-2, QNLI, MNLI respec
|
| 330 |
+
220 tively. Due to a stronger dropout module, the one with AttendOut tends to fall behind (SST-2,
|
| 331 |
+
221 MNLI) at the beginning of training. However, model becomes stronger since the second epoch
|
| 332 |
+
222 (SST-2, QNLI). Especially on MNLI, RoBERTa obtains better results in the first two epochs and it
|
| 333 |
+
223 drops in the last one, while with AttendOut, the performance is steadily rising for all three epochs.
|
| 334 |
+
|
| 335 |
+
# 7 Ablation Study
|
| 336 |
+
|
| 337 |
+
In this section, we conduct further experiments to demonstrate the effectiveness of AttendOut. Due to space limitation, we conduct corresponding experiments on development sets only.
|
| 338 |
+
|
| 339 |
+
# 7.1 Attention Dropout
|
| 340 |
+
|
| 341 |
+
Vanilla Dropout We conduct comparison with vanilla Dropout [13], in which we dropout the attention matrix for all layers with Bernoulli distribution of $p$ . Here, we choose the dropout probabilities in {0.1, 0.2}.
|
| 342 |
+
|
| 343 |
+
Table 3: Comparison of AttendOut, vanilla Dropout and LayerDrop.
|
| 344 |
+
|
| 345 |
+
<table><tr><td>Model</td><td>CoLA</td><td>QNLI</td><td>MNLI-mm</td></tr><tr><td>RoBERTa</td><td>62.5</td><td>92.0</td><td>86.6</td></tr><tr><td>+ Vanilla</td><td>61.3</td><td>92.2</td><td>86.9</td></tr><tr><td>+ AttendOut</td><td>63.8</td><td>93.1</td><td>87.8</td></tr><tr><td>+ LayerDrop</td><td>62.1</td><td>92.6</td><td>87.1</td></tr><tr><td>+ Attn.LayerDrop</td><td>64.2</td><td>92.7</td><td>87.3</td></tr></table>
|
| 346 |
+
|
| 347 |
+
Table 4: Comparison of AttendOut and scheduled Bernoulli dropout.
|
| 348 |
+
|
| 349 |
+
<table><tr><td>Model</td><td>CoLA</td><td>QNLI</td><td>SWAG</td></tr><tr><td>RoBERTa</td><td>62.5</td><td>92.0</td><td>83.8</td></tr><tr><td>+ Scheduler</td><td>63.3</td><td>92.6</td><td>83.6</td></tr><tr><td>+ AttendOut</td><td>63.8</td><td>93.1</td><td>84.1</td></tr></table>
|
| 350 |
+
|
| 351 |
+
231 LayerDrop We also compare with LayerDrop [29], which focuses on skipping the entire encoder
|
| 352 |
+
232 blocks, Inspired of it, we design another strategy which randomly skips attention layers via Eq. 4.
|
| 353 |
+
233 For fair enough comparison, we set the dropout probabilities to 0.2 for both methods, following the
|
| 354 |
+
234 settings in [29].
|
| 355 |
+
235 Intuitively in Table 3, vanilla Dropout with fixed probability does not produce noticeable gain $( 1 . 9 \%$
|
| 356 |
+
236 bellow RoBERTa on CoLA). However, AttendOut shows powerful advantage $4 . 1 \%$ , $1 . 0 \%$ and $1 . 0 \%$
|
| 357 |
+
237 over vanilla Dropout on CoLA, QNLI and MNLI), which stresses the necessity of dynamic dropout
|
| 358 |
+
238 patterns rather than fixed static one. On the other hand, both layer-level regularizers are effective,
|
| 359 |
+
239 while attention LayerDrop performs stronger and more stable on all the three. Especially on CoLA,
|
| 360 |
+
240 it outperforms RoBERTa by 1.7 points, while LayerDrop meets a performance drop, which demon
|
| 361 |
+
241 strates that removing the attention layers act as a more effective regularizer than removing the entire
|
| 362 |
+
242 SAN block as for self-attention based models.
|
| 363 |
+
|
| 364 |
+
# 243 7.2 Pattern Approximation
|
| 365 |
+
|
| 366 |
+
244 Guided by AttendOut, we design a dropout scheduler, in which we utilize piece-wise linearity to
|
| 367 |
+
245 approximate the real curves as depicted in Figure 3. Taking QNLI as an example, we initialize
|
| 368 |
+
246 the dropout probabilities to 0.6 for all attention layers and set a a specific slope for each of them.
|
| 369 |
+
247 Note that here the corresponding mask matrices are randomly-generated and subject to Bernoulli
|
| 370 |
+
248 distribution. In AttendOut, however, the distribution are learned dynamically through self-attention
|
| 371 |
+
249 of G-Net.
|
| 372 |
+
250 As shown in Table 4, RoBERTa with scheduled Bernoulli dropout works surprisingly well on both
|
| 373 |
+
251 CoLA and QNLI, which outperforms RoBERTa by 0.8 and 0.6 points respectively, closer to At
|
| 374 |
+
252 tendOut, even if the strategy here is random-based and much looser. The guided scheduled dropout
|
| 375 |
+
253 helps unfold the correctness of the dynamic dropout patterns learned by AttendOut as well as the
|
| 376 |
+
254 self-attention based dropout maker.
|
| 377 |
+
|
| 378 |
+
# 255 8 Conclusion
|
| 379 |
+
|
| 380 |
+
This paper focuses on the co-adaption problem of deep self-attention networks, and presents a novel dropout method onto self-attention empowered pre-trained language models. Extensive experiments on multiple natural language processing tasks demonstrate that our proposed approach is universal and qualified to enable more robust task-specific tuning, which contributes to much stronger stateof-the-arts. We probe into the learned dropout patterns on different tasks, which empirically guide us to the very needed dynamic attention dropout design.
|
| 381 |
+
|
| 382 |
+
262 References
|
| 383 |
+
263 [1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz
|
| 384 |
+
264 Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy
|
| 385 |
+
265 Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances
|
| 386 |
+
266 in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing
|
| 387 |
+
267 Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008, 2017.
|
| 388 |
+
268 [2] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidi
|
| 389 |
+
269 rectional transformers for language understanding. In Jill Burstein, Christy Doran, and Thamar Solorio,
|
| 390 |
+
270 editors, Proceedings of the 2019 Conference of the North American Chapter of the Association for Com
|
| 391 |
+
271 putational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June
|
| 392 |
+
272 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171–4186. Association for Computational Linguis
|
| 393 |
+
273 tics, 2019.
|
| 394 |
+
274 [3] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis,
|
| 395 |
+
275 Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized BERT pretraining approach.
|
| 396 |
+
276 CoRR, abs/1907.11692, 2019.
|
| 397 |
+
277 [4] Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut.
|
| 398 |
+
278 ALBERT: A lite BERT for self-supervised learning of language representations. In 8th International
|
| 399 |
+
279 Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. Open
|
| 400 |
+
280 Review.net, 2020.
|
| 401 |
+
281 [5] Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. ELECTRA: pre-training
|
| 402 |
+
282 text encoders as discriminators rather than generators. In 8th International Conference on Learning Rep
|
| 403 |
+
283 resentations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
|
| 404 |
+
284 [6] Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. {DEBERTA}: {DECODING}-
|
| 405 |
+
285 {enhanced} {bert} {with} {disentangled} {attention}. In International Conference on Learning Repre
|
| 406 |
+
286 sentations, 2021.
|
| 407 |
+
287 [7] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding
|
| 408 |
+
288 by generative pre-training. 2018.
|
| 409 |
+
289 [8] Weiqiu You, Simeng Sun, and Mohit Iyyer. Hard-coded gaussian attention for neural machine translation.
|
| 410 |
+
290 In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault, editors, Proceedings of the 58th
|
| 411 |
+
291 Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020,
|
| 412 |
+
292 pages 7689–7700. Association for Computational Linguistics, 2020.
|
| 413 |
+
293 [9] Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking
|
| 414 |
+
294 self-attention in transformer models. CoRR, abs/2005.00743, 2020.
|
| 415 |
+
295 [10] Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with
|
| 416 |
+
296 linear complexity. CoRR, abs/2006.04768, 2020.
|
| 417 |
+
297 [11] Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. Attention is not all you need: Pure attention
|
| 418 |
+
298 loses rank doubly exponentially with depth. CoRR, abs/2103.03404, 2021.
|
| 419 |
+
299 [12] Saurabh Goyal, Anamitra Roy Choudhury, Saurabh Raje, Venkatesan T. Chakaravarthy, Yogish Sabhar
|
| 420 |
+
300 wal, and Ashish Verma. Power-bert: Accelerating BERT inference via progressive word-vector elimi
|
| 421 |
+
301 nation. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18
|
| 422 |
+
302 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 3690–3699.
|
| 423 |
+
303 PMLR, 2020.
|
| 424 |
+
304 [13] Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov.
|
| 425 |
+
305 Dropout: a simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15(1):1929–
|
| 426 |
+
306 1958, 2014.
|
| 427 |
+
307 [14] Li Wan, Matthew D. Zeiler, Sixin Zhang, Yann LeCun, and Rob Fergus. Regularization of neural networks
|
| 428 |
+
308 using dropconnect. In Proceedings of the 30th International Conference on Machine Learning, ICML
|
| 429 |
+
309 2013, Atlanta, GA, USA, 16-21 June 2013, volume 28 of JMLR Workshop and Conference Proceedings,
|
| 430 |
+
310 pages 1058–1066. JMLR.org, 2013.
|
| 431 |
+
311 [15] Zhuosheng Zhang, Yuwei Wu, Junru Zhou, Sufeng Duan, Hai Zhao, and Rui Wang. Sg-net: Syntax
|
| 432 |
+
312 guided machine reading comprehension. In The Thirty-Fourth AAAI Conference on Artificial Intelligence,
|
| 433 |
+
313 AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020,
|
| 434 |
+
314 The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY,
|
| 435 |
+
315 USA, February 7-12, 2020, pages 9636–9643. AAAI Press, 2020.
|
| 436 |
+
|
| 437 |
+
[16] Hongqiu Wu, Hai Zhao, and Min Zhang. Code summarization with structure-induced transformer. arXiv preprint arXiv:2012.14710, 2020.
|
| 438 |
+
[17] Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017.
|
| 439 |
+
[18] Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: differentiable architecture search. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
|
| 440 |
+
[19] Hieu Pham and Quoc V. Le. Autodropout: Learning dropout patterns to regularize deep networks. CoRR, abs/2101.01761, 2021.
|
| 441 |
+
[20] Günter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Self-normalizing neural networks. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 971–980, 2017.
|
| 442 |
+
[21] Avrim Blum, Nika Haghtalab, and Ariel D. Procaccia. Variational dropout and the local reparameterization trick. In Corinna Cortes, Neil D. Lawrence, Daniel D. Lee, Masashi Sugiyama, and Roman Garnett, editors, Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 2575–2583, 2015.
|
| 443 |
+
[22] Dmitry Molchanov, Arsenii Ashukha, and Dmitry P. Vetrov. Variational dropout sparsifies deep neural networks. In Doina Precup and Yee Whye Teh, editors, Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pages 2498–2507. PMLR, 2017.
|
| 444 |
+
[23] Sungrae Park, Jun-Keon Park, Su-Jin Shin, and Il-Chul Moon. Adversarial dropout for supervised and semi-supervised learning. In Sheila A. McIlraith and Kilian Q. Weinberger, editors, Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 3917–3924. AAAI Press, 2018.
|
| 445 |
+
[24] Hojjat Salehinejad and Shahrokh Valaee. Edropout: Energy-based dropout and pruning of deep neural networks. CoRR, abs/2006.04270, 2020.
|
| 446 |
+
[25] Yarin Gal, Jiri Hron, and Alex Kendall. Concrete dropout. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 3581–3590, 2017.
|
| 447 |
+
[26] Shahin Boluki, Randy Ardywibowo, Siamak Zamani Dadaneh, Mingyuan Zhou, and Xiaoning Qian. Learnable bernoulli dropout for bayesian deep learning. In Silvia Chiappa and Roberto Calandra, editors, The 23rd International Conference on Artificial Intelligence and Statistics, AISTATS 2020, 26-28 August 2020, Online [Palermo, Sicily, Italy], volume 108 of Proceedings of Machine Learning Research, pages 3905–3916. PMLR, 2020.
|
| 448 |
+
[27] Mingzhang Yin and Mingyuan Zhou. ARM: augment-reinforce-merge gradient for stochastic binary networks. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
|
| 449 |
+
[28] Xinjie Fan, Shujian Zhang, Korawat Tanwisuth, Xiaoning Qian, and Mingyuan Zhou. Contextual dropout: An efficient sample-dependent dropout module. CoRR, abs/2103.04181, 2021.
|
| 450 |
+
[29] Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
|
| 451 |
+
[30] Wangchunshu Zhou, Tao Ge, Furu Wei, Ming Zhou, and Ke Xu. Scheduled drophead: A regularization method for transformer models. In Trevor Cohn, Yulan He, and Yang Liu, editors, Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, EMNLP 2020, Online Event, 16-20 November 2020, pages 1971–1980. Association for Computational Linguistics, 2020.
|
| 452 |
+
|
| 453 |
+
369 [31] Zewei Sun, Shujian Huang, Xinyu Dai, and Jiajun Chen. Alleviating the inequality of attention heads for
|
| 454 |
+
370 neural machine translation. CoRR, abs/2009.09672, 2020.
|
| 455 |
+
371 [32] Zhen Wu, Lijun Wu, Meng Qi, Yingce Xia, Shufang Xie, Tao Qin, Xinyu Dai, and Tie-Yan Liu. Unidrop:
|
| 456 |
+
372 A simple yet effective technique to improve transformer without extra cost. In Proceedings of the The 2021
|
| 457 |
+
373 Conference of the North American Chapter of the Association for Computational Linguistics - Human
|
| 458 |
+
374 Language Technologies, Volume 1 (Long Papers), 2021.
|
| 459 |
+
375 [33] Chris J. Maddison, Daniel Tarlow, and Tom Minka. $\mathbf { A } ^ { * }$ sampling. In Zoubin Ghahramani, Max Welling,
|
| 460 |
+
376 Corinna Cortes, Neil D. Lawrence, and Kilian Q. Weinberger, editors, Advances in Neural Information
|
| 461 |
+
377 Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December
|
| 462 |
+
378 8-13 2014, Montreal, Quebec, Canada, pages 3086–3094, 2014.
|
| 463 |
+
379 [34] Xinwei Geng, Longyue Wang, Xing Wang, Bing Qin, Ting Liu, and Zhaopeng Tu. How does selective
|
| 464 |
+
380 mechanism improve self-attention networks? In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R.
|
| 465 |
+
381 Tetreault, editors, Proceedings of the 58th Annual Meeting of the Association for Computational Linguis
|
| 466 |
+
382 tics, ACL 2020, Online, July 5-10, 2020, pages 2986–2995. Association for Computational Linguistics,
|
| 467 |
+
383 2020.
|
| 468 |
+
384 [35] Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement
|
| 469 |
+
385 learning. Mach. Learn., 8:229–256, 1992.
|
| 470 |
+
386 [36] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pier
|
| 471 |
+
387 ric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen,
|
| 472 |
+
388 Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame,
|
| 473 |
+
389 Quentin Lhoest, and Alexander M. Rush. Transformers: State-of-the-art natural language processing.
|
| 474 |
+
390 In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System
|
| 475 |
+
391 Demonstrations, pages 38–45, Online, October 2020. Association for Computational Linguistics.
|
| 476 |
+
392 [37] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE:
|
| 477 |
+
393 A multi-task benchmark and analysis platform for natural language understanding. In 7th International
|
| 478 |
+
394 Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenRe
|
| 479 |
+
395 view.net, 2019.
|
| 480 |
+
396 [38] Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts.
|
| 481 |
+
397 Learning word vectors for sentiment analysis. In Dekang Lin, Yuji Matsumoto, and Rada Mihalcea,
|
| 482 |
+
398 editors, The 49th Annual Meeting of the Association for Computational Linguistics: Human Language
|
| 483 |
+
399 Technologies, Proceedings of the Conference, 19-24 June, 2011, Portland, Oregon, USA, pages 142–150.
|
| 484 |
+
400 The Association for Computer Linguistics, 2011.
|
| 485 |
+
401 [39] Erik F. Tjong Kim Sang and Fien De Meulder. Introduction to the conll-2003 shared task: Language
|
| 486 |
+
402 independent named entity recognition. In Walter Daelemans and Miles Osborne, editors, Proceedings
|
| 487 |
+
403 of the Seventh Conference on Natural Language Learning, CoNLL 2003, Held in cooperation with HLT
|
| 488 |
+
404 NAACL 2003, Edmonton, Canada, May 31 - June 1, 2003, pages 142–147. ACL, 2003.
|
| 489 |
+
405 [40] Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. Building a large annotated corpus
|
| 490 |
+
406 of english: The penn treebank. Comput. Linguistics, 19(2):313–330, 1993.
|
| 491 |
+
407 [41] Rowan Zellers, Yonatan Bisk, Roy Schwartz, and Yejin Choi. SWAG: A large-scale adversarial dataset
|
| 492 |
+
408 for grounded commonsense inference. In Ellen Riloff, David Chiang, Julia Hockenmaier, and Jun’ichi
|
| 493 |
+
409 Tsujii, editors, Proceedings of the 2018 Conference on Empirical Methods in Natural Language Process
|
| 494 |
+
410 ing, Brussels, Belgium, October 31 - November 4, 2018, pages 93–104. Association for Computational
|
| 495 |
+
411 Linguistics, 2018.
|
| 496 |
+
|
| 497 |
+
# 412 Checklist
|
| 498 |
+
|
| 499 |
+
1. For all authors...
|
| 500 |
+
|
| 501 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 502 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 4.2.
|
| 503 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 504 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 505 |
+
|
| 506 |
+
2. If you are including theoretical results...
|
| 507 |
+
|
| 508 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 4.2. (b) Did you include complete proofs of all theoretical results? [No]
|
| 509 |
+
|
| 510 |
+
3. If you ran experiments...
|
| 511 |
+
|
| 512 |
+
(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 material.
|
| 513 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.2 and appendix.
|
| 514 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 515 |
+
(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 Section 4.2 and appendix.
|
| 516 |
+
|
| 517 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 518 |
+
|
| 519 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5.
|
| 520 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 521 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 522 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 523 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
|
| 524 |
+
|
| 525 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 526 |
+
|
| 527 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 528 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 529 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/rh0vIXw6i33/rh0vIXw6i33.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Multiple Descent: Design Your Own Generalization Curve
|
| 2 |
+
|
| 3 |
+
Lin Chen Simons Institute for the Theory of Computing University of California, Berkeley CA 94720 lin.chen@berkeley.edu
|
| 4 |
+
|
| 5 |
+
Yifei Min Department of Statistics and Data Science Yale University CT 06511 yifei.min@yale.edu
|
| 6 |
+
|
| 7 |
+
# Mikhail Belkin
|
| 8 |
+
|
| 9 |
+
Halıcıoglu Data Science Institute˘
|
| 10 |
+
University of California, San Diego CA 92093 mbelkin@ucsd.edu
|
| 11 |
+
|
| 12 |
+
Amin Karbasi School of Engineering and Applied Science Yale University CT 06511 amin.karbasi@yale.edu
|
| 13 |
+
|
| 14 |
+
# Abstract
|
| 15 |
+
|
| 16 |
+
This paper explores the generalization loss of linear regression in variably parameterized families of models, both under-parameterized and over-parameterized. We show that the generalization curve can have an arbitrary number of peaks, and moreover, locations of those peaks can be explicitly controlled. Our results highlight the fact that both classical U-shaped generalization curve and the recently observed double descent curve are not intrinsic properties of the model family. Instead, their emergence is due to the interaction between the properties of the data and the inductive biases of learning algorithms.
|
| 17 |
+
|
| 18 |
+
# 1 Introduction
|
| 19 |
+
|
| 20 |
+
The main goal of machine learning methods is to provide an accurate out-of-sample prediction, known as generalization. For a fixed family of models, a common way to select a model from this family is through empirical risk minimization, i.e., algorithmically selecting models that minimize the risk on the training dataset. Given a variably parameterized family of models, the statistical learning theory aims to identify the dependence between model complexity and model performance. The empirical risk usually decreases monotonically as the model complexity increases, and achieves its minimum when the model is rich enough to interpolate the training data, resulting in zero (or near-zero) training error. In contrast, the behaviour of the test error as a function of model complexity is far more complicated. Indeed, in this paper we show how to construct a model family for which the generalization curve can be fully controlled (away from the interpolation threshold) in both under-parameterized and over-parameterized regimes. Classical statistical learning theory supports a U-shaped curve of generalization versus model complexity [31, 33]. Under such a framework, the best model is found at the bottom of the U-shaped curve, which corresponds to appropriately balancing under-fitting and over-fitting the training data. From the view of the bias-variance trade-off, a higher model complexity increases the variance while decreasing the bias. A model with an appropriate level of complexity achieves a relatively low bias while still keeping the variance under control. On the other hand, a model that interpolates the training data is deemed to over-fit and tends to worsen the generalization performance due to the soaring variance.
|
| 21 |
+
|
| 22 |
+
Although classical statistical theory suggests a pattern of behavior for the generalization curve up to the interpolation threshold, it does not describe what happens beyond the interpolation threshold, commonly referred to as the over-parameterized regime. This is the exact regime where many modern machine learning models, especially deep neural networks, achieved remarkable success. Indeed, neural networks generalize well even when the models are so complex that they have the potential to interpolate all the training data points [61, 10, 32, 34].
|
| 23 |
+
|
| 24 |
+
Modern practitioners commonly deploy deep neural networks with hundreds of millions or even billions of parameters. It has become widely accepted that large models achieve performance superior to small models that may be suggested by the classical U-shaped generalization curve [13, 38, 55, 35, 36]. This indicates that the test error decreases again once model complexity grows beyond the interpolation threshold, resulting in the so called double-descent phenomenon described in [9], which has been broadly supported by empirical evidence [49, 48, 29, 30] and confirmed empirically on modern neural architectures by Nakkiran et al. [46]. On the theoretical side, this phenomenon has been recently addressed by several works on various model settings. In particular, Belkin et al. [11] proved the existence of double-descent phenomenon for linear regression with random feature selection and analyzed the random Fourier feature model [50]. Mei and Montanari [44] also studied the Fourier model and computed the asymptotic test error which captures the double-descent phenomenon. Bartlett et al. [8], Tsigler and Bartlett [56] analyzed and gave explicit conditions for “benign overfitting” in linear and ridge regression, respectively. Caron and Chretien [16] provided a finite sample analysis of the nonlinear function estimation and showed that the parameter learned through empirical risk minimization converges to the true parameter with high probability as the model complexity tends to infinity, implying the existence of double descent. Liu et al. [42] studied the high dimensional kernel ridge regression in the under- and over-parameterized regimes and showed that the risk curve can be double descent, bell-shaped, and monotonically decreasing.
|
| 25 |
+
|
| 26 |
+
Among all the aforementioned efforts, one particularly interesting question is whether one can observe more than two descents in the generalization curve. d’Ascoli et al. [21] empirically showed a samplewise triple-descent phenomenon under the random Fourier feature model. Similar triple-descent was also observed for linear regression [47]. More rigorously, Liang et al. [41] presented an upper bound on the risk of the minimum-norm interpolation versus the data dimension in Reproducing Kernel Hilbert Spaces (RKHS), which exhibits multiple descent. However, a multiple-descent upper bound without a properly matching lower bound does not imply the existence of a multiple-descent generalization curve. In this work, we study the multiple descent phenomenon by addressing the following questions:
|
| 27 |
+
|
| 28 |
+
• Can the existence of a multiple descent generalization curve be rigorously proven? • Can an arbitrary number of descents occur? • Can the generalization curve and the locations of descents be designed?
|
| 29 |
+
|
| 30 |
+
In this paper, we show that the answer to all three of these questions is yes. Further related work is presented in Section 2.
|
| 31 |
+
|
| 32 |
+
Our Contribution. We consider the linear regression model and analyze how the risk changes as the dimension of the data grows. In the linear regression setting, the data dimension is equal to the dimension of the parameter space, which reflects the model complexity. We rigorously show that the multiple descent generalization curve exists under this setting. To our best knowledge, this is the first work proving a multiple descent phenomenon.
|
| 33 |
+
|
| 34 |
+
Our analysis considers both the underparametrized and overparametrized regimes. In the overparametrized regime, we show that one can control where a descent or an ascent occurs in the generalization curve. This is realized through our algorithmic construction of a feature-revealing process. To be more specific, we assume that the data is in $\mathbb { R } ^ { D }$ , where $D$ can be arbitrarily large or even essentially infinite. We view each dimension of the data as a feature. We consider a linear regression problem restricted on the first $d$ features, where $d < D$ . New features are revealed by increasing the dimension of the data. We then show that by specifying the distribution of the newly revealed feature to be either a standard Gaussian or a Gaussian mixture, one can determine where an ascent or a descent occurs. In order to create an ascent when a new feature is revealed, it is sufficient that the feature follows a Gaussian mixture distribution. In order to have a descent, it is sufficient that the new feature follows a standard Gaussian distribution. Therefore, in the overparametrized regime, we can fully control the occurrence of a descent and an ascent. As a comparison, in the underparametrized regime, the generalization loss always increases regardless of the feature distribution. Generally speaking, we show that we are able to design the generalization curve.
|
| 35 |
+
|
| 36 |
+
On the one hand, we show theoretically that the generalization curve is malleable and can be constructed in an arbitrary fashion. On the other hand, we rarely observe complex generalization curves in practice, besides carefully curated constructions. Putting these facts together, we arrive at the conclusion that realistic generalization curves arise from specific interactions between properties of typical data and the inductive biases of algorithms. We should highlight that the nature of these interactions is far from being understood and should be an area of further investigations.
|
| 37 |
+
|
| 38 |
+
# 2 Related Work
|
| 39 |
+
|
| 40 |
+
Our work is directly related to the recent line of research in the theoretical understanding of the double descent [11, 34, 60, 44] and the multiple descent phenomenon [41, 39]. Here we briefly discuss some other work that is closely related to this paper.
|
| 41 |
+
|
| 42 |
+
Least Square Regression. In this paper we focus on the least square linear regression with no regularization. For the regularized least square regression, De Vito et al. [22] proposed a selection procedure for the regularization parameter. Advani and Saxe [1] analyzed the generalization of neural networks with mean squared error under the asymptotic regime where both the sample size and model complexity tend to infinity. Richards et al. [52] proved for least square regression in the asymptotic regime that as the dimension-to-sample-size ratio $d / n$ grows, an additional peak can occur in both the variance and bias due to the covariance structure of the features. As a comparison, in this paper the sample size is fixed and the model complexity increases. Rudi and Rosasco [53] studied kernel ridge regression and gave an upper bound on the number of the random features to reach certain risk level. Our result shows that there exists a natural setting where by manipulating the random features one can control the risk curve.
|
| 43 |
+
|
| 44 |
+
Over-Parameterization and Interpolation. The double descent occurs when the model complexity reaches and increases beyond the interpolation threshold. Most previous works focused on proving an upper bound or optimal rate for the risk. Caponnetto and De Vito [15] gave the optimal rate for least square ridge regression via careful selection of the regularization parameter. Belkin et al. [12] showed that the optimal rate for risk can be achieved by a model that interpolates the training data. In a series of work on kernel regression with regularization parameter tending to zero (a.k.a. kernel ridgeless regression), Rakhlin and Zhai [51] showed that the risk is bounded away from zero when the data dimension is fixed with respect to the sample size. Liang and Rakhlin [40] then considered the case when $d \asymp n$ , showed empirically the multiple descent phenomenon and proved a risk upper bound that can be small given favorable data and kernel assumptions. Instead of giving a bound, our paper presents an exact computation of risk in the cases of underparametrized and overparametrized linear regression, and proves the existence of the multiple descent phenomenon. Wyner et al. [59] analyzed AdaBoost and Random Forest from the perspective of interpolation. There has also been a line of work on wide neural networks [4–6, 23, 3, 58, 14, 2, 18, 62, 54].
|
| 45 |
+
|
| 46 |
+
Sample-wise Double Descent and Non-monotonicity. There has also been recent development beyond the model-complexity double-descent phenomenon. For example, regarding sample-wise non-monotonicity, Nakkiran et al. [46] empirically observed the epoch-wise double-descent and sample-wise non-monotonicity for neural networks. Chen et al. [19] and Min et al. [45] identified and proved the sample-wise double descent under the adversarial training setting, and Javanmard et al. [37] discovered double-descent under adversarially robust linear regression. Loog et al. [43] showed that empirical risk minimization can lead to sample-wise non-monotonicity in the standard linear model setting under various loss functions including the absolute loss and the squared loss, which covers the range from classification to regression. We also refer the reader to their discussion of the earlier work on non-monotonicity of generalization curves. Dar et al. [20] demonstrated the double descent curve of the generalization errors of subspace fitting problems. Fei et al. [28] studied the risk-sample tradeoff in reinforcement learning.
|
| 47 |
+
|
| 48 |
+
# 3 Preliminaries and Problem Formulation
|
| 49 |
+
|
| 50 |
+
Notation. For $x \in \mathbb { R } ^ { D }$ and $d \leq D$ , we let $x [ 1 : d ] \in \mathbb { R } ^ { d }$ denote a $d$ -dimensional vector with $x [ 1 : d ] _ { i } = x _ { i }$ for all $1 \ \leq \ i \ \leq \ d$ . For a matrix $A \ \in \ \mathbb { R } ^ { n \times d }$ , we denote its Moore-Penrose pseudoinverse by $A ^ { + } \in \mathbb { R } ^ { d \times n }$ and denote its spectral norm by $\textstyle \| A \| \triangleq \operatorname* { s u p } _ { x \neq 0 } { \frac { \| A x \| _ { 2 } } { \| x \| _ { 2 } } }$ kAxk2 , where k · k2 is the Euclidean norm for vectors. If $v$ is a vector, its spectral norm $\lVert v \rVert$ agrees with the Euclidean norm $\lVert \boldsymbol { v } \rVert _ { 2 }$ . Therefore, we write $\lVert v \rVert$ for $\lVert \boldsymbol { v } \rVert _ { 2 }$ to simplify the notation. We use the big $\mathrm { o }$ notation $\mathcal { O }$ and write variables in the subscript of $\mathcal { O }$ if the implicit constant depends on them. For example, ${ \mathcal { O } } _ { n , d , \sigma } ( 1 )$ is a constant that only depends on $n , d ,$ , and $\sigma$ . If $f ( \sigma )$ and $g ( \sigma )$ are functions of $\sigma$ , write $f ( \sigma ) \sim g ( \sigma )$ if $\begin{array} { r } { \operatorname* { l i m } \frac { f ( \sigma ) } { g ( \sigma ) } = 1 } \end{array}$ . It will be given in the context how we take the limit.
|
| 51 |
+
|
| 52 |
+
Distributions. Let ${ \mathcal { N } } ( \mu , \sigma ^ { 2 } )$ $( \mu , \sigma \in \mathbb { R } )$ and $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ $\mathbf { \mathcal { \mu } } _ { \mathbf { \lambda } } ( \mathbf { \mathcal { \mu } } _ { \mathbf { \lambda } } \mathbf { \mathbb { R } } ^ { n }$ , $\Sigma \in \mathbb { R } ^ { n \times n }$ ) denote the univariate and multivariate Gaussian distributions, respectively, where $\boldsymbol { \mu } \in \mathbb { R } ^ { n }$ and $\boldsymbol { \Sigma } \in \mathbb { R } ^ { n \times n }$ is a positive semi-definite matrix. We define a family of trimodal Gaussian mixture distributions as follows
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathcal { N } _ { \sigma , \mu } ^ { \mathrm { m i x } } \triangleq \frac 1 3 { N ( 0 , \sigma ^ { 2 } ) + \frac { 1 } { 3 } } { N ( - \mu , \sigma ^ { 2 } ) + \frac { 1 } { 3 } } { N ( \mu , \sigma ^ { 2 } ) } .
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
For an illustration, please see Fig. 1.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 1: Density functions of the $\mathcal { N } ( 0 , 1 )$ and $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ feature. A new entry is independently sampled from the 1-dimensional distribution being either a standard Gaussian or trimodal Gaussian mixture. Smaller $\sigma$ leads to higher concentration around each modes.
|
| 62 |
+
|
| 63 |
+
Let $\chi ^ { 2 } ( k , \lambda )$ denote the noncentral chi-squared distribution with $k$ degrees of freedom and the non-centrality parameter $\lambda$ . For example, if $X _ { i } \sim \mathcal { N } ( \mu _ { i } , 1 )$ (for $i = 1 , 2 , \ldots , k )$ are independent Gaussian random variables, we have ${ \textstyle \sum _ { i = 1 } ^ { k } X _ { i } ^ { 2 } \sim \chi ^ { 2 } ( k , \lambda ) }$ , where $\begin{array} { r } { \lambda = \sum _ { i = 1 } ^ { k } \mu _ { i } ^ { 2 } } \end{array}$ . We also denote by $\chi ^ { 2 } ( k )$ the (central) chi-squared distribution with $k$ degrees and the $F$ -distribution by $F ( d _ { 1 } , d _ { 2 } )$ where $d _ { 1 }$ and $d _ { 2 }$ are the degrees of freedom.
|
| 64 |
+
|
| 65 |
+
Problem Setup. Let $x _ { 1 } , \ldots , x _ { n } \in \mathbb { R } ^ { D }$ be column vectors that represent the training data of size $n$ and let $\boldsymbol { x } _ { \mathrm { t e s t } } \boldsymbol { \bar { \in } } \mathbb { R } ^ { D }$ be a column vector that represents the test data. We assume that they are all independently drawn from a distribution
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
x _ { 1 } , \ldots , x _ { n } , x _ { \mathrm { t e s t } } \overset { i i d } { \sim } \mathcal { D } .
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Let us consider a linear regression problem on the first $d$ features, where $d \leq D$ for some arbitrary large $D$ . Here, $d$ can be viewed as the number of features revealed. Then the feature vectors are $\tilde { x } _ { 1 } , \ldots , \tilde { x } _ { n }$ , where $\widetilde { x } _ { i } = x _ { i } [ 1 : d ] \in \mathbb { R } ^ { d }$ denotes the first $d$ entries of $x _ { i }$ . The corresponding response variable $y _ { i }$ satisfies
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
y _ { i } = \tilde { x } _ { i } ^ { \top } \beta + \varepsilon _ { i } , \quad i = 1 , \ldots , n ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where the noise $\varepsilon _ { i } \sim \mathcal { N } ( 0 , \eta ^ { 2 } )$ . We use the same setup as in [34] (see Equations (1) and (2) in [34]). Moreover, in another closely related work [41], if the kernel is set to the linear kernel, it is equivalent to our setup.
|
| 78 |
+
|
| 79 |
+
Next, we introduce the estimate $\hat { \beta }$ of $\beta$ and its excess generalization loss. Let $\varepsilon = ( \varepsilon _ { 1 } , \ldots , \varepsilon _ { n } ) ^ { \top } \in \mathbb { R } ^ { n }$ denote the noise vector. The design matrix $A$ equals $[ \tilde { x } _ { 1 } , \ldots , \tilde { x } _ { n } ] ^ { \top } \in \mathbb { R } ^ { n \times d }$ . Let $x = x _ { \mathrm { t e s t } } [ 1 : d ]$ denote the first $d$ features of the test data. For the underparametrized regime where $d < n$ , the least square solution on the training data is $A ^ { + } ( A \beta + \varepsilon )$ . For the overparametrized regime where $d > n$ , $A ^ { + } ( A \beta + \varepsilon )$ is the minimum-norm solution. In both regimes we consider the solution ${ \hat { \boldsymbol { \beta } } } \triangleq A ^ { + } ( A \beta + \varepsilon )$ . The excess generalization loss on the test data is then given by
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\begin{array} { r l } & { L _ { d } \triangleq \mathbb { E } [ ( y - x ^ { \top } \hat { \beta } ) ^ { 2 } - ( y - x ^ { \top } \beta ) ^ { 2 } ] } \\ & { \quad = \mathbb { E } [ ( x ^ { \top } ( \hat { \beta } - \beta ) ) ^ { 2 } ] } \\ & { \quad = \mathbb { E } [ ( x ^ { \top } ( ( A ^ { + } A - I ) \beta + A ^ { + } \varepsilon ) ) ^ { 2 } ] } \\ & { \quad = \mathbb { E } [ ( x ^ { \top } ( A ^ { + } A - I ) \beta ) ^ { 2 } ] + \mathbb { E } [ ( x ^ { \top } A ^ { + } \varepsilon ) ^ { 2 } ] } \\ & { \quad = \mathbb { E } [ ( x ^ { \top } ( A ^ { + } A - I ) \beta ) ^ { 2 } ] + \eta ^ { 2 } \mathbb { E } ( A ^ { \top } ) ^ { + } x ^ { 2 } , } \end{array}
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where $y = x ^ { \top } \beta + \varepsilon _ { \mathrm { t e s t } }$ and $\varepsilon _ { \mathrm { t e s t } } \sim \mathcal { N } ( 0 , \eta ^ { 2 } )$ . We call the term $\mathbb { E } \left[ ( x ^ { \top } ( A ^ { + } A - I ) \beta ) ^ { 2 } \right]$ the bias and call the term $\eta ^ { 2 } \mathbb { E } \left\| ( A ^ { \top } ) ^ { + } x \right\| ^ { 2 }$ the variance.
|
| 86 |
+
|
| 87 |
+
The next remark shows that in the underparametrized regime, the bias vanishes. The vanishing bias in the underparametrized regime is also observed by Hastie et al. [34] and shown in their Proposition 2.
|
| 88 |
+
|
| 89 |
+
Remark 1. In the underparametrized regime, if $\mathcal { D }$ is a continous distribution (our construction presented later satisfies this condition), the matrix $A$ has independent column almost surely. In this case, we have $A ^ { + } A = I$ and therefore the bias $\mathbb { E } \left[ ( x ^ { \top } ( A ^ { + } A - I ) \beta ) ^ { 2 } \right]$ vanishes irrespective of $\beta$ . In other words, in the underparametrized regime, $L _ { d }$ equals $\eta ^ { 2 } \mathbb { E } \| ( A ^ { \top } ) ^ { + } x \| ^ { 2 }$ .
|
| 90 |
+
|
| 91 |
+
According to Remark 1, we have $L _ { d } = \eta ^ { 2 } \mathbb { E } \| ( A ^ { \top } ) ^ { + } x \| ^ { 2 }$ in the underparametrized regime. It also holds in the overparametrized regime when $\beta = 0$ . Without loss of generality, we assume $\eta = 1$ in the underparametrized regime (for all $\beta$ ). In the overparametrized regime, we also assume $\eta = 1$ for the $\beta = 0$ case. In this case, we have
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
L _ { d } = \mathbb { E } \| ( A ^ { \top } ) ^ { + } x \| ^ { 2 } .
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
We assume a general $\eta$ (i.e., not necessarily being 1) in the overparametrized regime when $\beta$ is non-zero.
|
| 98 |
+
|
| 99 |
+
We would like to study the change in the loss caused by the growth in the number of features revealed. Recall $L _ { d } = \mathbb { E } \| ( A ^ { \top } ) ^ { + } x \| ^ { 2 }$ . Once we reveal a new feature, which adds a new row $b ^ { \top }$ to $A ^ { \top }$ and a new component $a _ { 1 }$ to $x$ , we have $L _ { d + 1 } = \mathbb { E } { \left. \left[ \binom { A ^ { \top } } { b ^ { \top } } \right] ^ { + } \left[ \frac { x } { a _ { 1 } } \right] \right. } ^ { 2 } .$
|
| 100 |
+
|
| 101 |
+
Local Maximum and Multiple Descent. Throughout the paper, we say that a local maximum occurs at a dimension $d \geq 1$ if $L _ { d - 1 } < L _ { d }$ and $L _ { d } > L _ { d + 1 }$ . Intuitively, a local maximum occurs if there is an increasing stage of the generalization loss, followed by a decreasing stage, as the dimension $d$ grows. Additionally, we define $L _ { 0 } \triangleq - \infty$ . If the generalization loss exhibits a single descent, based on our definition, a unique local maximum occurs at $d = 1$ . For a double-descent generalization curve, a local maximum occurs at two different dimensions. In general, if we observe local maxima at multiple dimensions, we say there is a multiple descent.
|
| 102 |
+
|
| 103 |
+
# 4 Underparametrized Regime
|
| 104 |
+
|
| 105 |
+
First, we present our main theorem for the underparametrized regime below, whose proof is deferred to the end of Section 4. It states that the generalization loss $L _ { d }$ is always non-decreasing as $d$ grows. Moreover, it is possible to have an arbitrarily large ascent, i.e., $L _ { d + 1 } - L _ { d } > C$ for any $C > 0$ .
|
| 106 |
+
|
| 107 |
+
Theorem 1 (Proof in Section 4.1). If $d < n$ , we have $L _ { d + 1 } \ge L _ { d }$ irrespective of the data distribution Moreover, for any $C > 0$ , there exists a distribution $\mathcal { D }$ such that $L _ { d + 1 } - L _ { d } > C$ .
|
| 108 |
+
|
| 109 |
+
Remark 2 ( $\mathcal { D }$ can be a product distribution). The first part of Theorem 1 holds irrespective of the data distribution. For the second part of the theorem ( i.e., for any $C > 0$ there exists a distribution such that $L _ { d + 1 } - L _ { d } > C )$ to hold, one extremely simple and elegant choice of the distribution $\mathcal { D }$ is a product distribution $\mathcal { D } = \mathcal { D } _ { 1 } \times \cdot \cdot \cdot \times \mathcal { D } _ { D }$ such that $x _ { i , j } \stackrel { i i d } { \sim } \mathcal { D } _ { j }$ for all $1 \leq i \leq n$ , where $\mathcal { D } _ { j }$ is a Gaussian mixture $\mathcal { N } _ { \sigma _ { j } , 1 } ^ { \mathrm { m i x } }$ for some $\sigma _ { j } > 0$ . Since the second part of Theorem 1 is of independent interest, the result is summarized by Theorem 4.
|
| 110 |
+
|
| 111 |
+
Remark 3 (Kernel regression on Gaussian data). In light of Remark 2, $\mathcal { D }$ can be chosen to be a product distribution that consists $\mathcal { N } _ { \sigma _ { j } } ^ { \mathrm { m i x } }$ . Note that one can simulate $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ with $\mathcal { N } ( 0 , 1 )$ through the inverse transform sampling. To see this, let $F _ { \mathcal { N } ( 0 , 1 ) }$ and $F _ { \mathrm { \mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } } } }$ be the cdf of $\mathcal { N } ( 0 , 1 )$ and $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ , respectively. If $X \sim \mathcal { N } ( 0 , 1 )$ , we have $F _ { \mathcal { N } ( 0 , 1 ) } ( X ) \sim \mathrm { U n i f } ( ( 0 , 1 ) )$ and therefore $\varphi _ { \sigma } ( X ) \triangleq$ $F _ { \mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } } } ^ { - 1 } ( F _ { \mathcal { N } ( 0 , 1 ) } ( X ) ) \sim \mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ . In fact, we can use a multivariate Gaussian $\mathcal { D } ^ { \prime } = \mathcal { N } ( 0 , I _ { D \times D } )$ and a sequence of non-linear kernels $k ^ { [ 1 : d ] } ( x , x ^ { \prime } )$ , $\langle \phi ^ { [ 1 : d ] } ( x ) , \phi ^ { [ 1 : d ] } ( x ^ { \prime } ) \rangle$ , where the feature map is $\phi ^ { [ 1 : d ] } ( x ) \ \triangleq \ [ \phi _ { 1 } ( x _ { 1 } ) , \phi _ { 2 } ( x _ { 2 } ) , \ldots , \phi _ { d } ( x _ { d } ) ] ^ { \top } \ \in \ \mathbb { R } ^ { d }$ . Here is a simple rule for defining $\phi _ { j }$ : if $\mathcal { D } _ { j } = \mathcal { N } _ { \sigma _ { j } } ^ { \mathrm { m i x } }$ , we set $\phi _ { j }$ to $\varphi _ { \sigma _ { j } }$ . Thus, the problem becomes a kernel regression problem on the standard Gaussian data.
|
| 112 |
+
|
| 113 |
+
The first part of Theorem 1, which says that $L _ { d }$ is increasing (or more precisely, non-decreasing), agrees with Figure 1 of [11] and Proposition 2 of [34]. In [34], they proved that the risk increases with $\gamma = d / n$ . Note that, at first glance, Theorem 1 may look counterintuitive since it does not obey the classical U-shaped generalization curve. However, we would like to emphasize that the U-shaped curve does not always occur. In Figure 1 and Proposition 2 of these two papers respectively, there is no U-shaped curve. The intuition behind Theorem 1 is that in the underparametrized setting, the bias is always zero and as $d$ approaches $n$ , the variance keeps increasing.
|
| 114 |
+
|
| 115 |
+
Coming to the second part of Theorem 1, we now discuss how we will construct such a distribution $\mathcal { D }$ inductively to satisfy $L _ { d + 1 } - L _ { d } > C$ . We fix $d$ . Again, denote the first $d$ features of $x _ { \mathrm { t e s t } }$ by $x \triangleq x _ { \mathrm { t e s t } } [ 1 : d ]$ . Let us add an additional component to the training data $x _ { 1 } [ 1 : d ] , \dotsc , x _ { n } [ 1 : d ]$ and test data $x$ so that the dimension $d$ is incremented by 1. Let $b _ { i } \in \mathbb { R }$ denote the additional component that we add to the vector $x _ { i }$ (so that the new vector is given as $[ x _ { i } [ 1 : d ] ^ { \top } , b _ { i } ] ^ { \top }$ . Similarly, let $a _ { 1 } \in \mathbb { R }$ denote the additional component that we add to the test vector $x$ . We form the column vector $b = [ b _ { 1 } , \ldots , b _ { n } ] ^ { \top } \in \mathbb { R } ^ { n }$ that collects all additional components that we add to the training data.
|
| 116 |
+
|
| 117 |
+
We consider the change in the generalization loss as follows
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
L _ { d + 1 } - L _ { d } = \mathbb { E } \left[ \left. \left[ \mathbf { \Sigma } _ { b } ^ { A } \right] ^ { + } \left[ \mathbf { \Sigma } _ { a _ { 1 } } ^ { x } \right] \right. ^ { 2 } - \left. ( A ^ { + } ) ^ { \top } x \right. ^ { 2 } \right] .
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
Note that the components $b _ { 1 } , \ldots , b _ { n } , a _ { 1 }$ are i.i.d. The proof of Theorem 1 starts with Lemma 2 which relates the pseudo-inverse of $[ A , b ] ^ { \top }$ to that of $A ^ { \top }$ . In this way, we can decompose $\left\| \left[ \binom { A ^ { \top } } { b ^ { \top } } \right] ^ { + } \left[ \binom { x } { a _ { 1 } } \right] \right\| ^ { 2 }$ into multiple terms for further careful analysis in the proofs hereinafter.
|
| 124 |
+
|
| 125 |
+
Lemma 2 (Proof in Appendix B.1). Let $A \in \mathbb { R } ^ { n \times d }$ and $0 \neq b \in \mathbb { R } ^ { n \times 1 }$ , where $n \geq d + 1$ Additionally, let $P = A A ^ { + }$ and $\begin{array} { r } { Q = b b ^ { + } = \frac { b b ^ { \top } } { \| b \| ^ { 2 } } } \end{array}$ bb>2 , and define z , b>(I−P )b2 . If $z \neq 0$ and the columnwise partitioned matrix $[ A , b ]$ has linearly independent columns, we have
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\begin{array} { r l } & { \left[ \boldsymbol { A } ^ { \top } \right] ^ { + } = \left[ \left( I - \frac { b b ^ { \top } } { \| b \| ^ { 2 } } \right) \left( I + \frac { \boldsymbol { A } \boldsymbol { A } ^ { + } b \boldsymbol { b } ^ { \top } } { \| b \| ^ { 2 } - b ^ { \top } \boldsymbol { A } \boldsymbol { A } ^ { + } b } \right) ( \boldsymbol { A } ^ { + } ) ^ { \top } , \frac { ( I - \boldsymbol { A } \boldsymbol { A } ^ { + } ) \boldsymbol { b } } { \| b \| ^ { 2 } - b ^ { \top } \boldsymbol { A } \boldsymbol { A } ^ { + } \boldsymbol { b } } \right] } \\ & { = \left[ ( I - \boldsymbol { Q } ) ( I + \frac { P Q } { 1 - \mathrm { t r } ( P Q ) } ) ( \boldsymbol { A } ^ { + } ) ^ { \top } , \frac { ( I - P ) \boldsymbol { b } } { b ^ { \top } ( I - P ) \boldsymbol { b } } \right] } \\ & { = \left[ ( I - Q ) ( I + \frac { P Q } { z } ) ( \boldsymbol { A } ^ { + } ) ^ { \top } , \frac { ( I - P ) \boldsymbol { b } } { b ^ { \top } ( I - P ) \boldsymbol { b } } \right] . } \end{array}
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
In our construction of $\mathcal { D }$ , the components $\mathcal { D } _ { j }$ are all continuous distributions. The matrix $I - P$ is an orthogonal projection matrix and therefore $\operatorname { i r a n k } ( I - P ) = n - d .$ . As a result, it holds almost surely that $b \neq 0$ , $z \neq 0$ , and $[ A , b ]$ has linearly independent columns. Thus the assumptions of Lemma 2 are satisfied almost surely. In the sequel, we assume that these assumptions are always fulfilled.
|
| 132 |
+
|
| 133 |
+
Theorem 3 guarantees that if $L _ { d } = \mathbb { E } \left\| ( A ^ { + } ) ^ { \top } x \right\| ^ { 2 }$ is finite and the $( d + 1 )$ -th features $b _ { 1 } , \ldots , b _ { n } , a _ { 1 }$ are i.i.d. sampled from $\mathcal { N } ( 0 , 1 )$ or $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ , $L _ { d + 1 } = \mathbb { E } \| [ { \binom { A ^ { \top } } { b ^ { \top } } } ^ { + } [ { \binom { x } { a _ { 1 } } } ] \| ^ { 2 }$ is also finite.
|
| 134 |
+
|
| 135 |
+
Theorem 3 (Proof in Appendix B.2). Let $z$ be as defined in Lemma 2. If $b _ { 1 } , \ldots , b _ { n } , a _ { 1 }$ are i.i.d. and follow a distribution with mean zero, conditioned on $A$ and $x$ , we have
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
\mathbb { E } _ { b , a _ { 1 } } \left[ \left. \left[ \boldsymbol { \mathsf { A } } ^ { \top } \right] ^ { + } \left[ \boldsymbol { \mathsf { x } } _ { 1 } \right] \right. ^ { 2 } \right] \leq \mathbb { E } _ { b , a _ { 1 } } \left[ \frac { 1 } { z } \left. ( \boldsymbol { A } ^ { + } ) ^ { \top } \boldsymbol { \mathsf { x } } \right. ^ { 2 } + \frac { a _ { 1 } ^ { 2 } } { b ^ { \top } ( I - P ) b } \right] .
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
In particular, if $d + 2 < n$ and $b _ { 1 } , \dots , b _ { n } , a _ { 1 } \overset { i i d } { \sim } \mathcal { N } ( 0 , 1 )$ , conditioned on $A$ and $x$ , we have
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\begin{array} { r l } & { \mathbb { E } _ { b , a _ { 1 } } \left[ \left. \left[ \boldsymbol { \mathsf { A } } ^ { \top } \right] ^ { + } \left[ \boldsymbol { \mathsf { x } } _ { 1 } \right] \right. ^ { 2 } \right] \leq \frac { ( n - 2 ) \left. ( \boldsymbol { \mathsf { A } } ^ { + } ) ^ { \top } \boldsymbol { \mathsf { x } } \right. ^ { 2 } + 1 } { n - d - 2 } . } \end{array}
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
$d + 2 < n$ and $b _ { 1 } , \dots , b _ { n } , a _ { 1 } \overset { i i d } { \sim } \mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ , conditioned on $A$ and $x$ , we have
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\mathbb { E } _ { b , a _ { 1 } } \| [ \binom { A ^ { \top } } { b ^ { \top } } ^ { + } [ \frac { x } { a _ { 1 } } ] \| ^ { 2 } \leq \frac { ( n - 2 + \sqrt { d } ) \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } + 2 / ( 3 \sigma ^ { 2 } ) + 1 } { n - d - 2 } .
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
Using Theorem 3, we can show inductively (on $d$ ) that $L _ { d }$ is finite for every $d$ . Provided that we are able to guarantee finite $L _ { 1 }$ , Theorem 3 implies that $L _ { d }$ is finite for every $d$ if the components are always sampled from $\mathcal { N } ( 0 , 1 )$ or $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ .
|
| 154 |
+
|
| 155 |
+
Making a large $L _ { d }$ can be achieved by adding an entry sampled from $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ when the data dimension increases from $d - 1$ to $d$ in the previous step. Theorem 4 shows that adding a $\mathcal { N } _ { \sigma , 1 } ^ { \mathrm { m i x } }$ feature can increase the loss by arbitrary amount, which in turn implies the second part of Theorem 1.
|
| 156 |
+
|
| 157 |
+
Theorem 4 (Proof in Appendix B.4). For any $\sigma > 0$ such that if $\mathbf { \dot { \cdot } } b _ { 1 } , \dots , b _ { n } , a _ { 1 } \overset { i i d } { \sim } \mathcal { N } _ { \sigma , 1 } ^ { \operatorname* { m i x } }$ , we have $C > 0$ and $\mathbb { E } \left\| ( A ^ { + } ) ^ { \top } x \right\| ^ { 2 } < + \infty$ , there exists $a$
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\begin{array} { r } { \mathbb { E } \left[ \left. \left[ \boldsymbol { \mathsf { A } } ^ { \top } \right] ^ { + } \left[ \boldsymbol { \mathsf { x } } _ { 1 } \right] \right. ^ { 2 } - \left. ( \boldsymbol { \mathsf { A } } ^ { + } ) ^ { \top } \boldsymbol { \mathsf { x } } \right. ^ { 2 } \right] > C . } \end{array}
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
We are now ready to prove Theorem 1.
|
| 164 |
+
|
| 165 |
+
# 4.1 Proof of Theorem 1
|
| 166 |
+
|
| 167 |
+
Proof. We follow the notation convention in (3):
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
\begin{array} { r } { L _ { d + 1 } - L _ { d } = \mathbb { E } \left[ \left. \left[ \boldsymbol { \mathsf { A } } ^ { \top } \right] ^ { + } \left[ \boldsymbol { \mathsf { a } } _ { 1 } \right] \right. ^ { 2 } - \left. ( \boldsymbol { A } ^ { \top } ) ^ { + } \boldsymbol { \mathsf { x } } \right. ^ { 2 } \right] . } \end{array}
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
Recall d < n and the matrix B0 , $B ^ { \prime } \triangleq { \left[ \begin{array} { l } { A ^ { \top } } \\ { b ^ { \top } } \end{array} \right] }$ is of size $( d + 1 ) \times n$ . Both matrices $B ^ { \prime }$ and $B \triangleq A ^ { \intercal }$ are fat matrices. As a result, if $x ^ { \prime } \triangleq { \left[ \begin{array} { l } { x } \\ { a _ { 1 } } \end{array} \right] }$ , we have
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
\| B ^ { \prime + } x ^ { \prime } \| ^ { 2 } = \operatorname* { m i n } _ { z : B ^ { \prime } z = x ^ { \prime } } \| z \| ^ { 2 } , \quad \| B ^ { + } x \| ^ { 2 } = \operatorname* { m i n } _ { z : B z = x } \| z \| ^ { 2 } .
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
Since $\{ z \mid B ^ { \prime } z = x ^ { \prime } \} \subseteq \{ z \mid B z = x \}$ , we get $\| B ^ { \prime + } x ^ { \prime } \| ^ { 2 } \geq \| B ^ { + } x \| ^ { 2 }$ . Therefore, we obtain $L _ { d + 1 } \ge L _ { d }$ . The second part follows from Theorem 4.
|
| 180 |
+
|
| 181 |
+
Remark 4. Remark 2 and the proof of Theorem 4 indicate that $\mathcal { D } = \mathcal { D } _ { 1 } \times \cdot \cdot \cdot \times \mathcal { D } _ { D }$ is a product distribution. The construction in the proof also shows that the generalization curve is determined by the specific choice of the $\mathcal { D } _ { i }$ ’s. Note that permuting the order of $\mathcal { D } _ { i }$ ’s is equivalent to changing the order by which the features are being revealed (i.e., permuting the entries of the data $x _ { i }$ ’s). Therefore, given the same data points $x _ { 1 } , \cdot \cdot \cdot , x _ { n } \in \mathbb { R } ^ { D }$ , one can create different generalization curves simply by changing the order of the feature-revealing process.
|
| 182 |
+
|
| 183 |
+

|
| 184 |
+
Figure 2: Illustration of the multiple descent phenomenon for the generalization loss $L _ { d }$ versus the dimension of data $d$ in the overparametrized regime starting from $d = n { + } 8$ . One can fully control the generalization curve to increase or decrease as specified by the sequence $\Delta = \{ \downarrow , \uparrow , \downarrow , \downarrow , \uparrow , \downarrow , . . . \}$ . Adding a new feature with Gaussian mixture distribution increases the loss, while adding one with Gaussian distribution decreases the loss.
|
| 185 |
+
|
| 186 |
+
# 5 Overparametrized Regime
|
| 187 |
+
|
| 188 |
+
In this section, we study the multiple decent phenomenon in the overparametrized regime. Note that as stated in Section 3, we consider the minimum-norm solution here. We first consider the case where the model $\beta = 0$ and $L _ { d }$ is as defined in (2). Then we discuss the setting $\beta \neq 0$ .
|
| 189 |
+
|
| 190 |
+
As stated in the following theorem, we require $d \ge n + 8$ . This is merely a technical requirement and we can still say that $d$ starts at roughly the same order as $n$ . In other words, the result covers almost the entire spectrum of the overparametrized regime.
|
| 191 |
+
|
| 192 |
+
Theorem 5 (Overparametrized regime, $\beta ~ = ~ 0 ,$ . Let $\begin{array} { l l l } { n } & { < } & { D ~ - ~ 9 } \end{array}$ . Given any sequence $\Delta _ { n + 8 } , \Delta _ { n + 9 } , . . . , \Delta _ { D - 1 }$ where $\Delta _ { d } \in \{ \uparrow , \downarrow \}$ , there exists a distribution $\mathcal { D }$ such that for every $n + 8 \leq d \leq D - 1$ , we have
|
| 193 |
+
|
| 194 |
+
$$
|
| 195 |
+
L _ { d + 1 } \left\{ \stackrel { > } { _ { < } } L _ { d } , \quad i f \Delta _ { d } = \uparrow \right.
|
| 196 |
+
$$
|
| 197 |
+
|
| 198 |
+
In Theorem 5, the sequence $\Delta _ { n + 8 } , \Delta _ { n + 9 } , \cdot \cdot \cdot , \Delta _ { D - 1 }$ is just used to specify the increasing/decreasing behavior of the $L _ { d }$ sequence for $d > n + 8$ . Compared to Theorem 1 for the underparametrized regime, where $L _ { d }$ always increases, Theorem 5 indicates that one is able to fully control both ascents and descents in the overparametrized regime. Fig. 2 is an illustration.
|
| 199 |
+
|
| 200 |
+
We now present tools for proving Theorem 5. Lemma 6 gives the pseudo-inverse of $A$ when $d > n$ . Lemma 6 (Proof in Appendix C.1). Let $A \in \mathbb { R } ^ { n \times d }$ and $b \in \mathbb { R } ^ { n \times 1 }$ , where $n \leq d$ . Assume that matrix $A$ and the columnwise partitioned matrix $B \triangleq [ A , b ]$ have linearly independent rows. Let $G \triangleq ( A A ^ { \top } ) ^ { - 1 } \in \mathbb { R } ^ { n \times n }$ and $\begin{array} { r } { u \triangleq \frac { b ^ { \intercal } G } { 1 + b ^ { \intercal } G b } \in \mathbb { R } ^ { 1 \times n } } \end{array}$ . We have
|
| 201 |
+
|
| 202 |
+
$$
|
| 203 |
+
\left[ \begin{array} { l } \boldsymbol { A } ^ { \top } \right] ^ { + } = \left[ ( \boldsymbol { I } - b \boldsymbol { u } ) ^ { \top } ( \boldsymbol { A } ^ { + } ) ^ { \top } , \boldsymbol { u } ^ { \top } \right] . \end{array}
|
| 204 |
+
$$
|
| 205 |
+
|
| 206 |
+
Lemma 7 establishes finite expectation for several random variables. These finite expectation results are necessary for Theorem 8 and Theorem 9 to hold. Technically, they are the dominating random variables needed in Lebesgue’s dominated convergence theorem. Lemma 7 indicates that to guarantee these finite expectations, it suffices to set the first $n + 8$ distributions to the standard normal distribution and then set $\mathcal { D } _ { n + 8 } , \ldots , \mathcal { D } _ { D }$ to either a Gaussian or a Gaussian mixture distribution. In fact, in Theorem 8 and Theorem 9, we always add a Gaussian distribution or a Gaussian mixture.
|
| 207 |
+
|
| 208 |
+
Lemma 7 (Proof in Appendix C.2). Let $\mathcal { D } = \mathcal { D } _ { 1 } \times \cdot \cdot \cdot \times \mathcal { D } _ { D }$ be a product distribution where
|
| 209 |
+
|
| 210 |
+
Let $\mathcal { D } _ { [ 1 : d ] }$ denote $\mathcal { D } _ { 1 } \times \cdots \times \mathcal { D } _ { d }$ . Assume that every row of $A \in \mathbb { R } ^ { n \times d }$ and $x \in \mathbb { R } ^ { d \times 1 }$ are i.i.d. and follow $\mathcal { D } _ { [ 1 : d ] }$ . For any $d$ such that $n + 8 \leq d \leq D$ , all of the followings hold:
|
| 211 |
+
|
| 212 |
+
$$
|
| 213 |
+
\begin{array} { r l r } & { \mathbb E [ \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } ] < + \infty , } & { \mathbb E [ \lambda _ { \operatorname* { m a x } } ^ { 2 } ( ( A A ^ { \top } ) ^ { - 1 } ) ] < + \infty , } \\ & { \mathbb E [ \lambda _ { \operatorname* { m a x } } ( ( A A ^ { \top } ) ^ { - 1 } ) \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } ] < + \infty , } & { \mathbb E [ \lambda _ { \operatorname* { m a x } } ^ { 2 } ( ( A A ^ { \top } ) ^ { - 1 } ) \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } ] < + \infty . } \end{array}
|
| 214 |
+
$$
|
| 215 |
+
|
| 216 |
+
Theorems 8 and 9 are the key technical results for constructing multiple descent in the overparametrized regime. One can create a descent $( L _ { d + 1 } < L _ { d } )$ by adding a Gaussian feature (Theorem 8) and create an ascent $( L _ { d + 1 } > L _ { d } )$ by adding a Gaussian mixture feature (Theorem 9).
|
| 217 |
+
|
| 218 |
+
Theorem 8 (Proof in Appendix C.3). If E $\bar { \mathsf { x } } [ \| ( A ^ { \top } A ) ^ { + } x \| ^ { 2 } ] > 0$ and all equations in (4) hold, there exists $\sigma > 0$ such that i $f a _ { 1 } , b _ { 1 } , \ldots , b _ { n } \stackrel { i i d } { \sim } { \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ , we have
|
| 219 |
+
|
| 220 |
+
$$
|
| 221 |
+
L _ { d + 1 } - L _ { d } = \mathbb { E } \| [ { \binom { A ^ { \top } } { b ^ { \top } } } ^ { + } [ { \binom { x } { a _ { 1 } } } ] \| ^ { 2 } - \mathbb { E } \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } < 0 .
|
| 222 |
+
$$
|
| 223 |
+
|
| 224 |
+
Theorem 9 shows that adding a Gaussian mixture feature can make $L _ { d + 1 } > L _ { d }$ .
|
| 225 |
+
|
| 226 |
+
Theorem 9 (Proof in Appendix C.4). Assume $\sigma > 0$ such that $i f a _ { 1 } , b _ { 1 } , \ldots , b _ { n } \stackrel { i i d } { \sim } \mathcal { N } _ { \sigma , \mu } ^ { \mathrm { m i x } }$ , we have $\mathbb { E } \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } < + \infty$ . For any $C > 0$ , there exist $\mu$
|
| 227 |
+
|
| 228 |
+
$$
|
| 229 |
+
L _ { d + 1 } - L _ { d } = \mathbb { E } \| [ { \binom { A ^ { \top } } { b ^ { \top } } } ^ { + } [ { \binom { x } { a _ { 1 } } } ] \| ^ { 2 } - \mathbb { E } \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } > C .
|
| 230 |
+
$$
|
| 231 |
+
|
| 232 |
+
The proof of Theorem 5 immediately follows from Theorem 8 and Theorem 9.
|
| 233 |
+
|
| 234 |
+
Proof of Theorem 5. We construct the product distribution $\begin{array} { r } { \mathcal { D } = \prod _ { d = 1 } ^ { D } \mathcal { D } _ { d } } \end{array}$ . We set $\mathcal { D } _ { d } = \mathcal { N } ( 0 , 1 )$ for $d = 1 , \dotsc , n + 8$ . For $n + 8 < d \leq D$ , $\mathcal { D } _ { d }$ is either $\textstyle \mathcal { N } ( 0 , \sigma _ { d } ^ { 2 } )$ dor $\sqrt { \operatorname * { m i x } _ { \sigma _ { d } , \mu _ { d } } }$ depending on $\Delta _ { d }$ being either $\downarrow \mathrm { o r } \uparrow$ .
|
| 235 |
+
|
| 236 |
+
First we show that for each step $d$ , the assumption $\mathbb { E } [ \| ( A ^ { \top } A ) ^ { + } x \| ^ { 2 } ] > 0$ of Theorem 8 is satisfied. If $\mathbb { E } [ \| ( A ^ { \top } A ) ^ { + } x \| ^ { 2 } ] = 0$ , we know that $( A ^ { \top } A ) ^ { + } x = 0$ almost surely. Since $\mathcal { D }$ is a continuous distribution, the matrix $A$ has full row rank almost surely. Therefore, $\operatorname { r a n k } ( ( A ^ { \top } A ) ^ { + } ) = \operatorname { r a n k } ( A ^ { \top } A ) = n$ almost surely. Thus $\dim \ker ( A ^ { \top } A ) ^ { + } = d - n \leq d - 1$ almost surely, which implies $x \not \in \ker ( A ^ { \top } A ) ^ { + }$ . In other words, $( A ^ { \top } A ) ^ { + } x \neq 0$ almost surely. We reach a contradiction. Moreover, by Lemma 7, the assumption $\mathbb { E } \| ( A ^ { + } ) ^ { \top } x \| ^ { 2 } < + \infty$ of Theorem 9 is also satisfied.
|
| 237 |
+
|
| 238 |
+
If $\Delta _ { d - 1 } = \downarrow$ , by Theorem 8, there exists $\sigma _ { d } > 0$ such that if $\mathcal { D } _ { d } = \mathcal { N } ( 0 , \sigma _ { d } ^ { 2 } )$ , then $L _ { d } < L _ { d - 1 }$ . Similarly if $\Delta _ { d - 1 } = \uparrow$ , by Theorem 9, there exists $\sigma _ { d }$ and $\mu _ { d }$ such that $\mathcal { D } _ { d } = \mathcal { N } _ { \sigma _ { d } , \mu _ { d } } ^ { \mathrm { m i x } }$ N mixσd,µd guarantees $L _ { d } > L _ { d - 1 }$ .
|
| 239 |
+
|
| 240 |
+
Gaussian $\beta$ setting. In what follows, we study the case where the model $\beta$ is non-zero. In particular, we consider a setting where each entry of $\beta$ is i.i.d. $\mathcal { N } ( 0 , \rho ^ { 2 } )$ . Recalling (1), define the biases
|
| 241 |
+
|
| 242 |
+
$$
|
| 243 |
+
\begin{array} { r } { \mathcal { E } _ { d } \triangleq ( x ^ { \top } ( A ^ { + } A - I ) \beta ) ^ { 2 } , \quad \mathcal { E } _ { d + 1 } \triangleq \left( [ x ^ { \top } , a _ { 1 } ] ( [ A , b ] ^ { + } [ A , b ] - I ) \left[ \beta \right] \right) ^ { 2 } , } \end{array}
|
| 244 |
+
$$
|
| 245 |
+
|
| 246 |
+
and the expected risks
|
| 247 |
+
|
| 248 |
+
$$
|
| 249 |
+
\begin{array} { r } { L _ { d } ^ { \mathrm { e x p } } \triangleq \mathbb E [ \mathcal { E } _ { d } ] + \eta ^ { 2 } \mathbb E \| ( A ^ { \top } ) ^ { + } x \| ^ { 2 } , \quad L _ { d + 1 } ^ { \mathrm { e x p } } \triangleq \mathbb E [ \mathcal { E } _ { d + 1 } ] + \eta ^ { 2 } \mathbb E \| [ [ A ^ { \top } ] ^ { + } [ a _ { 1 } ] ] ^ { 2 } , } \end{array}
|
| 250 |
+
$$
|
| 251 |
+
|
| 252 |
+
where $\beta \sim \mathcal { N } ( 0 , \rho ^ { 2 } I _ { d } )$ and $\beta _ { 1 } \sim \mathcal { N } ( 0 , \rho ^ { 2 } )$ . The second term in $\boldsymbol { L } _ { d } ^ { \mathrm { e x p } }$ and $L _ { d + 1 } ^ { \mathrm { e x p } }$ is the variance term. Note that ${ \cal L } _ { d } ^ { \mathrm { e x p } }$ is the expected value of $L _ { d }$ in (1) and averages over $\beta$ . Theorem 10 shows that one d can add a Gaussian mixture feature in order to make $L _ { d + 1 } ^ { \mathrm { e x p } } > L _ { d } ^ { \mathrm { e x p } }$ , and add a Gaussian feature in order to make Lexpd+1 $L _ { d + 1 } ^ { \exp } < L _ { d } ^ { \exp }$ .
|
| 253 |
+
|
| 254 |
+
Theorem 10 (Proof in Appendix C.5). Let $a _ { 1 } , \beta _ { 1 } \in \mathbb { R } ,$ , $x \in \mathbb { R } ^ { d \times 1 }$ , $\beta \in \mathbb { R } ^ { d \times 1 }$ , $A \in \mathbb { R } ^ { n \times d }$ and $b \in \mathbb { R } ^ { n \times 1 }$ , where $n \leq d$ . Assume that $x , a _ { 1 } , \beta _ { 1 } , \beta , A , b$ are jointly independent, $[ \beta ^ { \top } , \beta _ { 1 } ] ^ { \top } \sim$ $\mathcal { N } ( 0 , \rho ^ { 2 } I _ { d + 1 } )$ . Moreover, assume that the matrix $[ A , b ]$ has linearly independent rows almost surely. The following statements hold:
|
| 255 |
+
|
| 256 |
+
$f a _ { 1 } , b _ { 1 } , \ldots , b _ { n } \stackrel { i i d } { \sim } \mathcal { N } _ { \sigma , \mu } ^ { \mathrm { m i x } } ,$ , for any $C > 0$ , there exist $\mu , \sigma$ such that $L _ { d + 1 } ^ { \mathrm { e x p } } - L _ { d } ^ { \mathrm { e x p } } > C$ (b) If $\cdot _ { a _ { 1 } , b _ { 1 } , . . . , b _ { n } } \stackrel { i i d } { \sim } \mathcal { N } ( 0 , \sigma ^ { 2 } )$ , there exists $\sigma > 0$ such that for all
|
| 257 |
+
|
| 258 |
+
$$
|
| 259 |
+
\rho \leq \eta \sqrt { \frac { \mathbb { E } [ \| ( A ^ { \top } A ) ^ { + } x \| ^ { 2 } ] } { \mathbb { E } \| A ^ { + \top } x \| ^ { 2 } + 1 } } ,
|
| 260 |
+
$$
|
| 261 |
+
|
| 262 |
+
we hav e $L _ { d + 1 } ^ { \exp } < L _ { d } ^ { \exp }$
|
| 263 |
+
|
| 264 |
+
Theorem 10 indicates that for $\beta$ obeying a normal distribution, one can still construct a generalization curve as desired by adding a Gaussian or Gaussian mixture feature properly. We make this construction explicit for any desired generalization curve in (the proof of) Theorem 11. Similar to the construction in the underparametrized regime (for all $\beta$ ) and overparametrization regime (for $\beta = 0$ ), the distribution $\mathcal { D }$ can be made a product distribution.
|
| 265 |
+
|
| 266 |
+
Theorem 11 (Overparametrized regime, $\beta$ being Gaussian). Let $n < D - 9$ . Given any sequence $\Delta _ { n + 8 } , \Delta _ { n + 9 } , . . . , \Delta _ { D - 1 }$ where $\Delta _ { d } \in \{ \uparrow , \downarrow \}$ , there exists $\rho > 0$ and a distribution $\mathcal { D }$ such that for $\beta \sim \mathcal { N } ( 0 , \rho ^ { 2 } )$ and every $n + 8 \leq d \leq D - 1$ , we have
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\begin{array} { r } { L _ { d + 1 } ^ { \mathrm { e x p } } \left\{ { \stackrel { > } { \sim } } L _ { d } ^ { \mathrm { e x p } } , \quad i f \Delta _ { d } = \uparrow \right. } \\ { \left. < L _ { d } ^ { \mathrm { e x p } } , \quad i f \Delta _ { d } = \downarrow . \right. } \end{array}
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
Proof of Theorem $I I$ . Define the design matrix $A _ { d } \triangleq [ x _ { 1 } [ 1 : d ] , \dots , x _ { n } [ 1 : d ] ] ^ { \intercal } \in \mathbb { R } ^ { n \times d }$ . Similar to the proof of Theorem 5, we construct the product distribution $\begin{array} { r } { \mathcal { D } = \prod _ { d = 1 } ^ { D } \mathcal { D } _ { d } } \end{array}$ . We set $\mathcal { D } _ { d } = \mathcal { N } ( 0 , 1 )$ for $d = 1 , \ldots , n + 8$ . For $n + 8 < d \leq D$ , $\mathcal { D } _ { d }$ is either $\textstyle \mathcal { N } ( 0 , \sigma _ { d } ^ { 2 } )$ or $\sqrt { \operatorname* { m i x } _ { \sigma _ { d } , \mu _ { d } } }$ depending on $\Delta _ { d }$ being either $\downarrow$ or $\uparrow$ .
|
| 273 |
+
|
| 274 |
+
If $\Delta _ { d - 1 } = \uparrow$ , by Theorem 10, there exists $\sigma _ { d }$ and $\mu _ { d }$ such that $\mathcal { D } _ { d } = \mathcal { N } _ { \sigma _ { d } , \mu _ { d } } ^ { \mathrm { m i x } }$ guarantees $L _ { d } ^ { \exp } > L _ { d - 1 } ^ { \exp }$ $\Delta _ { d - 1 } = \downarrow$
|
| 275 |
+
|
| 276 |
+
$$
|
| 277 |
+
\rho _ { d } \triangleq \eta \sqrt { \frac { \mathbb { E } [ \| ( A _ { d - 1 } ^ { \top } A _ { d - 1 } ) ^ { + } x _ { \mathrm { t e s t } } [ 1 : d - 1 ] \| ^ { 2 } ] } { \mathbb { E } \| A _ { d - 1 } ^ { + \top } x _ { \mathrm { t e s t } } [ 1 : d - 1 ] \| ^ { 2 } + 1 } } .
|
| 278 |
+
$$
|
| 279 |
+
|
| 280 |
+
By Theorem 10, there exists $\sigma _ { d } > 0$ such that if $\rho \leq \rho _ { d }$ and $\mathcal { D } _ { d } = \mathcal { N } ( 0 , \sigma _ { d } ^ { 2 } )$ , then $L _ { d } ^ { \exp } < L _ { d - 1 } ^ { \exp }$ . We
|
| 281 |
+
|
| 282 |
+
$$
|
| 283 |
+
\rho = \operatorname* { m i n } _ { \substack { d : \Delta _ { d - 1 } = \downarrow } } \rho _ { d } .
|
| 284 |
+
$$
|
| 285 |
+
|
| 286 |
+
# 6 Conclusion
|
| 287 |
+
|
| 288 |
+
Our work proves that the expected risk of linear regression can manifest multiple descents when the number of features increases and sample size is fixed. This is carried out through an algorithmic construction of a feature-revealing process where the newly revealed feature follows either a Gaussian distribution or a Gaussian mixture distribution. Notably, the construction also enables us to control local maxima in the underparametrized regime and control ascents/descents freely in the overparametrized regime. Overall, this allows us to design the generalization curve away from the interpolation threshold.
|
| 289 |
+
|
| 290 |
+
We believe that our analysis of linear regression in this paper is a good starting point for explaining non-monotonic generalization curves observed in machine learning studies. Extending these results to more complex problem setups would be a meaningful future direction.
|
| 291 |
+
|
| 292 |
+
# Funding Transparency Statement
|
| 293 |
+
|
| 294 |
+
LC: Funding in direct support of this work: postdoctoral research fellowship by the Simons Institute for the Theory of Computing, University of California, Berkeley, and Google PhD Fellowship by Google. Additional revenues related to this work: internships at Google.
|
| 295 |
+
|
| 296 |
+
MB acknowledges support from NSF IIS-1815697, and the support of the NSF and the Simons Foundation for the Collaboration on the Theoretical Foundations of Deep Learning through awards DMS-2031883 and #814639.
|
| 297 |
+
|
| 298 |
+
AK: Funding in direct support of this work: NSF (IIS-1845032) and ONR (N00014-19-1-2406).
|
| 299 |
+
|
| 300 |
+
# References
|
| 301 |
+
|
| 302 |
+
[1] M. S. Advani and A. M. Saxe. High-dimensional dynamics of generalization error in neural networks. arXiv preprint arXiv:1710.03667, 2017.
|
| 303 |
+
[2] M. S. Advani, A. M. Saxe, and H. Sompolinsky. High-dimensional dynamics of generalization error in neural networks. Neural Networks, 132:428–446, 2020.
|
| 304 |
+
[3] Z. Allen-Zhu, Y. Li, and Z. Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning, pages 242–252, 2019.
|
| 305 |
+
[4] S. Arora, S. S. Du, W. Hu, Z. Li, R. R. Salakhutdinov, and R. Wang. On exact computation with an infinitely wide neural net. In Advances in Neural Information Processing Systems, pages 8141–8150, 2019.
|
| 306 |
+
[5] S. Arora, S. S. Du, W. Hu, Z. Li, and R. Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In ICML, pages 477–502, 2019.
|
| 307 |
+
[6] S. Arora, S. S. Du, Z. Li, R. Salakhutdinov, R. Wang, and D. Yu. Harnessing the power of infinitely wide deep nets on small-data tasks. In International Conference on Learning Representations, 2019. [7] J. K. Baksalary and O. M. Baksalary. Particular formulae for the moore–penrose inverse of a columnwise partitioned matrix. Linear algebra and its applications, 421(1):16–23, 2007.
|
| 308 |
+
[8] P. L. Bartlett, P. M. Long, G. Lugosi, and A. Tsigler. Benign overfitting in linear regression. Proceedings of the National Academy of Sciences, 2020.
|
| 309 |
+
[9] M. Belkin, D. Hsu, S. Ma, and S. Mandal. Reconciling modern machine learning and the bias-variance trade-off. stat, 1050:28, 2018.
|
| 310 |
+
[10] M. Belkin, S. Ma, and S. Mandal. To understand deep learning we need to understand kernel learning. In International Conference on Machine Learning, pages 541–549, 2018.
|
| 311 |
+
[11] M. Belkin, D. Hsu, and J. Xu. Two models of double descent for weak features. arXiv preprint arXiv:1903.07571, 2019.
|
| 312 |
+
[12] M. Belkin, A. Rakhlin, and A. B. Tsybakov. Does data interpolation contradict statistical optimality? In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1611–1619, 2019.
|
| 313 |
+
[13] Y. Bengio, R. Ducharme, P. Vincent, and C. Jauvin. A neural probabilistic language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
|
| 314 |
+
[14] Y. Cao and Q. Gu. Generalization bounds of stochastic gradient descent for wide and deep neural networks. In Advances in Neural Information Processing Systems, pages 10836–10846, 2019.
|
| 315 |
+
[15] A. Caponnetto and E. De Vito. Optimal rates for the regularized least-squares algorithm. Foundations of Computational Mathematics, 7(3):331–368, 2007.
|
| 316 |
+
[16] E. Caron and S. Chretien. A finite sample analysis of the double descent phenomenon for ridge function estimation. arXiv preprint arXiv:2007.12882, 2020.
|
| 317 |
+
[17] M. Caron, P. Bojanowski, A. Joulin, and M. Douze. Deep clustering for unsupervised learning of visual features. In Proceedings of the European Conference on Computer Vision (ECCV), pages 132–149, 2018.
|
| 318 |
+
[18] L. Chen and S. Xu. Deep neural tangent kernel and laplace kernel have the same rkhs. In ICLR, 2021.
|
| 319 |
+
[19] L. Chen, Y. Min, M. Zhang, and A. Karbasi. More data can expand the generalization gap between adversarially robust and standard models. In International Conference on Machine Learning, pages 1670–1680. PMLR, 2020.
|
| 320 |
+
[20] Y. Dar, P. Mayer, L. Luzi, and R. G. Baraniuk. Subspace fitting meets regression: The effects of supervision and orthonormality constraints on double descent of generalization errors. In ICML, 2020.
|
| 321 |
+
[21] S. d’Ascoli, L. Sagun, and G. Biroli. Triple descent and the two kinds of overfitting: Where & why do they appear? arXiv preprint arXiv:2006.03509, 2020.
|
| 322 |
+
[22] E. De Vito, A. Caponnetto, and L. Rosasco. Model selection for regularized least-squares algorithm in learning theory. Foundations of Computational Mathematics, 5(1):59–85, 2005.
|
| 323 |
+
[23] S. Du, J. Lee, H. Li, L. Wang, and X. Zhai. Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning, pages 1675–1685, 2019.
|
| 324 |
+
[24] Y. Fei and Y. Chen. Exponential error rates of sdp for block models: Beyond grothendieck’s inequality. IEEE Transactions on Information Theory, 65(1):551–571, 2018.
|
| 325 |
+
[25] Y. Fei and Y. Chen. Hidden integrality of sdp relaxations for sub-gaussian mixture models. In Conference On Learning Theory, pages 1931–1965. PMLR, 2018.
|
| 326 |
+
[26] Y. Fei and Y. Chen. Achieving the bayes error rate in stochastic block model by sdp, robustly. In Conference on Learning Theory, pages 1235–1269. PMLR, 2019.
|
| 327 |
+
[27] Y. Fei and Y. Chen. Achieving the bayes error rate in synchronization and block models by sdp, robustly. IEEE Transactions on Information Theory, 66(6):3929–3953, 2020.
|
| 328 |
+
[28] Y. Fei, Z. Yang, Y. Chen, Z. Wang, and Q. Xie. Risk-sensitive reinforcement learning: Nearoptimal risk-sample tradeoff in regret. arXiv preprint arXiv:2006.13827, 2020.
|
| 329 |
+
[29] M. Geiger, S. Spigler, S. d’Ascoli, L. Sagun, M. Baity-Jesi, G. Biroli, and M. Wyart. Jamming transition as a paradigm to understand the loss landscape of deep neural networks. Physical Review E, 100(1):012115, 2019.
|
| 330 |
+
[30] M. Geiger, A. Jacot, S. Spigler, F. Gabriel, L. Sagun, S. d’Ascoli, G. Biroli, C. Hongler, and M. Wyart. Scaling description of generalization with number of parameters in deep learning. Journal of Statistical Mechanics: Theory and Experiment, 2020(2):023401, 2020.
|
| 331 |
+
[31] S. Geman, E. Bienenstock, and R. Doursat. Neural networks and the bias/variance dilemma. Neural computation, 4(1):1–58, 1992.
|
| 332 |
+
[32] B. Ghorbani, S. Mei, T. Misiakiewicz, and A. Montanari. Linearized two-layers neural networks in high dimension. arXiv preprint arXiv:1904.12191, 2019.
|
| 333 |
+
[33] T. Hastie, R. Tibshirani, and J. Friedman. The elements of statistical learning: data mining, inference, and prediction. Springer Science & Business Media, 2009.
|
| 334 |
+
[34] T. Hastie, A. Montanari, S. Rosset, and R. J. Tibshirani. Surprises in high-dimensional ridgeless least squares interpolation. arXiv preprint arXiv:1903.08560, 2019.
|
| 335 |
+
[35] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770– 778, 2016.
|
| 336 |
+
[36] Y. Huang, Y. Cheng, A. Bapna, O. Firat, D. Chen, M. Chen, H. Lee, J. Ngiam, Q. V. Le, Y. Wu, et al. Gpipe: Efficient training of giant neural networks using pipeline parallelism. In Advances in neural information processing systems, pages 103–112, 2019.
|
| 337 |
+
[37] A. Javanmard, M. Soltanolkotabi, and H. Hassani. Precise tradeoffs in adversarial training for linear regression. In Conference on Learning Theory, 2020.
|
| 338 |
+
[38] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012.
|
| 339 |
+
[39] Y. Li and Y. Wei. Minimum $\ell _ { 1 }$ -norm interpolators: Precise asymptotics and multiple descent. arXiv preprint arXiv:2110.09502, 2021.
|
| 340 |
+
[40] T. Liang and A. Rakhlin. Just interpolate: Kernel “ridgeles” regression can generalize. Annals of Statistics, page to appear, 2019.
|
| 341 |
+
[41] T. Liang, A. Rakhlin, and X. Zhai. On the multiple descent of minimum-norm interpolants and restricted lower isometry of kernels. In COLT, 2020.
|
| 342 |
+
[42] F. Liu, Z. Liao, and J. Suykens. Kernel regression in high dimensions: Refined analysis beyond double descent. In International Conference on Artificial Intelligence and Statistics, pages 649–657. PMLR, 2021.
|
| 343 |
+
[43] M. Loog, T. Viering, and A. Mey. Minimizers of the empirical risk and risk monotonicity. In Advances in Neural Information Processing Systems, pages 7478–7487, 2019.
|
| 344 |
+
[44] S. Mei and A. Montanari. The generalization error of random features regression: Precise asymptotics and double descent curve. arXiv preprint arXiv:1908.05355, 2019.
|
| 345 |
+
[45] Y. Min, L. Chen, and A. Karbasi. The curious case of adversarially robust models: More data can help, double descend, or hurt generalization. arXiv preprint arXiv:2002.11080, 2020.
|
| 346 |
+
[46] P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak, and I. Sutskever. Deep double descent: Where bigger models and more data hurt. arXiv preprint arXiv:1912.02292, 2019.
|
| 347 |
+
[47] P. Nakkiran, P. Venkat, S. Kakade, and T. Ma. Optimal regularization can mitigate double descent. arXiv preprint arXiv:2003.01897, 2020.
|
| 348 |
+
[48] B. Neal, S. Mittal, A. Baratin, V. Tantia, M. Scicluna, S. Lacoste-Julien, and I. Mitliagkas. A modern take on the bias-variance tradeoff in neural networks. arXiv preprint arXiv:1810.08591, 2018.
|
| 349 |
+
[49] B. Neyshabur, R. Tomioka, and N. Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. In ICLR (Workshop), 2015.
|
| 350 |
+
[50] A. Rahimi and B. Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pages 1177–1184, 2008.
|
| 351 |
+
[51] A. Rakhlin and X. Zhai. Consistency of interpolation with laplace kernels is a high-dimensional phenomenon. In Conference on Learning Theory, pages 2595–2623, 2019.
|
| 352 |
+
[52] D. Richards, J. Mourtada, and L. Rosasco. Asymptotics of ridge (less) regression under general source condition. arXiv preprint arXiv:2006.06386, 2020.
|
| 353 |
+
[53] A. Rudi and L. Rosasco. Generalization properties of learning with random features. In Advances in Neural Information Processing Systems, pages 3215–3225, 2017.
|
| 354 |
+
[54] G. Song, R. Xu, and J. Lafferty. Convergence and alignment of gradient descent with random back propagation weights. arXiv preprint arXiv:2106.06044, 2021.
|
| 355 |
+
[55] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015.
|
| 356 |
+
[56] A. Tsigler and P. L. Bartlett. Benign overfitting in ridge regression. arXiv preprint arXiv:2009.14286, 2020.
|
| 357 |
+
[57] D. von Rosen. Moments for the inverted wishart distribution. Scandinavian Journal of Statistics, pages 97–109, 1988.
|
| 358 |
+
[58] C. Wei, J. D. Lee, Q. Liu, and T. Ma. Regularization matters: Generalization and optimization of neural nets vs their induced kernel. In Advances in Neural Information Processing Systems, pages 9712–9724, 2019.
|
| 359 |
+
[59] A. J. Wyner, M. Olson, J. Bleich, and D. Mease. Explaining the success of adaboost and random forests as interpolating classifiers. The Journal of Machine Learning Research, 18(1): 1558–1590, 2017.
|
| 360 |
+
[60] J. Xu and D. J. Hsu. On the number of variables to use in principal component regression. In Advances in Neural Information Processing Systems, pages 5094–5103, 2019.
|
| 361 |
+
[61] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
|
| 362 |
+
[62] D. Zou, Y. Cao, D. Zhou, and Q. Gu. Gradient descent optimizes over-parameterized deep relu networks. Machine Learning, 109(3):467–492, 2020.
|
| 363 |
+
|
| 364 |
+
# Checklist
|
| 365 |
+
|
| 366 |
+
1. For all authors...
|
| 367 |
+
|
| 368 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 369 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 370 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 371 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 372 |
+
|
| 373 |
+
2. If you are including theoretical results...
|
| 374 |
+
|
| 375 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
|
| 376 |
+
|
| 377 |
+
3. If you ran experiments...
|
| 378 |
+
|
| 379 |
+
(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)? [N/A]
|
| 380 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
|
| 381 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
|
| 382 |
+
(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]
|
| 383 |
+
|
| 384 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 385 |
+
|
| 386 |
+
(a) If your work uses existing assets, did you cite the creators? [N/A]
|
| 387 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 388 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 389 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 390 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 391 |
+
|
| 392 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 393 |
+
|
| 394 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 395 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 396 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/rk49Mg-CW/rk49Mg-CW.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# STOCHASTIC VARIATIONAL VIDEO PREDICTION
|
| 2 |
+
|
| 3 |
+
Mohammad Babaeizadeh1, Chelsea Finn2, Dumitru Erhan3, Roy Campbell1, and Sergey Levine2,3
|
| 4 |
+
|
| 5 |
+
1University of Illinois at Urbana-Champaign 2University of California, Berkeley 3Google Brain
|
| 6 |
+
|
| 7 |
+
mb2@uiuc.edu, cbfinn@eecs.berkeley.edu, dumitru@google.com, rhc@illinois.edu, svlevine@eecs.berkeley.edu
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Predicting the future in real-world settings, particularly from raw sensory observations such as images, is exceptionally challenging. Real-world events can be stochastic and unpredictable, and the high dimensionality and complexity of natural images require the predictive model to build an intricate understanding of the natural world. Many existing methods tackle this problem by making simplifying assumptions about the environment. One common assumption is that the outcome is deterministic and there is only one plausible future. This can lead to low-quality predictions in real-world settings with stochastic dynamics. In this paper, we develop a stochastic variational video prediction (SV2P) method that predicts a different possible future for each sample of its latent variables. To the best of our knowledge, our model is the first to provide effective stochastic multi-frame prediction for real-world videos. We demonstrate the capability of the proposed method in predicting detailed future frames of videos on multiple real-world datasets, both action-free and action-conditioned. We find that our proposed method produces substantially improved video predictions when compared to the same model without stochasticity, and to other stochastic video prediction methods. Our SV2P implementation will be open sourced upon publication.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Understanding the interaction dynamics of objects and predicting what happens next is one of the key capabilities of humans which we heavily rely on to make decisions in everyday life (Bubic et al., 2010). A model that can accurately predict future observations of complex sensory modalities such as vision must internally represent the complex dynamics of real-world objects and people, and therefore is more likely to acquire a representation that can be used for a variety of visual perception tasks, such as object tracking and action recognition (Srivastava et al., 2015; Lotter et al., 2017; Denton & Birodkar, 2017). Furthermore, such models can be inherently useful themselves, for example, to allow an autonomous agent or robot to decide how to interact with the world to bring about a desired outcome (Oh et al., 2015; Finn & Levine, 2017).
|
| 16 |
+
|
| 17 |
+
However, modeling future distributions over images is a challenging task, given the high dimensionality of the data and the complex dynamics of the environment. Hence, it is common to make various simplifying assumptions. One particularly common assumption is that the environment is deterministic and that there is only one possible future (Chiappa et al., 2017; Srivastava et al., 2015; Boots et al., 2014; Lotter et al., 2017). Models conditioned on the actions of an agent frequently make this assumption, since the world is more deterministic in these settings (Oh et al., 2015; Finn et al., 2016). However, most real-world prediction tasks, including the action-conditioned settings, are in fact not deterministic, and a deterministic model can lose many of the nuances that are present in real physical interactions. Given the stochastic nature of video prediction, any deterministic model is obliged to predict a statistic of all the possible outcomes. For example, deterministic models trained with a mean squared error loss function generate the expected value of all the possibilities for each pixel independently, which is inherently blurry (Mathieu et al., 2016).
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Importance of stochasticity in video prediction. In each video, a random shape follows a random direction (first row). Given only the first frame, the deterministic model from Finn et al. (2016) predicts the average of all the possibilities. The third row is the output of SV2P with latent sampled from approximated posterior which predicts the correct motion. Last two rows are stochastic outcomes using random latent values sampled from assumed prior. As observed, these outcomes are random but within the range of possible futures. Second sample of Figure 1c shows a case where the model predicts the average of more than one outcome.
|
| 21 |
+
|
| 22 |
+
Our main contribution in this paper is a stochastic variational method for video prediction, named SV2P, that predicts a different plausible future for each sample of its latent random variables. We also provide a stable training procedure for training a neural network based implementation of this method. To the extent of our knowledge, SV2P is the first latent variable model to successfully predict multiple frames in real-world settings. Our model also supports action-conditioned predictions, while still being able to predict stochastic outcomes of ambiguous actions, as exemplified in our experiments. We evaluate SV2P on multiple real-world video datasets, as well as a carefully designed toy dataset that highlights the importance of stochasticity in video prediction (see Figure 1). In both our qualitative and quantitative comparisons, SV2P produces substantially improved video predictions when compared to the same model without stochasticity, with respect to standard metrics such as PSNR and SSIM. The stochastic nature of SV2P is most apparent when viewing the predicted videos. Therefore, we highly encourage the reader to check the project website https://goo.gl/iywUHc to view the actual videos of the experiments. The TensorFlow (Abadi et al., 2016) implementation of this project will be open sourced upon publication.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
A number of prior works have addressed video frame prediction while assuming deterministic environments (Ranzato et al., 2014; Srivastava et al., 2015; Vondrick et al., 2015; Xingjian et al., 2015; Boots et al., 2014; Lotter et al., 2017). In this work, we build on the deterministic video prediction model proposed by Finn et al. (2016), which generates the future frames by predicting the motion flow of dynamically masked out objects extracted from the previous frames. Similar transformationbased models were also proposed by De Brabandere et al. (2016); Liu et al. (2017). Prior work has also considered alternative objectives for deterministic video prediction models to mitigate the blurriness of the predicted frames and produce sharper predictions (Mathieu et al., 2016; Vondrick & Torralba, 2017). Despite the adversarial objective, Mathieu et al. (2016) found that injecting noise did not lead to stochastic predictions, even for predicting a single frame. Oh et al. (2015); Chiappa et al. (2017) make sharp video predictions by assuming deterministic outcomes in video games given the actions of the agents. However, this assumption does not hold in real-world settings, which almost always have stochastic dynamics.
|
| 27 |
+
|
| 28 |
+
Auto-regressive models have been proposed for modeling the joint distribution of the raw pixels (Kalchbrenner et al., 2017). Although these models predict sharp images of the future, their training and inference time is extremely high, making them difficult to use in practice. Reed et al. (2017) proposed a parallelized multi-scale algorithm that significantly improves the training and prediction time but still requires more than a minute to generate one second of $6 4 \times 6 4$ video on a GPU. Our comparisons suggest that the predictions from these models are sharp, but noisy, and that our method produces substantially better predictions, especially for longer horizons.
|
| 29 |
+
|
| 30 |
+
Another approach for stochastic prediction uses generative adversarial networks (GANs) (Goodfellow et al., 2014), which have been used for video generation and prediction (Tulyakov et al., 2017; Li et al., 2017). Vondrick et al. (2016); Chen et al. (2017) applied adversarial training to predict video from a single image. Although GANs generate sharp images, they tend to suffer from modecollapse (Goodfellow, 2016), particularly in conditional generation settings (Zhu et al., 2017).
|
| 31 |
+
|
| 32 |
+
Variational auto-encoders (VAEs) (Kingma & Welling, 2014) also have been explored for stochastic prediction tasks. Walker et al. (2016) uses conditional VAEs to predict dense trajectories from pixels. Xue et al. (2016) predicts a single stochastic frame using cross convolutional networks in a VAElike architecture. Shu et al. (2016) uses conditional VAEs and Gaussian mixture priors for stochastic prediction. Both of these works have been evaluated solely on synthetic datasets with simple moving sprites and no object interaction. Real images significantly complicate video prediction due to the diversity and variety of stochastic events that can occur. Fragkiadaki et al. (2017) compared various architectures for multimodal motion forecasting and one-frame video prediction, including variational inference and straightforward sampling from the prior. Unlike these prior models, our focus is on designing a multi-frame video prediction model to produce stochastic predictions of the future. Multi-frame prediction is dramatically harder than single-frame prediction, since complex events such as collisions require multiple frames to fully resolve, and single-frame predictions can simply ignore this complexity. We believe, our approach is the first latent variable model to successfully demonstrate stochastic multi-frame video prediction on real world datasets.
|
| 33 |
+
|
| 34 |
+
# 3 STOCHASTIC VARIATIONAL VIDEO PREDICTION (SV2P)
|
| 35 |
+
|
| 36 |
+
In order to construct our stochastic variational video prediction model, we first formulate a probabilistic graphical model that explains the stochasticity in the video. Since our goal is to perform conditional video prediction, the predictions are conditioned on a set of $c$ context frames $\mathbf { x } _ { 0 } , \ldots , \mathbf { x } _ { c - 1 }$ (e.g., if we are conditioning on one frame, $c = 1 \AA$ ), and our goal is to sample from $p ( \mathbf { x } _ { c : T } | \mathbf { x } _ { 0 : c - 1 } )$ , where $\mathbf { x } _ { i }$ denotes the $\mathrm { i ^ { \mathrm { t h } } }$ frame of the video (Figure 2).
|
| 37 |
+
|
| 38 |
+
Video prediction is stochastic as a consequence of the latent events that are not observable from the context frames alone. For example, when a robot’s arm pushes a toy on a table, the unknown weight of that toy affects how it moves. We therefore introduce a vector of latent variables $\mathbf { z }$ into our model, distributed according to a prior $\mathbf { z } \sim p ( \mathbf { z } )$ , and build a model $p ( \mathbf { x } _ { c : T } | \mathbf { x } _ { 0 : c - 1 } , \mathbf { z } )$ . This model is still stochastic but uses a more general representation, such as a conditional Gaussian, to explain just the noise in the image, while $\mathbf { z }$ accounts for the more complex stochastic phenomena. We can then factorize this model to $\begin{array} { r } { \prod _ { t = c } ^ { T } p _ { \theta } \big ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 : t - 1 } , \mathbf { z } \big ) } \end{array}$ Learning then involves training the parameters of these factors $\theta$ , which we assume to be shared between all the time steps.
|
| 39 |
+
|
| 40 |
+
At inference time we need to estimate values for the true posterior $p ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ , which is intractable due its dependency on $p ( \mathbf { x } _ { 0 : T } )$ . We
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 2: Probabilistic graphical model of stochastic variational video prediction, assuming time-invariant latent. The generative model predicts the next frame conditioned on the previous frames and latent variables (solid lines), while the variational inference model approximates the posterior given all the frames (dotted lines).
|
| 44 |
+
|
| 45 |
+
overcome this problem by approximating the posterior with an inference network $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ that outputs the parameters of a conditionally Gaussian distribution $\mathcal { N } ( \mu _ { \phi } ( \mathbf { x } _ { 0 : T } ) , \sigma _ { \phi } ( \mathbf { x } _ { 0 : T } ) )$ . This network is trained using the reparameterization trick (Kingma & Welling, 2014), according to:
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 3: Architecture of SV2P. At training time, the inference network (top) estimates the posterior $\bar { q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } ) } = \mathcal { N } \big ( \mu ( \mathbf { x } _ { 0 : T } ) , \sigma ( \mathbf { x } _ { 0 : T } ) \big )$ . The latent value ${ \mathbf z } \sim q _ { \phi } ( { \mathbf z } | { \mathbf x } _ { 0 : T } )$ is passed to the generative network along with the (optional) action. The generative network (from Finn et al. (2016)) predicts the next frame given the previous frames, latent values, and actions. At test time, $\mathbf { z }$ is sampled from the assumed prior $\mathcal { N } ( \mathbf { 0 } , \bar { \mathbf { I } } )$ .
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\mathbf { z } = \mu _ { \phi } ( \mathbf { x } _ { 0 : T } ) + \sigma _ { \phi } ( \mathbf { x } _ { 0 : T } ) \times \epsilon , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
Here, $\theta$ and $\phi$ are the parameters of the generative model and inference network, respectively. To learn these parameters, we can optimize the variational lower bound, as in the variational autoencoder (VAE) (Kingma & Welling, 2014):
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\mathcal { L } ( \mathbf { x } ) = - \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } ) } \left[ \log p _ { \theta } ( \mathbf { x } _ { t : T } | \mathbf { x } _ { 0 : t - 1 } , \mathbf { z } ) \right] + D _ { K L } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } ) | | p ( \mathbf { z } ) \big )
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $D _ { K L }$ is the Kullback-Leibler divergence between the approximated posterior and assumed prior $p ( \mathbf { z } )$ which in our case is the standard Gaussian $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ .
|
| 61 |
+
|
| 62 |
+
In Equation 2, the first term on the RHS represents the reconstruction loss while the second term represents the divergence of the variational posterior from the prior on the latent variable. It is important to emphasize that the approximated posterior is conditioned on all of the frames, including the future frames $\mathbf { x } _ { t : T }$ . This is feasible during training, since $\mathbf { x } _ { t : T }$ is available at the training time, while at test time we can sample the latents from the assumed prior. Since the aim in our method is to recover latent variables that correspond to events which might explain the variability in the videos, we found that it is in fact crucial to condition the inference network on future frames. At test time, the latent variables are simply sampled from the prior which corresponds to a smoothing-like inference process. In principle, we could also perform a filtering-like inference procedure of the form $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : t - 1 } )$ for time step $t$ to infer the most likely latent variables based only on the conditioning frames, instead of sampling from the prior, which could produce more accurate predictions at test time. However, it would be undesirable to use a filtering process at training time: in order to incentivize the forward prediction network to make use of the latent variables, they must contain some information that is useful for predicting future frames that is not already present in the context frames. If they are predicted entirely from the context frames, no such information is present, and indeed we found that a purely filtering-based model simply ignores the latent variables.
|
| 63 |
+
|
| 64 |
+
So far, we’ve assumed that the latent events are constant over the entire video. We can relax this assumption by conditioning prediction on a time-variant latent variable $\mathbf { z } _ { t }$ that is sampled at every time step from $p ( \mathbf { z } )$ . The generative model then becomes $\begin{array} { r } { p ( \mathbf { z } _ { t } ) \prod _ { t = c } ^ { T } p _ { \theta } \big ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 : t - 1 } , \mathbf { z } _ { t } \big ) } \end{array}$ and, assuming a fixed posterior, the inference model will be approximated by $q _ { \phi } \big ( \mathbf { z } _ { t } | \mathbf { x } _ { 0 : T } \big )$ , where the model parameters $\phi$ are shared across time. In practice, the only difference between these two formulations is the frequency of sampling $\mathbf { z }$ from $p ( \mathbf { z } )$ and $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ . In the time-invariant version, we sample $\mathbf { z }$ once per video, whereas with the time-variant latent, sampling happens every frame. The main benefit of time-variant latent variable is better generalization beyond $T$ , since the model does not have to encode all the events of the video in one vector $\mathbf { z }$ . We provide an empirical comparison of these formulations in Section 5.2.
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 4: Three phases of training. In the first phase, the inference network is turned off and only the generative network is being trained, resulting in deterministic predictions. The inference network is used in the second phase without a KL-loss. The last phase includes $D _ { K L } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } ) | | p ( \mathbf { z } ) \big )$ to enable accurate sampling latent from $p ( \mathbf { z } )$ . (a) the KL-loss $( b )$ the reconstruction loss (c) Training stability. This graph compares reconstruction loss at the end of five training sessions on the BAIR robot pushing dataset, with and without following all the steps of the training procedure. The proposed training is quite stable and results in lower error compared to na¨ıve training.
|
| 68 |
+
|
| 69 |
+
In action-conditioned settings, we modify the generative model to be conditioned on action vector $\mathbf { a } _ { t }$ . This results in $\begin{array} { r } { p ( \mathbf { z } _ { t } ) \prod _ { t = c } ^ { T } p _ { \boldsymbol \theta } ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 : t - 1 } , \mathbf { z } _ { t } , \mathbf { a } _ { t } ) } \end{array}$ as generative model while keeping the posterior approximation intact. Conditioning the outcome on actions can decrease future variability; however it will not eliminate it if the environment is inherently stochastic or the actions are ambiguous. In this case, the model is still capable of predicting stochastic outcomes in a narrower range of possibilities.
|
| 70 |
+
|
| 71 |
+
# 3.1 MODEL ARCHITECTURE
|
| 72 |
+
|
| 73 |
+
To model the approximated posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ we used a deep convolutional neural network as shown in the top row of Figure 3. Since we assumed a diagonal Gaussian distribution for $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ , this network outputs the mean $\mu _ { \phi } \big ( \mathbf { x } _ { 0 : T } \big )$ and standard deviation $\log \sigma _ { \phi } ( \mathbf { x } _ { 0 : T } )$ of the approximated posterior. Hence the entire inference network is convolutional, the predicted parameters are $8 \times 8$ single channel response maps. We assume each entry in this response maps is pairwise independent, forming the latent vector $\mathbf { z }$ . The latent value is then sampled using Equation 1. As discussed before, this sampling happens every frame for time-varying latent, and once per video in time-invariant case.
|
| 74 |
+
|
| 75 |
+
For $p ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 : t - 1 } , \mathbf { z } )$ , we used the CDNA architecture proposed by Finn et al. (2016), which is a deterministic convolutional recurrent network that predicts the next frame $\mathbf { x } _ { t }$ given the previous frame $\mathbf { x } _ { t - 1 }$ and an optional action $\mathbf { a } _ { t }$ . This model constructs the next frames by predicting the motions of segments of the image (i.e., objects) and then merging these predictions via masking. Although this model directly outputs pixels, it is partially-appearance invariant and can generalize to unseen objects (Finn et al., 2016). To condition on the latent value, we modify the CDNA architecture by stacking $\mathbf { z } _ { t }$ as an additional channel on tiled action $\mathbf { a } _ { t }$ .
|
| 76 |
+
|
| 77 |
+
# 3.2 TRAINING PROCEDURE
|
| 78 |
+
|
| 79 |
+
Our model can be trained end-to-end. However, our experiments show that na¨ıve training usually results in the model ignoring the latent variables and converging to a suboptimal deterministic solution (Figure 4). Therefore, we train the model end-to-end in three phases, as follows:
|
| 80 |
+
|
| 81 |
+
1. Training the generative network: In this phase, the inference network has been disabled and the latent value $\mathbf { z }$ will be randomly sampled from $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . The intuition behind this phase is to train the generative model to predict the future frames deterministically (i.e. modeling $\mathbf { \bar { \rho } } _ { p _ { \theta } ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 : t - 1 } ) } ) $ .
|
| 82 |
+
2. Training the inference network: In the second phase, the inference network is trained to estimate the approximate posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ ; however, the KL-loss is set to 0. This means that the model can use the latent value without being penalized for diverging from $p ( \mathbf { z } )$ . As seen in Figure 4, this phase results in very low reconstruction error, however it is not usable at the test time since $D _ { K L } \mathbf { \bar { ( } } q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } ) | | p ( \mathbf { z } ) \rrangle \gg 0$ and sampling $\mathbf { z }$ from the assumed prior will be inaccurate.
|
| 83 |
+
|
| 84 |
+
3. Divergence reduction: In the last phase, the KL-loss is added, resulting in a sudden drop of KLdivergence and an increase of reconstruction error. The reconstruction loss converging to a value lower than the first phase and KL-loss converging to zero are indicators of successful training. This means that $\mathbf { z }$ can be sampled from $p ( \mathbf { z } )$ at test time for effective stochastic prediction.
|
| 85 |
+
|
| 86 |
+
To gradually transition from the second phase to the third, we add a multiplier to KL-loss that is set to zero during the first two phases and then increased slowly in the last phase. This is similar to the $\beta$ hyper-parameter in Higgins et al. (2016) and Bowman et al. (2016) that is used to balance latent channel capacity and independence constraints with reconstruction accuracy.
|
| 87 |
+
|
| 88 |
+
We found that this training procedure is quite stable and the model almost always converges to the desired parameters. To demonstrate this stability, we trained the model with and without the proposed training procedure, five times each. Figure 4 shows the average and standard deviation of reconstruction loss at the end of these training sessions. Na¨ıve training results in a slightly better error compared to Finn et al. (2016), but with high variance. When following the proposed training algorithm, the model consistently converges to a much lower reconstruction error.
|
| 89 |
+
|
| 90 |
+
# 4 STOCHASTIC MOVEMENT DATASET
|
| 91 |
+
|
| 92 |
+
To highlight the importance of stochasticity in video prediction, we created a toy video dataset with intentionally stochastic motion. Each video in this dataset is four frames long. The first frame contains a random shape (triangle, rectangle or circle) with random size and color, centered in the frame, which then randomly moves to one of the eight directions (up, down, left, right, up-left, upright, down-left, down-right). Each frame is $6 4 \times 6 4 \times 3$ and the background is static gray. The main intuition behind this design is that, given only the first frame, a model can figure out the shape, color, and size of the moving object, but not its movement direction.
|
| 93 |
+
|
| 94 |
+
We train Finn et al. (2016) and SV2P to predict the future frames, given only the first frame. Figure 1 shows the video predictions from these two models. Since Finn et al. (2016) is a deterministic model with mean squared error as loss, it predicts the average of all possible outcomes, as expected. In contrast, SV2P predicts different possible futures for each sample of the latent variable $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . In our experiments, all the videos predicted by SV2P are within the range of plausible futures (e.g. we never saw the shape moves in any direction other than the original eight). However, in some cases, SV2P still predicts the average of more than one future, as it can be seen in the first random sample of Figure 1c. The main reason for this problem seems to be overlapping posterior distributions in latent space which can cause some latent values (sampled from $p ( \mathbf { z } ) _ { , } ^ { \dag }$ ) to be ambiguous.
|
| 95 |
+
|
| 96 |
+
To demonstrate that the inference network is working properly and that the latent variable does indeed learn to store the information necessary for stochastic prediction (i.e., the direction of movement), we include predicted futures when ${ \mathbf z } \sim q _ { \phi } ( { \mathbf x } _ { 0 : T } )$ . By estimating the correct parameters of the latent distribution, using the inference network, the model always generates the right outcome. However, this cannot be used in practice, since the inference network requires access to all the frames, including the ones in the future. Instead, $\mathbf { z }$ will be sampled from assumed prior $p ( \mathbf { z } )$ .
|
| 97 |
+
|
| 98 |
+
# 5 EXPERIMENTS
|
| 99 |
+
|
| 100 |
+
To evaluate SV2P, we test it on three real-world video datasets by comparing it to the CDNA model (Finn et al., 2016), as a deterministic baseline, as well as a baseline that outputs the last seen frame as the prediction. We compare SV2P with an auto-regressive stochastic model, video pixel networks (VPN) (Kalchbrenner et al., 2017). We use the parallel multi-resolution implementation of VPN from Reed et al. (2017), which is an order of magnitude faster than the original VPN, but still requires more than a minute to generate one second of $6 4 \times 6 4$ video. In all of these experiments, we plot the results of sampling the latent once per video (SV2P time-invariant latent) and once per frame (SV2P time-variant latent). We strongly encourage readers to view https://goo.gl/iywUHc for videos of the results which are more illustrative than printed frames.
|
| 101 |
+
|
| 102 |
+
# 5.1 DATASETS
|
| 103 |
+
|
| 104 |
+
We quantitatively and qualitatively evaluate SV2P on following real-world datasets:
|
| 105 |
+
|
| 106 |
+
• BAIR robot pushing dataset (Ebert et al., 2017): This dataset contains action-conditioned videos collected by a Sawyer robotic arm pushing a variety of objects. All of the videos in this datasets have similar table top settings with static background. Each video also has recorded actions taken by the robotic arm which correspond to the commanded gripper pose. An interesting property of this dataset is the fact that the arm movements are quite unpredictable in the absence of actions (compared to the robot pushing dataset (Finn et al., 2016) which the arm moves to the center of the bin). For this dataset, we train the models to predict the next ten frames given the first two, both in action-conditioned and action-free settings.
|
| 107 |
+
|
| 108 |
+
• Human3.6M (Ionescu et al., 2014): Humans and animals are one of the most interesting sources of stochasticity in natural videos, which behave in complex ways as a consequence of unpredictable intentions. To study human motion prediction, we use the Human3.6M dataset which consists of actors performing various actions in a room. We used the pre-processing and testing format of Finn et al. (2016): a $1 0 \ : \mathrm { H z }$ frame rate and 10-frame prediction given the previous ten. The videos from this datasets contains various actions performed by humans (walking, talking on the phone, . . . ). Similar to Finn et al. (2016), we included videos from all the performed actions in training dataset while keeping all the videos from an specific actor out for testing.
|
| 109 |
+
|
| 110 |
+
• Robotic pushing prediction (Finn et al., 2016): We use the robot pushing prediction dataset to compare SV2P with another stochastic prediction method, video pixel networks (VPNs) (Kalchbrenner et al., 2017). VPNs demonstrated excellent results on this dataset in prior work, and therefore robot pushing dataset provides a strong point of comparison. However, in contrast to our method, VPNs do not include latent stochastic variables that represent random events, and rely on an expensive auto-regressive architecture. In this experiment, the models have been trained to predict the next ten frames, given the first two. Similar to BAIR robot pushing dataset, this dataset also contains actions taken by the robotic arm which are the pose of the commanded gripper.
|
| 111 |
+
|
| 112 |
+
# 5.2 QUANTITATIVE COMPARISON
|
| 113 |
+
|
| 114 |
+
In our quantitative evaluation, we aim to understand whether the range of possible futures captured by our stochastic model includes the true future. Models that are more stochastic do not necessarily score better on average standard metrics such as PSNR (Huynh-Thu & Ghanbari, 2008) and SSIM (Wang et al., 2004). However, if we are interested primarily in understanding whether the true outcome is within the set of predictions, we can instead evaluate the score of the best sample from multiple random priors. We argue that this is a better metric for stochastic models, since it allows us to understand if uncertain futures contain the true outcome. Figure 5 illustrates how this metric changes with different numbers of samples. By predicting more possible futures, the probability of predicting the true outcome increases, and therefore it is more likely to get a sample with higher PSNR compared to the ground truth. Of course, as with all video prediction metrics, it is imperfect, and is only suitable for understanding the performance of the model when combined with a visual examination of the qualitative results in Section 5.3.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 5: Stochasticity of SV2P predictions on the action-free BAIR dataset. Each line presents the sample with highest PSNR compared to ground truth, after multiple sampling. The number on the right indicates the number of random samples. As can be seen, SV2P predicts highly stochastic videos and, on average, only three samples is enough to predict outcomes with higher quality compared to Finn et al. (2016).
|
| 118 |
+
|
| 119 |
+
To use this metric, we sample 100 latent values from prior $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ and use them to predict 100 videos and show the result of the sample with
|
| 120 |
+
|
| 121 |
+
highest PSNR. For a fair comparison to VPN, we use the same best out of 100 samples for our stochastic baseline. Since even the fast implementation of VPN is quite slow, we limit the comparison with VPN to only last dataset with 256 test samples.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 6: Quantitative comparison of the prediction methods. The stochastic models have been sampled 100 times and the results with the best PSNR have been displayed. For SV2P, we demonstrate the results of both time-variant and time-invariant latent sampling. Repeat shows the results of the lower bound prediction by repeating the last seen frame as the prediction. In the last column, we compare the results of video pixel networks (VPN). All the models, including Finn et al. (2016), have been trained up to the frame marked by vertical separator and the results beyond this line display their generalization. The plots are the average SSIM and PSNR over the test set and shadow is the $9 5 \%$ confidence interval. In all of these graphs, higher is better.
|
| 125 |
+
|
| 126 |
+
Figure 6 displays the quantitative comparison of the predictions on all of the datasets. In this graph, the top row is a PSNR comparison and the bottom row is SSIM, while each column represents a different dataset. To evaluate the generalization of the models beyond what they have been trained for, we generate more frames than what the models observed during training time. The length of the training sequences is marked by a vertical separator in all of the graphs, and the results beyond this line represent extrapolation to longer sequences.
|
| 127 |
+
|
| 128 |
+
Overall, SV2P with both time-variant and time-invariant latent sampling outperform all of the other baselines, by predicting higher quality videos with higher PSNR and SSIM. Time-varying latent sampling is more stable beyond the time horizon used during training (Figure 6b). One possible explanation for this behaviour is that the time-invariant latent has to include the information required for predicting all the frames and therefore, beyond training time, it collapses. This issue is mitigated by a time-variant latent variable which takes a different value at each time step. However, this stability is not always the case as it is more evident in late frames of Figure 6a.
|
| 129 |
+
|
| 130 |
+
One other interesting observation is that the time-invariant model outperforms the time-variant model in the Human3.6M dataset. In this dataset, the most important latent event – the action performed by the actor – is consistent across the whole video which is easier to capture using timeinvariant latent.
|
| 131 |
+
|
| 132 |
+
# 5.3 QUALITATIVE COMPARISON
|
| 133 |
+
|
| 134 |
+
We can better understand the performance of the proposed model by visual examination of the qualitative results. We highlight some of the most important and observable differences in predictions by different models in Figures 8-11 1. In all of these figures, the $\mathbf { X }$ -axis is time (i.e., each row is one video). The first row is the ground truth video, and the second row is the result of Finn et al. (2016). The result of sampling the latent from approximated posterior is provided in the third row. For stochastic methods, we show the best (highest PSNR) and worst (lowest PSNR) predictions out of 100 samples (as discussed in Section 5.2), as well as two random predicted videos from our model.
|
| 135 |
+
|
| 136 |
+
Figure 8 illustrates two examples from the BAIR robot pushing dataset in the action-free setting. As a consequence of the high stochasticity in the movement of the arm in absence of actions, Finn et al. (2016) only blurs the arm out, while SV2P predicts varied but coherent movements of the arm. Note that, although each predicted movements of the arm is random, it is still in the valid range of possible outcomes (i.e., there is no sudden jump of the arm nor random movement of the objects). The proposed model also learned how to move objects in cases where they have been pushed by the predicted movements of the arm, as can be seen in the zoomed images of both samples.
|
| 137 |
+
|
| 138 |
+
In the action-conditioned setting (Figure 9), the differences are more subtle: the range of possible outcomes is narrower, but we can still observe stochasticity in the behavior of the pushed objects. Interactions between the arm and objects are uncertain due to ambiguity in depth, friction, and mass, and SV2P is able to capture some of this variation. Since these variations are subtle and occupy a smaller part of the images, we illustrate this with zoomed insets in Figure 9. Some examples of varied object movements can be found in last three rows of right example of Figure 9. SV2P also generates sharper outputs, compared to Finn et al. (2016) as is evident in the left example of Figure 9.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 7: Quantitative comparison of the predicted frames on Human3.6M dataset using confidence of object detection as quality metric. The y-axis demonstrates the average confidence of Huang et al. (2016) in detecting humans in predicted frames. Based on this metric, SV2P predicts images with more meaningful semantics compared to to Finn et al. (2016).
|
| 142 |
+
|
| 143 |
+
Please note that the approximate posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ is still trained with the evidence lower bound (ELBO), which means that the posterior must compress the information of the future events. Perfect reconstruction of high-quality images from posterior distributions over latent states is an open problem, and the results in our experiments compare favorably to those typically observed even in single-image VAEs (e.g. see Xue et al. (2016)). This is why the model cannot reconstruct all the future frames perfectly, even though when latent values are sampled from $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { 0 : T } )$ .
|
| 144 |
+
|
| 145 |
+
Figure 10 displays two examples from the Human3.6M dataset. In absence of actions, Finn et al. (2016) manages to separate the foreground from background, but cannot predict what happens next accurately. This results in distorted or blurred foregrounds. On the other hand, SV2P predicts a variety of different outcomes, and moves the actor accordingly. Note that PSNR and SSIM are measuring reconstruction loss with respect to the ground truth and they may not generally present a better prediction. For some applications, a prediction with lower PSNR/SSIM might have higher quality and be more interesting. A good example is the prediction with the worst PSNR in Figure 10- right, where the model predicts that the actor is spinning in his chair with relatively high quality. However, this output has the lowest PSNR compared to the ground truth.
|
| 146 |
+
|
| 147 |
+
However, pixel-wise metrics such as PSNR and SSIM may not be the best measures for semantic evaluation of predicted frames. Therefore, we use the confidence of an object detector to show the predicted frames contain useful semantic information. For this purpose, we use the open-sourced implementation of Huang et al. (2016) to compare the quality of predicted frames in Human3.6M dataset. As it can be seen in Figure 7, SV2P predicted frames which the human inside can be detected with higher confidence, compared to Finn et al. (2016).
|
| 148 |
+
|
| 149 |
+
Finally, Figure 11 demonstrates results on the Google robot pushing dataset. The qualitative and quantitative results in Figure 11 and 6 both indicate that SV2P produces substantially better predictions than VPNs. The quantitative results suggest that our best-of-100 metric is a reasonable measure of performance: the VPN predictions are more noisy, but simply increasing noise is not sufficient to increase the quality of the best sample. The stochasticity in our predictions is more coherent, corresponding to differences in object or arm motion, while much of the stochasticity in the VPN predictions resembles noise in the image, as well as visible artifacts when predicting for substantially longer time horizons.
|
| 150 |
+
|
| 151 |
+
# 6 CONCLUSION
|
| 152 |
+
|
| 153 |
+
We proposed stochastic variational video prediction (SV2P), an approach for multi-step video prediction based on variational inference. Our primary contributions include an effective stochastic prediction method with latent variables, a network architecture that succeeds on natural videos, and a training procedure that provides for stable optimization. The source code for our method will be released upon acceptance. We evaluated our proposed method on three real-world datasets in actionconditioned and action-free settings, as well as one toy dataset which has been carefully designed to highlight the importance of the stochasticity in video prediction. Both qualitative and quantitative results indicate higher quality predictions compared to other deterministic and stochastic baselines.
|
| 154 |
+
|
| 155 |
+
SV2P can be expanded in numerous ways. First, the current inference network design is fully convolutional, which exposes multiple limitations, such as unmodeled spatial correlations between the latent variables. The model could be improved by incorporating the spatial correlation induced by the convolutions into the prior, using a learned structured prior in place of the standard spherical Gaussian. Time-variant posterior approximation to reflect the new information that is revealed as the video progresses, is another possible SV2P improvement. However, as discussed in Section 3, this requires incentivizing the inference network to incorporate the latent information at training time. This would allow time-variant latent distributions which is more aligned with generative neural models for time-series(Johnson et al., 2016; Gao et al., 2016; Krishnan et al., 2017).
|
| 156 |
+
|
| 157 |
+
Another exciting direction for future research would be to study how stochastic predictions can be used to act in the real world, producing model-based reinforcement learning methods that can execute risk-sensitive behaviors from raw image observations. Accounting for risk in this way could be especially important in safety-critical settings, such as robotics.
|
| 158 |
+
|
| 159 |
+
# ACKNOWLEDGEMENT
|
| 160 |
+
|
| 161 |
+
The authors would like to thank Matt Johnson for providing feedback on an early draft of the paper, and Alex Lee for fixing bugs in the deterministic version of the model. This material is based upon work supported by the National Science Foundation under award no. 1725729 and was partially done while author was interning at Google Brain.
|
| 162 |
+
|
| 163 |
+
# REFERENCES
|
| 164 |
+
|
| 165 |
+
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 largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
|
| 166 |
+
|
| 167 |
+
Byron Boots, Arunkumar Byravan, and Dieter Fox. Learning predictive models of a depth camera & manipulator from raw execution traces. In International Conference on Robotics and Automation (ICRA), 2014.
|
| 168 |
+
|
| 169 |
+
Samuel R. Bowman, Luke Vilnis, Oriol Vinyals, Andrew M. Dai, Rafal Jozefowicz, and Samy ´ Bengio. Generating sentences from a continuous space. In Proceedings of the 20th SIGNLL Conference on Computational Natural Language Learning, CoNLL 2016, Berlin, Germany, August 11-12, 2016, pp. 10–21, 2016. URL http://aclweb.org/anthology/K/K16/ K16-1002.pdf.
|
| 170 |
+
|
| 171 |
+
Andreja Bubic, D Yves Von Cramon, and Ricarda I Schubotz. Prediction, cognition and the brain. Frontiers in human neuroscience, 4, 2010.
|
| 172 |
+
|
| 173 |
+
Baoyang Chen, Wenmin Wang, Jinzhuo Wang, Xiongtao Chen, and Weimian Li. Video imagination from a single image with transformation generation. arXiv preprint arXiv:1706.04124, 2017.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 8: Comparing the results of SV2P with Finn et al. (2016) (second row) on action-free BAIR robot pushing dataset. Fourth and fifth rows are the predictions with minimum and maximum PSNR out of 100 random outputs with time-invariant latent sampling. The last two rows are random predicted outcomes. The numbers on top indicate the predicted frame number. In lack of actions and therefore high stochasticity, Finn et al. (2016) only blurs the robotic arm out while the proposed method predicts sharper frames on each sampling. SV2P also predicts the interaction dynamics between random movements of the arm and the objects.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 9: Similar comparison as Figure 8 this time action-conditioned with time-variant latent sampling. SV2P predicts sharper and slightly variant outcomes compared to Finn et al. (2016). This is mostly evident in zoomed in objects which have been pushed by the arm.
|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
Figure 10: Prediction results on the action-free Human3.6M dataset. SV2P predicts a different outcome on each sampling given the latent. In the left example, the model predicts walking as well as stopping which result in different outputs in predicted future frames. Similarly, the right example demonstrates various outcomes including spinning.
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 11: Comparing the results of video pixel networks (VPN) (Kalchbrenner et al., 2017; Reed et al., 2017) with SV2P on the robotic pushing dataset. We use the same best PSNR out of 100 random samples for both methods. Besides stochastic movements of the pushed objects, another source of stochasticity is the starting lag in movements of the robotic arm. SV2P generates sharper images compared to Finn et al. (2016) (notice the pushed objects in zoomed images) with less noise compared to Reed et al. (2017) (look at the accumulated noise in later frames).
|
| 186 |
+
|
| 187 |
+
Silvia Chiappa, Sebastien Racani ´ ere, Daan Wierstra, and Shakir Mohamed. Recurrent environment \` simulators. In Proceedings of the International Conference on Learning Representations (ICLR), 2017.
|
| 188 |
+
|
| 189 |
+
Bert De Brabandere, Xu Jia, Tinne Tuytelaars, and Luc Van Gool. Dynamic filter networks. In Neural Information Processing Systems (NIPS), 2016.
|
| 190 |
+
|
| 191 |
+
Emily Denton and Vighnesh Birodkar. Unsupervised learning of disentangled representations from video. arXiv preprint arXiv:1705.10915, 2017.
|
| 192 |
+
|
| 193 |
+
Frederik Ebert, Chelsea Finn, Alex X. Lee, and Sergey Levine. Self-Supervised Visual Planning with Temporal Skip Connections. Conference on Robot Learning (CoRL), 2017.
|
| 194 |
+
|
| 195 |
+
Chelsea Finn and Sergey Levine. Deep visual foresight for planning robot motion. In International Conference on Robotics and Automation (ICRA), 2017.
|
| 196 |
+
|
| 197 |
+
Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In Advances in Neural Information Processing Systems, 2016.
|
| 198 |
+
|
| 199 |
+
Katerina Fragkiadaki, Jonathan Huang, Alex Alemi, Sudheendra Vijayanarasimhan, Susanna Ricco, and Rahul Sukthankar. Motion prediction under multimodality with conditional stochastic networks. CoRR, abs/1705.02082, 2017.
|
| 200 |
+
|
| 201 |
+
Yuanjun Gao, Evan W Archer, Liam Paninski, and John P Cunningham. Linear dynamical neural population models through nonlinear embeddings. In Advances in Neural Information Processing Systems, pp. 163–171, 2016.
|
| 202 |
+
|
| 203 |
+
Ian Goodfellow. Nips 2016 tutorial: Generative adversarial networks. arXiv preprint arXiv:1701.00160, 2016.
|
| 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, 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. International Conference on Learning Representations (ICLR), 2016.
|
| 208 |
+
|
| 209 |
+
Jonathan Huang, Vivek Rathod, Chen Sun, Menglong Zhu, Anoop Korattikara, Alireza Fathi, Ian Fischer, Zbigniew Wojna, Yang Song, Sergio Guadarrama, et al. Speed/accuracy trade-offs for modern convolutional object detectors. arXiv preprint arXiv:1611.10012, 2016.
|
| 210 |
+
|
| 211 |
+
Quan Huynh-Thu and Mohammed Ghanbari. Scope of validity of psnr in image/video quality assessment. Electronics letters, 2008.
|
| 212 |
+
|
| 213 |
+
Catalin Ionescu, Dragos Papava, Vlad Olaru, and Cristian Sminchisescu. Human3. 6m: Large scale datasets and predictive methods for 3d human sensing in natural environments. IEEE transactions on pattern analysis and machine intelligence, 36(7), 2014.
|
| 214 |
+
|
| 215 |
+
Matthew 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.
|
| 216 |
+
|
| 217 |
+
Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex ¨ Graves, and Koray Kavukcuoglu. Video pixel networks. International Conference on Machine Learning (ICML), 2017.
|
| 218 |
+
|
| 219 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. International Conference on Learning Representations (ICLR), 2014.
|
| 220 |
+
|
| 221 |
+
Rahul G Krishnan, Uri Shalit, and David Sontag. Structured inference networks for nonlinear state space models. In AAAI, pp. 2101–2109, 2017.
|
| 222 |
+
|
| 223 |
+
Yitong Li, Martin Renqiang Min, Dinghan Shen, David Carlson, and Lawrence Carin. Video generation from text. arXiv preprint arXiv:1710.00421, 2017.
|
| 224 |
+
|
| 225 |
+
Ziwei Liu, Raymond Yeh, Xiaoou Tang, Yiming Liu, and Aseem Agarwala. Video frame synthesis using deep voxel flow. International Conference on Computer Vision (ICCV), 2017.
|
| 226 |
+
|
| 227 |
+
William Lotter, Gabriel Kreiman, and David Cox. Deep predictive coding networks for video prediction and unsupervised learning. International Conference on Learning Representations (ICLR), 2017.
|
| 228 |
+
|
| 229 |
+
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. International Conference on Learning Representations (ICLR), 2016.
|
| 230 |
+
|
| 231 |
+
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, 2015.
|
| 232 |
+
|
| 233 |
+
MarcAurelio Ranzato, Arthur Szlam, Joan Bruna, Michael Mathieu, Ronan Collobert, and Sumit Chopra. Video (language) modeling: a baseline for generative models of natural videos. arXiv preprint arXiv:1412.6604, 2014.
|
| 234 |
+
|
| 235 |
+
Scott E. Reed, Aaron van den Oord, Nal Kalchbrenner, Sergio Gomez Colmenarejo, Ziyu Wang, ¨ Yutian Chen, Dan Belov, and Nando de Freitas. Parallel multiscale autoregressive density estimation. International Conference on Machine Learning (ICML), 2017.
|
| 236 |
+
|
| 237 |
+
Rui Shu, James Brofos, Frank Zhang, Hung Hai Bui, Mohammad Ghavamzadeh, and Mykel Kochenderfer. Stochastic video prediction with conditional density estimation. In ECCV Workshop on Action and Anticipation for Visual Learning, 2016.
|
| 238 |
+
|
| 239 |
+
Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using lstms. In International Conference on Machine Learning, 2015.
|
| 240 |
+
|
| 241 |
+
Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. arXiv preprint arXiv:1707.04993, 2017.
|
| 242 |
+
|
| 243 |
+
Carl Vondrick and Antonio Torralba. Generating the future with adversarial transformers. In Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 244 |
+
|
| 245 |
+
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Anticipating the future by watching unlabeled video. arXiv preprint arXiv:1504.08023, 2015.
|
| 246 |
+
|
| 247 |
+
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances In Neural Information Processing Systems, 2016.
|
| 248 |
+
|
| 249 |
+
Jacob Walker, Carl Doersch, Abhinav Gupta, and Martial Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In European Conference on Computer Vision, pp. 835–851. Springer, 2016.
|
| 250 |
+
|
| 251 |
+
Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 2004.
|
| 252 |
+
|
| 253 |
+
SHI Xingjian, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In Advances in Neural Information Processing Systems, 2015.
|
| 254 |
+
|
| 255 |
+
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, 2016.
|
| 256 |
+
|
| 257 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. International Conference on Computer Vision (ICCV), 2017.
|
| 258 |
+
|
| 259 |
+
# A TRAINING DETAILS
|
| 260 |
+
|
| 261 |
+
Figure 3 contains details of the network architectures used as generative and inference models. In all of the experiments we used the same set of hyper-parameters which can be found in Table 1.
|
| 262 |
+
|
| 263 |
+
Table 1: Hyper-parameters used for experiments.
|
| 264 |
+
|
| 265 |
+
<table><tr><td colspan="2">Generative Network</td></tr><tr><td>model type batch size learning rate scheduled sampling (k) #of masks</td><td>CDNA 16 0.001 900.0 10</td></tr><tr><td># of iterations InferenceNetwork</td><td>200000</td></tr><tr><td>latent minimumo starting β final β # of latent channels # step 1 iterations</td><td>-5.0 0.0 0.001 1 50000</td></tr><tr><td># step 2 iterations # step 3 iterations</td><td>50000 100000</td></tr><tr><td>Optimization</td><td>ADAM</td></tr><tr><td>Method β1</td><td>0.9</td></tr><tr><td>β2 E</td><td>0.999 1e-8</td></tr></table>
|
| 266 |
+
|
| 267 |
+
In the first step of training, we disable the inference network and instead sample latent values from $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . In step 2, the latent values will be sampled from the approximated posterior $q _ { \phi } ( { \bf z } | { \bf x } _ { 0 : T } ) =$ $\mathcal { N } \big ( \mu ( \mathbf { x } _ { 0 : T } ) , \sigma ( \mathbf { x } _ { 0 : T } ) \big )$ . Please note that the inference network approximates $\log ( \sigma )$ instead of $\sigma$ for numerical stability. To gradually switch from Step 2 of training procedure to Step 3, we increase $\beta$ linearly from its starting value to its end value over the length of training.
|
md/train/rk4Fz2e0b/rk4Fz2e0b.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GRAPH PARTITION NEURAL NETWORKS FOR SEMI-SUPERVISED CLASSIFICATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present graph partition neural networks (GPNN), an extension of graph neural networks (GNNs) able to handle extremely large graphs. GPNNs alternate between locally propagating information between nodes in small subgraphs and globally propagating information between the subgraphs. To efficiently partition graphs, we experiment with spectral partitioning and also propose a modified multi-seed flood fill for fast processing of large scale graphs. We extensively test our model on a variety of semi-supervised node classification tasks. Experimental results indicate that GPNNs are either superior or comparable to state-of-the-art methods on a wide variety of datasets for graph-based semi-supervised classification. We also show that GPNNs can achieve similar performance as standard GNNs with fewer propagation steps.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Graphs are a flexible way of encoding data, and many tasks can be cast as learning from graphstructured inputs. Examples include prediction of properties of chemical molecules (Duvenaud et al., 2015), answering questions about knowledge graphs (Marino et al., 2016), natural language processing with parse-structured inputs (trees or richer structures like Abstract Meaning Representations) (Banarescu et al.), predicting properties of data structures or source code in programming languages (Li et al., 2016), and making predictions from scene graphs (Teney et al., 2016). Sequence data can be seen as a special case of a simple chain-structured graph. Thus, we are interested in training high-capacity neural network-like models on these types of graph-structured inputs. Graph Neural Networks (GNNs) (Gori et al., 2005; Scarselli et al., 2009; Li et al., 2016; Qi et al., 2017; Li et al., 2017) are one of the best contenders, although there has been much recent interest in applying other neural network-like models to graph data, including generalizations of convolutional architectures (Duvenaud et al., 2015; Kipf & Welling, 2017). Gilmer et al. (2017) recently reviewed and unified many of these models.
|
| 12 |
+
|
| 13 |
+
An important issue that has not received much attention in GNN models is how information gets propagated across the graph. There are often scenarios in which information has to be propagated over long distances across a graph, e.g., when we have long sequences augmented with additional relationships between elements of the sequence, like in text, programming language source code, or temporal streams. The simplest approach, and the one adopted by almost all graph-based neural networks is to follow synchronous message-passing systems (Attiya & Welch, 2004) from distributed computing theory. Specifically, inference is executed as a sequence of rounds: in each round, every node sends messages to all of its neighbors, the messages are delivered and every node does some computation based on the received messages. While this approach has the benefit of being simple and easy to implement, it is especially inefficient when the task requires to spread information across long distances in the graph. For example, in processing sequence data, if we were to employ the above schedule for a sequence of length $N$ , it would take $\mathcal { O } ( \hat { N } ^ { 2 } )$ messages to propagate information from the beginning of the sequence to the end, and during training all $O ( N ^ { 2 } )$ messages must be stored in memory. In contrast, the common practice with sequence data is to use a forward pass followed by a backward pass at a cost of $O ( N )$ to propagate information from end to end, as in bidirectional recurrent neural networks (RNNs), for example.
|
| 14 |
+
|
| 15 |
+
One possible approach for tackling this problem is to propagate information over the graph following some pre-specified sequential order, as in Bidirectional LSTMs. However, this sequential solution has several issues. First, if a graph used for training has large diameter, the unrolled GNN computational graph will be large (cf. Bidirectional LSTMs on long sequences). This leads to fundamental issues with learning (e.g., vanishing/exploding gradients) and implementation difficulties (i.e., resource constraints). Second, sequential schedules are typically less amenable to efficient acceleration on parallel hardware. More recently, Gilmer et al. (2017) attempted to tackle the first problem by introducing a “dummy node” with connections to all nodes in the input graph, meaning that all nodes are at most two steps away from each other. However, we note that the graph structure itself often contains important information, which is modified by adding additional nodes and edges.
|
| 16 |
+
|
| 17 |
+
In this work, we propose graph partition neural networks (GPNN) that exploit a propagation schedule combining features of synchronous and sequential propagation schedules. Concretely, we first partition the graph into disjunct subgraphs and a cut set, and then alternate steps of synchronous propagation within subgraphs with synchronous propagation within the cut set. In Sect. 2, we discuss different propagation schedules on an example, showing that GPNNs can be substantially more efficient than standard GNNs, and then present our model formally. Finally, we evaluate our model in Sect. 4 on a variety of semi-supervised classification benchmarks. The empirical results suggest that our models are either superior to or comparable with state-of-the-art learning systems on graphs.
|
| 18 |
+
|
| 19 |
+
# 2 MODEL
|
| 20 |
+
|
| 21 |
+
In this section, we briefly recapitulate graph neural networks (GNNs) and then describe our graph partition neural networks (GPNN). A graph $\mathcal { G } = ( \nu , \mathcal { E } )$ has nodes $\nu$ and edges $\mathcal { E } \subseteq \mathcal { V } \times \mathcal { V }$ . We focus on directed graphs, as our approach readily applies to undirected graphs by splitting any undirected edge into two directed edges. We denote the out-going neighborhood as $\mathcal { N } _ { o u t } ( v ) = \{ u \in \mathcal { V } \mid$ $( v , u ) \in \mathcal { E } \}$ , and similarly, the incoming neighborhood as $\bar { \mathcal { N } _ { i n } } ( v ) = \{ u \in \mathcal { V } \mid ( u , v ) \in \mathcal { E } \}$ . We associate an edge type $c _ { ( v , u ) } \in \{ 1 , \ldots , C \}$ with every edge $( v , u )$ , where $C$ is some pre-specified total number of edge types. Such edge types are used to encode different relationships between nodes. Note that one can also associate multiple edge types with the same edge which results in a multi-graph. W.l.o.g. we assume one edge type per directed edge to simplify the notation.
|
| 22 |
+
|
| 23 |
+
# 2.1 GRAPH NEURAL NETWORKS
|
| 24 |
+
|
| 25 |
+
Graph neural networks (Scarselli et al., 2009; Li et al., 2016) can be viewed as an extension of recurrent neural networks (RNNs) to arbitrary graphs. Each node $v$ in the graph is associated with an initial state vector ${ h } _ { v } ^ { ( 0 ) }$ at time step 0. Initial state vectors can be observed features or annotations as in Li et al. (2016). At time step $t$ , an outgoing message is computed for each edge by transforming the source state according to the edge type, i.e.,
|
| 26 |
+
|
| 27 |
+
$$
|
| 28 |
+
\pmb { m } _ { ( v , u ) } ^ { ( t ) } = M _ { c _ { ( v , u ) } } ( \pmb { h } _ { v } ^ { ( t ) } ) ,
|
| 29 |
+
$$
|
| 30 |
+
|
| 31 |
+
where Mc(u,v) is a message function, which could be the identity or a fully connected neural network. Note the subscript $c _ { ( v , u ) }$ indicating that different edges of the same type share the same instance of the message function. We then aggregate all messages at the receiving nodes, i.e.,
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
\bar { \pmb { m } } _ { u } ^ { ( t ) } = A ( \{ \pmb { m } _ { ( v , u ) } ^ { ( t ) } \ | \ v \in \mathcal { N } _ { i n } ( u ) \} ) ,
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
where $A$ is the aggregation function, which may be a summation, average or max-pooling function. Finally, every node will update its state vector based on its current state vector and the aggregated message, i.e.,
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\pmb { h } _ { v } ^ { ( t + 1 ) } = U ( \pmb { h } _ { v } ^ { ( t ) } , \pmb { \bar { m } } _ { v } ^ { ( t ) } ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $U$ is the update function, which may be a gated recurrent unit (GRU), a long short term memory (LSTM) unit, or a fully connected network. Note that all nodes share the same instance of update function. The described propagation step is repeatedly applied for a fixed number of time steps $T$ , to obtain final state vectors $\{ h _ { v } ^ { ( T ) } \mid v \in \mathcal { V } \}$ . A node classification task can then be implemented by feeding these state vectors to a fully connected neural network which is shared by all nodes. Back-propagation through time (BPTT) is typically adopted for learning the model.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 1: Propagation schedules on an example graph. (a) The input graph where the line type, i.e., solid & dash, indicates different edge types; (b) Graph partitions where blue bounding boxes indicate different subgraphs and red edges belong to the cut; (c) Computational graphs of two possible sequential propagation schedules of the input graph; (d) Computational graph for synchronous propagation schedule; (e) Computational graph for GPNNs where both inter-subgraph and intrasubgraph propagation steps are 1.
|
| 47 |
+
|
| 48 |
+
# Algorithm 1 Graph Partition Propagation Schedule.
|
| 49 |
+
|
| 50 |
+
1: Input: $K$ subgraphs $\{ S _ { k } | k = 1 , \ldots , K \}$ , cut $ { \boldsymbol { S } } _ { 0 }$ , outer propagation step limit $T$ , intra-subgraph
|
| 51 |
+
and inter-subgraph propagation step limits $T _ { S }$ and $T _ { C }$ .
|
| 52 |
+
2: for $t = 1 , \dots , T$ do
|
| 53 |
+
3: for all $k \in \{ 1 , \ldots , K \}$ do in parallel
|
| 54 |
+
4: Call SYNCPROP within subgraph $\boldsymbol { S _ { k } }$ for $T _ { S }$ steps.
|
| 55 |
+
5: Call SYNCPROP within cut $S _ { 0 }$ for $T _ { C }$ steps.
|
| 56 |
+
6: function SYNCPROP
|
| 57 |
+
7: Compute & send messages as in Eq. (1)
|
| 58 |
+
8: Aggregate messages as in Eq. (2)
|
| 59 |
+
9: Update states as in Eq. (3)
|
| 60 |
+
|
| 61 |
+
# 2.2 GRAPH PARTITION NEURAL NETWORKS
|
| 62 |
+
|
| 63 |
+
The above inference process is described from the perspective of an individual node. If we look at the same process from the graph view, we observe a synchronous schedule in which all nodes receive and send messages at the same time, cf. the illustration in Fig. 1(d). A natural question is to consider different propagation schedules in which not all nodes in the graph send messages at the same time, e.g., sequential schedules, in which nodes are ordered in some linear sequence and messages are set only from one node at a time. A mix of the two ideas leads to our Graph Partition Neural Networks (GPNN), which we will discuss before elaborating on how to partition graphs appropriately. Finally, we discuss how to handle initial node labels and node classification tasks.
|
| 64 |
+
|
| 65 |
+
Propagation Model We first consider the example graph in Fig. 1 (a). A corresponding computational graph that shows how information is propagated from time step $t$ to time step $t + 1$ using the standard (synchronous) propagation schedule is shown in Fig. 1 (d). The example graph’s diameter is 5, and it hence requires at least 5 steps to propagate information over the graph. Fig. 1(c) instead shows two possible sequences that show how information can be propagated between nodes 2 to 6 and 5 to 1. These visualizations show that (i) a full synchronous propagation schedule requires significant computation at each step, and (ii) a sequential propagation schedule, in which we only propagate along sequences of nodes, results in very sparse and deep computational graphs. Moreover, experimentally, we found sequential schedules to require multiple propagation rounds across the whole graph, resulting in an even deeper computational graph.
|
| 66 |
+
|
| 67 |
+
In order to achieve both efficient propagation and tractable learning, we propose a new propagation schedule that follows a divide and conquer strategy. In particular, we first partition the graph into disjunct subgraphs. We will explain the details of how to compute graph partitions below. For now, we assume that we already have $K$ subgraphs such that each subgraph contains a subset of nodes and the edges induced by this subset. We will also have a cut set, i.e., the set of edges that connect different subgraphs. One possible partition is visualized in Fig. 1 (b).
|
| 68 |
+
|
| 69 |
+
In GPNNs, we alternate between propagating information in parallel local to each subgraph (making use of highly parallel computing units such as GPUs) and propagating messages between subgraphs. Our propagation schedule is shown in Alg. 1. To understand the benefit of this schedule, consider a broadcasting problem over the example graph in Fig. 1. When information from any one node has reached all other nodes in the graph for the first time, this problem is considered as solved. We will compare the number of messages required to solve this problem for different propagation schedules.
|
| 70 |
+
|
| 71 |
+
Synchronous propagation: Fig. 1(d) shows that a synchronous step requires 10 messages. Broadcasting requires sufficient propagation steps to cover the graph diameter (in this case, 5), giving a total of $5 \times 1 0 = 5 0$ messages.
|
| 72 |
+
|
| 73 |
+
Partitioned propagation: For simplicity, we analyze the case $T _ { S } = D _ { S }$ , $T _ { C } = 1$ , where $D _ { S }$ is the maximum diameter of the subgraphs. Using the partitioning in 1(e), we have $D _ { S } = 2$ and each step of intra-subgraph propagation requires 8 messages. After $T _ { S }$ steps ( $8 D _ { S }$ messages) the broadcast problem is solved within each subgraph. Inter-subgraph propagation requires 2 messages in this example, giving $8 D _ { S } + 2$ messages per outer loop iteration in Alg. 1. The example requires 2 outer iterations to broadcast between all subgraphs, giving a total of $2 ( \bar { 8 } D _ { S } + 2 ) = 3 \bar { 6 }$ messages.
|
| 74 |
+
|
| 75 |
+
In general, our propagation schedule requires no more messages than the synchronous schedule to solve broadcast (if the number of subgraphs $K$ is set to 1 or $N$ then our schedule reduces to the synchronous one). We analyze the number of messages required to solve the broadcast problem on chain graphs in detail in Sect. A.1. Overall, our method avoids the large number of messages required by synchronous schedules, while avoiding the very deep computational graphs required by sequential schedules. Our experiments in Sect. 4 show that this makes learning tractable even on extremely large graphs.
|
| 76 |
+
|
| 77 |
+
Graph Partition We now investigate how to construct graph partitions. First, since partition problems in graph theory typically are NP-hard, we are only looking for approximations in practice. A simple approach is to re-use the classical spectral partition method. Specifically, we follow the normalized cut method in Shi & Malik (2000) and use the random walk normalized graph Laplacian matrix $L = I - D ^ { - 1 } W$ , where $I$ is the identity matrix, $D$ is the degree matrix and $W$ is the weight matrix of graph (i.e., the adjacency matrix if no weights are presented).
|
| 78 |
+
|
| 79 |
+
However, the spectral partition method is slow and hard to scale with large graphs (Von Luxburg, 2007). For performance reasons, we developed the following heuristic method based on a multiseed flood fill partition algorithm as listed in Alg. 2. We first randomly sample the initial seed nodes biased towards nodes which are labeled and have a large out-degree. We maintain a global dictionary assigning nodes to subgraphs, and initially assign each selected seed node to its own subgraph. We then grow the dictionary using flood fill, attaching unassigned nodes that are direct neighbors of a subgraph to that graph. To avoid bias towards the first subgraph, we randomly permute the order in the beginning of each round. This procedure is repeatedly applied until no subgraph grows anymore. There may still be disconnected components left in the graph, which we assign to the smallest subgraph found so far to balance subgraph sizes.
|
| 80 |
+
|
| 81 |
+
Node Features & Classification In practice, problems using graph-structured data sometimes (1) do not have observed features associated with every node (Grover & Leskovec, 2016); (2) have very high dimensional sparse features per node (Bing et al., 2015). We develop two types of models for the initial node labels: embedding-input and feature-input. For embedding-input, we introduce learnable node embeddings into the model to solve challenge (1), inspired by other graph embedding methods. For nodes with observed features we initialize the embeddings to these observations, and all other nodes are initialized randomly. All embeddings are fed to the propagation model and are treated as learnable parameters. For feature-input, we apply a sparse fully-connected network to input features to tackle challenge (2). The dimension-reduced feature is then fed to the propagation model, and the sparse network is jointly learned with the rest of model.
|
| 82 |
+
|
| 83 |
+
We also empirically found that concatenating the input features with the final embedding produced by the propagation model is helpful in boosting the performance.
|
| 84 |
+
|
| 85 |
+
1: Input: Graph $G$ , number of subgraphs $K$ , indices $I$ of nodes which are labeled.
|
| 86 |
+
2: Create two dictionaries $D$ and $L$ and $K$ FIFO queues $Q = \{ Q _ { 1 } , \ldots , Q _ { K } \}$ . $D$ maps node index
|
| 87 |
+
to FALSE and $L$ maps node index to subgraph index 0.
|
| 88 |
+
3: $\forall u \in I$ , compute the out-going degree $d _ { u }$ of node $u$ .
|
| 89 |
+
4: $\forall u \in I$ , compute the probability $p _ { u } = d _ { u } / \sum _ { v \in I } d _ { v }$ .
|
| 90 |
+
5: Sample $K$ nodes $S = \{ s _ { 1 } , \ldots , s _ { K } \}$ from $I$ based on the above probability distribution $p$ .
|
| 91 |
+
6: $\forall s _ { k } \in S$ , enqueue $s _ { k }$ to $Q _ { k }$ $, D ( s _ { k } ) =$ TRUE, $L ( s _ { k } ) = k$ .
|
| 92 |
+
7: while Any queue in $Q$ is not empty do
|
| 93 |
+
8: for $k \in$ RANDPERM(K) do
|
| 94 |
+
9: if $Q _ { k }$ is not empty then
|
| 95 |
+
10: $u \mathsf { p o p } Q _ { k }$
|
| 96 |
+
11: for $v \in { \mathrm { C H I L D R E N } } ( u )$ do
|
| 97 |
+
12: if $D ( v ) = = $ FALSE then
|
| 98 |
+
13: Enqueue $v$ to $Q _ { k }$
|
| 99 |
+
14: $\begin{array} { l } { { L ( v ) = k } } \\ { { D ( v ) = \mathrm { T R U E } } } \end{array}$
|
| 100 |
+
15:
|
| 101 |
+
16: Put any unvisited nodes into the smallest subgraph and set $L$ accordingly.
|
| 102 |
+
17: Return L
|
| 103 |
+
|
| 104 |
+
# 3 RELATED WORK
|
| 105 |
+
|
| 106 |
+
There are many neural network models for handling graph-structured inputs. They can be roughly categorized into generalizations of recurrent neural networks (RNNs) (Goller & Kuchler, 1996; Gori et al., 2005; Scarselli et al., 2009; Socher et al., 2011b; Tai et al., 2015; Li et al., 2016; Marino et al., 2016; Qi et al., 2017; Li et al., 2017) and generalizations of convolutional neural networks (CNNs) (Bruna et al., 2014; Duvenaud et al., 2015; Kipf & Welling, 2017; Schlichtkrull et al., 2017). Gilmer et al. (2017) provide a good review and unification of many of these models, and they present some additional model variations that lead to strong empirical results in making predictions from chemical-structured inputs.
|
| 107 |
+
|
| 108 |
+
In RNN-like models, the standard approach is to propagate information using a synchronous schedule. In convolution-like models, the node updates mimic standard convolutions where all nodes in a layer are updated as functions of neighboring node states in the previous layer. This leads to information propagating across the graph in the same pattern as synchronous schedules. While our focus has been mainly on the RNN-like model of Li et al. (2016), it would be interesting to apply our schedules to the other models as well.
|
| 109 |
+
|
| 110 |
+
Some of the RNN based neural network models operate on restricted classes of graphs and employ sequential or sequential-like schedules. For example, recursive neural networks (Goller & Kuchler, 1996; Socher et al., 2011a) and tree-LSTMs Tai et al. (2015) have bidirectional variants that use fully sequential schedules.
|
| 111 |
+
|
| 112 |
+
It is possible to view Sukhbaatar et al. (2016) as a GNN model with a sequential schedule, where messages are passed inwards towards a master node that aggregates messages from different agents, and then outwards from the master node to all the agents. The difference in our work is the focus on graphs with arbitrary structure (not necessarily a sequence or tree). Recently, Marino et al. (2016) developed an attention-like mechanism to dynamically select a subset of graph nodes to propagate information from, but the propagation is synchronous amongst selected nodes.
|
| 113 |
+
|
| 114 |
+
An area where scheduling has been studied extensively is in the belief propagation (BP) literature. It is common to decompose a graph into spanning trees and sequentially update the tree structures Wainwright et al. (2002). See also Elidan et al. (2006); Tarlow et al. (2011); Sutton & McCallum (2012) for more discussion of sequential updates in the context of belief propagation. Finally, the question of sequential versus synchronous updates arises in numerical linear algebra. Jacobi iteration uses a synchronous update while Gauss-Seidel applies the same algorithm but according to a sequential schedule.
|
| 115 |
+
|
| 116 |
+
Table 1: Dataset statistics. ∗ indicates the average label rate over 10 fixed splits.
|
| 117 |
+
|
| 118 |
+
<table><tr><td>Dataset</td><td>Type</td><td>#Nodes</td><td>#Edges</td><td>#Classes</td><td>#Features</td><td>Label Rate</td></tr><tr><td>Citeseer</td><td>Citation network</td><td>3,327</td><td>4,732</td><td>6</td><td>3,703</td><td>0.036</td></tr><tr><td>Cora</td><td>Citation network</td><td>2,708</td><td>5,429</td><td>7</td><td>1,433</td><td>0.052</td></tr><tr><td>Pubmed</td><td>Citation network</td><td>19,717</td><td>44,338</td><td>3</td><td>500</td><td>0.003</td></tr><tr><td>NELL</td><td>Knowledge graph</td><td>65,755</td><td>266,144</td><td>210</td><td>5,414</td><td>0.1, 0.01, 0.001</td></tr><tr><td>DIEL</td><td>Entity & list graph</td><td>4,373,008</td><td>4,464,261</td><td>4</td><td>1,233,598</td><td>0.0095*</td></tr></table>
|
| 119 |
+
|
| 120 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">(Source)</td><td rowspan="2">Citeseer</td><td rowspan="2">Cora</td><td rowspan="2">Pubmed</td><td colspan="3">NELL</td></tr><tr><td>10%</td><td>1%</td><td>0.1%</td></tr><tr><td>Feat</td><td>(Yang et al., 2016)</td><td>57.2</td><td>57.4</td><td>69.8</td><td>62.1</td><td>40.4</td><td>21.7</td></tr><tr><td>ManiReg</td><td>(Belkin et al., 2006)</td><td>60.1</td><td>59.5</td><td>70.7</td><td>63.4</td><td>41.3</td><td>21.8</td></tr><tr><td>SemiEmb</td><td>(Weston et al.,2012)</td><td>59.6</td><td>59.0</td><td>71.1</td><td>65.4</td><td>43.8</td><td>26.7</td></tr><tr><td>LP</td><td>(Zhu et al., 2003)</td><td>45.3</td><td>68.0</td><td>63.0</td><td>71.4</td><td>44.8</td><td>26.5</td></tr><tr><td>DeepWalk</td><td>(Perozzi et al., 2014)</td><td>43.2</td><td>67.2</td><td>65.3</td><td>79.5</td><td>72.5</td><td>58.1</td></tr><tr><td>ICA</td><td>(Lu & Getoor,2003)</td><td>69.1</td><td>75.1</td><td>73.9</td><td></td><td></td><td></td></tr><tr><td>Planetoid (Transductive)</td><td>(Yang et al., 2016)</td><td>64.9</td><td>75.7</td><td>75.7</td><td>84.5</td><td>75.7</td><td>61.9</td></tr><tr><td>Planetoid (Inductive)</td><td>(Yang et al., 2016)</td><td>64.7</td><td>61.2</td><td>77.2</td><td>70.2</td><td>59.8</td><td>45.4</td></tr><tr><td>GCN</td><td>(Kipf & Welling, 2017)</td><td>70.3</td><td>81.5</td><td>79.0</td><td>t83.0</td><td>t67.0</td><td>t54.2</td></tr><tr><td>GGNN*</td><td>(Li et al., 2016)</td><td>68.1</td><td>77.9</td><td>77.2</td><td>84.6</td><td>66.2</td><td>59.1</td></tr><tr><td>GPNN</td><td>(ours)</td><td>69.7</td><td>81.9</td><td>79.2</td><td>83.7</td><td>74.6</td><td>63.1</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Table 2: Classification accuracies on citation networks and knowledge graphs. ∗ and † indicate we run our own (resp. the released) implementation..
|
| 123 |
+
|
| 124 |
+
# 4 EXPERIMENTS
|
| 125 |
+
|
| 126 |
+
We test our model on a variety of semi-supervised tasks: document classification on citation networks; entity classification in a bipartite graph extracted from a knowledge graph; and distantlysupervised entity extraction. We then compare different partition methods exploited by our model. We also compare the effectiveness of different propagation schedules. We follow the datasets and experimental setups in Yang et al. (2016). The statistics are summarized in Tab. 1, revealing that the datasets vary a lot in terms of scale, label rate and feature dimension. We report the details of hyper-parameters for all experiments in the appendix.
|
| 127 |
+
|
| 128 |
+
# 4.1 CITATION NETWORKS
|
| 129 |
+
|
| 130 |
+
We first discuss experimental results on three citation networks: Citeseer, Cora and Pubmed (Sen et al., 2008). The datasets contain sparse bag-of-words feature vectors for each document and a list of citation links between documents. Documents and citation links are regarded as nodes and edges while constructing the graph. 20 instances are sampled for each class as labeled data, 1000 instances as test data, and the rest are used as unlabeled data. The goal is to classify each document into one of the predefined classes. We use the same data split as in Yang et al. (2016) and Kipf & Welling (2017). We use an additional validation set of 500 labeled nodes for tuning hyperparameters as in Kipf & Welling (2017).
|
| 131 |
+
|
| 132 |
+
The results are listed in Thm. 2. We report the results of baselines directly from Yang et al. (2016) and Kipf & Welling (2017). We see that GPNN is on par with other state-of-the-art methods on these small graphs. We also conducted experiments with 10 random splits and results are reported in the appendix. We found these datasets easy to overfit due to their small size, and use feat-input rather than embedding-input, as the latter case increases the model capacity as well as the risk of overfitting. We also show a t-SNE (Maaten & Hinton, 2008) visualization of node representations produced by the propagation model of GGNN and GPNN on the Cora dataset in Fig. 2 (a) and (b) respectively. The visualizations show that the node representations of GPNN are better separated.
|
| 133 |
+
|
| 134 |
+
Table 3: Average recall on the DIEL dataset. Note that GCN is not included as it runs out of memory.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Method</td><td>Recall@k</td></tr><tr><td>LP (Zhu et al.,2003) DeepWalk (Perozzi et al., 2014)</td><td>16.20 25.80</td></tr><tr><td>Feat (Yang et al., 2016)</td><td>34.90</td></tr><tr><td>DIEL (Bing et al., 2015)</td><td>40.50</td></tr><tr><td>ManiReg (Belkin et al.,2006)</td><td>47.70</td></tr><tr><td>SemiEmb )(Weston et al.,2012)</td><td>48.60</td></tr><tr><td>Planetoid (Transductive) (Yang et al., 2016)</td><td>50.00</td></tr><tr><td>Planetoid (Inductive) (Yang et al., 2016)</td><td>50.10</td></tr><tr><td>GGNN* (Li et al., 2016)</td><td>51.15</td></tr><tr><td>GPNN</td><td>52.11</td></tr></table>
|
| 137 |
+
|
| 138 |
+
# 4.2 ENTITY CLASSIFICATION
|
| 139 |
+
|
| 140 |
+
Next, we consider experimental results of entity classification task on the NELL dataset extracted from the knowledge graph first presented in Carlson et al. (2010). A knowledge graph consists of a set of entities and a set of directed edges which have labels (i.e., different types of relation). Following Yang et al. (2016), each triplet $( e _ { 1 } , r , e _ { 2 } )$ of entities $e _ { 1 } , e _ { 2 }$ and relation $r$ in the knowledge graph is split into two tuples. Specifically, we assign separate relation nodes $r _ { 1 }$ and $r _ { 2 }$ to each entity and thus obtain $( e _ { 1 } , r _ { 1 } )$ and $( e _ { 2 } , r _ { 2 } )$ . Entity nodes are associated with sparse feature vectors. We follow Kipf $\&$ Welling (2017) to extend the number of features by assigning a unique one-hot representation for every relation node. This results in a 61278-dim sparse feature vector per node. An additional validation set of 500 labeled nodes under the label rate $0 . 1 \%$ as in Kipf & Welling (2017) is used for tuning hyperparameters. The chosen hyperparameters are then used for other label rates. The semi-supervised task here considers three different label rates $1 0 \%$ , $1 \%$ , $0 . 1 \%$ per class in the training set. We run the released code of GCN with the reported hyperparameters in Kipf & Welling (2017). Since we did not observe overfitting on this dataset, we choose the embedding-input variant as the input model. The results are shown in Tab. 2, where we see that our model outperforms competitors under the most challenging label rate 0.001 and obtain comparable results with the state of the art on other label rates.
|
| 141 |
+
|
| 142 |
+
# 4.3 DISTANTLY-SUPERVISED ENTITY EXTRACTION
|
| 143 |
+
|
| 144 |
+
Finally, we consider the DIEL (Distant Information Extraction using coordinate-term Lists) dataset (Bing et al., 2015). This dataset constructs a bipartite graph where nodes are medical entities and texts (referred as mentions and coordinate lists in the original paper). Texts contain some facts about the medical entities. Edges of the graph are links between entities and texts. Each entity is associated with a pre-extracted sparse feature vector. The goal is to extract medical entities from text given sparse feature vectors and the graph. As shown in Tab. 1, this dataset is very challenging due to its extremely large scale and very high-dimensional sparse features. Note that we attempted to run the released code GCN model on this dataset, but ran out of memory. We follow the exact experimental setup as in Bing et al. (2015); Yang et al. (2016), including 10 different data splits, preprocessing of entity mentions and coordinate lists, and evaluation. We randomly sample $1 / 5$ of the training nodes as the validation set. We regard the top- $k$ entities returned by a model as positive instances and compute recall $@ k$ as the evaluation metric where $k = 2 4 0 0 0 0$ as in Bing et al. (2015); Yang et al. (2016). Average recall over 10 runs is reported in Tab. 3, and we see that GPNN outperforms all other models. Note that since Freebase is used as ground truth and some entities are not present in texts, the upper bound of recall given by Bing et al. (2015) is 0.617.
|
| 145 |
+
|
| 146 |
+
# 4.4 COMPARISON OF DIFFERENT PARTITION METHODS
|
| 147 |
+
|
| 148 |
+
We now compare the two partition methods we considered for our model: spectral partition and our modified multi-seed flood fill. We use the NELL data set to benchmark and report the average validation accuracy over 10 runs in Tab. 4, in which we also report the average runtime of the partition process. The accuracies of the trained models do not allow for a clear conclusion as to
|
| 149 |
+
|
| 150 |
+
<table><tr><td>Method</td><td>5</td><td>10</td><td>20</td><td>30</td></tr><tr><td>Spectral Partition</td><td>54.8 (2.49s)</td><td>55.6 (4.16s)</td><td>58.0 (12.2s)</td><td>60.1 (3115s)</td></tr><tr><td>Modified Multi-seed Flood Fill</td><td>62.0 (0.36s)</td><td>63.1 (0.36s)</td><td>57.5 (0.43s)</td><td>59.9 (0.23s)</td></tr></table>
|
| 151 |
+
|
| 152 |
+
Table 4: Accuracy and run time of different partition methods with different numbers of subgraphs.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 2: (a), (b) The t-SNE visualization of node representations produced by propagation model of GGNN and GPNN on Cora dataset in which nodes actually belong to 7 classes. (c) Comparison of different propagation schedules with varying propagation steps.
|
| 156 |
+
|
| 157 |
+
which method to use, and in our further experiments they seem to highly depend on the number of subgraphs, the connectivity of input graphs, optimization and other factors. However, our multi-seed flood fill partition method is substantially faster and is efficiently applicable to very large graphs.
|
| 158 |
+
|
| 159 |
+
# 4.5 COMPARISON OF DIFFERENT PROPAGATION SCHEDULES
|
| 160 |
+
|
| 161 |
+
Besides the synchronous and our partition based propagation schedules, we also investigated two further schedules based on a sequential order and a series of minimum spanning trees (MST).
|
| 162 |
+
|
| 163 |
+
To generate a sequential schedule, we first perform graph traversal via breadth first search (BFS) which gives us a visiting order. We then split the edges into those that follow the visiting order and those that violate it. The edges in each class construct a directed acyclic graph (DAG), and we construct a propagation schedule from each DAG following the principle that every node will send messages once it receives all messages from its parents and updates its own state. An example of the schedule is given in the appendix. Note that this sequential schedule reduces to a standard bidirectional recurrent neural network on a chain graph.
|
| 164 |
+
|
| 165 |
+
For the MST schedule, we find a sequence of minimum spanning trees as follows. We first assign random positive weights between 0 and 1 to every edge and then apply Kruskal’s algorithm to find an MST. Next we increase the weights by 1 for edges which are present in the MST we found so far. This process is iterated until we find $K$ MSTs where $K$ is the total number of propagation steps.
|
| 166 |
+
|
| 167 |
+
We compare all four schedules by varying the number of propagation steps on the Cora dataset. The validation accuracies are shown in Fig. 2 (c). In these results, the meaning of one propagation step varies, so the takeaways are based just on the trends and overall performance across number of propagation steps. For the synchronous schedule, it means that every node sent and received messages once and updated its state. For the sequential schedule, it means that messages from all roots of the two DAGs were sent to all the leaves. For the MST-based schedule, it means sending messages from the root to all leaves on one minimum spanning tree. For our partition schedules, it means one outer loop of the algorithm. In this sense, messages are propagated furthest through the graph for the sequential schedule within one propagate step. This is also validated by the best performance of sequential schedule in the beginning. However, when increasing the number of propagation steps, it performs worse as the deep computational graph makes the learning problem very hard. Our partition schedule is better than other schedules when the number of propagation steps is small and tends to perform similarly with synchronous schedule with more steps.
|
| 168 |
+
|
| 169 |
+
# 5 CONCLUSION
|
| 170 |
+
|
| 171 |
+
We presented graph partition neural networks, which extend graph neural networks. Relying on graph partitions, our model alternates between locally propagating information between nodes in small subgraphs and globally propagating information between the subgraphs. Moreover, we propose a modified multi-seed flood fill for fast partitioning of large scale graphs. Empirical results show that our model performs better or is comparable to state-of-the-art methods on a wide variety of semi-supervised node classification tasks.
|
| 172 |
+
|
| 173 |
+
There are quite a few exciting directions to explore in the future. One is to learn the graph partitioning as well as the GNN weights, using a soft partition assignment. Other types of propagation schedules which have proven useful in probabilistic graphical models are also worthwhile to explore in the context of GNNs. To further improve the efficiency of propagating information, different nodes within the graph could share some memory, which mimics the shared memory model in the theory of distributed computing. Perhaps most importantly, this work makes it possible to run GNN models on very large graphs, which potentially opens the door to many new applications.
|
| 174 |
+
|
| 175 |
+
# REFERENCES
|
| 176 |
+
|
| 177 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
|
| 178 |
+
|
| 179 |
+
Hagit Attiya and Jennifer Welch. Distributed computing: fundamentals, simulations, and advanced topics, volume 19. John Wiley & Sons, 2004.
|
| 180 |
+
|
| 181 |
+
Laura Banarescu, Claire Bonial, Shu Cai, Madalina Georgescu, Kira Griffitt, Ulf Hermjakob, Kevin Knight, Philipp Koehn, Martha Palmer, and Nathan Schneider. Abstract meaning representation (amr) 1.0 specification.
|
| 182 |
+
|
| 183 |
+
Mikhail Belkin, Partha Niyogi, and Vikas Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. Journal of machine learning research, 7 (Nov):2399–2434, 2006.
|
| 184 |
+
|
| 185 |
+
Lidong Bing, Sneha Chaudhari, Richard Wang, and William Cohen. Improving distant supervision for information extraction using label propagation through lists. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 524–529, 2015.
|
| 186 |
+
|
| 187 |
+
Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. ICLR, 2014.
|
| 188 |
+
|
| 189 |
+
Andrew Carlson, Justin Betteridge, Bryan Kisiel, Burr Settles, Estevam R Hruschka Jr, and Tom M Mitchell. Toward an architecture for never-ending language learning. In AAAI, volume 5, pp. 3, 2010.
|
| 190 |
+
|
| 191 |
+
David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan´ Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In NIPS, 2015.
|
| 192 |
+
|
| 193 |
+
Gal Elidan, Ian McGraw, and Daphne Koller. Residual belief propagation: informed scheduling for asynchronous message passing. In Proceedings of the Twenty-Second Conference on Uncertainty in Artificial Intelligence, pp. 165–173. AUAI Press, 2006.
|
| 194 |
+
|
| 195 |
+
Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
|
| 196 |
+
|
| 197 |
+
Christoph Goller and Andreas Kuchler. Learning task-dependent distributed representations by backpropagation through structure. In Neural Networks, 1996., IEEE International Conference on, volume 1, pp. 347–352. IEEE, 1996.
|
| 198 |
+
|
| 199 |
+
Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In IJCNN, 2005.
|
| 200 |
+
|
| 201 |
+
Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 855–864. ACM, 2016.
|
| 202 |
+
|
| 203 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 204 |
+
|
| 205 |
+
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. ICLR, 2017.
|
| 206 |
+
|
| 207 |
+
Ruiyu Li, Makarand Tapaswi, Renjie Liao, Jiaya Jia, Raquel Urtasun, and Sanja Fidler. Situation recognition with graph neural networks. 2017.
|
| 208 |
+
|
| 209 |
+
Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. ICLR, 2016.
|
| 210 |
+
|
| 211 |
+
Qing Lu and Lise Getoor. Link-based classification. In ICML, volume 3, pp. 496–503, 2003.
|
| 212 |
+
|
| 213 |
+
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(Nov):2579–2605, 2008.
|
| 214 |
+
|
| 215 |
+
Kenneth Marino, Ruslan Salakhutdinov, and Abhinav Gupta. The more you know: Using knowledge graphs for image classification. arXiv preprint arXiv:1612.04844, 2016.
|
| 216 |
+
|
| 217 |
+
Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 701–710. ACM, 2014.
|
| 218 |
+
|
| 219 |
+
Xiaojuan Qi, Renjie Liao, Jiaya Jia, Sanja Fidler, and Raquel Urtasun. 3D graph neural networks for rgbd semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5199–5208, 2017.
|
| 220 |
+
|
| 221 |
+
Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE TNN, 2009.
|
| 222 |
+
|
| 223 |
+
M. Schlichtkrull, T. N. Kipf, P. Bloem, R. vd Berg, I. Titov, and M. Welling. Modeling relational data with graph convolutional networks. arXiv preprint arXiv:1703.06103, 2017.
|
| 224 |
+
|
| 225 |
+
Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93, 2008.
|
| 226 |
+
|
| 227 |
+
Jianbo Shi and Jitendra Malik. Normalized cuts and image segmentation. IEEE Transactions on pattern analysis and machine intelligence, 22(8):888–905, 2000.
|
| 228 |
+
|
| 229 |
+
Richard Socher, Eric H Huang, Jeffrey Pennin, Christopher D Manning, and Andrew Y Ng. Dynamic pooling and unfolding recursive autoencoders for paraphrase detection. In Advances in neural information processing systems, pp. 801–809, 2011a.
|
| 230 |
+
|
| 231 |
+
Richard Socher, Cliff C Lin, Chris Manning, and Andrew Y Ng. Parsing natural scenes and natural language with recursive neural networks. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 129–136, 2011b.
|
| 232 |
+
|
| 233 |
+
Sainbayar Sukhbaatar, Rob Fergus, et al. Learning multiagent communication with backpropagation. In Advances in Neural Information Processing Systems, pp. 2244–2252, 2016.
|
| 234 |
+
|
| 235 |
+
Charles Sutton and Andrew McCallum. Improved dynamic schedules for belief propagation. arXiv preprint arXiv:1206.5291, 2012.
|
| 236 |
+
|
| 237 |
+
Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. ACL, 2015.
|
| 238 |
+
Daniel Tarlow, Inmar Givoni, Richard Zemel, and Brendan Frey. Graph cuts is a max-product algorithm. In Uncertainty in Artificial Intelligence (UAI), 2011.
|
| 239 |
+
Damien Teney, Lingqiao Liu, and Anton van den Hengel. Graph-structured representations for visual question answering. arXiv preprint arXiv:1609.05600, 2016.
|
| 240 |
+
Ulrike Von Luxburg. A tutorial on spectral clustering. Statistics and computing, 17(4):395–416, 2007.
|
| 241 |
+
Martin J Wainwright, Tommi Jaakkola, and Alan S Willsky. Tree-based reparameterization for approximate inference on loopy graphs. In Advances in neural information processing systems, pp. 1001–1008, 2002.
|
| 242 |
+
Jason Weston, Fred´ eric Ratle, Hossein Mobahi, and Ronan Collobert. Deep learning via semi- ´ supervised embedding. In Neural Networks: Tricks of the Trade, pp. 639–655. Springer, 2012.
|
| 243 |
+
Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. arXiv preprint arXiv:1603.08861, 2016.
|
| 244 |
+
Xiaojin Zhu, Zoubin Ghahramani, John Lafferty, et al. Semi-supervised learning using gaussian fields and harmonic functions. In ICML, volume 3, pp. 912–919, 2003.
|
| 245 |
+
|
| 246 |
+
<table><tr><td>Method</td><td>Citeseer</td><td>Cora</td><td>Pubmed</td></tr><tr><td>GCNt (Kipf & Welling, 2017)</td><td>68.7 ± 2.0</td><td>80.4 ± 2.8</td><td>77.5 ± 2.1</td></tr><tr><td>GGNN* (Li et al., 2016)</td><td>66.3 ± 2.0</td><td>78.9 ± 2.6</td><td>74.7 ± 2.8</td></tr><tr><td>GPNN</td><td>68.6 ± 1.7</td><td>79.9 ± 2.4</td><td>76.1 ± 2.0</td></tr></table>
|
| 247 |
+
|
| 248 |
+
Table 5: Classification accuracies on citation networks with 10 random splits. ∗ and $\dagger$ indicates we run our own implementation and the released code respectively.
|
| 249 |
+
|
| 250 |
+
# A APPENDIX
|
| 251 |
+
|
| 252 |
+
# A.1 BI-DIRECTIONAL CHAIN
|
| 253 |
+
|
| 254 |
+
In this section, we revisit the broadcast problem on bi-direction chain graphs. We show that our propagation schedule has advantages over the synchronous one via the following proposition.
|
| 255 |
+
|
| 256 |
+
Proposition 1. Let $\mathcal { G }$ be a bi-direction chain of size $N$ . We have: $( l )$ Synchronous propagation schedule requires $2 ( N - 1 ) ^ { 2 }$ messages to solve the problem; (2) If we partition the chain evenly into $K$ sub-chains for $1 \le K \le N$ , GPNN propagation schedule can solve the problem with $2 ( ( N - K ) ^ { 2 } + ( K ^ { \setminus } - 1 ) ^ { 2 } )$ ) messages.
|
| 257 |
+
|
| 258 |
+
Proof. We first analyze the case for synchronous propagation schedule. At each round, it needs $2 ( N - 1 )$ messages to propagate messages one step away. Since it requires at least $( N - 1 )$ steps for message from one endpoint of the chain to reach the other, the number of messages to solve broadcast is thus $2 ( N - 1 ) ^ { \frac { \cdot } { 2 } }$ .
|
| 259 |
+
|
| 260 |
+
We now turn to our schedule. Since the chain is evenly partitioned, each sub-chain is of $n = N / K$ nodes. We need to perform $( n - 1 )$ propagation steps to traverse a sub-chain, so we set $T _ { S } = n - 1$ . The number of messages required by a single sub-chain during the intra-subgraph propagation phase is $2 ( n - 1 ) ^ { 2 }$ , and so all $K$ sub-chains collectively require $2 \bar { K } ( n - 1 ) ^ { 2 }$ messages. Between intrasubgraph propagation, we perform $T _ { C } = 1$ step of inter-subgraph propagation to transfer messages over the cut edges between sub-chains. Each inter-subgraph step requires 2 messages per cut edge - i.e. 2(K-1) messages in total. We need $K$ outer loops to ensure that message from any node can reach any other nodes, and strictly speaking, the the last inter-subgraph propagation step is unnecessary. So in total, we require $K \times \bar { 2 } \bar { K ( { n - 1 } ) } + ( K - 1 ) \times 2 ( K - 1 ) = \bar { 2 } ( ( \bar { N } { - } \bar { K } ) ^ { 2 } + ( \bar { K - 1 } ) ^ { 2 } )$ messages, which proves the proposition. □
|
| 261 |
+
|
| 262 |
+
One can see from the above proposition that if we take $K = 1$ and $K = N$ , the number of messages of our schedule matches the synchronous one. We can also derive the optimal value of $K$ as $( \bar { N } +$ $1 ) / 2$ resulting in a factor of 2 reduction in the total messages sent compared to the synchronous schedule.
|
| 263 |
+
|
| 264 |
+
# A.2 HYPERPARAMETERS
|
| 265 |
+
|
| 266 |
+
We train all models using Adam Kingma & Ba (2014) with a learning rate of 0.01. We also use early stopping with a window size of 10. We clip the norm gradient to ensure that it is no larger than 5.0. The maximum epochs for citation networks, NELL and DIEL are set to 200, 300 and 100 respectively. The weight decays for citation networks, NELL and DIEL are set to $5 . 0 e ^ { - 4 }$ , $1 . 0 e ^ { - 5 }$ and $1 . 0 e ^ { - \bar { 3 } }$ respectively. The dimensions of state vectors of GPNNfor Cora, Citeseer, Pubmed, NELL and DIEL are set to 128, 128, 64, 512 and 64. The output model for Cora, Citeseer, NELL is just softmax layer. For Pubmed and DIEL, we add one hidden layer with tanh activation function before the softmax which have dimension 512 and 2048 respectively.
|
| 267 |
+
|
| 268 |
+
# A.3 RANDOM SPLITS OF CITATION NETWORKS
|
| 269 |
+
|
| 270 |
+
We include the results on citation networks with 10 random splits in Table 5. From the table, we can see that our results are comparable with the state-of-the-art on these small scale datasets.
|
| 271 |
+
|
| 272 |
+

|
| 273 |
+
Figure 3: Sequential scheduling. (a) The original graph. (b) and (c) are the two DAGs obtained by the sequential schedule we described in section 4.5 where BFS traversal is started from node 1.
|
| 274 |
+
|
| 275 |
+
# A.4 SEQUENTIAL PROPAGATION SCHEDULE
|
| 276 |
+
|
| 277 |
+
In Fig. 3 we show an example visualization of the DAGs decomposition of the sequential propagation schedule we implemented in the section 4.5.
|
| 278 |
+
|
| 279 |
+
# A.5 IMPLEMENTATION
|
| 280 |
+
|
| 281 |
+
The released code of GGNN (Li et al., 2016) is implemented in Torch. We implement both our own version of GGNN and our model in Tensorflow (Abadi et al., 2015). To ensure correctness, we first reproduced the experimental results of the paper on bAbI artificial intelligence (AI) tasks with our implementations of GGNN. Our code will be released soon. One challenging part is the implementation of synchronous propagation within subgraphs. We implicitly implement the parallel part by building one separate branch of the computational graph for each subgraphs (i.e., use a Python for loop rather than tf.while loop). This relies on the claim that tensorflow optimizes the execution of the computational graph in a way that independent branches of the graph will be executed in parallel as decribed in Abadi et al. (2015). However, since we have no control of the optimization of the computational graph, this part could be improved by explicitly putting each branch on one separate computation device, just like the multi-tower solution for training convolutional neural networks (CNNs) on multiple GPUs.
|
md/train/rk4Qso0cKm/rk4Qso0cKm.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AD V-BNN: IMPROVED ADVERSARIAL DEFENSE THROUGH ROBUST BAYESIAN NEURAL NETWORK
|
| 2 |
+
|
| 3 |
+
Xuanqing Liu1, Yao $\mathbf { L i } ^ { 2 , }$ ∗, Chongruo $\mathbf { W } \mathbf { u } ^ { 3 , \ast } \&$ Cho-Jui Hsieh1
|
| 4 |
+
|
| 5 |
+
1: Department of Computer Science, UCLA Los Angeles, CA 90095, UCLA {xqliu,choheish}@cs.ucla.edu 2: Department of Statistics, UC Davis 3: Department of Computer Science, UC Davis Davis, CA 95616, USA {crwu,yaoli}@ucdavis.edu
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We present a new algorithm to train a robust neural network against adversarial attacks. Our algorithm is motivated by the following two ideas. First, although recent work has demonstrated that fusing randomness can improve the robustness of neural networks (Liu et al., 2017), we noticed that adding noise blindly to all the layers is not the optimal way to incorporate randomness. Instead, we model randomness under the framework of Bayesian Neural Network (BNN) to formally learn the posterior distribution of models in a scalable way. Second, we formulate the mini-max problem in BNN to learn the best model distribution under adversarial attacks, leading to an adversarial-trained Bayesian neural network. Experiment results demonstrate that the proposed algorithm achieves state-of-the-art performance under strong attacks. On CIFAR-10 with VGG network, our model leads to $14 \%$ accuracy improvement compared with adversarial training (Madry et al., 2017) and random self-ensemble (Liu et al., 2017) under PGD attack with 0.035 distortion, and the gap becomes even larger on a subset of ImageNet1.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Deep neural networks have demonstrated state-of-the-art performances on many difficult machine learning tasks. Despite the fundamental breakthroughs in various tasks, deep neural networks have been shown to be utterly vulnerable to adversarial attacks (Szegedy et al., 2013; Goodfellow et al., 2015). Carefully crafted perturbations can be added to the inputs of the targeted model to drive the performances of deep neural networks to chance-level. In the context of image classification, these perturbations are imperceptible to human eyes but can change the prediction of the classification model to the wrong class. Algorithms seek to find such perturbations are denoted as adversarial attacks (Chen et al., 2018; Carlini & Wagner, 2017b; Papernot et al., 2017), and some attacks are still effective in the physical world (Kurakin et al., 2017; Evtimov et al., 2017). The inherent weakness of lacking robustness to adversarial examples for deep neural networks brings out security concerns, especially for security-sensitive applications which require strong reliability.
|
| 14 |
+
|
| 15 |
+
To defend from adversarial examples and improve the robustness of neural networks, many algorithms have been recently proposed (Papernot et al., 2016; Zantedeschi et al., 2017; Kurakin et al., 2017; Huang et al., 2015; Xu et al., 2015). Among them, there are two lines of work showing effective results on medium-sized data (e.g., CIFAR-10). The first line of work uses adversarial training to improve robustness, and the recent algorithm proposed in Madry et al. (2017) has been recognized as one of the most successful defenses, as shown in Athalye et al. (2018). The second line of work adds stochastic components in the neural network to hide gradient information from attackers. In the black-box setting, stochastic outputs can significantly increase query counts for attacks using finite-difference techniques (Chen et al., 2018; Ilyas et al., 2018), and even in the white-box setting the recent Random Self-Ensemble (RSE) approach proposed by Liu et al. (2017) achieves similar performance to Madry’s adversarial training algorithm.
|
| 16 |
+
|
| 17 |
+
In this paper, we propose a new defense algorithm called Adv-BNN. The idea is to combine adversarial training and Bayesian network, although trying BNNs in adversarial attacks is not new (e.g. (Li & Gal, 2017; Feinman et al., 2017; Smith & Gal, 2018)), and very recently Ye & Zhu (2018) also tried to combine Bayesian learning with adversarial training, this is the first time we scale the problem to complex data and our approach achieves better robustness than previous defense methods. The contributions of this paper can be summarized below:
|
| 18 |
+
|
| 19 |
+
• Instead of adding randomness to the input of each layer (as what has been done in RSE), we directly assume all the weights in the network are stochastic and conduct training with techniques commonly used in Bayesian Neural Network (BNN).
|
| 20 |
+
• We propose a new mini-max formulation to combine adversarial training with BNN, and show the problem can be solved by alternating between projected gradient descent and SGD.
|
| 21 |
+
• We test the proposed Adv-BNN approach on CIFAR10, STL10 and ImageNet143 datasets, and show significant improvement over previous approaches including RSE and adversarial training.
|
| 22 |
+
|
| 23 |
+
Notations A neural network parameterized by weights $\pmb { w } \in \mathbb { R } ^ { d }$ is denoted by $f ( { \pmb x } ; { \pmb w } )$ , where $\ b { x } \in \mathbb { R } ^ { p }$ is an input example and $y$ is the corresponding label, the training/testing dataset is ${ \mathcal { D } } _ { \mathrm { t r / t e } }$ with size $N _ { \mathrm { t r / t e } }$ respectively. When necessary, we abuse ${ \mathcal { D } } _ { \mathrm { t r / t e } }$ to define the empirical distributions, i.e. Dtr/te = 1Ntr/t $\begin{array} { r } { \mathcal { D } _ { \mathrm { t r / t e } } = \frac { 1 } { N _ { \mathrm { t r / t e } } } \sum _ { i = 1 } ^ { N _ { \mathrm { t r / t e } } } \delta ( x _ { i } ) \delta ( y _ { i } ) } \end{array}$ e PNtr/tei=1 δ(xi)δ(yi), where δ(·) is the Dirac delta function. xo represents the original input and $\pmb { x } ^ { \mathrm { a d v } }$ denotes the adversarial example. The loss function is represented as $\ell \big ( f ( \pmb { x } _ { i } ; \pmb { w } ) , y _ { i } \big )$ , where $i$ is the index of the data point. Our approach works for any loss but we consider the cross-entropy loss in all the experiments. The adversarial perturbation is denoted as $\pmb { \xi } \in \mathbb { R } ^ { p }$ , and adversarial example is generated by ${ \pmb x } ^ { \mathrm { a d v } } = { \pmb x } _ { o } + { \pmb \xi }$ . In this paper, we focus on the attack under norm constraint Madry et al. (2017), so that $\| \pmb { \xi } \| \le \gamma$ . In order to align with the previous works, in the experiments we set the norm to $\| \cdot \| _ { \infty }$ . The Hadamard product is denoted as $\odot$ .
|
| 24 |
+
|
| 25 |
+
# 2 BACKGROUNDS
|
| 26 |
+
|
| 27 |
+
# 2.1 ADVERSARIAL ATTACK AND DEFENSE
|
| 28 |
+
|
| 29 |
+
In this section, we summarize related works on adversarial attack and defense.
|
| 30 |
+
|
| 31 |
+
Attack: Most algorithms generate adversarial examples based on the gradient of loss function with respect to the inputs. For example, FGSM (Goodfellow et al., 2015) perturbs an example by the sign of gradient, and use a step size to control the $\ell _ { \infty }$ norm of perturbation. Kurakin et al. (2017) proposes to run multiple iterations of FGSM. More recently, C&W attack Carlini & Wagner (2017a) formally poses attack as an optimization problem, and applies a gradient-based iterative solver to get an adversarial example. Both C&W attack and PGD attack (Madry et al., 2017) have been frequently used to benchmark the defense algorithms due to their effectiveness (Athalye et al., 2018). Throughout, we take the PGD attack as an example, largely following Madry et al. (2017).
|
| 32 |
+
|
| 33 |
+
The goal of PGD attack is to find adversarial examples in a $\gamma$ -ball, which can be naturally formulated as the following objective function:
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
\operatorname* { m a x } _ { \| \pmb { \xi } \| _ { \infty } \leq \gamma } \ell ( f ( \pmb { x } _ { o } + \pmb { \xi } ; \pmb { w } ) , y _ { o } ) .
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
Starting from $\pmb { x } ^ { 0 } = \pmb { x } _ { o }$ , PGD attack conducts projected gradient descent iteratively to update the adversarial example:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\begin{array} { r } { \pmb { x } ^ { t + 1 } = \Pi _ { \gamma } \left\{ \pmb { x } ^ { t } + \alpha \cdot \mathrm { s i g n } \Big ( \nabla _ { \pmb { x } } \ell \big ( f ( \pmb { x } ^ { t } ; \pmb { w } ) , y _ { o } \big ) \Big ) \right\} , } \end{array}
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $\Pi _ { \gamma }$ is the projection to the set $\{ { \pmb x } | \| { \pmb x } - { \pmb x } _ { o } \| _ { \infty } \le { \gamma } \}$ . Although multi-step PGD iterations may not necessarily return the optimal adversarial examples, we decided to apply it in our experiments, following the previous work of (Madry et al., 2017). An advantage of PGD attack over C&W attack is that it gives us a direct control of distortion by changing $\gamma$ , while in C&W attack we can only do this indirectly via tuning the regularizer.
|
| 46 |
+
|
| 47 |
+
Since we are dealing with networks with random weights, we elaborate more on which strategy should attackers take to increase their success rate, and the details can be found in Athalye et al. (2018). In random neural networks, an attacker seeks a universal distortion $\boldsymbol { \xi }$ that cheats a majority of realizations of the random weights. This can be achieved by maximizing the loss expectation
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\pmb { \xi } \triangleq \underset { \| \pmb { \xi } \| _ { \infty } \leq \gamma } { \arg \operatorname* { m a x } } \underset { \pmb { w } } { \mathbb { E } } \big [ \ell \big ( f \big ( \pmb { x } _ { o } + \pmb { \xi } ; \pmb { w } \big ) , y _ { o } \big ) \big ] .
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
Here the model weights $\pmb { w }$ are considered as random vector following certain distributions. In fact, solving (3) to a saddle point can be done easily by performing multi-step (projected) SGD updates. This is done inherently in some iterative attacks such as C&W or PGD discussed above, where the only difference is that we sample new weights $\pmb { w }$ at each iteration.
|
| 54 |
+
|
| 55 |
+
Defense: There are a large variety of defense methods proposed in recent years, e.g. denoiser based HGD (Liao et al., 2017) and randomized image preprocessing (Xie et al., 2017). Readers can find more from Kurakin et al. (2018). Below we select two representative ones that turn out to be effective to white box attacks. They are the major baselines in our experiments.
|
| 56 |
+
|
| 57 |
+
The first example is the adversarial training (Szegedy et al., 2013; Goodfellow et al., 2015). It is essentially a data augmentation method, which trains the deep neural networks on adversarial examples until the loss converges. Instead of searching for adversarial examples and adding them into the training data, Madry et al. (2017) proposed to incorporate the adversarial search inside the training process, by solving the following robust optimization problem:
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\pmb { w } ^ { * } = \underset { \pmb { w } } { \arg \operatorname* { m i n } } \ \underset { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } _ { \mathrm { t r } } } { \mathbb { E } } \left\{ \underset { \| \pmb { \xi } \| _ { \infty } \leq \gamma } { \operatorname* { m a x } } \ell \big ( f ( \pmb { x } + \pmb { \xi } ; \pmb { w } ) , \ b { y } \big ) \right\} ,
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where ${ \mathcal { D } } _ { \mathrm { t r } }$ is the training data distribution. The above problem is approximately solved by generating adversarial examples using PGD attack and then minimizing the classification loss of the adversarial example. In this paper, we propose to incorporate adversarial training in Bayesian neural network to achieve better robustness.
|
| 64 |
+
|
| 65 |
+
The other example is RSE (Liu et al., 2017), in this algorithm the authors proposed a “noise layer”, which fuses input features with Gaussian noise. They show empirically that an ensemble of models can increase the robustness of deep neural networks. Besides, their method can generate an infinite number of models on-the-fly without any additional memory cost. The noise layer is applied in both training and testing phases, so the prediction accuracy will not be largely affected. Our algorithm is different from RSE in two folds: 1) We add noise to each weight instead of input or hidden feature, and formally model it as a BNN. 2) We incorporate adversarial training to further improve the performance.
|
| 66 |
+
|
| 67 |
+
# 2.2 BAYESIAN NEURAL NETWORKS (BNN)
|
| 68 |
+
|
| 69 |
+
The idea of BNN is illustrated in Fig. 1. Given the observable random variables $( { \pmb x } , y )$ , we aim to estimate the distributions of hidden variables $\textbf { \em w }$ . In our case, the observable random variables correspond to the features $_ { \textbf { \em x } }$ and labels $y$ , and we are interested in the posterior over the weights $p ( \pmb { w } | \pmb { x } , y )$ given the prior $p ( \pmb { w } )$ . However, the exact solution of posterior is often intractable: notice that $\begin{array} { r } { p ( \pmb { w } | \pmb { x } , y ) = \frac { p ( \pmb { x } , y | \pmb { w } ) p ( \pmb { w } ) } { p ( \pmb { x } , y ) } } \end{array}$ but the denominator involves a high dimensional integral (Blei et al., 2017), hence the conditional probabilities are hard to compute. To speedup inference, we generally have two approaches—we can either sample ${ \pmb w } \sim \bar { p ( { \pmb w } | { \pmb x } , \bar { y ) } }$ efficiently without knowing the closed-form formula through, for example, Stochastic Gradient Langevin Dynamics (SGLD) (Welling & Teh, 2011), or we can approximate the true posterior $p ( \pmb { w } | \pmb { x } , y )$ by a parametric distribution $q _ { \pmb { \theta } } ( \pmb { w } )$ , where the unknown parameter $\pmb \theta$ is estimated by minimizing ${ \sf K L } \big ( q _ { \theta } ( { \pmb w } ) \parallel p ( { \pmb w } | { \pmb x } , y ) \big )$ over $\pmb \theta$ . For
|
| 70 |
+
|
| 71 |
+

|
| 72 |
+
Figure 1: Illustration of Bayesian neural networks.
|
| 73 |
+
|
| 74 |
+
neural network, the exact form of KL-divergence can be unobtainable, but we can easily find an unbiased gradient estimator of it using backward propagation, namely Bayes by Backprop (Blundell et al., 2015).
|
| 75 |
+
|
| 76 |
+
Despite that both methods are widely used and analyzed in-depth, they have some obvious shortcomings, making high dimensional Bayesian inference remain to be an open problem. For SGLD and its extension (e.g. (Li et al., 2016)), since the algorithms are essentially SGD updates with extra Gaussian noise, they are very easy to implement. However, they can only get one sample ${ \pmb w } \sim p ( { \pmb w } | { \pmb x } , y )$ in each minibatch iteration at the cost of one forward-backward propagation, thus not efficient enough for fast inference. In addition, as the step size $\eta _ { t }$ in SGLD decreases, the samples become more and more correlated so that one needs to generate many samples in order to control the variance. Conversely, the variational inference method is efficient to generate samples since we know the approximated posterior $q _ { \pmb { \theta } } ( \pmb { w } )$ once we minimized the KL-divergence. The problem is that for simplicity we often assume the approximation $q _ { \theta }$ to be a fully factorized Gaussian distribution:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
q _ { \pmb \theta } ( \pmb w ) = \prod _ { i = 1 } ^ { d } q _ { \pmb \theta _ { i } } ( \pmb w _ { i } ) , \mathrm { ~ a n d ~ } q _ { \pmb \theta _ { i } } ( \pmb w _ { i } ) = \mathcal N ( \pmb w _ { i } ; \pmb \mu _ { i } , \pmb \sigma _ { i } ^ { 2 } ) .
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
Although our assumption (5) has a simple form, it inherits the main drawback from mean-field approximation. When the ground truth posterior has significant correlation between variables, the approximation in (5) will have a large deviation from true posterior $p ( \pmb { w } | \pmb { x } , y )$ . This is especially true for convolutional neural networks, where the values in the same convolutional kernel seem to be highly correlated. However, we still choose this family of distribution in our design as the simplicity and efficiency are mostly concerned.
|
| 83 |
+
|
| 84 |
+
In fact, there are many techniques in deep learning area borrowing the idea of Bayesian inference without mentioning explicitly. For example, Dropout (Srivastava et al., 2014) is regarded as a powerful regularization tool for deep neural networks, which applies an element-wise product of the feature maps and i.i.d. Bernoulli or Gaussian r.v. $B ( 1 , \alpha )$ (or $\bar { \mathcal { N } } ( 1 , \alpha ) \}$ . If we allow each dimension to have an independent dropout rate and take them as model parameters to be learned, then we can extend it to the variational dropout method (Kingma et al., 2015). Notably, learning the optimal dropout rates for data relieves us from manually tuning hyper-parameter on hold-out data. Similar idea is also used in RSE (Liu et al., 2017), except that it was used to improve the robustness under adversarial attacks. As we discussed in the previous section, RSE incorporates Gaussian noise $\epsilon \sim \mathcal { N } ( 0 , \sigma ^ { 2 } )$ in an additive manner, where the variance $\sigma ^ { 2 }$ is user predefined in order to maximize the performance. Different from RSE, our Adv-BNN has two degrees of freedom (mean and variance) and the network is trained on adversarial examples.
|
| 85 |
+
|
| 86 |
+
# 3 METHOD
|
| 87 |
+
|
| 88 |
+
In our method, we combine the idea of adversarial training (Madry et al., 2017) with Bayesian neural network, hoping that the randomness in the weights $\textbf { \em w }$ provides stronger protection for our model.
|
| 89 |
+
|
| 90 |
+
To build our Bayesian neural network, we assume the joint distribution $q _ { \mu , s } ( \pmb { w } )$ is fully factorizable (see (5)), and each posterior $q _ { \pmb { \mu } _ { i } , \pmb { s } _ { i } } ( \pmb { w } _ { i } )$ follows normal distribution with mean $\pmb { \mu _ { i } }$ and standard deviation $\exp ( { \pmb { s } } _ { i } ) > 0$ . The prior distribution is simply isometric Gaussian $\mathcal { N } ( \mathbf { 0 } _ { d } , s _ { 0 } ^ { 2 } I _ { d \times d } )$ . We choose the Gaussian prior and posterior for its simplicity and closed-form KL-divergence, that is, for any two Gaussian distributions $s$ and $t$ ,
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mathsf { K L } ( s \parallel t ) = \log \frac { \sigma _ { t } } { \sigma _ { s } } + \frac { \sigma _ { s } ^ { 2 } + ( \mu _ { s } - \mu _ { t } ) ^ { 2 } } { 2 \sigma _ { t } ^ { 2 } } - 0 . 5 , \qquad s \mathrm { o r } t \sim \mathcal { N } ( \mu _ { s \mathrm { o r } t } , \sigma _ { s \mathrm { o r } t } ^ { 2 } ) .
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Note that it is also possible to choose more complex priors such as “spike-and-slab” (Ishwaran et al., 2005) or Gaussian mixture, although in these cases the KL-divergence of prior and posterior is hard to compute and practically we replace it with the Monte-Carlo estimator, which has higher variance, resulting in slower convergence rate (Kingma, 2017).
|
| 97 |
+
|
| 98 |
+
Following the recipe of variational inference, we adapt the robust optimization to the evidence lower bound (ELBO) w.r.t. the variational parameters during training. First of all, recall the ELBO on the original dataset (the unperturbed data) can be written as
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
- \mathsf { K L } \big ( q _ { \mu , s } ( w ) \parallel p ( w ) \big ) + \sum _ { ( \mathbf { x } _ { i } , y _ { i } ) \in \mathcal { D } _ { \mathrm { t r } } } \mathbb { E } _ { w \sim q _ { \mu , s } } \log p ( y _ { i } | x _ { i } , w ) ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
rather than directly maximizing the ELBO in (7), we consider the following alternative objective,
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\mathcal { L } ( \mu , s ) \triangleq - \mathsf { K L } \big ( q _ { \mu , s } ( w ) \parallel p ( w ) \big ) + \sum _ { ( x _ { i } , y _ { i } ) \in \mathcal { D } _ { \mathrm { t r } } } \operatorname* { m i n } _ { \| x _ { i } ^ { \mathrm { a d v } } - x _ { i } \| \leq \gamma } \mathbb { E } _ { w \sim q _ { \mu , s } } \log p ( y _ { i } | x _ { i } ^ { \mathrm { a d v } } , w ) .
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
This is essentially finding the minima for each data point $( \boldsymbol { x } _ { i } , \boldsymbol { y } _ { i } ) \in \mathcal { D } _ { \mathrm { t r } }$ inside the $\gamma$ -norm ball, we can also interpret (8) as an even looser lower bound of evidence. So the robust optimization procedure is to maximize (8), i.e.
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\mu ^ { * } , s ^ { * } = \underset { \mu , s } { \arg \operatorname* { m a x } } \mathcal { L } ( \mu , s ) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
To make the objective more specific, we combine (8) with (9) and get
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\underset { \mu , s } { \arg \operatorname* { m a x } } \left\{ \big [ \sum _ { \left( \mathbf { x } _ { i } , y _ { i } \right) \in \mathcal { D } _ { \mathrm { t r } } } \operatorname* { m i n } _ { \left\| \mathbf { x } _ { i } ^ { \mathrm { a d v } } - \mathbf { x } _ { i } \right\| \leq \gamma } \mathbb { E } _ { w \sim q _ { \mu , s } } \log p ( y _ { i } | x _ { i } ^ { \mathrm { a d v } } , w ) \big ] - \mathsf { K L } \big ( q _ { \mu , s } ( w ) \big \| p ( w ) \big ) \right\}
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
In our case, $p ( \boldsymbol { y } | \mathbf { x } ^ { \mathrm { a d v } } , \boldsymbol { w } ) = \mathrm { S o f t m a x } \big ( f ( \mathbf { x } _ { i } ^ { \mathrm { a d v } } ; \boldsymbol { w } ) \big ) [ \boldsymbol { y } _ { i } ]$ is the network output on the adversarial sample $( x _ { i } ^ { \mathrm { a d v } } , y _ { i } )$ . More generally, we can reformulate our model as $y = f ( { \pmb x } ; { \pmb w } ) { + } \zeta$ and assume the residual $\zeta$ follows either Logistic $( 0 , 1 )$ or Gaussian distribution depending on the specific problem, so that our framework includes both classification and regression tasks. We can see that the only difference between our Adv-BNN and the standard BNN training is that the expectation is now taken over the adversarial examples $( \boldsymbol { x } ^ { \mathrm { a d v } } , \boldsymbol { y } )$ , rather than natural examples $( { \pmb x } , y )$ . Therefore, at each iteration we first apply a randomized PGD attack (as introduced in eq (3)) for $T$ iterations to find $\pmb { x } ^ { \mathrm { a d v } }$ , and then fix the $\pmb { x } ^ { \mathrm { a d v } }$ to update $\mu , s$ .
|
| 123 |
+
|
| 124 |
+
When updating $\pmb { \mu }$ and $\pmb { s }$ , the KL term in (8) can be calculated exactly by (6), whereas the second term is very complex (for neural networks) and can only be approximated by sampling. Besides, in order to fit into the back-propagation framework, we adopt the Bayes by Backprop algorithm (Blundell et al., 2015). Notice that we can reparameterize $\pmb { w } = \pmb { \mu } + \exp ( \pmb { s } ) \odot \pmb { \epsilon } .$ , where $\epsilon \sim \mathcal { N } ( \mathbf { 0 } _ { d } , I _ { d \times d } )$ is a parameter free random vector, then for any differentiable function $h ( w , \mu , s )$ , we can show that
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\begin{array} { l } { \displaystyle \frac { \partial } { \partial \mu } \mathop { \mathbb { E } } _ { w } [ h ( w , \mu , s ) ] = \mathop { \mathbb { E } } _ { \epsilon } \left[ \frac { \partial } { \partial w } h ( w , \mu , s ) + \frac { \partial } { \partial \mu } h ( w , \mu , s ) \right] } \\ { \displaystyle \frac { \partial } { \partial s } \mathop { \mathbb { E } } _ { w } [ h ( w , \mu , s ) ] = \mathop { \mathbb { E } } _ { \epsilon } \left[ \exp ( s ) \odot \epsilon \odot \frac { \partial } { \partial w } h ( w , \mu , s ) + \frac { \partial } { \partial s } h ( w , \mu , s ) \right] . } \end{array}
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
Now the randomness is decoupled from model parameters, and thus we can generate multiple $\epsilon$ to form a unbiased gradient estimator. To integrate into deep learning framework more easily, we also designed a new layer called RandLayer, which is summarized in appendix.
|
| 131 |
+
|
| 132 |
+
It is worth noting that once we assume the simple form of variational distribution (5), we can also adopt the local reparameterization trick (Kingma et al., 2015). That is, rather than sampling the weights $\pmb { w }$ , we directly sample the activations and enjoy the lower variance during the sampling process. Although in our experiments we find the simple Bayes by Backprop method efficient enough.
|
| 133 |
+
|
| 134 |
+
For ease of doing SGD iterations, we rewrite (9) into a finite sum problem by dividing both sides by the number of training samples $N _ { \mathrm { t r } }$
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\mu ^ { * } , s ^ { * } = \underset { \mu , s } { \arg \operatorname* { m i n } } - \frac { 1 } { N _ { \mathrm { t r } } } \sum _ { i = 1 } ^ { N _ { \mathrm { t r } } } \log p ( y _ { i } | x _ { i } ^ { \mathrm { a d v } } , w ) + \frac { 1 } { N _ { \mathrm { t r } } } g ( \mu , s ) ,
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
here we define $g ( \pmb { \mu } , \pmb { s } ) \triangleq { \sf K L } ( q _ { \pmb { \mu } , \pmb { s } } ( \pmb { w } ) \parallel p ( \pmb { w } ) )$ by the closed form solution (6), so there is no randomness in it. We sample new weights by $\pmb { w } = \mu + \exp ( \pmb { s } ) \odot \pmb { \epsilon }$ in each forward propagation, so that the stochastic gradient is unbiased. In practice, however, we need a weaker regularization for
|
| 141 |
+
|
| 142 |
+
small dataset or large model, since the original regularization in (12) can be too large. We fix this problem by adding a factor $0 < \alpha \leq 1$ to the regularization term, so the new loss becomes
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
- \frac { 1 } { N _ { \mathrm { t r } } } \sum _ { i = 1 } ^ { N _ { \mathrm { t r } } } \log p ( y _ { i } | x _ { i } ^ { \mathrm { a d v } } , w ) + \frac { \alpha } { N _ { \mathrm { t r } } } g ( \pmb { \mu } , \pmb { s } ) , \quad 0 < \alpha \leq 1 .
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
In our experiments, we found little to no performance degradation compared with the same network without randomness, if we choose a suitable hyper-parameter $\alpha$ , as well as the prior distribution $\mathcal { N } ( \mathbf { 0 } , s _ { 0 } ^ { 2 } I )$ .
|
| 149 |
+
|
| 150 |
+
The overall training algorithm is shown in Alg. 1. To sum up, our Adv-BNN method trains an arbitrary Bayesian neural network with the min-max robust optimization, which is similar to Madry et al. (2017). As we mentioned earlier, even though our model contains noise and eventually the gradient information is also noisy, by doing multiple forward-backward iterations, the noise will be cancelled out due to the law of large numbers. This is also the suggested way to bypass some stochastic defenses in Athalye et al. (2018).
|
| 151 |
+
|
| 152 |
+
# Algorithm 1 Code snippet for training Adv-BNN
|
| 153 |
+
|
| 154 |
+
<table><tr><td colspan="2">1: procedure pgd_attack(x,y,w)</td><td></td></tr><tr><td>2:</td><td colspan="2">Perform the PGD-attack (2), omitted for brevity</td></tr><tr><td>3:</td><td>procedure train(data,w)</td><td></td></tr><tr><td>4:</td><td>DInput: dataset and network weights w</td><td></td></tr><tr><td>5:</td><td>for(x,y) in data do</td><td></td></tr><tr><td>6:</td><td>xadv ← pgd.attack(x,y, w)</td><td>Generate adversarial images</td></tr><tr><td>7:</td><td>w ←μ+exp(s)①∈,∈~N(0d,Idxd)</td><td>Samplenewmodel parameters</td></tr><tr><td>8:</td><td>y ← forward(w,xadv)</td><td>Forward propagation</td></tr><tr><td>9:</td><td>loss_ce ← cross_entropy(y,y)</td><td>Cross-entropy loss</td></tr><tr><td>10:</td><td>loss_kl ←kl_divergence(w)</td><td>KL-divergence following (6)</td></tr><tr><td>11:</td><td>L(μ,s)←loss_ce+ α ·loss_kl Ntr</td><td>Total loss following (13)</td></tr><tr><td>12:</td><td>,←backward(L(μ,s)) p's</td><td>Backward propagation to get gradients</td></tr><tr><td>13:</td><td>μ,s←μ-nt, aL 8- nts </td><td>>SGD update,omitting momentum and weight decay</td></tr><tr><td colspan="2">14: return net</td><td></td></tr></table>
|
| 155 |
+
|
| 156 |
+
Will it be beneficial to have randomness in adversarial training? After all, both randomized network and adversarial training can be viewed as different ways for controlling local Lipschitz constants of the loss surface around the image manifold, and thus it is non-trivial to see whether combining those two techniques can lead to better robustness. The connection between randomized network (in particular, RSE) and local Lipschitz regularization has been derived in Liu et al. (2017). Adversarial training can also be connected to local Lipschitz regularization with the following arguments. Recall that the loss function given data $( x _ { i } , y _ { i } )$ is denoted as $\ell \big ( f ( \pmb { x } _ { i } ; \pmb { w } ) , y _ { i } \big )$ , and similarly the loss on perturbed data $( { \pmb x } _ { i } + { \pmb \xi } , y _ { i } )$ is $\ell \big ( f ( \pmb { x } _ { i } + \pmb { \xi } ; \pmb { w } ) , y _ { i } \big )$ . Then if we expand the loss to the first order
|
| 157 |
+
|
| 158 |
+
$$
|
| 159 |
+
\begin{array} { r } { \Delta \ell \triangleq \ell \big ( f ( { \boldsymbol x } _ { i } + { \boldsymbol \xi } ; { \boldsymbol w } ) , { \boldsymbol y } _ { i } \big ) - \ell \big ( f ( { \boldsymbol x } _ { i } ; { \boldsymbol w } ) , { \boldsymbol y } _ { i } \big ) = { \boldsymbol \xi } ^ { \mathsf { T } } \nabla _ { { \boldsymbol x } _ { i } } \ell \big ( f ( { \boldsymbol x } _ { i } ; { \boldsymbol w } ) , { \boldsymbol y } _ { i } \big ) + { \boldsymbol O } ( \| { \boldsymbol \xi } \| ^ { 2 } ) , } \end{array}
|
| 160 |
+
$$
|
| 161 |
+
|
| 162 |
+
we can see that the robustness of a deep model is closely related to the gradient of the loss over the input, i.e. $\nabla _ { \pmb { x } _ { i } } \ell \big ( f ( \pmb { x } _ { i } ) , y _ { i } \big )$ . If $\| \nabla _ { \pmb { x } _ { i } } \ell \big ( f ( \pmb { x } _ { i } ) , y _ { i } \big ) \|$ is large, then we can find a suitable $\boldsymbol { \xi }$ such that $\Delta \ell$ is large. Under such condition, the perturbed image ${ \pmb x } _ { i } + { \pmb \xi }$ is very likely to be an adversarial example. It turns out that adversarial training (4) directly controls the local Lipschitz value on the training set, this can be seen if we combine (14) with (4)
|
| 163 |
+
|
| 164 |
+
$$
|
| 165 |
+
\begin{array} { l } \displaystyle { \operatorname* { m i n } _ { w } \ell \big ( f \big ( { \boldsymbol x } _ { i } ^ { \mathrm { a d v } } ; { \boldsymbol w } \big ) , y _ { i } \big ) = \operatorname* { m i n } _ { { \boldsymbol w } } \operatorname* { m a x } _ { \boldsymbol \parallel \xi \boldsymbol \parallel \leq \gamma } \ell \big ( f \big ( { \boldsymbol x } _ { i } + { \boldsymbol \xi } ; { \boldsymbol w } \big ) } \\ { = \displaystyle { \operatorname* { m i n } _ { { \boldsymbol w } } \operatorname* { m a x } _ { \boldsymbol \parallel \xi \boldsymbol \parallel \leq \gamma } \ell \big ( f \big ( { \boldsymbol x } _ { i } ; { \boldsymbol w } \big ) , y _ { i } \big ) + \xi ^ { \top } \nabla _ { { \boldsymbol x } _ { i } } \ell \big ( f \big ( { \boldsymbol x } _ { i } ; { \boldsymbol w } \big ) , y _ { i } \big ) + \mathcal O ( \| \boldsymbol \xi \| ^ { 2 } ) . } } \end{array}
|
| 166 |
+
$$
|
| 167 |
+
|
| 168 |
+
Moreover, if we ignore the higher order term $\mathcal { O } ( \| \pmb { \xi } \| ^ { 2 } )$ then (15) becomes
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\operatorname* { m i n } _ { \pmb { w } } \ell ( f ( \pmb { x } _ { i } ; \pmb { w } ) , y _ { i } ) + \gamma \cdot \| \nabla _ { \pmb { x } _ { i } } \ell ( f ( \pmb { x } _ { i } ; \pmb { w } ) , y _ { i } ) \| .
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
In other words, the adversarial training can be simplified to Lipschitz regularization, and if the model generalizes, the local Lipschitz value will also be small on the test set. Yet, as (Liu & Hsieh,
|
| 175 |
+
|
| 176 |
+
2018) indicates, for complex dataset like CIFAR-10, the local Lipschitz is still very large on test set, even though it is controlled on training set. The drawback of adversarial training motivates us to combine the randomness model with adversarial training, and we observe a significant improvement over adversarial training or RSE alone (see the experiment section below).
|
| 177 |
+
|
| 178 |
+
# 4 EXPERIMENTAL RESULTS
|
| 179 |
+
|
| 180 |
+
In this section, we test the performance of our robust Bayesian neural networks (Adv-BNN) with strong baselines on a wide variety of datasets. In essence, our method is inspired by adversarial training (Madry et al., 2017) and BNN (Blundell et al., 2015), so these two methods are natural baselines. If we see a significant improvement in adversarial robustness, then it means that randomness and robust optimization have independent contributions to defense. Additionally, we would like to compare our method with RSE (Liu et al., 2017), another strong defense algorithm relying on randomization. Lastly, we include the models without any defense as references. For ease of reproduction, we list the hyper-parameters in the appendix. Readers can also refer to the source code on github.
|
| 181 |
+
|
| 182 |
+
It is known that adversarial training becomes increasingly hard for high dimensional data (Schmidt et al., 2018). In addition to standard low dimensional dataset such as CIFAR-10, we also did experiments on two more challenging datasets: 1) STL-10 (Coates et al., 2011), which has 5,000 training images and 8,000 testing images. Both of them are $9 6 \times 9 6$ pixels; 2) ImageNet-143, which is a subset of ImageNet (Deng et al., 2009), and widely used in conditional GAN training (Miyato & Koyama, 2018). The dataset has 18,073 training and 7,105 testing images, and all images are $6 4 \times 6 4$ pixels. It is a good benchmark because it has much more classes than CIFAR-10, but is still manageable for adversarial training.
|
| 183 |
+
|
| 184 |
+
# 4.1 EVALUATING MODELS UNDER WHITE BOX $\ell _ { \infty }$ -PGD ATTACK
|
| 185 |
+
|
| 186 |
+
In the first experiment, we compare the accuracy under the white box $\ell _ { \infty }$ -PGD attack. We set the maximum $\ell _ { \infty }$ distortion to $\gamma \in \mathrm { ~ [ ~ 0 : 0 ~ . 0 7 : 0 ~ . 0 0 5 ] ~ }$ and report the accuracy on test set. The results are shown in Fig. 2. Note that when attacking models with stochastic components, we adjust PGD accordingly as mentioned in Section 2.1. To demonstrate the relative performance more clearly, we show some numerical results in Tab. 1.
|
| 187 |
+
|
| 188 |
+

|
| 189 |
+
Figure 2: Accuracy under $\ell _ { \infty }$ -PGD attack on three different datasets: CIFAR-10, STL-10 and ImageNet-143. In particular, we adopt a smaller network for STL-10 namely “Model $\mathbf { A } ^ { \mathsf { { s } } , 1 }$ , while the other two datasets are trained on VGG.
|
| 190 |
+
|
| 191 |
+
From Fig. 2 and Tab. 1 we can observe that although BNN itself does not increase the robustness of the model, when combined with the adversarial training method, it dramatically increase the testing accuracy for ${ \sim } 1 0 \%$ on a variety of datasets. Moreover, the overhead of Adv-BNN over adversarial training is small: it will only double the parameter space (for storing mean and variance), and the total training time does not increase much. Finally, similar to RSE, modifying existing network architectures into BNN is fairly simple, we only need to replace Conv/BatchNorm/Linear layers by their variational version. Hence we can easily build robust models based on existing ones.
|
| 192 |
+
|
| 193 |
+
Table 1: Comparing the testing accuracy under different levels of PGD attacks. We include our method, Adv-BNN, and the state of the art defense method, the multi-step adversarial training proposed in Madry et al. (2017). The better accuracy is marked in bold. Notice that although our Adv-BNN incurs larger accuracy drop in the original test set (where $\| \pmb { \xi } \| _ { \infty } = 0 )$ , we can choose a smaller $\alpha$ in (13) so that the regularization effect is weakened, in order to match the accuracy.
|
| 194 |
+
|
| 195 |
+
<table><tr><td>Data</td><td>Defense</td><td>0</td><td>0.015</td><td>0.035</td><td>0.055</td><td>0.07</td></tr><tr><td>CIFAR10</td><td>Adv. Training Adv-BNN</td><td>80.3 79.7</td><td>58.3 68.7</td><td>31.1 45.4</td><td>15.5 26.9</td><td>10.3 18.6</td></tr><tr><td>STL10</td><td>Adv. Training Adv-BNN</td><td>63.2 59.9</td><td>46.7 51.8</td><td>27.4 37.6</td><td>12.8 27.2</td><td>7.0 21.1</td></tr><tr><td>Data</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>Defense Adv. Training</td><td>0 48.7</td><td>0.004 37.6</td><td>0.01</td><td>0.016</td><td>0.02</td></tr><tr><td>ImageNet-143</td><td>Adv-BNN</td><td>47.3</td><td>43.8</td><td>23.0 39.3</td><td>12.4 30.2</td><td>7.5 24.6</td></tr></table>
|
| 196 |
+
|
| 197 |
+
# 4.2 BLACK BOX TRANSFER ATTACK
|
| 198 |
+
|
| 199 |
+
Is our Adv-BNN model susceptible to transfer attack? we answer this question by studying the affinity between models, because if two models are similar (e.g. in loss landscape) then we can easily attack one model using the adversarial examples crafted through the other. In this section, we measure the adversarial sample transferability between different models namely None (no defense), BNN, Adv.Train, RSE and Adv-BNN. This is done by the method called “transfer attack” (Liu et al., 2016). Initially it was proposed as a black box attack algorithm: when the attacker has no access to the target model, one can instead train a similar model from scratch (called source model), and then generate adversarial samples with source model. As we can imagine, the success rate of transfer attack is directly linked with how similar the source/target models are. In this experiment, we are interested in the following question: how easily can we transfer the adversarial examples between these five models? We study the affinity between those models, where the affinity is defined by
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\rho _ { A \mapsto B } = { \frac { \operatorname { A c c } [ B ] - \operatorname { A c c } [ B \vert A ] } { \operatorname { A c c } [ B ] - \operatorname { A c c } [ B \vert B ] } } ,
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
where $\rho _ { A \mapsto B }$ measures the success rate using source model $A$ and target model $B$ , $\operatorname { A c c } [ B ]$ denotes the accuracy of model $B$ without attack, $\bar { \mathrm { A c c } } [ B | A ( \mathrm { o r } B ) ]$ means the accuracy under adversarial samples generated by model $A ( \ o { \mathrm { o r } } \ : B )$ . Most of the time, it is easier to find adversarial examples through the target model itself, so we have $\operatorname { A c c } [ B | A ] \ \geq \ \operatorname { A c c } [ B | B ]$ and thus $0 \leq \rho _ { A \mapsto B } \leq 1$ . However, $\rho _ { A \mapsto B } = \rho _ { B \mapsto A }$ is not necessarily true, so the affinity matrix is not likely to be symmetric. We illustrate the result in Fig. 3.
|
| 206 |
+
|
| 207 |
+
We can observe that $\left\{ \mathrm { N o n e , B N N } \right\}$ are similar models, their affinity is strong $( \rho \approx 0 . 8 5 )$ for both direction: $\rho _ { \mathtt { B N N } \mapsto \mathtt { N o n e } }$ and $\rho _ { \mathrm { N o n e r } \mathrm { B N N } }$ . Likewise, $\left\{ \mathrm { R S E , A d v - B N N , A d v \cdot T r a i n } \right\}$ constitute the other group, yet the affinity is not very strong $( \rho \approx 0 . 5 { \sim } 0 . 6 )$ , meaning these three methods are all robust to the black box attack to some extent.
|
| 208 |
+
|
| 209 |
+
# 4.3 MISCELLANEOUS EXPERIMENTS
|
| 210 |
+
|
| 211 |
+
Following experiments are not crucial in showing the success of our method, however, we still include them to help clarifying some doubts of careful readers.
|
| 212 |
+
|
| 213 |
+

|
| 214 |
+
Figure 3: Black box, transfer attack experiment results. We select all combinations of source and target models trained from 5 defense methods and calculate the affinity according to (17).
|
| 215 |
+
|
| 216 |
+
The first question is about sample efficiency, recall in prediction stage we sample weights from the approximated posterior and generate the label by
|
| 217 |
+
|
| 218 |
+
$$
|
| 219 |
+
\hat { y } = \mathop { \arg \operatorname* { m a x } } _ { y } \frac { 1 } { m } \sum _ { k = 1 } ^ { m } p ( y | x , w _ { k } ) , \quad w _ { k } \sim q _ { \mu , s } .
|
| 220 |
+
$$
|
| 221 |
+
|
| 222 |
+
In practice, we do not want to average over lots of forward propagation to control the variance, which will be much slower than other models during the prediction stage. Here we take ImageNet-143 dat $\iota + \mathrm { V G G }$ network as an example, to show that only $1 0 { \sim } 2 0$ forward operations are sufficient for robust and accurate prediction. Furthermore, the number seems to be independent on the adversarial distortion, as we can see in Fig. 4(left). So our algorithm is especially suitable to large scale scenario.
|
| 223 |
+
|
| 224 |
+
One might also be concerned about whether 20 steps of PGD iterations are sufficient to find adversarial examples. It has been known that for certain adversarial defense method, the effectiveness appears to be worse than claimed (Engstrom et al., 2018), if we increase the PGD-steps from 20 to 100. In Fig. $4 ( r i g h t )$ , we show that even if we increase the number of iteration to 1000, the accuracy does not change very much. This means that even the adversary invests more resources to attack our model, its marginal benefit is negligible.
|
| 225 |
+
|
| 226 |
+

|
| 227 |
+
Figure 4: Left: we tried different number of forward propagation and averaged the results to make prediction (18). We see that for different scales of perturbation $\gamma \in \{ 0 , 0 . 0 1 , 0 . 0 2 \}$ , choosing number of ensemble $n = 1 0 { \sim } 2 0$ is good enough. Right: testing accuracy stabilizes quickly as #PGDsteps goes greater than 20, so there is no necessity to further increase the number of PGD steps.
|
| 228 |
+
|
| 229 |
+
# 5 CONCLUSION & DISCUSSION
|
| 230 |
+
|
| 231 |
+
To conclude, we find that although the Bayesian neural network has no defense functionality, when combined with adversarial training, its robustness against adversarial attack increases significantly. So this method can be regarded as a non-trivial combination of BNN and the adversarial training: robust classification relies on the controlled local Lipschitz value, while adversarial training does not generalize this property well enough to the test set; if we train the BNN with adversarial examples, the robustness increases by a large margin. Admittedly, our method is still far from the ideal case, and it is still an open problem on what the optimal defense solution will be.
|
| 232 |
+
|
| 233 |
+
# REFERENCES
|
| 234 |
+
|
| 235 |
+
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.
|
| 236 |
+
David M Blei, Alp Kucukelbir, and Jon D McAuliffe. Variational inference: A review for statisticians. Journal of the American Statistical Association, 112(518):859–877, 2017.
|
| 237 |
+
Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In International Conference on Machine Learning, pp. 1613–1622, 2015.
|
| 238 |
+
Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, AISec ’17, pp. 3–14, New York, NY, USA, 2017a. ACM. ISBN 978-1-4503-5202- 4. doi: 10.1145/3128572.3140444. URL http://doi.acm.org/10.1145/3128572. 3140444.
|
| 239 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In Security and Privacy (SP), 2017 IEEE Symposium on, pp. 39–57. IEEE, 2017b.
|
| 240 |
+
Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
|
| 241 |
+
Adam Coates, Andrew $\mathrm { N g }$ , and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 215–223, 2011.
|
| 242 |
+
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.
|
| 243 |
+
Logan Engstrom, Andrew Ilyas, and Anish Athalye. Evaluating and understanding the robustness of adversarial logit pairing. arXiv preprint arXiv:1807.10272, 2018.
|
| 244 |
+
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.
|
| 245 |
+
Reuben Feinman, Ryan R Curtin, Saurabh Shintre, and Andrew B Gardner. Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017.
|
| 246 |
+
Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015. URL http:// arxiv.org/abs/1412.6572.
|
| 247 |
+
Ruitong Huang, Bing Xu, Dale Schuurmans, and Csaba Szepesvari. Learning with a strong adver- ´ sary. arXiv preprint arXiv:1511.03034, 2015.
|
| 248 |
+
Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. arXiv preprint arXiv:1804.08598, 2018.
|
| 249 |
+
|
| 250 |
+
Hemant Ishwaran, J Sunil Rao, et al. Spike and slab variable selection: frequentist and bayesian strategies. The Annals of Statistics, 33(2):730–773, 2005.
|
| 251 |
+
|
| 252 |
+
Diederik P Kingma. Variational inference & deep learning: A new synthesis. 2017.
|
| 253 |
+
|
| 254 |
+
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.
|
| 255 |
+
|
| 256 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In International Conference of Learning Representation, 2017.
|
| 257 |
+
|
| 258 |
+
Alexey Kurakin, Ian Goodfellow, Samy Bengio, Yinpeng Dong, Fangzhou Liao, Ming Liang, Tianyu Pang, Jun Zhu, Xiaolin Hu, Cihang Xie, et al. Adversarial attacks and defences competition. arXiv preprint arXiv:1804.00097, 2018.
|
| 259 |
+
|
| 260 |
+
Chunyuan Li, Changyou Chen, David E Carlson, and Lawrence Carin. Preconditioned stochastic gradient langevin dynamics for deep neural networks. In AAAI, volume 2, pp. 4, 2016.
|
| 261 |
+
|
| 262 |
+
Yingzhen Li and Yarin Gal. Dropout inference in bayesian neural networks with alpha-divergences. arXiv preprint arXiv:1703.02914, 2017.
|
| 263 |
+
|
| 264 |
+
Fangzhou Liao, Ming Liang, Yinpeng Dong, Tianyu Pang, Jun Zhu, and Xiaolin Hu. Defense against adversarial attacks using high-level representation guided denoiser. arXiv preprint arXiv:1712.02976, 2017.
|
| 265 |
+
|
| 266 |
+
Xuanqing Liu and Cho-Jui Hsieh. From adversarial training to generative adversarial networks. arXiv preprint arXiv:1807.10454, 2018.
|
| 267 |
+
|
| 268 |
+
Xuanqing Liu, Minhao Cheng, Huan Zhang, and Cho-Jui Hsieh. Towards robust neural networks via random self-ensemble. arXiv preprint arXiv:1712.00673, 2017.
|
| 269 |
+
|
| 270 |
+
Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. arXiv preprint arXiv:1611.02770, 2016.
|
| 271 |
+
|
| 272 |
+
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.
|
| 273 |
+
|
| 274 |
+
Takeru Miyato and Masanori Koyama. cgans with projection discriminator. 2018.
|
| 275 |
+
|
| 276 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016.
|
| 277 |
+
|
| 278 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017.
|
| 279 |
+
|
| 280 |
+
Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. arXiv preprint arXiv:1804.11285, 2018.
|
| 281 |
+
|
| 282 |
+
Lewis Smith and Yarin Gal. Understanding measures of uncertainty for adversarial example detection. arXiv preprint arXiv:1803.08533, 2018.
|
| 283 |
+
|
| 284 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
|
| 285 |
+
|
| 286 |
+
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.
|
| 287 |
+
|
| 288 |
+
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), pp. 681–688, 2011.
|
| 289 |
+
|
| 290 |
+
Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. arXiv preprint arXiv:1711.01991, 2017.
|
| 291 |
+
|
| 292 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International Conference on Machine Learning, pp. 2048–2057, 2015.
|
| 293 |
+
|
| 294 |
+
Nanyang Ye and Zhanxing Zhu. Bayesian adversarial learning. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 6892–6901. Curran Associates, Inc., 2018. URL http: //papers.nips.cc/paper/7921-bayesian-adversarial-learning.pdf.
|
| 295 |
+
|
| 296 |
+
Valentina Zantedeschi, Maria-Irina Nicolae, and Ambrish Rawat. Efficient defenses against adversarial attacks. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 39–49. ACM, 2017.
|
| 297 |
+
|
| 298 |
+
# A HOW TO ATTACK THE RANDOMIZED NETWORK
|
| 299 |
+
|
| 300 |
+
We largely follow the guidelines of attacking networks with “obfuscated gradients” in Athalye et al. (2018). Specifically, we derive the algorithm for white box attack to random networks denoted as $f ( w ; \epsilon )$ , where $\pmb { w }$ is the (fixed) network parameters and $\epsilon$ is the random vector. Many random neural networks can be reparameterized to this form, where each forward propagation returns different results. In particular, this framework includes our Adv-BNN model by setting ${ \pmb w } = ( { \pmb \mu } , { \pmb s } )$ . Recall the prediction is made through “majority voting”:
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\begin{array} { r } { \hat { y } = \underset { y } { \arg \operatorname* { m i n } } \ \underset { \epsilon } { \mathbb { E } } \left( f ( \boldsymbol { x } ; \boldsymbol { w } , \epsilon ) , y \right) . } \end{array}
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
So the optimal white-box attack should maximize the loss (19) on the ground truth label $y ^ { * }$ . That is,
|
| 307 |
+
|
| 308 |
+
$$
|
| 309 |
+
\pmb { \xi } ^ { \ast } = \underset { \pmb { \xi } } { \arg \operatorname* { m a x } } \underset { \pmb { \epsilon } } { \mathbb { E } } \left( f ( \pmb { x } + \pmb { \xi } ; \pmb { w } , \boldsymbol { \epsilon } ) , y ^ { * } \right) ,
|
| 310 |
+
$$
|
| 311 |
+
|
| 312 |
+
and then ${ \pmb x } ^ { \mathrm { a d v } } \triangleq { \pmb x } + { \pmb \xi } ^ { * }$ . To do that we apply SGD optimizer and sampling $\epsilon$ at each iteration,
|
| 313 |
+
|
| 314 |
+
$$
|
| 315 |
+
\pmb { \xi } _ { t + 1 } \gets \pmb { \xi } _ { t } + \eta _ { t } \frac { \partial } { \partial \pmb { \xi } } \ell \big ( f ( \pmb { x } + \pmb { \xi } ; \pmb { w } , \pmb { \epsilon } ) , y ^ { * } \big ) \Big | _ { \pmb { \xi } = \pmb { \xi } _ { t } } ,
|
| 316 |
+
$$
|
| 317 |
+
|
| 318 |
+
one can see the iteration (21) approximately solves (20).
|
| 319 |
+
|
| 320 |
+
# B FORWARD & BACKWARD IN RANDLAYER
|
| 321 |
+
|
| 322 |
+
It is very easy to implement the forward & backward propagation in BNN. Here we introduce the RandLayer that can seamlessly integrate into major deep learning frameworks. We take PyTorch as an example, the code snippet is shown in Alg. 1.
|
| 323 |
+
|
| 324 |
+
Algorithm 1: Code snippet for implementing RandLayer
|
| 325 |
+
|
| 326 |
+
<table><tr><td>15 if :ctx.needs_input_grad[0]:</td></tr><tr><td>grad_mu = grad_output + mu/(sigma_O*sigma_0*N)</td></tr><tr><td>16 if ctx.needs_input_grad[1]:</td></tr><tr><td>17 grad_sigma = grad_output*tmp*eps - 1 / N + tmp*tmp/(sigma_0*sigma_0*N)</td></tr><tr><td>18</td></tr><tr><td>19 return grad_mu,grad_sigma,grad_eps,grad_sigma_0,grad_N 20 rand_layer = RandLayerFunc.apply</td></tr></table>
|
| 327 |
+
|
| 328 |
+
Based on RandLayer, we can further implement variational Linear layer below in Alg. 2. The other layers such as Conv/BatchNorm are very similar.
|
| 329 |
+
|
| 330 |
+
Algorithm 2: Code snippet for implementing variational Linear layer
|
| 331 |
+
|
| 332 |
+
<table><tr><td colspan="2">class Linear(Module): __init_(self,d_in,d_out):</td></tr><tr><td colspan="2">def self.d_in = d_in</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">self.d_in = d_in</td></tr><tr><td colspan="2">self.d_out = d_out</td></tr><tr><td colspan="2">self.init_s = init_s</td></tr><tr><td colspan="2">self.mu_weight = Parameter(torch.Tensor(d_out,d_in))</td></tr><tr><td colspan="2">self.sigma_weight = Parameter(torch.Tensor(d_out,d_in))</td></tr><tr><td colspan="2">self.register_buffer('eps_weight',torch.Tensor(d_out,d_in))</td></tr><tr><td colspan="2">def forward(self,x):</td></tr><tr><td colspan="2">weight = rand_layer(self.mu_weight, self.sigma_weight, self.eps_weight)</td></tr><tr><td colspan="2">bias = None</td></tr></table>
|
| 333 |
+
|
| 334 |
+
# C HYPER-PARAMETERS
|
| 335 |
+
|
| 336 |
+
We list the key hyper-parameters in Tab. 2, note that we did not tune the hyper-parameters very hard, therefore it is entirely possible to find better ones.
|
| 337 |
+
|
| 338 |
+
Table 2: Hyper-parameters setting in our experiments.
|
| 339 |
+
|
| 340 |
+
<table><tr><td>Name</td><td>Value</td><td>Notes</td></tr><tr><td>k</td><td>20</td><td>#PGD iterations in attack</td></tr><tr><td>k'</td><td>10</td><td>#PGD iterations in adversarial training</td></tr><tr><td>2</td><td>CIFAR10/STL10: 8/256, ImageNet: 0.01</td><td>loo-norm in adversarial training</td></tr><tr><td>00</td><td>CIFAR10: 0.05,others: 0.15</td><td>Std. of the prior distribution (not sensitive)</td></tr><tr><td>α</td><td>CIFAR10: 1.0,others: 1.0/50</td><td>See (13)</td></tr><tr><td>n</td><td>10~20</td><td>#Forward passes when doing ensemble inference</td></tr></table>
|
md/train/rk5UYassf/rk5UYassf.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Regularized siamese neural network for unsupervised outlier detection on brain multiparametric magnetic resonance imaging: application to epilepsy lesion screening
|
| 2 |
+
|
| 3 |
+
Zara Alaverdyan
|
| 4 |
+
Univ Lyon, INSA-Lyon, Université Claude Bernard Lyon 1,
|
| 5 |
+
UJM-Saint Etienne, CNRS, Inserm, CREATIS UMR 5220, U1206, F-69621, Lyon, France zaruhi.alaverdyan@creatis.insa-lyon.fr
|
| 6 |
+
|
| 7 |
+
Julien Jung, Romain Bouet Lyon Neuroscience Research Center, CRNL, INSERM U1028, CNRS UMR5292, University Lyon 1, Lyon, France {julien.jung, romain.bouet}@inserm.fr
|
| 8 |
+
|
| 9 |
+
Carole Lartizien
|
| 10 |
+
Univ Lyon, INSA-Lyon, Université Claude Bernard Lyon 1,
|
| 11 |
+
UJM-Saint Etienne, CNRS, Inserm, CREATIS UMR 5220, U1206, F-69621, Lyon, France carole.lartizien@creatis.insa-lyon.fr
|
| 12 |
+
|
| 13 |
+
# Abstract
|
| 14 |
+
|
| 15 |
+
Computer aided diagnosis (CAD) systems are designed to assist clinicians in various tasks, including highlighting abnormal regions in medical images. Common methods exploit supervised learning using annotated data sets and perform classification at voxel-level. However, many pathologies are characterized by subtle lesions that may be located anywhere in the organ of interest, have various shapes, sizes and textures. Acquiring a data set adequately representing the heterogeneity of such pathologies is therefore a major issue. Moreover, when a lesion is not visually detected on a scan, outlining it accurately is not feasible. Performing supervised learning on such labeled data would not be reliable. In this study, we consider the problem of detecting subtle epilepsy lesions in multiparametric (T1w, FLAIR) MRI exams considered as normal (MRI-negative). We cast this problem as an outlier detection problem and build on a previously proposed approach that consists in learning a oc-SVM model for each voxel in the brain volume using a small number of clinically-guided features [1]. Our goal in this study is to make a step forward by replacing the handcrafted features with automatically learnt representations using neural networks. We propose a novel version of siamese networks trained on patches extracted from healthy patients’ scans only. This network, composed of stacked convolutional autoencoders as subnetworks, is regularized by the reconstruction error of the patches. It is designed to map patches centered at the same spatial localization to ’close’ representations with respect to the chosen metric (i.e. cosine) in a latent space. Finally, the middle layer representations of the subnetworks are fed into oc-SVM models at voxel-level. The model is trained on 75 healthy subjects and validated on 21 patients with confirmed epilepsy lesions (with 18 MR negative patients) and shows a promising performance.
|
| 16 |
+
|
| 17 |
+
# 1 Introduction
|
| 18 |
+
|
| 19 |
+
Computer aided diagnosis (CAD) systems have been introduced as to assist clinicians in various tasks such as organ or lesion segmentation, detection of abnormal regions in a medical image, etc. Recent CAD systems for brain pathologies exploit various modalities of neuroimaging data, such as magnetic resonance imaging (MRI) and positron emission tomography (PET). The vast majority of the existing CAD systems are built upon methods developed in supervised settings, using either manually designed features or currently ubiquitous deep learning architectures as in [2, 3, 4, 5]. Such systems benefit from the available data sets (usually) annotated at voxel-level, and output maps where each voxel is characterized either by a class label, a probability or, less commonly, a score discriminating healthy versus pathological voxels. Supervised learning, however, cannot be applied when the number of pathological cases in the training set is not sufficient to account for the complexity of the task. This is often the case when it comes to detecting some brain pathologies such as small vessel diseases (SVD), multiple sclerosis (MS) or epilepsy, when the lesions are subtle and vary largely in terms of shapes and textures. It is not trivial to obtain a well-annotated data set to represent such a variability. To bypass the problem of insufficient labeled data, some authors recently proposed to formulate such lesion detection tasks in semi-supervised settings, by accounting for both labeled and unlabeled data in a deep architecture for MS lesion segmentation [6] or by exploiting weak labels (the number of lesions in a scan) to detect enlarged perivascular spaces in the basal ganglia [7].
|
| 20 |
+
|
| 21 |
+
In this study we propose to tackle the problem of epilepsy lesion detection in patients with MRI negative exams, meaning that the lesions were not visually identified by clinicians on the MR scans. Similarly to the above mentioned lesion detection tasks, most of the current epilepsy detection methods perform supervised learning by leveraging annotated lesions delineated on MRI positive patients (the lesions are visually detected on the scans) [8] or by careful a posteriori re-reading of postsurgical scans of MRI negative patients who had undergone surgery and were seizure-free afterwards [1, 9, 10, 11]. While obtaining accurately labeled data for MRI positive patients is feasible, the real challenge is to extract accurate delineations in MRI negative patients. [11] showed that exploiting ’too generously’ annotated lesions on MRI negative scans as labels for supervised learning methods leads to poor detection rate due to the presence of normal tissue in the areas labeled as pathological. Therefore, some recent methods cast epilepsy lesion detection task as an outlier detection problem [1, 11, 12]. Such an approach solely needs a training set of non-pathological images, hence no labeled data is required. [1] used a small number of features modeling the gray-white matter junction (similarly to [13, 14]) while [12] and [11] derived features from surface based morphometry (SBM). All the latter methods targeted a specific type of epilepsy caused by focal cortical dysplasia (FCD); hence the features were chosen as to provide the most common FCD-characteristics to the models.
|
| 22 |
+
|
| 23 |
+
In this work we build on the method proposed in [1] that learns a one-class SVM (oc-SVM) model for each voxel individually. Our goal is to make a step forward by replacing the handcrafted features with automatically learnt representations using neural networks. Deep learning architectures allow to learn representations that are not limited to the clinically-guided features which have to be designed for each pathology individually; the representations are learnt based on the available data. Moreover, certain architectures provide a convenient framework to learn joint representations of multiparametric/multimodality imaging. Our methodological contribution consists in proposing a variant of siamese neural network designed to learn representations for outlier detection on brain images. The network is composed of stacked convolutional autoencoders and is trained on the patches of healthy brain volumes only, by utilizing a novel loss function adapted to the given context. Such a network allows learning meaningful representations which, coupled with voxel-level oc-SVM classifiers, discriminate various brain abnormalities and can be applied to detect subtle pathologies in general. From the medical application perspective, we attempt to make a step forward in automatically learning representations for epilepsy lesion detection, unlike in the previous studies ([1, 11]). Our approach is not targeted at one specific epilepsy type and thus is more generic and also detects lesions with rather unknown signatures. Moreover, to our knowledge, this is the first study to propose a neural network architecture trained on multiparametric MRI data that can be applied to detect epilepsy lesions.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: Siamese neural network composed of stacked convolutional autoencoders as sub-networks. The input consists of a pair of patches of 2 different subjects centered at the same spatial localization in the brain. The middle-layer representation is denoted by $g ( x )$ .
|
| 27 |
+
|
| 28 |
+
# 2 Method
|
| 29 |
+
|
| 30 |
+
In this study we propose to use a siamese network to learn patch-level representations in the context of outlier detection. Such an approach is applicable in cases where pathological samples are not available or their number is insufficient to adequately represent the nature of the pathology and hence, supervised learning is not possible.
|
| 31 |
+
|
| 32 |
+
The motivation behind the architecture choice is the following. Our objective is to map the original patches to a space where the patches belonging to different subjects but centered at the same spatial localization are "close" with respect to a chosen metric. We could consider the patches centered at the same voxel as representatives of the same class (hence, "similar" patches). In this case the number of classes would be equal to the number of voxels in a brain volume (around 4 millions) but the number of samples per class would be equal to the number of subjects. The siamese networks have proved to be efficient in similar scenarios [15, 16] where the number of classes is largely greater than the number of samples per class.
|
| 33 |
+
|
| 34 |
+
# 2.1 Regularized siamese neural network for representation learning
|
| 35 |
+
|
| 36 |
+
# 2.1.1 Architecture
|
| 37 |
+
|
| 38 |
+
The proposed architecture is illustrated on figure 1. Our regularized siamese neural network (rSNN) consists of two identical (same architecture, shared parameters) subnetworks - stacked convolutional autoencoders (sCAE) with $K$ hidden layers and a cost module. The input $\mathbf { x }$ of a SCAE is first encoded to a middle-layer representation by a series of convolutional and max-pooling operations and later decoded with a series of deconvolutions and up-poolings to produce a reconstruction $\hat { \bf x }$ of the input. A convolutional layer $l$ is composed of $N _ { l }$ kernels and biases and can be expressed as
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\mathbf { H } _ { l } ^ { m } = f ( \mathbf { W } _ { l - 1 } ^ { m } * \mathbf { H } _ { l - 1 } + b _ { l - 1 } ^ { m } )
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\mathbf { H } _ { l } ^ { m }$ is the $m$ -th feature map of the convolutional layer $l$ , $\mathbf { W } _ { l } ^ { m }$ is the kernel matrix associated with $\mathbf { H } _ { l } ^ { m }$ and $b _ { l } ^ { m }$ is its bias, $f$ is an activation function (usually non-linear). $^ *$ denotes the convolution operation. The parameters are iteratively updated to optimize a loss function that measures the deviation between the output $\hat { \bf x }$ and the input $\mathbf { x }$ .
|
| 45 |
+
|
| 46 |
+
The siamese network receives a pair of patches $\left( \mathbf { x _ { 1 } } , \mathbf { x _ { 2 } } \right)$ at input, then each patch is propagated through the corresponding subnetwork yielding representations $g ( \mathbf { x _ { t } } ) , t \ = \ ( 1 , 2 )$ in the middle layer which are then passed to the loss function $L$ below. It is important to mention that, unlike in the classical siamese frameworks where the network also receives a binary label that stands for the similarity/dissimilarity of the pair, in our application all the considered pairs are ’similar’ and therefore the label is not present in the loss function. The loss function, however, can be easily modified to meet the general setting.
|
| 47 |
+
|
| 48 |
+
# 2.1.2 Loss function
|
| 49 |
+
|
| 50 |
+
Our loss function is designed to maximize the cosine similarity between $g ( \mathbf { x _ { 1 } } )$ and $g ( \mathbf { x _ { 2 } } )$ . In the absence of dissimilar pairs (the notion of dissimilar patches is not defined in our context), it is necessary to add a regularizing term. To this end, we propose to use the mean squared error between the input patches and their reconstructions output by the subnetworks. Without a proper regularization term, the loss function could be driven to 0 by mapping all the patches to a constant value. The proposed loss function for a single pair hence is:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
L ( \mathbf { x _ { 1 } } , \mathbf { x _ { 2 } } ; \Theta ) = \sum _ { t = 1 } ^ { 2 } | | \mathbf { x _ { t } } - { \hat { \mathbf { x _ { t } } } } | | _ { 2 } ^ { 2 } - \alpha c o s ( g ( \mathbf { x _ { 1 } } ) , g ( \mathbf { x _ { 2 } } ) )
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
where $\hat { \mathbf { x } } _ { \mathbf { t } }$ is the reconstructed output of subnetwork $t$ of the patch $\mathbf { x _ { t } }$ while $g ( \mathbf { x _ { t } } )$ is its (vectorized) representation in the middle layer and $\alpha$ is a coefficient that controls the tradeoff between the two terms. $\Theta$ represents the parameter set.
|
| 57 |
+
|
| 58 |
+
# 2.2 Voxel-level outlier detection with oc-SVM classifiers
|
| 59 |
+
|
| 60 |
+
A oc-SVM classifier [17] is an outlier detection method that seeks to find the optimal hyperplane that separates the given points from the origin in a dot product space defined by some kernel function $\phi$ . The corresponding optimization problem is the following:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { l } { \displaystyle \underset { \mathbf { w } , \rho , \xi _ { i } } { \operatorname* { m i n } } \quad \displaystyle \frac { 1 } { 2 } | | \mathbf { w } | | ^ { 2 } - \rho + \frac { 1 } { \nu \mathrm { n } } \sum _ { \mathrm { i } = 1 } ^ { \mathrm { n } } \xi _ { \mathrm { i } } } \\ { \displaystyle \mathrm { s u b j e c t ~ t o } \quad \mathbf { w } \cdot \phi ( \mathbf { x _ { i } } ) \geq \rho - \xi _ { \mathrm { i } } , \xi _ { \mathrm { i } } \geq 0 , \mathrm { i } \in [ 1 , \mathrm { n } ] } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $n$ is the number of training examples, $\mathbf { x _ { i } }$ is the $i$ -th example in the training dataset $X$ , $\xi _ { i }$ -s are slack variables relaxing the inequality constraints as to account for the non-separable classes, w and $\rho$ define the separating hyperplane, $\nu$ is a parameter that sets a boundary to the fraction of outliers allowed. The decision function, then, for an example $\mathbf { x }$ is ${ \bf w } \cdot \phi ( { \bf x } ) - \dot { \rho }$ . This decision function contributes to the signed score output by a oc-SVM model (in a typical scenario examples with negatives scores would be considered outliers).
|
| 67 |
+
|
| 68 |
+
To validate the usefulness of the features learnt by the proposed method, we use the representations in the middle layer of the subnetworks $( g ( \mathbf { x } ) )$ to train oc-SVM classifiers at voxel level. Each voxel is associated with a classifier, hence the number of classifiers is equal to the number of voxels in a volume (around 4 million voxels). For a given voxel $v _ { i }$ , the associated oc-SVM classifier $C _ { i }$ is trained on the matrix $M _ { i } = [ \bf { x _ { i 1 } } , . . . , \bf { x _ { i n } } ]$ where $\mathbf { x _ { i j } }$ is the feature vector corresponding to the patch centered at $v _ { i }$ of subject $j$ and $n$ is the number of subjects.
|
| 69 |
+
|
| 70 |
+
For a new patient, each voxel $v _ { i }$ is matched against the corresponding classifier $C _ { i }$ and is assigned the signed score output by the classifier. This yields a distance map $D _ { p }$ for the given patient.
|
| 71 |
+
|
| 72 |
+
# 2.3 Post-processing
|
| 73 |
+
|
| 74 |
+
For a given patient, the output of the previous step - the distance map $D _ { p }$ - is then post-processed to obtain the final detections. A 3-step post-processing is proposed as follows.
|
| 75 |
+
|
| 76 |
+
The first step consists in normalizing the distance maps with respect to the intra-subject spatial variability. For that purpose, the distance maps of the control subjects are computed by performing a $k$ -fold evaluation of the controls in the training set (i.e. for each fold of normal subjects, the distance maps are obtained with oc-SVMs trained on the remaining subjects). These maps are used to estimate the standard deviation of the normal subjects’ distance distribution at voxel-level. For a given patient $p$ , a new map $\acute { D } _ { p }$ is computed by a voxel-wise division of the output distance map $D _ { p }$ over the estimated standard deviations. The final distance map $F _ { p }$ is then derived by averaging $D _ { p }$ and $\acute { D } _ { p }$ i.e. $\begin{array} { r } { F _ { p } = \frac { 1 } { 2 } ( \frac { D _ { p } } { m a x ( a b s ( D _ { p } ) ) } + \frac { \dot { D } _ { p } } { m a x ( a b s ( \dot { D } _ { p } ) } ) ) } \end{array}$ . The reason behind the additional term is that some zones in the brain have more intra-subject variability than others and therefore are more likely to be considered as anomalies. By weighing them by the standard deviation, the score maps account for this effect. The second step consists in thresholding the $F _ { p }$ map to produce a cluster map. We keep the most negative scores up to the score corresponding to a pre-chosen $p$ -value in the patient’s distance score distribution and apply a 26-connectivity rule to identify connected components which we refer to as clusters. The voxel clusters smaller than a fixed size (here, 82 voxels corresponding to the expected cluster size calculated with the SPM analysis of the T1 MRI data) are discarded. This allows quick elimination of small and very negative clusters which usually represent isolated intensity peaks (the size of the majority of the detected clusters varies between 500 and 1500, this threshold therefore does not affect the performance in any significant way). The clusters are what we refer to as detections by the proposed method. By varying the $p$ -value the number of clusters can be controlled according to a clinician’s needs.
|
| 77 |
+
|
| 78 |
+
The third step consists in ranking the detected clusters to help the analysis of the detections. For each patient individually, a $p$ -value is found that produces at most 15 clusters. Among those, we use the following ranking criterion to assign a rank to a cluster $c _ { i }$
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
r a n k ( \mathbf { c _ { i } } ) \sim \lambda * \frac { s c o r e ( \mathbf { c _ { i } } ) } { m i n _ { j } s c o r e ( \mathbf { c _ { j } } ) } + ( 1 - \lambda ) * \frac { s i z e ( \mathbf { c _ { i } } ) } { m a x _ { j } s i z e ( \mathbf { c _ { j } } ) }
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $s c o r e ( c _ { i } )$ is the average of the voxel scores in the cluster and $s i z e ( c _ { i } )$ is the number of voxels in the cluster. Such a ranking favors large clusters with the most negative average score. Using this ranking, we keep the top $n$ detections and discard the rest. When there is a significant overlap between a detected cluster and the ground truth for a given patient, we consider the cluster a true positive and false positive otherwise.
|
| 85 |
+
|
| 86 |
+
# 3 Experiments and results
|
| 87 |
+
|
| 88 |
+
# 3.1 Dataset description and pre-processing
|
| 89 |
+
|
| 90 |
+
The study was approved by our institutional review board with approval numbers 2012-A00516-37 and 2014-019 B and a written consent was obtained for all participants.
|
| 91 |
+
|
| 92 |
+
Our database consists of multiparametric (T1-weighted and FLAIR) MR images of 75 healthy subjects and 21 patients. They all had a 3D anatomical T1-weighted brain MRI (TR/TE 2400/3.55; 160 sagittal slices of $1 9 2 \mathrm { ~ x ~ } 1 9 2 \ 1 . 2 \mathrm { m m }$ cubic voxels) and FLAIR (176 sagittal slices of $1 9 6 \times 2 5 6 ~ 1 . 2 \mathrm { m m }$ cubic voxels) on a $1 . 5 \mathrm { T }$ Sonata scanner (Siemens Healthcare, Erlangen, Germany). All the volumes were normalized to the standard brain template of the Montreal Neurological Institute (MNI) [18] using a voxel size of $1 \mathrm { ~ x ~ } 1 \mathrm { ~ x ~ } 1 \mathrm { ~ m m }$ . This processing was performed using the unified segmentation algorithm [19] implemented in SPM12 also correcting for magnetic field inhomogeneities. This spatial normalisation assures a voxel-level correspondence between the subjects. We removed top $1 \%$ intensities and scaled the images between 0 and 1 at image level before feeding the patches to the rSNN.
|
| 93 |
+
|
| 94 |
+
The method has been validated on 21 patients admitted to our clinical center with confirmed medically intractable epileptogenic lesions: 2 of them were visually detected on the patient FLAIR images (but not on T1w images) and only 1 lesion was identified on both T1w and FLAIR scans. The remaining 18 patients are confirmed MR negative patients. The MR negative patients had undertaken surgeries and have been seizure-free since. The ground truth annotations used in the performance evaluation were obtained by outlining the visible zones of the MR positive patients and by combining the information of post-surgical MR images and the resected zones for MR negative patients.
|
| 95 |
+
|
| 96 |
+
# 3.2 Feature extraction with SNN
|
| 97 |
+
|
| 98 |
+
The proposed rSNN consists of two identical subnetworks - stacked convolutional autoencoders with the architecture as in fig. 2. In the mono-modal scenario, they both receive at input $1 5 \mathrm { x } 1 5$ patches extracted from all the available healthy subjects’ volumes of the corresponding modality (T1w or FLAIR) with a stride of 8. In the multi-modal scenario, the input consists of the patches of each modality joint as channels. For each of the patches, a random ’similar pair’ is found among the other subjects yielding in total around 3.5 million pairs. The $\alpha$ parameter in the loss 1 is set to 0 during the first 10 epochs, then grows linearly for 15 epochs until it reaches 0.5 and then plateaus for 5 more epochs. We used ReLU activation function in all the layers except the last one where the sigmoid is used (the input patches are scaled between 0 and 1). The Adam optimizer was used with the learning rate set to 0.001 (the rest of the parameters remained at their default value as implemented in Theano). The architecture itself is not arbitrary. The size of the patches at input was chosen after a number of tested configurations and is justified by the subtle nature of epilepsy lesions. Indeed, larger patch sizes were not successful at detecting subtle lesions. Since the middle-layer representations are used to build oc-SVM models per voxel where the number of samples per model is equal to the number of subjects, having large representation vectors would not be beneficial. As shown on figure 2 the middle layer has 16 feature maps of $2 \mathbf { x } 2$ which, when flattened, yields a 64-dimensional vector.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 2: rSNN subnetwork architecture for epilepsy lesion detection. $C$ and $D C$ denote convolutional and deconvolutional layers respectively, $M P$ and $U P$ denote Maxpooling and Uppooling. The C and DC layers are denoted with the number of features maps (e.g. 16 for the first C layer) and the kernel size in parenthesis (e.g. 3x3 for the first C layer). With this configuration, the middle-layer is composed of 16 feature maps of size $2 \mathbf { x } 2$ which yields a 64-dimensional representation vector $g ( \mathbf { x } )$ when flattened.
|
| 102 |
+
|
| 103 |
+
# 3.3 oc-SVM classifier design
|
| 104 |
+
|
| 105 |
+
We used oc-SVM classifiers with RBF kernel which gives us two parameters to tune - $\nu$ (upper bound on the fraction of permitted outliers) and $\gamma$ (the kernel parameter). Varying the parameter $\nu$ did not significantly impact the results; the fraction of the outliers is controlled in the post-processing step by the threshold value applied on the distance map. It was set to 0.03 for all the voxels. The $\gamma$ parameter was derived for each voxel $v _ { i }$ individually by estimating the median of the standardized euclidean pairwise distances of the corresponding matrix $M _ { i }$ (see section 2.2) as in [20].
|
| 106 |
+
|
| 107 |
+
# 3.4 Results
|
| 108 |
+
|
| 109 |
+
Below we evaluate the performance of the system on 21 patients with confirmed epilepsy lesions. We first demonstrate the advantage of the multi-modal approach versus mono-modal approaches. Fig. 3 shows the true detection rates among the top $n$ clusters for 3 scenarios - voxel-level outlier detection with T1w-only, FLAIR-only and T1w/FLAIR-trained features, for 3 values of $\lambda$ of expression 3, the trade-off coefficient between the cluster size and average score. It clearly demonstrates that features learnt on the combination of multimodality data outperform the individual modalities. Moreover, the figure shows that ranking the clusters by both their average score and size has an advantage over the individual criteria. With this ranking approach, the multimodal model achieves $62 \%$ of true detections among the top 10 clusters. [11] reports a detection rate of $70 \%$ when individual SBM-based features are used; the results vary between 60 and $70 \%$ when considering combinations of some of these SBM features. 2 of the 3 MR positive lesions were detected among the top 2 clusters. This result is expected considering that visually detected lesions have visible markers that allow to distinguish them easily unlike the MR negative patients whose lesions may be detected along with other outliers of similar ’suspiciousness’.
|
| 110 |
+
|
| 111 |
+
We have also compared the global results of our CAD system to the results obtained with a general linear model (GLM) learned on feature maps derived from T1w images using three settings - 1. junction contrast, 2.extension contrast and 3. the conjunction of both contrasts - for a $p$ -value of 0.001 as done in [1]. These features model the junction between gray and white matters as described in [13, 14]. For a fair comparison, the same clustering and ranking procedures (as described in section 2.3) were applied and only the top 10 clusters were considered. The results are summarized in table 1. While extension contrast detects one additional lesion compared with our mono-modal T1-based approach, the combination of junction and extension contrasts does not achieve our best performance with T1w/FLAIR model. We should also note that without applying the ranking method the original SPM implementation produces much more false positive detections without any significant change in the true positive rate.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: The performance of the CAD system. $\mathbf { X }$ -axis: Top $n$ clusters, y-axis: Detection rate among the top $n$ clusters. From left to right: $\lambda = 1$ (score-only), $\lambda = 0 . 5$ (score and size average) and $\lambda = 0$ (size-only) ranking criteria.
|
| 115 |
+
|
| 116 |
+
Table 1: Our system versus GLM model on T1w MRI as implemented in SPM software. First column: the true positive rate; the number of detected patients / total number of patients in parenthesis. Second column: the true positive rate calculated on MRI negative patients only. Third column: the average number of false positive detections per patient.
|
| 117 |
+
|
| 118 |
+
<table><tr><td></td><td>True positive rate</td><td>True positive rate on MR negative patients</td><td>Average # of false positives</td></tr><tr><td>rSNN +oc-SVMon T1 (ranked, top 10)</td><td>0.38 (8/21)</td><td>0.38 (7/18)</td><td>9</td></tr><tr><td>rSNN + oc-SVM on FLAIR (ranked,top 10)</td><td>0.52 (11/21)</td><td>0.5 (9/18)</td><td>9</td></tr><tr><td>rSNN + oc-SVMon T1/FLAIR (ranked,top 10)</td><td>0.62 (13/21)</td><td>0.61 (11/18)</td><td>9</td></tr><tr><td>SPMJunction on T1 (ranked,top 10)</td><td>0.28 (6/21)</td><td>0.27 (5/18)</td><td>9</td></tr><tr><td>SPM Extension on T1 (ranked,top 10)</td><td>0.43 (9/21)</td><td>0.44 (8/18)</td><td>9</td></tr><tr><td>SPM Junction-Extension on T1 (ranked, top 10)</td><td>0.24 (5/21)</td><td>0.22 (4/18)</td><td>9</td></tr></table>
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 4: CAD system output for patients $A ^ { + }$ , $B ^ { - }$ and $C ^ { - }$ respectively ( $^ +$ stands for MR positive patients, − for MR negative patients). Top row: Transverse slices centered at the lesion locations (highlighted in red circles). Bottom row: Maximum intensity projections (MIP) of the cluster maps overlaid on the MRI transverse slices. The maps show the top 1, top 6 and top 3 clusters, respectively.
|
| 122 |
+
|
| 123 |
+
# 4 Discussion
|
| 124 |
+
|
| 125 |
+
This study presents a novel method to learn representations that can be used in the task of anomaly detection on brain images. We have formulated a regularized siamese network architecture that learns normal brain representations using a set of non-pathological MR volumes. The features learnt with the network do not target specific pathology but rather allow to capture normal variability from a cohort of healthy subjects. The framework allows integrating multiple modalities and we have shown the performance gain obtained by coupling T1w and FLAIR imaging for the task of detecting subtle epilepsy lesions in MRI negative patients. To our knowledge, this is the first attempt to use deep learning for epilepsy lesion detection.
|
| 126 |
+
|
| 127 |
+
Most current studies target a specific type of the pathology, referred to as focal cortical dysplasia (FCD), mainly resulting from a malformation of cortical development and leading to drug-resistant epilepsy lesions. Some of these studies use manually designed features characterizing cortical malformations based on surface based morphometry (SBM) [9, 11, 12]. Others associate these morphometric features to the intensity anomalies in T1w MRI mainly caused by heterotopy lesions [1, 8]. Our method seeks to find more complex features in an unsupervised manner in order to identify lesions with unknown signatures. Naturally, such an approach, when applied to a specific pathology, is likely to produce more false positive detections. Although a fair comparison with published results is difficult because of the differences in the patient groups, results reported in table 1 ( $6 2 \%$ sensitivity for 9 false positives per scan) are of the same order as those reported in recent studies for the difficult task of automated detection in MRI-negative patients. Indeed, the system proposed in [11] based on SBM features coupled with semi-supervised hierarchical conditional random fields achieves $70 \%$ sensitivity on a sample of $2 0 \mathrm { T } 1$ weighted MRI negative patients among the top 10 detections per scan. In [1], a CAD system based on morphometric and intensity features coupled with a oc-SVM classifier allows achieving the same $70 \%$ sensitivity with an average of 4 false positives per scan when evaluated on a small cohort of 8 T1w MRI negative patients.
|
| 128 |
+
|
| 129 |
+
There are different options to improve the diagnostic performance of the proposed system. First, some pathology-specific information could be introduced in the post-processing step, by discarding some of the detected clusters based on shape and/or localization criteria. In the majority of the cases, as shown in figure 4, most of the detected false positive clusters are indeed irregularities that can be easily removed by a trained radiologist. An alternative option is to move towards a semi-supervised setting by enhancing the neural network with a few ’pathological’ patches that could be extracted from MRI positive cases or after a careful analysis of retrospective MRI negative patients, following, for instance, some ideas recently proposed in [21]. More improvement could be achieved by accounting for the complementary information provided by different imaging modalities. T1 and FLAIR modalities, introduced as channels to our network, allowed a significant diagnostic performance gain as shown on figure 3. We expect a further performance gain by exploiting PET imaging as recently demonstrated in [22].
|
| 130 |
+
|
| 131 |
+
Finally, the proposed method is quite straightforward to implement and to apply in daily practice as the output of the system can be obtained under a couple of minutes.
|
| 132 |
+
|
| 133 |
+
# 5 Acknowledgements
|
| 134 |
+
|
| 135 |
+
This work was performed within the framework of the LABEX PRIMES (ANR-11-LABX-0063) of Université de Lyon, within the program "Investissements d’Avenir" (ANR-11-IDEX-0007) operated by the French National Research Agency (ANR). The authors sincerely thank Valentin Hoang for his valuable contribution to the SPM analysis.
|
| 136 |
+
|
| 137 |
+
# References
|
| 138 |
+
|
| 139 |
+
[1] M. El Azami, A. Hammers, J. Jung, N. Costes, R. Bouet, and C. Lartizien, “Detection of lesions underlying intractable epilepsy on t1-weighted mri as an outlier detection problem,” PloS one, vol. 11, no. 9, p. e0161498, 2016.
|
| 140 |
+
[2] P. Moeskops, M. A. Viergever, A. M. Mendrik, L. S. de Vries, M. J. Benders, and I. Išgum, “Automatic segmentation of mr brain images with a convolutional neural network,” IEEE transactions on medical imaging, vol. 35, no. 5, pp. 1252–1261, 2016.
|
| 141 |
+
[3] K. Kamnitsas, C. Ledig, V. F. Newcombe, J. P. Simpson, A. D. Kane, D. K. Menon, D. Rueckert, and B. Glocker, “Efficient multi-scale 3d cnn with fully connected crf for accurate brain lesion segmentation,” Medical Image Analysis, vol. 36, pp. 61 – 78, 2017.
|
| 142 |
+
[4] M. Ghafoorian, N. Karssemeijer, T. Heskes, M. Bergkamp, J. Wissink, J. Obels, K. Keizer, F.-E. de Leeuw, B. van Ginneken, E. Marchiori, and B. Platel, “Deep multi-scale location-aware 3d convolutional neural networks for automated detection of lacunes of presumed vascular origin,” Neuroimage, vol. 14, pp. 391– 399, 2017.
|
| 143 |
+
[5] Q. Dou, H. Chen, L. Yu, L. Zhao, J. Qin, D. Wang, V. Mok, L. Shi, and P.-A. Heng, “Automatic detection of cerebral microbleeds from mr images via 3d convolutional neural networks.,” IEEE transactions on medical imaging, vol. 35, no. 5, pp. 1182–1195, 2016.
|
| 144 |
+
[6] C. Baur, S. Albarqouni, and N. Navab, “Semi-supervised deep learning for fully convolutional networks,” in Medical Image Computing and Computer-Assisted Intervention (MICCAI 2017) (M. Descoteaux, L. Maier-Hein, A. Franz, P. Jannin, D. L. Collins, and S. Duchesne, eds.), (Cham), pp. 311–319, Springer International Publishing, 2017.
|
| 145 |
+
[7] F. Dubost, G. Bortsova, H. Adams, A. Ikram, W. J. Niessen, M. Vernooij, and M. De Bruijne, “Gp-unet: Lesion detection from weak labels with a 3d regression network,” in Medical Image Computing and Computer Assisted Intervention (MICCAI 2017) (M. Descoteaux, L. Maier-Hein, A. Franz, P. Jannin, D. L. Collins, and S. Duchesne, eds.), (Cham), pp. 214–221, Springer International Publishing, 2017.
|
| 146 |
+
[8] R. S. Gill, S.-J. Hong, F. Fadaie, B. Caldairou, B. Bernhardt, N. Bernasconi, and A. Bernasconi, “Automated detection of epileptogenic cortical malformations using multimodal mri,” in Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support, pp. 349–356, Springer, 2017.
|
| 147 |
+
[9] S.-J. Hong, H. Kim, D. Schrader, N. Bernasconi, B. C. Bernhardt, and A. Bernasconi, “Automated detection of cortical dysplasia type ii in mri-negative epilepsy,” Neurology, vol. 83, no. 1, pp. 48–55, 2014.
|
| 148 |
+
[10] B. Ahmed, C. E. Brodley, K. E. Blackmon, R. Kuzniecky, G. Barash, C. Carlson, B. T. Quinn, W. K. Doyle, J. French, O. Devinsky, and T. Thesen, “Cortical feature analysis and machine learning improves detection of "mri-negative" focal cortical dysplasia.,” Epilepsy and behavior, vol. 48, pp. 21–8, 2015.
|
| 149 |
+
[11] B. Ahmed, T. Thesen, K. E. Blackmon, R. Kuzniekcy, O. Devinsky, and C. E. Brodley, “Decrypting "cryptogenic" epilepsy: Semi-supervised hierarchical conditional random fields for detecting cortical lesions in mri-negative patients,” Journal of Machine Learning Research, vol. 17, no. 112, pp. 1–30, 2016.
|
| 150 |
+
[12] T. Thesen, B. T. Quinn, C. Carlson, O. Devinsky, J. DuBois, C. R. McDonald, J. French, R. Leventer, O. Felsovalyi, X. Wang, et al., “Detection of epileptogenic cortical malformations with surface-based mri morphometry,” PloS one, vol. 6, no. 2, p. e16430, 2011.
|
| 151 |
+
[13] H.-J. Huppertz, C. Grimm, S. Fauser, J. Kassubek, I. Mader, A. Hochmuth, J. Spreer, and A. SchulzeBonhage, “Enhanced visualization of blurred gray–white matter junctions in focal cortical dysplasia by voxel-based 3d mri analysis,” Epilepsy research, vol. 67, no. 1-2, pp. 35–50, 2005.
|
| 152 |
+
[14] J. Wagner, B. Weber, H. Urbach, C. E. Elger, and H.-J. Huppertz, “Morphometric mri analysis improves detection of focal cortical dysplasia type ii,” Brain, vol. 134, no. 10, pp. 2844–2854, 2011.
|
| 153 |
+
[15] J. Bromley, J. W. Bentz, L. Bottou, I. Guyon, Y. LeCun, C. Moore, E. Säckinger, and R. Shah, “Signature verification using a "siamese" time delay neural network,” IJPRAI, vol. 7, no. 4, pp. 669–688, 1993.
|
| 154 |
+
[16] S. Chopra, R. Hadsell, and Y. LeCun, “Learning a similarity metric discriminatively, with application to face verification,” in Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, vol. 1, pp. 539–546, IEEE, 2005.
|
| 155 |
+
[17] B. Schölkopf, J. C. Platt, J. Shawe-Taylor, A. J. Smola, and R. C. Williamson, “Estimating the support of a high-dimensional distribution,” Neural computation, vol. 13, no. 7, pp. 1443–1471, 2001.
|
| 156 |
+
[18] J. Mazziotta, A. Toga, A. Evans, P. Fox, J. Lancaster, K. Zilles, R. Woods, T. Paus, G. Simpson, B. Pike, et al., “A probabilistic atlas and reference system for the human brain: International consortium for brain mapping (icbm),” Philosophical Transactions of the Royal Society of London B: Biological Sciences, vol. 356, no. 1412, pp. 1293–1322, 2001.
|
| 157 |
+
[19] J. Ashburner and K. Friston, “Unified segmentation,” Neuroimage, vol. 26, pp. 839–851, 2005.
|
| 158 |
+
[20] B. Caputo, K. Sim, F. Furesjo, and A. Smola, “Appearance-based object recognition using svms: which kernel should i use?,” in Proc of NIPS workshop on Statistical methods for computational experiments in visual processing and computer vision, Whistler, vol. 2002, 2002.
|
| 159 |
+
[21] M. P. Shah, S. N. Merchant, and S. P. Awate, “Abnormality detection using deep neural networks with robust quasi-norm autoencoding and semi-supervised learning,” in IEEE International Symposium on Biomedical Imaging (ISBI 2018), pp. 568–572.
|
| 160 |
+
[22] Y. L. Tan, H. Kim, S. Lee, T. Tihan, L. Ver Hoef, S. G. Mueller, A. J. Barkovich, D. Xu, and R. Knowlton, “Quantitative surface analysis of combined mri and pet enhances detection of focal cortical dysplasias.,” Neuroimage, vol. 166, pp. 10–18, 2018.
|
md/train/rk5upnsxe/rk5upnsxe.md
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NORMALIZING THE NORMALIZERS: COMPARING AND EXTENDING NETWORK NORMALIZATION SCHEMES
|
| 2 |
+
|
| 3 |
+
Mengye $\mathbf { R e n } ^ { * \dagger }$ , Renjie Liao∗†, Raquel Urtasun†, Fabian H. $\mathbf { S i n z ^ { \ddagger } }$ , Richard S. Zemel†> †University of Toronto, Toronto ON, CANADA ‡Baylor College of Medicine, Houston TX, USA >Canadian Institute for Advanced Research (CIFAR) {mren, rjliao, urtasun}@cs.toronto.edu fabian.sinz@epagoge.de, zemel@cs.toronto.edu
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Normalization techniques have only recently begun to be exploited in supervised learning tasks. Batch normalization exploits mini-batch statistics to normalize the activations. This was shown to speed up training and result in better models. However its success has been very limited when dealing with recurrent neural networks. On the other hand, layer normalization normalizes the activations across all activities within a layer. This was shown to work well in the recurrent setting. In this paper we propose a unified view of normalization techniques, as forms of divisive normalization, which includes layer and batch normalization as special cases. Our second contribution is the finding that a small modification to these normalization schemes, in conjunction with a sparse regularizer on the activations, leads to significant benefits over standard normalization techniques. We demonstrate the effectiveness of our unified divisive normalization framework in the context of convolutional neural nets and recurrent neural networks, showing improvements over baselines in image classification, language modeling as well as super-resolution.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Standard deep neural networks are difficult to train. Even with non-saturating activation functions such as ReLUs (Krizhevsky et al., 2012), gradient vanishing or explosion can still occur, since the Jacobian gets multiplied by the input activation of every layer. In AlexNet (Krizhevsky et al., 2012), for instance, the intermediate activations can differ by several orders of magnitude. Tuning hyperparameters governing weight initialization, learning rates, and various forms of regularization thus become crucial in optimizing performance.
|
| 12 |
+
|
| 13 |
+
In current neural networks, normalization abounds. One technique that has rapidly become a standard is batch normalization (BN) in which the activations are normalized by the mean and standard deviation of the training mini-batch (Ioffe & Szegedy, 2015). At inference time, the activations are normalized by the mean and standard deviation of the full dataset. A more recent variant, layer normalization (LN), utilizes the combined activities of all units within a layer as the normalizer (Ba et al., 2016). Both of these methods have been shown to ameliorate training difficulties caused by poor initialization, and help gradient flow in deeper models.
|
| 14 |
+
|
| 15 |
+
A less-explored form of normalization is divisive normalization (DN) (Heeger, 1992), in which a neuron’s activity is normalized by its neighbors within a layer. This type of normalization is a well established canonical computation of the brain (Carandini & Heeger, 2012) and has been extensively studied in computational neuroscience and natural image modelling (see Section 2). However, with few exceptions (Jarrett et al., 2009; Krizhevsky et al., 2012) it has received little attention in conventional supervised deep learning.
|
| 16 |
+
|
| 17 |
+
Here, we provide a unifying view of the different normalization approaches by characterizing them as the same transformation but along different dimensions of a tensor, including normalization across examples, layers in the network, filters in a layer, or instances of a filter response. We explore the effect of these varieties of normalizations in conjunction with regularization, on the prediction performance compared to baseline models. The paper thus provides the first study of divisive normalization in a range of neural network architectures, including convolutional neural networks (CNNs) and recurrent neural networks (RNNs), and tasks such as image classification, language modeling and image super-resolution. We find that DN can achieve results on par with BN in CNN networks and out-performs it in RNNs and super-resolution, without having to store batch statistics. We show that casting LN as a form of DN by incorporating a smoothing parameter leads to significant gains, in both CNNs and RNNs. We also find advantages in performance and stability by being able to drive learning with higher learning rate in RNNs using DN. Finally, we demonstrate that adding an L1 regularizer on the activations before normalization is beneficial for all forms of normalization.
|
| 18 |
+
|
| 19 |
+
# 2 RELATED WORK
|
| 20 |
+
|
| 21 |
+
In this section we first review related work on normalization, followed by a brief description of regularization in neural networks.
|
| 22 |
+
|
| 23 |
+
# 2.1 NORMALIZATION
|
| 24 |
+
|
| 25 |
+
Normalization of data prior to training has a long history in machine learning. For instance, local contrast normalization used to be a standard effective tool in vision problems (Pinto et al., 2008; Jarrett et al., 2009; Sermanet et al., 2012; Le, 2013). However, until recently, normalization was usually not part of the machine learning algorithm itself. Two notable exceptions are the original AlexNet by Krizhevsky et al. (2012) which includes a divisive normalization step over a subset of features after ReLU at each pixel location, and the work by Jarrett et al. (2009) who demonstrated that a combination of nonlinearities, normalization and pooling improves object recognition in two-stage networks.
|
| 26 |
+
|
| 27 |
+
Recently Ioffe & Szegedy (2015) demonstrated that standardizing the activations of the summed inputs of neurons over training batches can substantially decrease training time in deep neural networks. To avoid covariate shift, where the weight gradients in one layer are highly dependent on previous layer outputs, Batch Normalization (BN) rescales the summed inputs according to their variances under the distribution of the mini-batch data. Specifically, if $z _ { j , n }$ denotes the activation of a neuron $j$ on example $n$ , and $B ( n )$ denotes the mini-batch of examples that contains $n$ , then BN computes an affine function of the activations standardized over each mini-batch:
|
| 28 |
+
|
| 29 |
+
$$
|
| 30 |
+
\tilde { z } _ { n , j } = \gamma \frac { z _ { n , j } - \mathbb { E } [ z _ { j } ] } { \sqrt { \frac { 1 } { | B ( n ) | } ( z _ { n , j } - \mathbb { E } [ z _ { j } ] ) ^ { 2 } } } + \beta \quad \mathbb { E } [ z _ { j } ] = \frac { 1 } { | B ( n ) | } \sum _ { m \in B ( n ) } z _ { m , j }
|
| 31 |
+
$$
|
| 32 |
+
|
| 33 |
+
However, training performance in Batch Normalization strongly depends on the quality of the aquired statistics and, therefore, the size of the mini-batch. Hence, Batch Normalization is harder to apply in cases for which the batch sizes are small, such as online learning or data parallelism. While classification networks can usually employ relatively larger mini-batches, other applications such as image segmentation with convolutional nets use smaller batches and suffer from degraded performance. Moreover, application to recurrent neural networks (RNNs) is not straightforward and leads to poor performance (Laurent et al., 2015).
|
| 34 |
+
|
| 35 |
+
Several approaches have been proposed to make Batch Normalization applicable to RNNs. Cooijmans et al. (2016) and Liao & Poggio (2016) collect separate batch statistics for each time step. However, neither of this techniques address the problem of small batch sizes and it is unclear how to generalize them to unseen time steps.
|
| 36 |
+
|
| 37 |
+
More recently, Ba et al. (2016) proposed Layer Normalization (LN), where the activations are normalized across all summed inputs within a layer instead of within a batch:
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\tilde { z } _ { n , j } = \gamma \frac { z _ { n , j } - \mathbb { E } [ z _ { n } ] } { \sqrt { \frac { 1 } { | L ( j ) | } ( z _ { n , j } - \mathbb { E } [ z _ { n } ] ) ^ { 2 } } } + \beta \quad \mathbb { E } [ z _ { n } ] = \frac { 1 } { | L ( j ) | } \sum _ { k \in L ( j ) } z _ { n , k }
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $L ( j )$ contains all of the units in the same layer as $j$ . While promising results have been shown on RNN benchmarks, direct application of layer normalization to convolutional layers often leads to a degradation of performance. The authors hypothesize that since the statistics in convolutional layers can vary quite a bit spatially, normalization with statistics from an entire layer might be suboptimal.
|
| 44 |
+
|
| 45 |
+
Ulyanov et al. (2016) proposed to normalize each example on spatial dimensions but not on channel dimension, and was shown to be effective on image style transfer applications (Gatys et al., 2016).
|
| 46 |
+
|
| 47 |
+
Liao et al. (2016a) proposed to accumulate the normalization statistics over the entire training phase, and showed that this can speed up training in recurrent and online learning without a deteriorating effect on the performance. Since gradients cannot be backpropagated through this normalization operation, the authors use running statistics of the gradients instead.
|
| 48 |
+
|
| 49 |
+
Exploring the normalization of weights instead of activations, Salimans & Kingma (2016) proposed a reparametrization of the weights into a scale independent representation and demonstrated that this can speed up training time.
|
| 50 |
+
|
| 51 |
+
Divisive Normalization (DN) on the other hand modulates the neural activity by the activity of a pool of neighboring neurons (Heeger, 1992; Bonds, 1989). DN is one of the most well studied and widely found transformations in real neural systems, and thus has been called a canonical computation of the brain (Carandini & Heeger, 2012). While the exact form of the transformation can differ, all formulations model the response of a neuron $\tilde { z } _ { j }$ as a ratio between the acitivity in a summation field $A _ { j }$ , and a norm-like function of the suppression field $B _ { j }$
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\tilde { z } _ { j } = \gamma \frac { \sum _ { z _ { i } \in A _ { j } } u _ { i } z _ { i } } { \left( \sigma ^ { 2 } + \sum _ { z _ { k } \in B _ { j } } w _ { k } z _ { k } ^ { p } \right) ^ { \frac { 1 } { p } } } ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $\{ u _ { i } \}$ are the summation weights and $\{ w _ { k } \}$ the suppression weights.
|
| 58 |
+
|
| 59 |
+
Previous theoretical studies have outlined several potential computational roles for divisive normalization such as sensitivity maximization (Carandini & Heeger, 2012), invariant coding (Olsen et al., 2010), density modelling (Balle et al., 2016), image compression (Malo et al., 2006), distributed ´ neural representations (Simoncelli & Heeger, 1998), stimulus decoding (Ringach, 2009; Froudarakis et al., 2014), winner-take-all mechanisms (Busse et al., 2009), attention (Reynolds & Heeger, 2009), redundancy reduction (Schwartz & Simoncelli, 2001; Sinz & Bethge, 2008; Lyu & Simoncelli, 2008; Sinz & Bethge, 2013), marginalization in neural probabilistic population codes (Beck et al., 2011), and contextual modulations in neural populations and perception (Coen-Cagli et al., 2015; Schwartz et al., 2009).
|
| 60 |
+
|
| 61 |
+
# 2.2 REGULARIZATION
|
| 62 |
+
|
| 63 |
+
Various regularization techniques have been applied to neural networks for the purpose of improving generalization and reduce overfitting. They can be roughly divided into two categories, depending on whether they regularize the weights or the activations.
|
| 64 |
+
|
| 65 |
+
Regularization on Weights: The most common regularizer on weights is weight decay which just amounts to using the L2 norm squared of the weight vector. An L1 regularizer (Goodfellow et al., 2016) on the weights can also be adopted to push the learned weights to become sparse. Scardapane et al. (2016) investigated mixed norms in order to promote group sparsity.
|
| 66 |
+
|
| 67 |
+
Regularization on Activations: Sparsity or group sparsity regularizers on the activations have shown to be effective in the past (Roz, 2008; Kavukcuoglu et al., 2009) and several regularizers have been proposed that act directly on the neural activations. Glorot et al. (2011) add a sparse regularizer on the activations after ReLU to encourage sparse representations. Dropout developed by Srivastava et al. (2014) applies random masks to the activations in order to discourage them to co-adapt. DeCov proposed by Cogswell et al. (2015) tries to minimize the off-diagonal terms of the sample covariance matrix of activations, thus encouraging the activations to be as decorrelated as possible. Liao et al. (2016b) utilize a clustering-based regularizer to encourage the representations to be compact.
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 1: Illustration of different normalization schemes, in a CNN. Each $H \times W$ -sized feature map is depicted as a rectangle; overlays depict instances in the set of $C$ filters; and two examples from a mini-batch of size $N$ are shown, one above the other. The colors show the summation/suppression fields of each scheme.
|
| 71 |
+
|
| 72 |
+
# 3 A UNIFIED FRAMEWORK FOR NORMALIZING NEURAL NETS
|
| 73 |
+
|
| 74 |
+
We first compare the three existing forms of normalization, and show that we can modify batch normalization (BN) and layer normalization (LN) in small ways to make them have a form that matches divisive normalization (DN). We present a general formulation of normalization, where existing normalizations involve alternative schemes of accumulating information. Finally, we propose a regularization term that can be optimized jointly with these normalization schemes to encourage decorrelation and/or improve generalization performance.
|
| 75 |
+
|
| 76 |
+
# 3.1 GENERAL FORM OF NORMALIZATION
|
| 77 |
+
|
| 78 |
+
Without loss of generality, we denote the hidden input activation of one arbitrary layer in a deep neural network as $\mathbf { z } \in \mathbb { R } ^ { \tilde { N } \times L }$ . Here $N$ is the mini-batch size. In the case of a CNN, $L = H \times W \times C$ , where $H , W$ are the height and width of the convolutional feature map and $C$ is the number of filters. For an RNN or fully-connected layers of a neural net, $L$ is the number of hidden units.
|
| 79 |
+
|
| 80 |
+
Different normalization methods gather statistics from different ranges of the tensor and then perform normalization. Consider the following general form:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\begin{array} { l } { \displaystyle z _ { n , j } = \sum _ { i } w _ { i , j } x _ { n , i } + b _ { j } } \\ { \displaystyle v _ { n , j } = z _ { n , j } - \mathbb { E } _ { A _ { n , j } } [ z ] } \\ { \displaystyle \tilde { z } _ { n , j } = \frac { v _ { n , j } } { \sqrt { \sigma ^ { 2 } + \mathbb { E } _ { \mathcal { B } _ { n , j } } [ v ^ { 2 } ] } } } \end{array}
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $A _ { j }$ and $B _ { j }$ are subsets of $z$ and $v$ respectively. $\mathcal { A }$ and $\boldsymbol { B }$ in standard divisive normalization are referred to as summation and suppression fields (Carandini & Heeger, 2012). One can cast each normalization scheme into this general formulation, where the schemes vary based on how they define these two fields. These definitions are specified in Table 1. Optional parameters $\gamma$ and $\beta$ can be added in the form of $\gamma _ { j } \tilde { z } _ { n , j } + \beta _ { j }$ to increase the degree of freedom.
|
| 87 |
+
|
| 88 |
+
Fig. 1 shows a visualization of the normalization field in a 4-D ConvNet tensor setting. Divisive normalization happens within a local spatial window of neurons across filter channels. Here we set $d ( \cdot , \cdot )$ to be the spatial $L _ { \infty }$ distance.
|
| 89 |
+
|
| 90 |
+
# 3.2 NEW MODEL COMPONENTS
|
| 91 |
+
|
| 92 |
+
Smoothing the Normalizers: One obvious way in which the normalization schemes differ is in terms of the information that they combine for normalizing the activations. A second more subtle but important difference between standard BN and LN as opposed to DN is the smoothing term $\sigma$ in the denominator of Eq. (1). This term allows some control of the bias of the variance estimation, effectively smoothing the estimate. This is beneficial because divisive normalization does not utilize information from the mini-batch as in BN, and combines information from a smaller field than LN. A similar but different denominator bias term $\operatorname* { m a x } ( \sigma , c )$ appears in (Jarrett et al., 2009), which is active when the activation variance is small. However, the clipping function makes the transformation not invertible, losing scale information.
|
| 93 |
+
|
| 94 |
+
<table><tr><td>Model</td><td>Range</td><td>Normalizer Bias</td></tr><tr><td>BN</td><td>An,j ={2m,j : m ∈[1,N],j ∈[1,H] × [1,W]} Bn,j = {Um,j : m ∈ [1,N],j ∈[1,H] ×[1,W]}</td><td>g=0</td></tr><tr><td>LN</td><td>An,j ={zn,i :i ∈[1,L]} Bn,j={Un,i : i∈[1,L]}</td><td>σ=0</td></tr><tr><td>DN</td><td>An,j ={2n,i : d(i,j)≤RA} Bn,j = {Un,i : d(i,j)≤RB}</td><td>q≥0</td></tr></table>
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Table 1: Different choices of the summation and suppression fields $\mathcal { A }$ and $\boldsymbol { B }$ , as well as the constant $\sigma$ in the normalizer lead to known normalization schemes in neural networks. $d ( i , j )$ denotes an arbitrary distance between two hidden units $_ { i }$ and $j$ , and $R$ denotes the neighbourhood radius.
|
| 98 |
+
Figure 2: Divisive normalization followed by ReLU can be viewed as a new activation function. Left: Effect of varying $\sigma$ in this activation function. Right: Two units affect each other’s activation in the $\mathrm { D N + }$ ReLU formulation.
|
| 99 |
+
|
| 100 |
+
Moreover, if we take the nonlinear activation function after normalization into consideration, we find that $\sigma$ will change the overall properties of the non-linearity. To illustrate this effect, we use a simple 1-layer network which consists of: two input units, one divisive normalization operator, followed by a ReLU activation function. If we fix one input unit to be 0.5, varying the other one with different values of $\sigma$ produces different output curves (Fig. 2, left). These curves exhibit different non-linear properties compared to the standard ReLU. Allowing the other input unit to vary as well results in different activation functions of the first unit depending on the activity of the second (Fig. 2, right). This illustrates potential benefits of including this smoothing term $\sigma$ , as it effectively modulates the rectified response to vary from a linear to a highly saturated response.
|
| 101 |
+
|
| 102 |
+
In this paper we propose modifications of the standard BN and LN which borrow this additive term $\sigma$ in the denominator from DN. We study the effect of incorporating this smoother in the respective normalization schemes below.
|
| 103 |
+
|
| 104 |
+
L1 regularizer: Filter responses on lower layers in deep neural networks can be quite correlated which might impair the estimate of the variance in the normalizer. More independent representations help disentangle latent factors and boost the networks performance (Higgins et al., 2016). Empirically, we found that putting a sparse (L1) regularizer
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\mathcal { L } _ { L 1 } = \alpha \frac { 1 } { N L } \sum _ { n , j } | v _ { n , j } |
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
on the centered activations $v _ { n , j }$ helps decorrelate the filter responses (Fig. 5). Here, $N$ is the batch size and $L$ is the number of hidden units, and $\mathcal { L } _ { L 1 }$ is the regularization loss which is added to the training loss.
|
| 111 |
+
|
| 112 |
+
A possible explanation for this effect is that the L1 regularizer might have a similar effect as maximum likelihood estimation of an independent Laplace distribution. To see that, let $p _ { v } \left( \mathbf { v } \right) \propto \exp \left( - \left\| \mathbf { v } \right\| _ { 1 } \right)$ and $\mathbf { x } = W ^ { - 1 } \mathbf { v }$ , with $W$ a full rank invertible matrix. Under this model $p _ { x } \left( \mathbf { x } \right) = p _ { v } \left( W \mathbf { x } \right) \left| \operatorname* { d e t } W \right|$ .
|
| 113 |
+
|
| 114 |
+
Then, minimization of the L1 norm of the activations under the volume-conserving constraint det $A =$ const. corresponds to maximum likelihood on that model, which would encourage decorrelated responses. We do not enforce such a constraint, and the filter matrix might even not be invertible. However, the supervised loss function of the network benefits from having diverse non-zero filters. This encourages the network to not collapse filters along the same direction or put them to zero, and might act as a relaxation of the volume-conserving constraint.
|
| 115 |
+
|
| 116 |
+
# 3.3 SUMMARY OF NEW MODELS
|
| 117 |
+
|
| 118 |
+
DN and $\mathbf { D } \mathbf { N } ^ { * }$ : We propose DN as a new local normalization scheme in neural networks. In convolutional layers, it operates on a local spatial window across filter channels, and in fully connected layers it operates on a slice of a hidden state vector. Additionally, $\mathrm { D N ^ { * } }$ has a L1 regularizer on the pre-normalization centered activation $( v _ { n , j } )$ .
|
| 119 |
+
|
| 120 |
+
BN-s and $\mathbf { B N } ^ { * }$ : To compare with DN and $\mathrm { D N ^ { * } }$ , we also propose modifications to original BN: we denote BN-s with $\sigma ^ { 2 }$ in the denominator’s square root, and $\mathbf { B N } ^ { * }$ with the L1 regularizer on top of BN-s.
|
| 121 |
+
|
| 122 |
+
LN-s and $\mathbf { L N ^ { * } }$ : We apply the same changes as from BN to BN-s and $\mathbf { B N } ^ { * }$ . In order to narrow the differences in the normalization schemes down to a few parameter choices, we additionally remove the affine transformation parameters $\gamma$ and $\beta$ from LN such that the difference between $\mathrm { L N ^ { * } }$ and $\mathrm { D N ^ { * } }$ is only the size of the normalization field. $\gamma$ and $\beta$ can really be seen as a separate layer and in practice we find that they do not improve the performance in the presence of $\sigma ^ { 2 }$ .
|
| 123 |
+
|
| 124 |
+
# 4 EXPERIMENTS
|
| 125 |
+
|
| 126 |
+
We evaluate the normalization schemes on three different tasks:
|
| 127 |
+
|
| 128 |
+
CNN image classification: We apply different normalizations on CNNs trained on the CIFAR-10/100 datasets for image recognition, each of which contains 50,000 training images and 10,000 test images. Each image is of size $3 2 \times 3 2 \times 3$ and has been labeled an object class out of 10 or 100 total number of classes.
|
| 129 |
+
RNN language modeling: We apply different normalizations on RNNs trained on the Penn Treebank dataset for language modeling, containing 42,068 training sentences, 3,370 validation sentences, and 3,761 test sentences.
|
| 130 |
+
CNN image super-resolution: We train a CNN on low resolution images and learn cascades of non-linear filters to smooth the upsampled images. We report performance of trained CNN on the standard Set 14 and Berkeley 200 dataset.
|
| 131 |
+
|
| 132 |
+
For each model, we perform a grid search of three or four choices of each hyperparameter including the smoothing constant $\sigma$ , and L1 regularization constant $\alpha$ , and learning rate $\epsilon$ on the validation set.
|
| 133 |
+
|
| 134 |
+
# 4.1 CIFAR EXPERIMENTS
|
| 135 |
+
|
| 136 |
+
We used the standard CNN model provided in the Caffe library. The architecture is summarized in Table 2. We apply normalization before each ReLU function. We implement DN as a convolutional operator, fixing the local window size to $5 \times 5 , 3 \times 3 , 3 \times 3$ for the three convolutional layers in all the CIFAR experiments.
|
| 137 |
+
|
| 138 |
+
We set the learning rate to 1e-3 and momentum 0.9 for all experiments. The learning rate schedule is set to $\{ 5 \mathrm { K } , 3 0 \mathrm { K } , 5 0 \mathrm { K } \}$ for the baseline model and to $\{ 3 0 \mathrm { K } , 5 0 \mathrm { K } , 8 0 \mathrm { K } \}$ for all other models. At every stage we multiply the learning rate by 0.1. Weights are randomly initialized from a zero-mean normal distribution with standard deviation $\{ 1 \mathrm { e } { - } 4 , 1 \mathrm { e } { - } 2 , 1 \mathrm { e } { - } 2 \}$ for the convolutional layers, and $\{ 1 \mathrm { e } \mathrm { - } 1 , 1 \mathrm { e } \mathrm { - } 1 \}$ for fully connected layers. Input images are centered on the dataset image mean.
|
| 139 |
+
|
| 140 |
+
Table 3 summarizes the test performances of $\mathbf { B N } ^ { * }$ , $\mathrm { L N ^ { * } }$ and $\mathrm { D N ^ { * } }$ , compared to the performance of a few baseline models and the standard batch and layer normalizations. We also add standard regularizers to the baseline model: L2 weight decay (WD) and dropout. Adding the smoothing constant and L1 regularization consistently improves the classification performance, especially for the original LN. The modification of LN makes it now better than the original BN, and only slightly worse than $\mathbf { B N } ^ { * }$ . $\mathrm { D N ^ { * } }$ achieves comparable performance to $\mathbf { B N ^ { * } }$ on both datasets, but only relying on a local neighborhood of hidden units.
|
| 141 |
+
|
| 142 |
+
Table 2: CIFAR CNN specification
|
| 143 |
+
|
| 144 |
+
<table><tr><td>Type</td><td>Size</td><td>Kernel</td><td>Stride</td></tr><tr><td>input</td><td>32 × 32×3</td><td>1</td><td>-</td></tr><tr><td>conv +relu</td><td>32 × 32 × 32</td><td>5×5×3×32</td><td>1</td></tr><tr><td>max pool</td><td>16 ×16×32</td><td>3×3</td><td>2</td></tr><tr><td>conv +relu</td><td>16 ×16 × 32</td><td>5×5×32×32</td><td>1</td></tr><tr><td>avg pool</td><td>8×8×32</td><td>3×3</td><td>2</td></tr><tr><td>conv +relu</td><td>8×8×64</td><td>5×5×32×64</td><td>1</td></tr><tr><td>avg pool</td><td>4×4×64</td><td>3×3</td><td>2</td></tr><tr><td>fully conn. linear</td><td>64</td><td></td><td></td></tr><tr><td>fully conn. linear</td><td>10 or 100</td><td></td><td></td></tr></table>
|
| 145 |
+
|
| 146 |
+
Table 3: CIFAR-10/100 experiments
|
| 147 |
+
|
| 148 |
+
<table><tr><td>Model</td><td>CIFAR-10 Acc.</td><td>CIFAR-100 Acc.</td></tr><tr><td>Baseline</td><td>0.7565</td><td>0.4409</td></tr><tr><td>Baseline +WD +Dropout</td><td>0.7795</td><td>0.4179</td></tr><tr><td>BN</td><td>0.7807</td><td>0.4814</td></tr><tr><td>LN</td><td>0.7211</td><td>0.4249</td></tr><tr><td>BN*</td><td>0.8179</td><td>0.5156</td></tr><tr><td>LN*</td><td>0.8091</td><td>0.4957</td></tr><tr><td>DN*</td><td>0.8122</td><td>0.5066</td></tr></table>
|
| 149 |
+
|
| 150 |
+
ResNet Experiments. Residual networks (ResNet) (He et al., 2016), a type of CNN with residual connections between layers, achieve impressive performance on many image classification benchmarks. The original architecture uses BN by default. If we remove BN, the architecture is very difficult to train or converges to a poor solution. We first reproduced the original BN ResNet-32, obtaining $9 2 . 6 \%$ accuracy on CIFAR10, and $6 9 . 8 \%$ on CIFAR-100. Our best DN model achieves $9 1 . 3 \%$ and $6 6 . 6 \%$ , respectively. While this performance is lower than the original BN-ResNet, there is certainly room to improve as we have not performed any hyperparameter optimization. Importantly, the beneficial effects of sigma $( 2 . 5 \%$ gain on CIFAR-100) and the L1 regularizer $( 0 . 5 \% )$ are still found, even in the presence of other regularization techniques such as data augmentation and weight decay in the training.
|
| 151 |
+
|
| 152 |
+
Since the number of sigma hyperparameters scales with the number of layers, we found that setting sigma as a learnable parameter for each layer helps the performance ( $1 . 3 \%$ gain on CIFAR-100). Note that training this parameter is not possible in the formulation by Jarrett et al. (2009). The learned sigma shows a clear trend: it tends to decrease with depth, and in the last convolution layer it approaches 0 (see Fig. 3).
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 3: Input scale $( | x | )$ vs. learned $\sigma$ at each layer, color coded by the layer number in ResNet-32, trained on CIFAR-10 (left), and CIFAR-100 (right).
|
| 156 |
+
|
| 157 |
+
# 4.2 RNN EXPERIMENTS
|
| 158 |
+
|
| 159 |
+
To apply divisive normalization in fully connected layers of RNNs, we consider a local neighborhood in the hidden state vector $\mathbf { h } _ { j - R : j + R }$ , where $R$ is the radius
|
| 160 |
+
|
| 161 |
+
Table 4: PTB Word-level language modeling experiments
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Model</td><td>LSTM</td><td>TanH RNN</td><td>ReLU RNN</td></tr><tr><td>Baseline</td><td>115.720</td><td>149.357</td><td>147.630</td></tr><tr><td>BN</td><td>123.245</td><td>148.052</td><td>164.977</td></tr><tr><td>LN</td><td>119.247</td><td>154.324</td><td>149.128</td></tr><tr><td>BN*</td><td>116.920</td><td>129.155</td><td>138.947</td></tr><tr><td>LN*</td><td>101.725</td><td>129.823</td><td>116.609</td></tr><tr><td>DN*</td><td>102.238</td><td>123.652</td><td>117.868</td></tr></table>
|
| 164 |
+
|
| 165 |
+
of the neighborhood. Although the hidden states are randomly initialized, this structure will impose local competition among the neighbors.
|
| 166 |
+
|
| 167 |
+
$$
|
| 168 |
+
\begin{array} { l } { \displaystyle v _ { j } = z _ { j } - \frac { 1 } { 2 R + 1 } \sum _ { r = - R } ^ { R } z _ { j + r } } \\ { \displaystyle \tilde { z } _ { j } = \frac { v _ { j } } { \sqrt { \sigma ^ { 2 } + \frac { 1 } { 2 R + 1 } \sum _ { r = - R } ^ { R } v _ { j + r } ^ { 2 } } } } \end{array}
|
| 169 |
+
$$
|
| 170 |
+
|
| 171 |
+
We follow Cooijmans et al. (2016)’s batch normalization implementation for RNNs: normalizers are separate for input transformation and hidden transformation. Let $B N ( \cdot ) , L N ( \cdot ) , D N ( \cdot )$ be BatchNorm, LayerNorm and DivNorm, and $g$ be either tanh or ReLU.
|
| 172 |
+
|
| 173 |
+
$$
|
| 174 |
+
\begin{array} { r l } & { \mathbf { h } _ { t + 1 } = g ( W _ { x } \mathbf { x } _ { t } + W _ { h } \mathbf { h } _ { t - 1 } + b ) } \\ & { \mathbf { h } _ { t + 1 } ^ { ( B N ) } = g ( B N ( W _ { x } \mathbf { x } _ { t } + b _ { x } ) + B N ( W _ { h } \mathbf { h } _ { t - 1 } ^ { ( B N ) } + b _ { h } ) ) } \\ & { \mathbf { h } _ { t + 1 } ^ { ( L N ) } = g ( L N ( W _ { x } \mathbf { x } _ { t } + W _ { h } \mathbf { h } _ { t - 1 } ^ { ( L N ) } + b ) ) } \\ & { \mathbf { h } _ { t + 1 } ^ { ( D N ) } = g ( D N ( W _ { x } \mathbf { x } _ { t } + W _ { h } \mathbf { h } _ { t - 1 } ^ { ( D N ) } + b ) ) } \end{array}
|
| 175 |
+
$$
|
| 176 |
+
|
| 177 |
+
Note that in recurrent BN, the additional parameters $\gamma$ and $\beta$ are shared across timesteps whereas the moving averages of batch statistics are not shared. For the LSTM version, we followed the released implementation from the authors of layer normalization 1, and apply LN at the same places as BN and $\mathbf { B N ^ { * } }$ , which is after the linear transformation of $W _ { x } { \bf x }$ and $W _ { h } \mathbf { h }$ individually. For $\mathrm { L N ^ { * } }$ and DN, we modified the places of normalization to be at each non-linearity, instead of jointly with a concatenated vector for different non-linearity. We found that this modification improves the performance and makes the formulation clearer since normalization is always a combined operation with the activation function. We include details of the LSTM implementation in the Appendix.
|
| 178 |
+
|
| 179 |
+
The RNN model is provided by the Tensorflow library (Abadi et al., 2016) and the LSTM version was originally proposed in Zaremba et al. (2014). We used a two-layer stack-RNN of size 400 (vanilla RNN) or 200 (LSTM). $R$ is set to 60 (vanilla RNN) and 30 (LSTM). We tried both tanh and ReLU as the activation function for the vanilla RNN. For unnormalized baselines and BN+ReLU, the initial learning rate is set to 0.1 and decays by half every epoch, starting at the 5th epoch for a maximum of 13 epochs. For the other normalized models, the initial learning rate is set to 1.0 while the schedule is kept the same. Standard stochastic gradient descent is used in all RNN experiments, with gradient clipping at 5.0.
|
| 180 |
+
|
| 181 |
+
Table 4 shows the test set perplexity for LSTM models and vanilla models. Perplexity is defined as $\begin{array} { r } { \mathrm { p p l } = \exp ( - \sum _ { x } \log p ( x ) ) } \end{array}$ . We find that BN and LN alone do not improve the final performance relative to the baseline, but similar to what we see in the CNN experiments, our modified versions $\mathbf { B N } ^ { * }$ and $\mathrm { L N ^ { * } }$ show significant improvements. $\mathbf { B N } ^ { * }$ on RNN is outperformed by both $\mathrm { L N ^ { * } }$ and DN. By applying our normalization, we can improve the vanilla RNN perplexity by $20 \%$ , comparable to an LSTM baseline with the same hidden dimension.
|
| 182 |
+
|
| 183 |
+
Table 5: Average test results of PSNR and SSIM on Set14 Dataset.
|
| 184 |
+
|
| 185 |
+
<table><tr><td>Model</td><td>PSNR (x3)</td><td>SSIM (x3)</td><td>PSNR (x4)</td><td>SSIM (x4)</td></tr><tr><td>Bicubic</td><td>27.54</td><td>0.7733</td><td>26.01</td><td>0.7018</td></tr><tr><td>A+</td><td>29.13</td><td>0.8188</td><td>27.32</td><td>0.7491</td></tr><tr><td>SRCNN</td><td>29.35</td><td>0.8212</td><td>27.53</td><td>0.7512</td></tr><tr><td>BN</td><td>22.31</td><td>0.7530</td><td>21.40</td><td>0.6851</td></tr><tr><td>DN*</td><td>29.38</td><td>0.8229</td><td>27.64</td><td>0.7562</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 6: Average test results of PSNR and SSIM on BSD200 Dataset.
|
| 188 |
+
|
| 189 |
+
<table><tr><td>Model</td><td>PSNR (x3)</td><td>SSIM (x3)</td><td>PSNR (x4)</td><td>SSIM (x4)</td></tr><tr><td>Bicubic</td><td>27.19</td><td>0.7636</td><td>25.92</td><td>0.6952</td></tr><tr><td>A+</td><td>27.05</td><td>0.7945</td><td>25.51</td><td>0.7171</td></tr><tr><td>SRCNN</td><td>28.42</td><td>0.8100</td><td>26.87</td><td>0.7378</td></tr><tr><td>BN</td><td>21.89</td><td>0.7553</td><td>21.53</td><td>0.6741</td></tr><tr><td>DN*</td><td>28.44</td><td>0.8110</td><td>26.96</td><td>0.7428</td></tr></table>
|
| 190 |
+
|
| 191 |
+
# 4.3 SUPER RESOLUTION EXPERIMENTS
|
| 192 |
+
|
| 193 |
+
We also evaluate DN on the low-level computer vision problem of single image super-resolution. We adopt the SRCNN model of Dong et al. (2016) as the baseline which consists of 3 convolutional layers and 2 ReLUs. From bottom to top layers, the sizes of the filters are 9, 5, and $5 ^ { 2 }$ . The number of filters are 64, 32, and 1, respectively. All the filters are initialized with zero-mean Gaussian and standard deviation 1e-3. Then we respectively apply batch normalization (BN) and our divisive normalization with L1 regularization $\mathrm { ( D N ^ { * } ) }$ to the convolutional feature maps before ReLUs. We construct the training set in a similar manner as Dong et al. (2016) by randomly cropping 5 million patches (size $3 3 \times 3 3$ ) from a subset of the ImageNet dataset of Deng et al. (2009). We only train our model for 4 million iterations which is less than the one adopted by SRCNN, i.e., 15 million, as the gain of PSNR and SSIM by spending that long time is marginal.
|
| 194 |
+
|
| 195 |
+
We report the average test results, utilizing the standard metrics PSNR and SSIM (Wang et al., 2004), on two standard test datasets Set14 (Zeyde et al., 2010) and BSD200 (Martin et al., 2001). We compare with two state-of-the-art single image super-resolution methods, $\mathbf { A } +$ (Timofte et al., 2013) and SRCNN (Dong et al., 2016). All measures are computed on the Y channel of YCbCr color space. We also provide a visual comparison in Fig. 4.
|
| 196 |
+
|
| 197 |
+
As show in Tables 5 and $6 \mathrm { D N ^ { * } }$ outperforms the strong competitor SRCNN, while BN does not perform well on this task. The reason may be that BN applies the same statistics to all patches of one image which causes some overall intensity shift (see Figs. 4). From the visual comparisons, we can see that our method not only enhances the resolution but also removes artifacts, e.g., the ringing effect in Fig. 4.
|
| 198 |
+
|
| 199 |
+
# 4.4 ABLATION STUDIES AND DISCUSSION
|
| 200 |
+
|
| 201 |
+
Finally, we investigated the differential effects of the $\sigma ^ { 2 }$ term and the L1 regularizer on the performance. We ran ablation studies on CIFAR-10/100 as well as PTB experiments. The results are listed in Table 7.
|
| 202 |
+
|
| 203 |
+
We find that adding the smoothing term $\sigma ^ { 2 }$ and the L1 regularization consistently increases the performance of the models. In the convolutional networks, we find that L1 and $\sigma$ both have similar effects on the performance. L1 seems to be slightly more important. In recurrent networks, $\sigma ^ { 2 }$ has a much more dramatic effect on the performance than the L1 regularizer.
|
| 204 |
+
|
| 205 |
+
Fig. 5 plots randomly sampled pairwise pre-normalization responses (after the linear transform) in the first layer at the same spatial location of the feature map, along with the average pair-wise correlation coefficient (Corr) and mutual information (MI). It is evident that both $\sigma$ and L1 encourages independence of the learned linear filters.
|
| 206 |
+
|
| 207 |
+

|
| 208 |
+
Figure 4: Comparisons at a magnification factor of 4.
|
| 209 |
+
|
| 210 |
+
There are several factors that could explain the improvement in performance. As mentioned above, adding the L1 regularizer on the activations encourages the filter responses to be less correlated. This can increase the robustness of the variance estimate in the normalizer and lead to an improved scaling of the responses to a good regime. Furthermore, adding the smoother to the denominator in the normalizer can be seen as implicitly injecting zero mean noise on the activations. While noise injection would not change the mean, it does add a term to the variance of the data, which is represented by $\sigma ^ { 2 }$ . This term also makes the normalization equation invertible. While dividing by the standard deviation decreases the degrees of freedom in the data, the smoothed normalization equation is fully information preserving. Finally, DN type operations have been shown to decrease the redundancy of filter responses to natural images and sound (Schwartz & Simoncelli, 2001; Sinz & Bethge, 2008; Lyu & Simoncelli, 2008). In combination with the L1 regularizer this could lead to a more independent representation of the data and thereby increase the performance of the network.
|
| 211 |
+
|
| 212 |
+
# 5 CONCLUSIONS
|
| 213 |
+
|
| 214 |
+
We have proposed a unified view of normalization techniques which contains batch and layer normalization as special cases. We have shown that when combined with a sparse regularizer on the activations, our framework has significant benefits over standard normalization techniques. We have demonstrated this in the context of both convolutional neural nets as well as recurrent neural networks. In the future we plan to explore other regularization techniques such as group sparsity. We also plan to conduct a more in-depth analysis of the effects of normalization on the correlations of the learned representations.
|
| 215 |
+
|
| 216 |
+
Table 7: Comparison of standard batch and layer normalation (BN and LN) models, to those with only L1 regularizer $( + \mathrm { L } 1 )$ , only the $\sigma$ smoothing term (-s), and with both $( ^ { \ast } )$ . We also compare divisive normalization with both $\mathrm { ( D N ^ { * } ) }$ , versus with only the smoothing term (DN).
|
| 217 |
+
|
| 218 |
+
<table><tr><td>Model</td><td>CIFAR-10</td><td>CIFAR-100</td><td>LSTM</td><td>Tanh RNN</td><td>ReLU RNN</td></tr><tr><td>Baseline Baseline +L1</td><td>0.7565 0.7839</td><td>0.4409 0.4517</td><td>115.720 111.885</td><td>149.357 143.965</td><td>147.630 148.572</td></tr><tr><td>BN BN+L1 BN-s</td><td>0.7807 0.8067 0.8017 0.8179</td><td>0.4814 0.5100 0.5005 0.5156</td><td>123.245 123.736 123.243 116.920</td><td>148.052 152.777 131.719 129.155</td><td>164.977 166.658 139.159 138.947</td></tr><tr><td>BN* LN LN +L1</td><td>0.7211 0.7994</td><td>0.4249 0.4990</td><td>119.247 116.964</td><td>154.324</td><td>149.128</td></tr><tr><td>LN-s</td><td></td><td></td><td></td><td>152.100</td><td>147.937</td></tr><tr><td></td><td>0.8083</td><td>0.4863</td><td>102.492</td><td>133.812</td><td>118.786</td></tr><tr><td>LN*</td><td>0.8091</td><td>0.4957</td><td>101.725</td><td></td><td></td></tr><tr><td>DN</td><td>0.8058</td><td></td><td></td><td>129.823</td><td>116.609</td></tr><tr><td></td><td></td><td>0.4892</td><td>103.714</td><td>132.143</td><td>118.789</td></tr><tr><td>DN*</td><td>0.8122</td><td>0.5066</td><td>102.238</td><td>123.652</td><td>117.868</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 219 |
+
|
| 220 |
+

|
| 221 |
+
Figure 5: First layer CNN pre-normalized activation joint histogram
|
| 222 |
+
|
| 223 |
+
Acknowledgements RL is supported by Connaught International Scholarships. FS would like to thank Edgar Y. Walker, Shuang Li, Andreas Tolias and Alex Ecker for helpful discussions. Supported by the Intelligence Advanced Research Projects Activity (IARPA) via Department of Interior/Interior Business Center (DoI/IBC) contract number D16PC00003. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DoI/IBC, or the U.S. Government.
|
| 224 |
+
|
| 225 |
+
# REFERENCES
|
| 226 |
+
|
| 227 |
+
Sparse coding via thresholding and local competition in neural circuits. Neural Computation, 20(10): 2526–63, 2008. ISSN 08997667. doi: 10.1162/neco.2008.03-07-486.
|
| 228 |
+
|
| 229 |
+
Abadi, Mart´ın, Barham, Paul, Chen, Jianmin, Chen, Zhifeng, Davis, Andy, Dean, Jeffrey, Devin, Matthieu, Ghemawat, Sanjay, Irving, Geoffrey, Isard, Michael, Kudlur, Manjunath, Levenberg, Josh, Monga, Rajat, Moore, Sherry, Murray, Derek Gordon, Steiner, Benoit, Tucker, Paul A., Vasudevan, Vijay, Warden, Pete, Wicke, Martin, Yu, Yuan, and Zhang, Xiaoqiang. Tensorflow: A system for large-scale machine learning. CoRR, abs/1605.08695, 2016.
|
| 230 |
+
|
| 231 |
+
Ba, Jimmy Lei, Kiros, Jamie Ryan, and Hinton, Geoffrey E. Layer normalization. CoRR, abs/1607.06450, 2016.
|
| 232 |
+
|
| 233 |
+
Balle, Johannes, Laparra, Valero, and Simoncelli, Eero P. Density modeling of images using a ´ generalized normalization transformation. ICLR, 2016.
|
| 234 |
+
|
| 235 |
+
Beck, J. M., Latham, P. E., and Pouget, A. Marginalization in Neural Circuits with Divisive Normalization. The Journal of neuroscience : the official journal of the Society for Neuroscience, 31(43):15310–9, oct 2011. ISSN 1529-2401. doi: 10.1523/JNEUROSCI.1706-11.2011.
|
| 236 |
+
|
| 237 |
+
Bevilacqua, Marco, Roumy, Aline, Guillemot, Christine, and Morel, Marie-Line Alberi. Lowcomplexity single-image super-resolution based on nonnegative neighbor embedding. In BMVC, 2012.
|
| 238 |
+
|
| 239 |
+
Bonds, A. B. Role of Inhibition in the Specification of Orientation Selectivity of Cells in the Cat Striate Cortex. Visual Neuroscience, 2(01):41–55, 1989.
|
| 240 |
+
|
| 241 |
+
Busse, L., Wade, A. R., and Carandini, M. Representation of Concurrent Stimuli by Population Activity in Visual Cortex. Neuron, 64(6):931–942, dec 2009. ISSN 0896-6273. doi: 10.1016/j. neuron.2009.11.004.
|
| 242 |
+
|
| 243 |
+
Carandini, M. and Heeger, D. J. Normalization as a canonical neural computation. Nature reviews. Neuroscience, 13(1):51–62, nov 2012. ISSN 1471-0048. doi: 10.1038/nrn3136.
|
| 244 |
+
|
| 245 |
+
Coen-Cagli, R., Kohn, A., and Schwartz, O. Flexible gating of contextual influences in natural vision. Nature Neuroscience, 18(11):1648–1655, 2015. ISSN 1097-6256. doi: 10.1038/nn.4128.
|
| 246 |
+
|
| 247 |
+
Cogswell, Michael, Ahmed, Faruk, Girshick, Ross, Zitnick, Larry, and Batra, Dhruv. Reducing overfitting in deep networks by decorrelating representations. ICLR, 2015.
|
| 248 |
+
|
| 249 |
+
Cooijmans, Tim, Ballas, Nicolas, Laurent, Cesar, and Courville, Aaron. Recurrent batch normaliza- ´ tion. CoRR, abs/1603.09025, 2016.
|
| 250 |
+
|
| 251 |
+
Deng, Jia, Dong, Wei, Socher, Richard, Li, Li-Jia, Li, Kai, and Fei-Fei, Li. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
|
| 252 |
+
|
| 253 |
+
Dong, Chao, Loy, Chen Change, He, Kaiming, and Tang, Xiaoou. Image super-resolution using deep convolutional networks. TPAMI, 38(2):295–307, 2016.
|
| 254 |
+
|
| 255 |
+
Froudarakis, Emmanouil, Berens, Philipp, Ecker, Alexander S, Cotton, R James, Sinz, Fabian H, Yatsenko, Dimitri, Saggau, Peter, Bethge, Matthias, and Tolias, Andreas S. Population code in mouse V1 facilitates readout of natural scenes through increased sparseness. Nature neuroscience, 17(6):851–7, apr 2014. ISSN 1546-1726. doi: 10.1038/nn.3707.
|
| 256 |
+
|
| 257 |
+
Gatys, Leon A., Ecker, Alexander S., and Bethge, Matthias. Image style transfer using convolutional neural networks. In CVPR, 2016.
|
| 258 |
+
|
| 259 |
+
Glorot, Xavier, Bordes, Antoine, and Bengio, Yoshua. Deep sparse rectifier neural networks. In AISTATS, 2011.
|
| 260 |
+
|
| 261 |
+
Goodfellow, Ian, Bengio, Yoshua, and Courville, Aaron. Deep learning. Book in preparation for MIT Press, 2016.
|
| 262 |
+
|
| 263 |
+
He, Kaiming, Zhang, Xiangyu, Ren, Shaoqing, and Sun, Jian. Deep residual learning for image recognition. In CVPR, 2016.
|
| 264 |
+
Heeger, D. J. Normalization of cell responses in cat striate cortex. Vis Neurosci, 9(2):181–197, 1992. ISSN 09525238.
|
| 265 |
+
Higgins, I., Matthey, L., Glorot, X., Pal, A., Uria, B., Blundell, C., Mohamed, S., and Lerchner, A. Early Visual Concept Learning with Unsupervised Deep Learning. CoRR, abs/1606.05579, 2016.
|
| 266 |
+
Ioffe, Sergey and Szegedy, Christian. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
|
| 267 |
+
Jarrett, K., Kavukcuoglu, K., Ranzato, M. A., and LeCun, Y. What is the best multi-stage architecture for object recognition? ICCV, 2009.
|
| 268 |
+
Kavukcuoglu, K., Ranzato, M.’A., Fergus, R., and LeCun, Y. Learning invariant features through topographic filter maps. In CVPR Workshops, 2009.
|
| 269 |
+
Krizhevsky, A., Sutskever, I., and Hinton, G. E. ImageNet Classification with Deep Convolutional Neural Networks. NIPS, 2012.
|
| 270 |
+
Laurent, Cesar, Pereyra, Gabriel, Brakel, Phil ´ emon, Zhang, Ying, and Bengio, Yoshua. Batch ´ normalized recurrent neural networks. arXiv preprint arXiv:1510.01378, 2015.
|
| 271 |
+
Le, Quoc V. Building high-level features using large scale unsupervised learning. In 2013 IEEE international conference on acoustics, speech and signal processing, pp. 8595–8598. IEEE, 2013.
|
| 272 |
+
Liao, Q. and Poggio, T. Bridging the Gaps Between Residual Learning, Recurrent Neural Networks and Visual Cortex. CoRR, abs/1604.03640, 2016.
|
| 273 |
+
Liao, Qianli, Kawaguchi, Kenji, and Poggio, Tomaso. Streaming Normalization: Towards Simpler and More Biologically-plausible Normalizations for Online and Recurrent Learning. CoRR, abs/1610.06160, 2016a.
|
| 274 |
+
Liao, Renjie, Schwing, Alexander, Zemel, Richard, and Urtasun, Raquel. Learning deep parsimonious representations. NIPS, 2016b.
|
| 275 |
+
Lyu, Siwei and Simoncelli, Eero P. Reducing statistical dependencies in natural signals using radial Gaussianization. NIPS, 2008.
|
| 276 |
+
Malo, J., Epifanio, I., Navarro, R., and Simoncelli, E. P. Nonlinear image representation for efficient perceptual coding. TIP, 15(1):68–80, 2006.
|
| 277 |
+
Martin, David, Fowlkes, Charless, Tal, Doron, and Malik, Jitendra. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In ICCV, 2001.
|
| 278 |
+
Olsen, S. R, Bhandawat, V., and Wilson, R. I. Divisive Normalization in Olfactory Population Codes. Neuron, 66(2):287–299, 2010. ISSN 10974199. doi: 10.1016/j.neuron.2010.04.009.
|
| 279 |
+
Pinto, N., Cox, D. D., and DiCarlo, J. J. Why is Real-World Visual Object Recognition Hard? PLoS Comput Biol, 4(1):e27, jan 2008. doi: 10.1371/journal.pcbi.0040027.
|
| 280 |
+
Reynolds, J. H. and Heeger, D. J. The normalization model of attention. Neuron, 61(2):168–85, jan 2009. ISSN 1097-4199. doi: 10.1016/j.neuron.2009.01.002.
|
| 281 |
+
Ringach, D. L. Population coding under normalization. Vision Research, 50(22):2223–2232, 2009. ISSN 18785646. doi: 10.1016/j.visres.2009.12.007.
|
| 282 |
+
Salimans, Tim and Kingma, Diederik P. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In NIPS, 2016.
|
| 283 |
+
Scardapane, S., Comminiello, D., Hussain, A., and Uncin, A. Group sparse regularization for deep neural networks. CoRR, abs/1607.00485, 2016.
|
| 284 |
+
Schwartz, O. and Simoncelli, E. P. Natural signal statistics and sensory gain control. Nat Neurosci, 4 (8):819–825, 2001. ISSN 1097-6256. doi: 10.1038/90526.
|
| 285 |
+
Schwartz, O., J., Sejnowski T., and P., Dayan. Perceptual organization in the tilt illusion. Journal of Vision, 9(4):1–20, apr 2009. ISSN 1534-7362.
|
| 286 |
+
Sermanet, P., Chintala, S., and LeCun, Y. Convolutional neural networks applied to house numbers digit classification. Proceedings of International Conference on Pattern Recognition ICPR12, (Icpr):10–13, 2012. ISSN 1051-4651. doi: 10.0/Linux-x86 64.
|
| 287 |
+
Simoncelli, E. P. and Heeger, D. J. A model of neuronal responses in visual area MT. Vision Research, 38(5):743–761, 1998.
|
| 288 |
+
Sinz, Fabian and Bethge, Matthias. Temporal Adaptation Enhances Efficient Contrast Gain Control on Natural Images. PLoS Computational Biology, 9(1):e1002889, jan 2013. ISSN 1553734X.
|
| 289 |
+
Sinz, Fabian H and Bethge, Matthias. The Conjoint Effect of Divisive Normalization and Orientation Selectivity on Redundancy Reduction. In NIPS, 2008.
|
| 290 |
+
Srivastava, Nitish, Hinton, Geoffrey E, Krizhevsky, Alex, Sutskever, Ilya, and Salakhutdinov, Ruslan. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 15(1):1929–1958, 2014.
|
| 291 |
+
Timofte, Radu, De Smet, Vincent, and Van Gool, Luc. Anchored neighborhood regression for fast example-based super-resolution. In ICCV, 2013.
|
| 292 |
+
Ulyanov, Dmitry, Vedaldi, Andrea, and Lempitsky, Victor S. Instance normalization: The missing ingredient for fast stylization. CoRR, abs/1607.08022, 2016.
|
| 293 |
+
Wang, Zhou, Bovik, Alan C, Sheikh, Hamid R, and Simoncelli, Eero P. Image quality assessment: from error visibility to structural similarity. TIP, 13(4):600–612, 2004.
|
| 294 |
+
Zaremba, Wojciech, Sutskever, Ilya, and Vinyals, Oriol. Recurrent neural network regularization. CoRR, abs/1409.2329, 2014.
|
| 295 |
+
Zeyde, Roman, Elad, Michael, and Protter, Matan. On single image scale-up using sparserepresentations. In International conference on curves and surfaces, pp. 711–730. Springer, 2010.
|
| 296 |
+
|
| 297 |
+
# A EFFECT OF SIGMA AND L1 ON CIFAR-10/100 VALIDATION SET
|
| 298 |
+
|
| 299 |
+
We plot the effect of $\sigma$ and L1 regularization on the validation performance in Figure 6. While sigma makes the most contributions to the improvement, L1 also provides much gain for the original version of LN and BN.
|
| 300 |
+
|
| 301 |
+

|
| 302 |
+
Figure 6: Validation accuracy on CIFAR-10/100 showing effect of sigma constant (a, b) and L1 regularization (c, d) on BN, LN, and DN
|
| 303 |
+
|
| 304 |
+
# B LSTM IMPLEMENTATION DETAILS
|
| 305 |
+
|
| 306 |
+
In LSTM experiments, we found that have an individual normalizer for each non-linearity (sigmoid and tanh) helps the performance for both LN and DN. Eq. 12-14 are the standard LSTM equations, and let $N$ be the normalizer function, our new normalizer is replacing the nonlinearity with Eq. 15-16. This modification can also be thought as combining normalization and activation as a single activation function.
|
| 307 |
+
|
| 308 |
+
This is different from the released implementation of LN and BN in LSTM, which separately normalized the concatenated vector $W _ { h } \mathbf { h } _ { t - 1 }$ and $W _ { x } { \bf x } _ { t }$ . For all $\mathrm { L N ^ { * } }$ and DN experiments we choose this new formulation, whereas LN experiments are consistent with the released version.
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\begin{array} { r c l } { \left( \begin{array} { l } { \mathbf { f } _ { t } } \\ { \mathbf { i } _ { t } } \\ { \mathbf { o } _ { t } } \\ { \mathbf { g } _ { t } } \end{array} \right) } & { = } & { W _ { h } \mathbf { h } _ { t - 1 } + W _ { x } \mathbf { x } _ { t } + \mathbf { b } } \\ { \mathbf { c } _ { t } } & { = } & { \sigma ( \mathbf { f } _ { t } ) \odot \mathbf { c } _ { t - 1 } + \sigma ( \mathbf { i } _ { t } ) \odot \mathrm { t a n h } ( \mathbf { g } _ { t } ) } \\ { \mathbf { h } _ { t } } & { = } & { \sigma ( \mathbf { o } _ { t } ) \odot \mathrm { t a n h } ( \mathbf { c } _ { t } ) } \end{array}
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
$$
|
| 315 |
+
\begin{array} { r c l } { { \bar { \sigma } ( x ) } } & { { = } } & { { \sigma ( N ( x ) ) } } \\ { { \overline { { { \operatorname { t a n h } } } } ( x ) } } & { { = } } & { { \operatorname { t a n h } ( N ( x ) ) } } \end{array}
|
| 316 |
+
$$
|
| 317 |
+
|
| 318 |
+
# C MORE RESULTS ON IMAGE SUPER-RESOLUTION
|
| 319 |
+
|
| 320 |
+
We include results on another standard dataset Set5 Bevilacqua et al. (2012) in Table 8 and show more visual results in Fig. 7.
|
| 321 |
+
|
| 322 |
+
Table 8: Average test results of PSNR and SSIM on Set5 Dataset.
|
| 323 |
+
|
| 324 |
+
<table><tr><td>Model</td><td>PSNR (x3)</td><td>SSIM (x3)</td><td>PSNR (x4)</td><td>SSIM (x4)</td></tr><tr><td>Bicubic</td><td>30.41</td><td>0.8678</td><td>28.44</td><td>0.8097</td></tr><tr><td>A+</td><td>32.59</td><td>0.9088</td><td>30.28</td><td>0.8603</td></tr><tr><td>SRCNN</td><td>32.83</td><td>0.9087</td><td>30.52</td><td>0.8621</td></tr><tr><td>BN</td><td>22.85</td><td>0.8027</td><td>20.71</td><td>0.7623</td></tr><tr><td>DN*</td><td>32.83</td><td>0.9106</td><td>30.62</td><td>0.8665</td></tr></table>
|
| 325 |
+
|
| 326 |
+

|
| 327 |
+
Figure 7: Comparisons at a magnification factor of 4.
|
md/train/rk6H0ZbRb/rk6H0ZbRb.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# INTRIGUING PROPERTIES OF ADVERSARIAL EXAM-PLES
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
It is becoming increasingly clear that many machine learning classifiers are vulnerable to adversarial examples. In attempting to explain the origin of adversarial examples, previous studies have typically focused on the fact that neural networks operate on high dimensional data, they overfit, or they are too linear. Here we show that distributions of logit differences have a universal functional form. This functional form is independent of architecture, dataset, and training protocol; nor does it change during training. This leads to adversarial error having a universal scaling, as a power-law, with respect to the size of the adversarial perturbation. We show that this universality holds for a broad range of datasets (MNIST, CIFAR10, ImageNet, and random data), models (including state-of-the-art deep networks, linear models, adversarially trained networks, and networks trained on randomly shuffled labels), and attacks (FGSM, step l.l., PGD). Motivated by these results, we study the effects of reducing prediction entropy on adversarial robustness. Finally, we study the effect of network architectures on adversarial sensitivity. To do this, we use neural architecture search with reinforcement learning to find adversarially robust architectures on CIFAR10. Our resulting architecture is more robust to white and black box attacks compared to previous attempts.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
An intriguing aspect of deep learning models in computer vision is that while they can classify images with high accuracy, they fail catastrophically when those same images are perturbed slightly in an adversarial fashion (Szegedy et al., 2013; Goodfellow et al., 2014). The prevalence of adversarial examples presents challenges to our understanding of how deep networks generalize and pose security risks in real world applications (Papernot et al., 2016a; Kurakin et al., 2016a). Several techniques have been proposed to defend against adversarial examples. Adversarial training (Goodfellow et al., 2014) augments the training data with adversarial examples. It has been shown that using stronger adversarial attacks in adversarial training can increase the robustness to stronger attacks, but at the cost of a decrease in clean accuracy (i.e. accuracy on samples that have not been adversarially perturbed) (Madry et al., 2017). Defensive distillation (Papernot et al., 2016b), feature squeezing (Xu et al., 2017), and Parseval training (Cisse et al., 2017) have also been shown to make models more robust against adversarial attacks.
|
| 12 |
+
|
| 13 |
+
The goal of this work is to study the common properties of adversarial examples. We calculate the adversarial error, defined as the difference between clean accuracy and adversarial accuracy at a given size of adversarial perturbation (). Surprisingly, adversarial error has a similar dependence on small values of $\epsilon$ for all network models and datasets we studied, including linear, fully-connected, simple convolutional networks, Inception v3 (Szegedy et al., 2016), Inception-ResNet v2, Inception v4 (Szegedy et al., 2017), ResNet v1, ResNet v2 (He et al., 2016), NasNet-A (Zoph & Le, 2016; Zoph et al., 2017), adversarially trained Inception v3 (Kurakin et al., 2016b) and Inception-ResNet v2 (Tramer et al., 2017), and networks trained on randomly shuffled labels of MNIST. Adversarial \` error due to the Fast Gradient Sign Method (FGSM), its L2-norm variant, and Projected Gradient Descent (PGD) attack grows as a power-law like $A \epsilon ^ { B }$ with $B$ between 0.9 and 1.3. By contrast, we find that adversarial error caused by one-step least likely class method (step l.l.) also scales as a power-law where $B$ is between 1.8 and 2.5 for small $\epsilon$ . This observed universality points to a mysterious commonality between these models and datasets, despite the different number of channels, pixels, and classes present. Adversarial error caused by FGSM on the training set of randomly shuffled labels of MNIST (LeCun & Cortes) also has the power-law form where $B = 1 . 2$ , which implies that the universality is not a result of the specific content of these datasets nor the ability of the model to generalize.
|
| 14 |
+
|
| 15 |
+
To discover the mechanism behind this universality we show how, at small $\epsilon$ , the success of an adversarial attack depends on the input-logit Jacobian of the model and on the logits of the network. We demonstrate that the susceptibility of a model to FGSM and PGD attacks is in large part dictated by the cumulative distribution of the difference between the most likely logit and the second most likely logit. We observe that this cumulative distribution has a universal form among all datasets and models studied, including randomly produced data. Together, we believe these results provide a compelling story regarding the susceptibility of machine learning models to adversarial examples at small $\epsilon$ .
|
| 16 |
+
|
| 17 |
+
We show that training with single-step adversarial examples offers protection against large $\epsilon$ attacks (between 0.2 and 32), but does not help appreciably at defending against small $\epsilon$ attacks (below 0.2). At $\epsilon = 0 . 2$ , all ImageNet models we studied incur 10 to $2 5 \%$ adversarial error, and surprisingly, vanilla NASNet-A (best clean accuracy in our study) has a lower adversarial error than adversarially trained Inception-ResNet v2 or Inception v3 (Kurakin et al., 2016b) (Fig. 1(a)). In light of these results, we explore a different avenue to adversarial robustness through architecture selection. We perform neural architecture search (NAS) using reinforcement learning (Zoph & Le, 2016; Zoph et al., 2017). These techniques allow us to find several architectures that are especially robust to adversarial perturbations. In addition, by analyzing the adversarial robustness of the tens-of-thousands of architectures constructed by NAS, we gain insights into the relationship between size of a model, its clean accuracy, and its adversarial robustness. In summary, the key contributions of our work are:
|
| 18 |
+
|
| 19 |
+
• We study the functional form of adversarial error and logit differences across several models and datasets, which turn out to be universal. We analytically derive the commonality in the power-law tails of the logit differences, and show how it leads to the commonality in the form of adversarial error.
|
| 20 |
+
• We observe that although the qualitative form of logit differences and adversarial error is universal, it can be quantitatively improved with entropy regularization and better network architectures.
|
| 21 |
+
• We study the dependence of adversarial robustness on the network architecture via NAS. We show that while adversarial accuracy is strongly correlated with clean accuracy, it is only weakly correlated with model size. Our work leads to architectures that are more robust to white-box and black-box attacks on CIFAR10 (Krizhevsky & Hinton, 2009) than previous studies.
|
| 22 |
+
|
| 23 |
+
# 2 SURPRISING UNIVERSALITY OF ADVERSARIAL ERROR AT SMALL
|
| 24 |
+
|
| 25 |
+
FGSM computes adversarial examples as:
|
| 26 |
+
|
| 27 |
+
$$
|
| 28 |
+
\boldsymbol { x } ^ { \mathrm { a d v } } = \boldsymbol { x } + \epsilon \mathrm { s i g n } \left( \nabla _ { \boldsymbol { x } } L ( \boldsymbol { x } , \boldsymbol { y } ) \right) ,
|
| 29 |
+
$$
|
| 30 |
+
|
| 31 |
+
where $x$ is the clean image, $y$ is the correct label for that image, $x ^ { \mathrm { a d v } }$ is the adversarial image, $\epsilon$ is the size of the adversarial perturbation, and $L ( x , y )$ is the loss function. $\epsilon$ values are specified in range [0,255]. We only study white-box attacks in this section.
|
| 32 |
+
|
| 33 |
+
We begin with a preliminary examination of the architectural dependence of adversarial robustness. To that end, in Fig. 1 (a) we plot the test set adversarial error due to an FGSM attack as a function of $\epsilon$ for several models on ImageNet (Russakovsky et al., 2015). We note that for $\epsilon < 0 . 2$ , the adversarial error follows a power law form with an exponent between 0.9 and 1.1 for all models studied. Even adversarially trained models Kurakin et al. (2016b), while adversarially much more robust for larger values of $\epsilon$ , follow a similar form and reach as large as $20 \%$ adversarial error at smaller $\epsilon$ .
|
| 34 |
+
|
| 35 |
+
In light of the surprising commonality in adversarial error at small- $\epsilon$ , we investigate whether there is any way to get a different form for the adversarial error. To do this, we evaluate the adversarial error due to step l.l. attack, which is computed as:
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
x ^ { \mathrm { a d v } } = x - \epsilon \mathrm { s i g n } \left( \nabla _ { x } L ( x , y _ { l . l . } ) \right) ,
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
where $y _ { l . l . }$ is least likely class predicted by the network on clean image $x$ (Kurakin et al., 2016b). The adversarial error also follows a power law, however with a larger exponent. The exponents range from 1.8 to 2.2 for ImageNet models (Fig. 1(b)), and 1.8 to 2.5 for models trained on MNIST (Fig. 2(c)) and CIFAR10. Thus, we see that attack protocol can change the exponent of the observed power-law.
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 1: Test set adversarial error as a function of $\epsilon$ for models trained on ImageNet due to FGSM and step l.l. attack in (a) and (b), respectively. adv. tr. denotes models that are adversarially trained (Kurakin et al., 2016b). In (b), we also show two of the power law fits with straight lines.
|
| 45 |
+
|
| 46 |
+
To test the limits of the universality observed in Fig. 1, we perform a number of more extensive tests. First, we investigate the effect of architecture by stochastically sampling thousands of different neural networks and train them on MNIST. We then measure their adversarial error due to FGSM on the test set. The architectures we sample are either fully-connected networks with 1-4 hidden layers and 30-2000 hidden nodes in each layer, or simple convolutional networks with dropout rates between 0-0.5. The adversarial error of representative linear, fully-connected, and convolutional networks are shown in Fig. 2 (a). As above, these models all have the same form of adversarial error with a powerlaw dependence on $\epsilon$ with exponents between 0.9 and 1.2.
|
| 47 |
+
|
| 48 |
+
See Fig. 9 in the Appendix for a plot with all of the generated networks. We perform the same analysis on a 32-layer ResNet trained on CIFAR10 (He et al., 2016), which achieves a $9 2 . 6 \%$ clean accuracy on the test set. The result is shown in Appendix Fig. 10, where the adversarial error follows a power law with an exponent of 0.99 up to an $\epsilon$ of 1.
|
| 49 |
+
|
| 50 |
+
Next, we probe the relationship between generalization and adversarial robustness following a similar approach to Zhang et al. (2016). In particular, we train a fully connected network on MNIST with shuffled labels until it reaches perfect accuracy on the training set. The adversarial error on the training set is shown in Fig. 2(b). Once again we see that the adversarial error follows an almost identical power-law form at small $\epsilon$ with an exponent of 1.2.
|
| 51 |
+
|
| 52 |
+
Finally, we further investigate the dependence of adversarial robustness on attack protocol. We plot in Fig. 2 (c) the adversarial error on MNIST with an $L _ { \infty }$ -normalized FGSM attack, an $L _ { 2 }$ - normalized FGSM attack, and a 20-step projected gradient descent (PGD) attack (Madry et al., 2017). We see that despite the anomalous exponent observed for step-l.l. attacks, the other attack methods display the same universality with exponents of 1.1, 1.2, and 1.3 for L2-norm, FGSM, and PGD attacks, respectively. step-l.l. attack on MNIST has an exponent of 2.3.
|
| 53 |
+
|
| 54 |
+
# 3 A MEAN-FIELD THEORY OF ADVERSARIAL PERTURBATIONS
|
| 55 |
+
|
| 56 |
+
# 3.1 LINEAR RESPONSE
|
| 57 |
+
|
| 58 |
+
We now offer a theoretical explanation for the observed universal behavior of adversarial error. The breadth of these observations shows that adversarial error for small adversarial perturbations does not depend on the specifics of the neural network, which implies that we can understand the small $\epsilon$ regime by making simplifying approximations. We begin by considering the linear response of a neural network to adversarial perturbations. Another approach to adversarial examples that considers the linear response of the network can be found in Nayebi & Ganguli (2017). The effect of margins on adversarial robustness has been brought up in ?.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: Points represent adversarial error as a function of $\epsilon$ for models trained on MNIST. Straight lines are power-law fits. (a) FGSM attack on fully-connected 3-layer network (FC), a linear model, and a convolutional network (b) FGSM attack on FC trained on randomly shuffled labels (evaluated on the training set). (c) Different attacks on FC.
|
| 62 |
+
|
| 63 |
+
We will study an $L _ { 2 }$ -variant of the FGSM attack. Here, the adversarial perturbation is given by,
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
x ^ { \mathrm { a d v } } = x + \epsilon \frac { \nabla _ { x } L } { | | \nabla _ { x } L | | _ { 2 } }
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
instead of the more commonly used $\ell _ { \infty }$ variant. As shown above, the form and exponent of adversarial error is qualitatively insensitive to this choice (see Fig. 2(c)). We will now attempt to compute the minimum $\epsilon$ , that we call $\hat { \epsilon } ( x )$ , required before the class assigned to an input, $x$ , changes. Assuming the network was able to perfectly classify clean images, the adversarial error rate will then be $P ( \bar { \hat { \epsilon } } < \epsilon )$ . While perfect classification will not be achieved in practice, the insensitivity of the form of adversarial error to clean accuracy demonstrated above for many systems suggests that this approximation is sound.
|
| 70 |
+
|
| 71 |
+
Notationally, we will refer to the output of the network as ${ \hat { y } } _ { i } ( x )$ and the corresponding logits as $h _ { i } ( x )$ . The class prediction of the network will then be arg $\operatorname* { m a x } ( \hat { y } ( x ) ) = \operatorname { a r g m a x } ( h ( x ) )$ . For simplicity we will choose an ordering of the logits such that $h _ { 1 } ( x ) \geq h _ { 2 } ( x ) \geq \cdot \cdot \cdot \geq h _ { N } ( x )$ . We can then enumerate a set of logit-differences, $\Delta _ { i j } ( x ) = h _ { i } ( x ) - \dot { h _ { j } } ( x )$ . If an adversarial perturbation is to successfully cause the network to make an erroneous prediction, then it must be true that $h _ { 1 } ( x ^ { \mathrm { a d v } } ) < h _ { j } ( \dot { x } ^ { \mathrm { a d v } } )$ for at least one $j$ .
|
| 72 |
+
|
| 73 |
+
We calculate the response of the logits to adversarial perturbation. We consider the linearized response of the network and find that in the limit of small $\epsilon$ (see Appendix 6.2.1),
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
h ( x ^ { \mathrm { a d v } } ) = h ( x ) + \epsilon \frac { J ^ { T } J \delta } { | | J \delta | | _ { 2 } } + \mathcal { O } ( \epsilon ^ { 2 } )
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $J _ { i j } = \partial h _ { j } / \partial x _ { i }$ is the input-logit Jacobian of the network and $\delta _ { i } = \partial L / \partial h _ { i }$ is the error of the outputs of the network. For notational convenience we will define $\Gamma ( x ) = J ^ { T } J \delta / | J \delta | | _ { 2 }$ . In this linear model we therefore predict that the logit-differences will scale as follows,
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\Delta _ { i j } ( x ^ { \mathrm { a d v } } ) \approx \Delta _ { i j } ( x ) + \epsilon ( \Gamma _ { i } ( x ) - \Gamma _ { j } ( x ) ) + \mathcal { O } ( \epsilon ^ { 2 } ) .
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
Recall that the adversarial perturbation will successfully cause the network to just barely misclassify an input precisely when $\Delta _ { 1 j } ( x ^ { \mathrm { a d v } } ) = 0$ for at least one $j$ . We can predict per-class $\epsilon$ -thresholds beyond which the network will misclassify a given point,
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\hat { \epsilon } _ { j } ( x ) = \frac { \Delta _ { 1 j } ( x ) } { \Gamma _ { j } ( x ) - \Gamma _ { 1 } ( x ) } .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
Together this allows us to compute a linear approximation to $\hat { \epsilon }$ given by $\hat { \epsilon } _ { \mathrm { l i n e a r } } ( x ) = \operatorname* { m i n } _ { j } ( \epsilon _ { j } ( x ) )$
|
| 92 |
+
|
| 93 |
+
We can confirm that the change in the logits for small changes in the inputs is well-described by this linear model. This is shown in fig. 3 (a) where we see the logits for a single example upon perturbation over a range of $\epsilon$ . In particular, for small $\epsilon$ we see an excellent agreement between the linear approximation and the true logit dynamics. We also see that the $\epsilon$ where the first and second logit cross is well-approximated by the linear prediction. In Fig. 3 (b) we plot $\hat { \epsilon } _ { \mathrm { l i n e a r } } ( x )$ against $\hat { \epsilon } ( x )$ evaluated on every MNIST example in the test set. The white dashed line is the line $\hat { \epsilon } ( x ) = \hat { \epsilon } _ { \mathrm { l i n e a r } } ( x )$ . We see that when $\hat { \epsilon } ( x )$ is small the $\hat { \epsilon } _ { \mathrm { l i n e a r } } ( x )$ concentrate increasingly around the $\hat { \epsilon } ( x )$ . Together these results show that the linear response predictions are valid for small adversarial perturbations.
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 3: Linear approximation for the response of the logits to adversarial perturbation. (a) The dynamics of logits to an adversarial perturbation as a function of size $\epsilon$ for a single training example. Dashed lines show the linear approximation. Colors indicate the ranking of the logit from largest (red) to smallest (blue). (b) The smallest $\epsilon$ needed to fool the network (ˆ) for individual test examples compared with the prediction from the linear theory. (c) Mean field prediction of $\hat { \epsilon }$ .
|
| 97 |
+
|
| 98 |
+
While the linear model outlined above gives excellent agreement in the $\epsilon 0$ limit, the $\Gamma _ { i } ( x )$ are themselves complicated objects (being functions of the Jacobian). This makes the analytic evaluation of Eq. (6) challenging. We therefore introduce a “mean-field” approximation to Eq. (6) by replacing $\Gamma _ { i } ( x )$ by its average over the dataset, $\langle \Gamma _ { i } ( x ) \rangle$ . Similar independence approximations have previously been successful in analyzing the expressivity and trainability of neural networks (Schoenholz et al., 2016; Poole et al., 2016). Finally, we observe that the vast majority of the time (for example, more than $9 5 \%$ of successful FGSM attacks for $\epsilon < 5 0$ ), it is $\Delta _ { 1 2 } ( x ^ { \mathrm { a d v } } )$ that goes to zero before any of the other $\Delta _ { 1 j }$ . We therefore assume that this will be the dominant failure mode for neural networks and write down a mean-field estimate for $\hat { \epsilon }$ ,
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\hat { \epsilon } _ { \mathrm { M . F . } } = \frac { \Delta _ { 1 2 } ( x ) } { \langle \Gamma _ { 2 } \rangle - \langle \Gamma _ { 1 } \rangle } .
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
We show in Fig. 3 (c) that this approximation continues to be strongly correlated with ˆ. Together these results suggest that the adversarial error rate for perturbations of size $\epsilon$ will be
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
P ( \hat { \epsilon } \le \epsilon ) \approx P \left[ \Delta _ { 1 2 } \le \epsilon ( \langle \Gamma _ { 2 } \rangle - \langle \Gamma _ { 1 } \rangle ) \right] = P ( \Delta _ { 1 2 } \le \tilde { \epsilon } )
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
where we have defined $\tilde { \epsilon } = \epsilon ( \left. \Gamma _ { 2 } \right. - \left. \Gamma _ { 1 } \right. )$ to be a network-specific rescaling of $\epsilon$ . We therefore expect the adversarial error rate at small $\epsilon$ to be dictated by the cumulative distribution of $\Delta _ { 1 2 }$ for attacks that effectively target the second most likely class (e.g. FGSM, PGD ...etc.).
|
| 111 |
+
|
| 112 |
+
# 3.2 UNIVERSAL PROPERTIES OF THE LOGIT DIFFERENCE DISTRIBUTION
|
| 113 |
+
|
| 114 |
+
With the results from the preceding section in hand, we now investigate the distribution of logit differences, $P ( \Delta _ { 1 j } )$ . Since we are particularly interested in the small $\epsilon$ regime, we seek to compute $P ( \Delta _ { 1 j } )$ for small $\Delta _ { 1 j }$ . To make progress we will again make a mean field approximation and assume that each of the logits are i.i.d. with arbitrary distribution. With this approximation we find that for small $\Delta _ { 1 j }$ (see Appendix 6.2.2),
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
P ( \Delta _ { 1 j } ) = C \Delta _ { 1 j } ^ { j - 2 } + \mathcal { O } ( \Delta _ { 1 j } ^ { j - 1 } )
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
where $C$ is a network specific constant. An interesting consequence of this result is that the difference that we are particularly interested in, $P ( \Delta _ { 1 2 } )$ , scales as $\mathcal { O } ( 1 )$ as $\Delta _ { 1 2 } 0$ . This implies that, generically, we expect the most likely logit and second most likely logit to have a finite probability of being arbitrarily close together. We interpret this as an inherent uncertainty in the predictions of neural networks.
|
| 121 |
+
|
| 122 |
+
While it is not obvious that the assumption of a factorial logit distribution is valid here, we will see that Eq. (9) captures the universal features of the distribution at small values of the logit difference. Indeed, from the previous section we see that the form of Eq. (9) implies that the adversarial error rate should scale as follows
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
P ( \hat { \epsilon } < \epsilon ) \approx P ( \Delta _ { 1 2 } < \tilde { \epsilon } ) \approx C \tilde { \epsilon } + \mathcal { O } ( \tilde { \epsilon } ^ { 2 } )
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
as was broadly observed in the previous section.
|
| 129 |
+
|
| 130 |
+
To further test whether or not the mean field approximation is valid, we evaluate $\Delta _ { 1 j }$ for a number of different neural network architectures and datasets. We find that on all datasets and models studied, the $\Delta _ { 1 j }$ distributions have power-law tails. As predicted, $\Delta _ { 1 2 }$ has a power-law tail with an exponent of about 0, and $\Delta _ { 1 j }$ for $j > 2$ have power-law tails with positive exponents increasing with $j$ . We note, however, that the powers are typically not integral for large $j$ . It seems likely that this breakdown is the result of correlations between the logits. In Fig. 4, we compare distribution of $\Delta _ { 1 j }$ with $j = 2 , 3 , 4$ for ImageNet and logits that are independently sampled from a uniform distribution for 5 million samples with 10 classes. In Fig. 6 we see similar results for MNIST. Together these results verify our predictions over a vast set of networks and datasets.
|
| 131 |
+
|
| 132 |
+
The empirical results above show that adversarial error has a power-law form for well-studied and random datasets, simple full connected networks as well as complicated state-of-the-art models. It follows that the prevalence and commonality of adversarial examples is not due to the depth of the model (for example, see the linear model in Fig. 2 (a)), or the high-dimensionality of the datasets. Rather, they are due to the fact that lots of examples have small $\Delta _ { 1 2 }$ values. This makes it easy to find examples to fool the model at test-time.
|
| 133 |
+
|
| 134 |
+
It is interesting that the distribution of $\Delta _ { 1 j }$ , at small $\Delta _ { 1 j }$ , for trained models is essentially identical to that of i.i.d. random logits (especially for $j = 2$ ). This suggests that while our training procedures are good at modifying the largest logit in a way that leads to good clean accuracies, these procedures do not induce strong enough correlations between the logits to disrupt the essential scaling uncovered above. This problem is reminiscent of the problem distillation (Hinton et al., 2015) attempts to solve, by incorporating information about ratios of incorrect classes. This might be one of the reasons defensive distillation improves adversarial robustness. It would be interesting to study the distributions of logit differences during training of distillation networks.
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
Figure 4: (a) Distribution of $\Delta _ { 1 j }$ of NASNet-A trained on ImageNet. (b) Distribution of $\Delta _ { 1 j }$ for logits that are sampled independently from a uniform random distribution for 5 million samples with 10 classes. $\Delta _ { 1 j }$ of other models are in Appendix Fig. 14
|
| 138 |
+
|
| 139 |
+
Given the large density of small more robust. Our proposed los $\Delta _ { 1 2 }$ values, we study an entronction can be written as: $\begin{array} { r } { \mathrm { \bar { l o s s } } = \mathrm { o l d } \mathrm { \bar { l o s s } } - \lambda \sum _ { i = 1 } ^ { n } p _ { i } \log p _ { i } } \end{array}$ where is a hyperparameter, $n$ is the number of classes, and $p _ { i }$ are the outputs of the neural network. This regularization term has been used by Miyato et al. (2017) for semi-supervised learning tasks. It aims to increase the confidence of the network on each sample, which is the opposite of previous regularization attempts that penalized confidence to increase generalization accuracy (Pereyra et al.,
|
| 140 |
+
|
| 141 |
+
2017; Szegedy et al., 2015). By penalizing the entropy of the softmax outputs, we aim to increase the logit differences.
|
| 142 |
+
|
| 143 |
+
In Fig. 5, we show that entropy regularization with a $\lambda = 4 . 5$ increases the adversarial robustness both for regularly trained networks and step l.l. adversarially trained networks, and both for permutation invariant and regular MNIST. We note that the same qualitative results hold for other values of $\lambda$ we tried. Despite the increase in adversarial accuracy, the permutation invariant MNIST model has $0 . 8 \%$ lower clean accuracy when trained with the entropy penalty. In Appendix Fig. 11, we show that a wide ResNet trained with the entropy regularizer has improved robustness with no loss in clean accuracy.
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 5: Step l.l. attack adversarial accuracy as a function of $\epsilon$ for CNN and permutation invariant MNIST in (a) and (b), respectively. Regular training (purple), entropy regularization (red), adversarial training (green), and adversarial training with entropy regularization (blue) have been implemented. Adversarial training was done using the step l.l. method. In (c), we show the PGD attack adversarial accuracy on permutation invariant MNIST trained with and without step l.l. adversarial training.
|
| 147 |
+
|
| 148 |
+
We investigate whether the increased adversarial robustness is due to increased logit differences. In Fig. 6, we plot the distribution of $\Delta _ { 1 j }$ for $j$ up to 4, for two networks trained on permutation invariant MNIST, with and without entropy regularization. As expected, margins are shifted to larger values and density of samples with small $\Delta _ { 1 j }$ are reduced. The tails still follow a power-law form with the same exponents, however there are fewer samples with small margins compared to a regularly trained network. Although entropy regularization made our networks white-box attacks, it did not lead to a significant improvement against black-box attacks. For this reason, we focus on the influence of network architectures on adversarial sensitivity below.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 6: Distribution of $\Delta _ { 1 j }$ up to $j = 5$ for permutation invariant MNIST trained with and without entropy regularization in red and purple, respectively.
|
| 152 |
+
|
| 153 |
+
# 4 ROLE OF NETWORK ARCHITECTURES IN ADVERSARIAL ROBUSTNESS
|
| 154 |
+
|
| 155 |
+
Several recent papers observe that larger networks are more robust against adversarial examples, regardless if they are adversarially trained or not (Kurakin et al., 2016b; Madry et al., 2017). However, it is not clear if network architectures play an important role in adversarial robustness. Are larger models more robust because they have more trainable parameters, or simply because they have higher clean accuracy? Is it possible to find more robust network architectures that do not necessarily have more parameters? We run several experiments to answer these questions, as well as to find an adversarially more robust model on CIFAR10. We perform neural architecture search (NAS) with reinforcement learning. Our search space and procedure are almost exactly the same as in Zoph et al. (2017). One difference is that we restrict the search space so that the normal cell must be the same as the reduction cell. This reduces the complexity of the search space as now we have only half as many predictions. Finally, we increase the number of prediction steps from 5 to 7 to slightly gain back the complexity that was lost when we restricted the normal cell to be equal to the reduction cell.
|
| 156 |
+
|
| 157 |
+
We carry out two experiments:
|
| 158 |
+
|
| 159 |
+
• Experiment 1: NAS where child models are trained with clean and step l.l. adversarial examples and the reward is computed on the validation set with FGSM adversarial accuracy at $\epsilon = 8$ .
|
| 160 |
+
• Experiment 2: NAS where child models are trained with clean and PGD adversarial examples and the reward is computed on the validation set with FGSM adversarial accuracy at $\epsilon = 8$ .
|
| 161 |
+
|
| 162 |
+
In both experiments, child models are trained for 10 epochs on a training set of 25 thousand samples. Child models are trained on mini-batches where half of the samples are adversarially perturbed, following the procedure in (Kurakin et al., 2016b). At the end of each experiment, we pick the child model with the highest FGSM adversarial accuracy at $\epsilon = 8$ on the validation set of 5000 samples, and scale up the number of filters. We train the enlarged models for 100 epochs on the full training set of 45000 samples for 12 different hyperparameter sets, and pick the one with the highest adversarial accuracy on the validation set. Finally, we report below the performance of these models on a held-out test set of 10 thousand samples. To provide a comparison with the results of our two experiments, we also run a vanilla NAS where the reward is clean validation accuracy. We will refer to the best architecture from vanilla NAS as NAS Baseline. When trained using the setup above only on clean examples, NAS Baseline reaches a test set accuracy of $9 5 . 3 \%$ .
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 7: (a) step l.l. adversarial accuracy of NAS Baseline trained with and without step l.l. adversarial examples in green and red, respectively. Best model from Experiment 1 is shown in blue. (b) PGD adversarial accuracy of NAS Baseline trained with and without PGD adversarial examples in green and red, respectively. Best model from Experiment 2 is shown in blue.
|
| 166 |
+
|
| 167 |
+
We present the results of Experiment 1 in Fig 7(a). Here the green curve is the adversarial accuracy NAS Baseline. The blue curve is the adversarial accuracy of a network architecture that was found by Experiment 1. Both of these architectures are trained with the same adversarial training procedure. We try the same sets of hyperparameters and report here the models with best adversarial accuracy at $\epsilon = 8$ on the validation set. Adversarial training reduced the clean accuracy by $0 . 2 \%$ . Adversarially trained models both have clean accuracy of $9 5 . 1 \%$ on the test set, whereas the model that was trained without adversarial training reached $9 5 . 3 \%$ accuracy.
|
| 168 |
+
|
| 169 |
+
We next use PGD adversarial examples in the training of child models, to find architectures that are more robust to any adversarial attack within an $\epsilon$ ball (Madry et al., 2017). Following the training procedure by Madry et al. (2017), we use 7 steps of size 2, for a total $\epsilon = 8$ . We present the results of Experiment 2 in Fig. 7(b). As was the case in Experiment 1, the architecture found by adversarial NAS leads to a more robust model. At $\epsilon = 8$ , the architecture from Experiment 2 reaches a $17 \%$ higher adversarial accuracy on PGD examples. We compare our results to the results by Madry et al. (2017). Madry et al. (2017) trained only on PGD examples, whereas half of our minibatches are clean examples. Despite this, we match their accuracy on white-box PGD attacks. Against other white- and black-box attacks our model is more robust, and our clean accuracy is $5 . 9 \%$ higher. We also note that NAS Baseline model has 4.9 million trainable parameters, whereas the model from Experiments 1 and 2 have 2.3 million and 3.5 million parameters, respectively. NAS found an adversarially more robust architecture with many fewer parameters. Best architecture from Experiment 2 and NAS Baseline are presented in Appendix Fig. 16. Finally, we study the performance statistics of child models during NAS. In Fig. 8, we report the results for 9360 child models that were trained during Experiment 1. As explained above, these models are only trained for 10 epochs. In Fig. 8(a), we see that the correlation between adversarialy accuracy and the number of trainable parameters of the model is not very strong. On the other hand, adversarial accuracy is strongly correlated with clean accuracy (Fig. 8(b)). We hypothesize that this is the reason both Madry et al. (2017) and Kurakin et al. (2016b) found that making networks larger increased adversarial robustness, because it also increased the clean accuracy. This implies that commonly used architectures, like Inception v3 and ResNet, benefit from having more parameters. This however was not the case for most child models during NAS. On the other hand, having a high clean accuracy is not sufficient for adversarial robustness. As seen in Fig. 8(c), there is a large variance in the adversarial accuracy of models with good clean accuracy. The range of adversarial accuracies in the histogram of models with larger than $85 \%$ clean accuracy is $22 \%$ and the standard deviation is $2 . 6 \%$ . For this reason, our experiments led to more robust architectures than NAS Baseline.
|
| 170 |
+
|
| 171 |
+
Table 1: Performance of our best architecture from Experiment 2 at $\epsilon = 8$ . Black-box attacks are sourced from a copy of the network independently initialized and trained.
|
| 172 |
+
|
| 173 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>White-box</td><td rowspan=1 colspan=3>Black-box</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>step 1.1.</td><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>step 1.1.</td><td rowspan=1 colspan=1>PGD</td></tr><tr><td rowspan=1 colspan=1>Madry et al. (2017)</td><td rowspan=1 colspan=1>87.3%</td><td rowspan=1 colspan=1>56.1%</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>50.0%</td><td rowspan=1 colspan=1>67.0 %</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>64.2%</td></tr><tr><td rowspan=1 colspan=1>This work</td><td rowspan=1 colspan=1>93.2%</td><td rowspan=1 colspan=1>63.6%</td><td rowspan=1 colspan=1>77.9%</td><td rowspan=1 colspan=1>50.1%</td><td rowspan=1 colspan=1>78.1 %</td><td rowspan=1 colspan=1>84.9%</td><td rowspan=1 colspan=1>75.0%</td></tr></table>
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 8: Performance of child models on the validation set. FGSM adversarial accuracy at $\epsilon = 8$ vs. number of trainable parameters and clean accuracy in (a) and (b), respectively. Black dots represent each child model, purple line is a running average. Figure (c) is the histogram of the adversarial accuracy for models with clean accuracy larger than $85 \%$ .
|
| 177 |
+
|
| 178 |
+
# 5 CONCLUSION
|
| 179 |
+
|
| 180 |
+
In this paper we studied common properties of adversarial examples across different models and datasets. We theoretically derived a universality in logit differences and adversarial error of machine learning models. We showed that architecture plays an important role in adversarial robustness, which correlates strongly with clean accuracy.
|
| 181 |
+
|
| 182 |
+
# REFERENCES
|
| 183 |
+
|
| 184 |
+
Moustapha Cisse, Piotr Bojanowski, Edouard Grave, Yann Dauphin, and Nicolas Usunier. Parseval networks: Improving robustness to adversarial examples. In International Conference on Machine Learning, pp. 854–863, 2017.
|
| 185 |
+
|
| 186 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 187 |
+
|
| 188 |
+
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.
|
| 189 |
+
|
| 190 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 191 |
+
|
| 192 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 193 |
+
|
| 194 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016a.
|
| 195 |
+
|
| 196 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016b.
|
| 197 |
+
|
| 198 |
+
Yann LeCun and Corinna Cortes. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/.
|
| 199 |
+
|
| 200 |
+
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.
|
| 201 |
+
|
| 202 |
+
Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. arXiv preprint arXiv:1704.03976, 2017.
|
| 203 |
+
|
| 204 |
+
Aran Nayebi and Surya Ganguli. Biologically inspired protection of deep networks from adversarial attacks. arXiv preprint arXiv:1703.09202, 2017.
|
| 205 |
+
|
| 206 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. arXiv preprint arXiv:1602.02697, 2016a.
|
| 207 |
+
|
| 208 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016b.
|
| 209 |
+
|
| 210 |
+
Gabriel Pereyra, George Tucker, Jan Chorowski, Łukasz Kaiser, and Geoffrey Hinton. Regularizing neural networks by penalizing confident output distributions. arXiv preprint arXiv:1701.06548, 2017.
|
| 211 |
+
|
| 212 |
+
Ben Poole, Subhaneil Lahiri, Maithreyi Raghu, Jascha Sohl-Dickstein, and Surya Ganguli. Exponential expressivity in deep neural networks through transient chaos. In Advances In Neural Information Processing Systems, pp. 3360–3368, 2016.
|
| 213 |
+
|
| 214 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
|
| 215 |
+
|
| 216 |
+
Samuel S Schoenholz, Justin Gilmer, Surya Ganguli, and Jascha Sohl-Dickstein. Deep information propagation. arXiv preprint arXiv:1611.01232, 2016.
|
| 217 |
+
|
| 218 |
+
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.
|
| 219 |
+
|
| 220 |
+
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.
|
| 221 |
+
|
| 222 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2818–2826, 2016.
|
| 223 |
+
|
| 224 |
+
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI, pp. 4278–4284, 2017.
|
| 225 |
+
|
| 226 |
+
Florian Tramer, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick McDaniel. Ensemble \` adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017.
|
| 227 |
+
|
| 228 |
+
Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. arXiv preprint arXiv:1704.01155, 2017.
|
| 229 |
+
|
| 230 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
|
| 231 |
+
|
| 232 |
+
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
|
| 233 |
+
|
| 234 |
+
Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. arXiv preprint arXiv:1707.07012, 2017.
|
| 235 |
+
|
| 236 |
+
# 6 APPENDIX
|
| 237 |
+
|
| 238 |
+
# 6.1 FURTHER EXPERIMENTS
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 9: Adversarial error for hundreds of models trained on MNIST, including fully-connected and convolutional models. We only show models with clean accuracy larger than $80 \%$ .
|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
Figure 10: Points represent the adversarial error due to FGSM as a function of $\epsilon$ for a 32-layer ResNet trained on CIFAR10. Straight line is a power law fit with an exponent of 0.99.
|
| 245 |
+
|
| 246 |
+

|
| 247 |
+
Figure 11: Effect of adding an entropy regularization $( \lambda = 3 . 0 )$ ): step l.l. adversarial accuracy of wide ResNet on CIFAR10, with and without entropy regularization. Both models have a clean accuracy of $9 4 \%$ . They were both trained for 100 epochs with the same hyperparameters.
|
| 248 |
+
|
| 249 |
+
# 6.2 DERIVATIONS
|
| 250 |
+
|
| 251 |
+
Here we derive several of the results found in the main text.
|
| 252 |
+
|
| 253 |
+
# 6.2.1 LINEAR RESPONSE
|
| 254 |
+
|
| 255 |
+
First, we compute the linear response of the network to the $L _ { 2 }$ FGSM attack. Let, $f : \mathbb { R } ^ { N } \to \mathbb { R } ^ { M }$ be a neural network (or other model) structured such that $f = \operatorname { s o f t m a x } \circ h$ where $h : \mathbb { R } ^ { N } \to \mathbb { R } ^ { M }$ maps inputs to logits. Additionally define a loss $L : \mathbb { R } ^ { M } \to \mathbb { R }$ which can be cross-entropy, $L ^ { 2 }$ , etc.. To generate adversarial examples we start with an input $\boldsymbol { x } \in \mathbb { R } ^ { N }$ and a corresponding target $t \in \mathbb { R } ^ { M }$ such that $t _ { \beta } = 1$ if $\beta = \gamma$ for some $\gamma$ and $t _ { \beta } = 0$ otherwise. We assume our network gets the answer correct so that $h _ { \gamma } > h _ { \beta }$ for all $\beta \neq \gamma$ . Then we apply the adversarial perturbation,
|
| 256 |
+
|
| 257 |
+
$$
|
| 258 |
+
x _ { \alpha } ^ { \prime } = x _ { \alpha } + \epsilon \frac { \nabla _ { x } L } { | | \nabla _ { x } L | | _ { 2 } } .
|
| 259 |
+
$$
|
| 260 |
+
|
| 261 |
+
Note that we can write
|
| 262 |
+
|
| 263 |
+
$$
|
| 264 |
+
\nabla _ { x } L = { \frac { \partial L } { \partial x _ { \alpha } } } = \sum _ { \beta } { \frac { \partial h _ { \beta } } { \partial x _ { \alpha } } } { \frac { \partial L } { \partial h _ { \beta } } } = \sum _ { \beta } J _ { \alpha \beta } { \frac { \partial L } { \partial h _ { \beta } } } = J \delta .
|
| 265 |
+
$$
|
| 266 |
+
|
| 267 |
+
Where we associate $J _ { \alpha \beta } = \partial h _ { \beta } / \partial x _ { \alpha }$ with the input-to-logit Jacobian linking the inputs to the logits and $\delta = \partial L / \partial h _ { \beta }$ the error of the outputs of the network.
|
| 268 |
+
|
| 269 |
+

|
| 270 |
+
Figure 12: Fully connected network trained on MNIST with hinge loss. (a) Distributions of logit differences. (b) Red dots represent the adversarial error when FGSM attack uses the same hinge loss from training. Blue dots represent the adversarial error when FGSM attack uses a cross-entropy loss to create the adversarial examples.The line is a power-law fit with an exponent of 0.98
|
| 271 |
+
|
| 272 |
+

|
| 273 |
+
Figure 13: Fully connected network trained on MNIST with L2-norm loss. (a) Distributions of logit differences. (b) Black dots represent the adversarial error due to FGSM. The line is a power-law fit with an exponent of 1.02
|
| 274 |
+
|
| 275 |
+
We can compute the change to the logits of the network due to this perturbation. We find,
|
| 276 |
+
|
| 277 |
+
$$
|
| 278 |
+
\begin{array} { l } { \displaystyle h ( \boldsymbol { x } ^ { \prime } ) = h ( \boldsymbol { x } + \epsilon \nabla _ { \boldsymbol { x } } L / | | \nabla _ { \boldsymbol { x } } L | | _ { 2 } ) } \\ { \displaystyle h _ { \beta } ^ { \prime } \approx h _ { \beta } + \frac { \epsilon } { | | \nabla _ { \boldsymbol { x } } L | | _ { 2 } } \sum _ { \alpha } \frac { \partial h _ { \beta } } { \partial x _ { \alpha } } \frac { \partial L } { \partial x _ { \alpha } } + \mathcal { O } ( \epsilon ^ { 2 } ) } \\ { \displaystyle ~ = h _ { \beta } + \frac { \epsilon } { | | \nabla _ { \boldsymbol { x } } L | | _ { 2 } } \sum _ { \alpha \delta } \frac { \partial h _ { \beta } } { \partial x _ { \alpha } } \frac { \partial h _ { \delta } } { \partial x _ { \alpha } } \frac { \partial L } { \partial h _ { \delta } } } \end{array}
|
| 279 |
+
$$
|
| 280 |
+
|
| 281 |
+
where we have plugged in for eq. (11). Expressing the above equation in terms of the Jacobian, it follows that we can write the effect of the adversarial perturbation on the logits by,
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
h ^ { \prime } = h + \epsilon \frac { J ^ { T } J \delta } { | | J \delta | | _ { 2 } }
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
as postulated.
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
Figure 14: (a) Distribution of $\Delta _ { 1 N }$ for other ImageNet models.
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
Figure 15: (a) FGSM adversarial accuracy of NAS Baseline trained with and without step l.l. adversarial examples in green and red, respectively. Best model from Experiment 1 is shown in blue. (b) FGSM adversarial accuracy of NAS Baseline trained with and without PGD adversarial examples in green and red, respectively. Best model from Experiment 2 is shown in blue.
|
| 294 |
+
|
| 295 |
+
6.2.2 UNIVERSAL PROPERTIES OF THE LOGIT DIFFERENCE DISTRIBUTION
|
| 296 |
+
|
| 297 |
+
We now show that
|
| 298 |
+
|
| 299 |
+
$$
|
| 300 |
+
P ( \Delta _ { 1 j } ) = C \Delta _ { 1 j } ^ { j - 2 } + \mathcal { O } ( \Delta _ { 1 j } ^ { j - 1 } ) .
|
| 301 |
+
$$
|
| 302 |
+
|
| 303 |
+
To make progress we will again make a mean field approximation and assume that each of the logits are i.i.d. with arbitrary distribution $P ( h )$ . We denote the cumulative distribution $F ( h )$ . While it is not obvious that the factorial approximation is valid here, we will see that the resulting distribution of $P ( \Delta _ { 1 j } )$ shares many qualitative similarities with the distribution observed in real networks.
|
| 304 |
+
|
| 305 |
+
We first change variables from the logits to a sorted version of the logits, $r _ { i }$ . The ranked logits are defined such that $r _ { 1 } = \operatorname* { m a x } ( \{ h _ { i } \} )$ , $r _ { 2 } = \mathrm { m a x } ( \{ h _ { i } \} \backslash \{ r _ { 1 } \} ) , \cdot \cdot \cdot$ . Our first result is to compute the resulting joint distribution between $r _ { 1 }$ and $r _ { j }$ ,
|
| 306 |
+
|
| 307 |
+
$$
|
| 308 |
+
P _ { j } ( r _ { 1 } , r _ { j } ) = A ( N , j ) F ^ { N - j } ( r _ { j } ) \left[ F ( r _ { 1 } ) - F ( r _ { j } ) \right] ^ { j - 2 } P ( r _ { j } ) P ( r _ { 1 } )
|
| 309 |
+
$$
|
| 310 |
+
|
| 311 |
+
where $A ( N , j ) = N ( N - 1 ) { \binom { N - 2 } { j - 2 } }$ is a combinatorial factor. Eq. (18) has a simple interpretation. $F ^ { N - j } ( r _ { j } )$ is the probability that there are $N - j$ variables less than $r _ { j }$ ; $[ F ( r _ { 1 } ) - F ( r _ { j } ) ] ^ { j - 2 }$ is the probability that $j - 2$ variables are between $r _ { j }$ and $r _ { 1 }$ ; $P ( r _ { j } ) P ( r _ { 1 } )$ is the probability that there is one variable equal to each of $r _ { 1 }$ and $r _ { j }$ . The combinatorial factor can be understood since there are $N$ ways of selecting $r _ { 1 }$ , $N - 1$ ways of selecting $r _ { j }$ , and $\binom { N - 2 } { j - 2 }$ ways of choosing $j - 2$ variables out of the remaining $N - 2$ to be between $r _ { j }$ and $r _ { 1 }$ .
|
| 312 |
+
|
| 313 |
+
In terms of eq. (18) we can compute the distribution over $\Delta _ { 1 j }$ to be given by,
|
| 314 |
+
|
| 315 |
+
$$
|
| 316 |
+
\begin{array} { l } { { P ( \Delta _ { 1 j } ) = \displaystyle \int d r P _ { j } ( r + \Delta _ { 1 j } , r ) } } \\ { { \displaystyle \qquad = A ( N , j ) \int d r F ^ { N - j } ( r ) \left[ F ( r + \Delta _ { 1 j } ) - F ( r ) \right] ^ { j - 2 } P ( r ) P ( r + \Delta _ { 1 j } ) . } } \end{array}
|
| 317 |
+
$$
|
| 318 |
+
|
| 319 |
+
We can analyze this equation for small $\Delta _ { 1 j }$ . Expanding to lowest order in $\Delta _ { 1 j }$ ,
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
\begin{array} { l } { P ( \Delta _ { 1 j } ) \approx A ( N , j ) \displaystyle \int d r { \cal F } ^ { N - j } ( r ) \left[ { \cal F } ( r ) + \Delta _ { 1 j } P ( r ) - { \cal F } ( r ) \right] ^ { j - 2 } P ( r ) \left[ P ( r ) + \Delta _ { 1 j } \frac { d P ( r ) } { d r } \right] } \\ { \displaystyle ~ ( \Delta ( N , j ) \Delta _ { 1 j } ^ { j - 2 } \int d r { \cal F } ^ { N - j } ( r ) P ^ { j } ( r ) + \mathcal { O } ( \Delta _ { 1 j } ^ { j - 1 } ) . ~ } \end{array}
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
Since the term in the integral does not depend on $\Delta _ { 1 j }$ the result follows with,
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
{ \cal C } = { \cal N } ( N - 1 ) { \binom { N - 2 } { j - 2 } } \int d r F ^ { N - j } ( r ) P ^ { j } ( r ) .
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
# 6.2.3 ARCHITECTURES
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 16: Left: Best architecture from Experiment 1. Right: Architecture of NAS Baseline. We note that the architecture from Experiment 1 is “longer” and “narrower” than previous architectures found by NAS for higher clean accuracy (Zoph & Le, 2016; Zoph et al., 2017).
|
md/train/rk6cfpRjZ/rk6cfpRjZ.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING INTRINSIC SPARSE STRUCTURES WITHIN LONG SHORT-TERM MEMORY
|
| 2 |
+
|
| 3 |
+
Wei Wen∗, Yiran Chen & Hai Li Electrical and Computer Engineering, Duke University {wei.wen,yiran.chen,hai.li}@duke.edu
|
| 4 |
+
|
| 5 |
+
Yuxiong $\mathbf { H e } ^ { \dagger }$ , Samyam Rajbhandari†, Minjia Zhang†, Wenhan Wang†, Fang Liu§ & Bin $\mathbf { H } \mathbf { u } ^ { \mathrm { \ S } }$ Business AI† and Bing§, Microsoft {yuxhe,samyamr,minjiaz,wenhanw,fangliu,binhu}@microsoft.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Model compression is significant for the wide adoption of Recurrent Neural Networks (RNNs) in both user devices possessing limited resources and business clusters requiring quick responses to large-scale service requests. This work aims to learn structurally-sparse Long Short-Term Memory (LSTM) by reducing the sizes of basic structures within LSTM units, including input updates, gates, hidden states, cell states and outputs. Independently reducing the sizes of basic structures can result in inconsistent dimensions among them, and consequently, end up with invalid LSTM units. To overcome the problem, we propose Intrinsic Sparse Structures (ISS) in LSTMs. Removing a component of ISS will simultaneously decrease the sizes of all basic structures by one and thereby always maintain the dimension consistency. By learning ISS within LSTM units, the obtained LSTMs remain regular while having much smaller basic structures. Based on group Lasso regularization, our method achieves $1 0 . 5 9 \times$ speedup without losing any perplexity of a language modeling of Penn TreeBank dataset. It is also successfully evaluated through a compact model with only 2.69M weights for machine Question Answering of SQuAD dataset. Our approach is successfully extended to nonLSTM RNNs, like Recurrent Highway Networks (RHNs). Our source code is available1.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Model Compression (Jaderberg et al. (2014), Han et al. (2015a), Wen et al. (2017), Louizos et al. (2017)) is a class of approaches of reducing the size of Deep Neural Networks (DNNs) to accelerate inference. Structure Learning (Zoph & Le (2017), Philipp & Carbonell (2017), Cortes et al. (2017)) emerges as an active research area for DNN structure exploration, potentially replacing human labor with machine automation for design space exploration. In the intersection of both techniques, an important area is to learn compact structures in DNNs for efficient inference computation using minimal memory and execution time without losing accuracy. Learning compact structures in Convolutional Neural Networks (CNNs) have been widely explored in the past few years. Han et al. (2015b) proposed connection pruning for sparse CNNs. Pruning method also works successfully in coarse-grain levels, such as pruning filters in CNNs (Li et al. (2017)) and reducing neuron numbers (Alvarez & Salzmann (2016)). Wen et al. (2016) presented a general framework to learn versatile compact structures (neurons, filters, filter shapes, channels and even layers) in DNNs.
|
| 14 |
+
|
| 15 |
+
Learning the compact structures in Recurrent Neural Networks (RNNs) is more challenging. As a recurrent unit is shared across all the time steps in sequence, compressing the unit will aggressively affect all the steps. A recent work by Narang et al. (2017) proposes a pruning approach that deletes up to $9 0 \%$ connections in RNNs. Connection pruning methods sparsify weights of recurrent units but cannot explicitly change basic structures, e.g., the number of input updates, gates, hidden states, cell states and outputs. Moreover, the obtained sparse matrices have an irregular/nonstructured pattern of non-zero weights, which is unfriendly for efficient computation in modern hardware systems (Lebedev & Lempitsky (2016)). Previous study (Wen et al. (2016)) on sparse matrix multiplication in GPUs showed that the speedup2 was either counterproductive or ignorable. More specific, with sparsity3 of $6 7 . 6 \%$ , $9 2 . 4 \%$ , $9 7 . 2 \%$ , $9 6 . 6 \%$ and $9 4 . 3 \%$ in weight matrices of AlexNet, the speedup was $0 . 2 5 \times$ , $0 . 5 2 \times$ , $1 . 3 8 \times$ , $1 . 0 4 \times$ , and $1 . 3 6 \times$ , respectively. This problem also exists in CPUs. Fig. 1 shows that non-structured pattern in sparsity limits the speedup. We only starts to observe speed gain when the sparsity is beyond $8 0 \%$ , and the speedup is about $3 \times$ to $4 \times$ even when the sparsity is $9 5 \%$ which is far below the theoretical $2 0 \times$ . In this work, we focus on learning structurally sparse LSTMs for computation efficiency. More specific, we aim to reduce the number of basic structures simultaneously during learning, such that the obtained LSTMs have the original schematic with dense connections but with smaller sizes of these basic structures. Such compact models have structured sparsity, with columns and rows in weight matrices removed, whose computation efficiency is shown in Fig. 1. Moreover, off-the-shelf libraries in deep learning frameworks can be directly utilized to deploy the reduced LSTMs. Details should be explained.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Speedups of matrix multiplication using non-structured and structured sparsity. Speeds are measured in Intel MKL implementations in Intel Xeon CPU E5-2673 v3 $@$ $2 . 4 0 \mathrm { G H z }$ . General matrix-matrix multiplication (GEMM) of $\mathbf { W } \cdot \mathbf { X }$ is implemented by cblas sgemm. The matrix sizes are selected to reflect commonly used GEMMs in LSTMs. For example, (a) represents GEMM in LSTMs with hidden size 1500, input size 1500 and batch size 10. To accelerate GEMM by sparsity, W is sparsified. In non-structured sparsity approach, W is randomly sparsified and encoded as Compressed Sparse Row format for sparse computation (using mkl scsrmm); in structured sparsity approach, $2 k$ columns and $4 k$ rows in W are removed to match the same level of sparsity (i.e., the percentage of removed parameters) for faster GEMM under smaller sizes.
|
| 19 |
+
|
| 20 |
+
There is a vital challenge originated from recurrent units: as the basic structures interweave with each other, independently removing these structures can result in mismatch of their dimensions and then inducing invalid recurrent units. The problem does not exist in CNNs, where neurons (or filters) can be independently removed without violating the usability of the final network structure. One of our key contributions is to identify the structure inside RNNs that shall be considered as a group to most effectively explore sparsity in basic structures. More specific, we propose Intrinsic Sparse Structures (ISS) as groups to achieve the goal. By removing weights associated with one component of ISS, the sizes/dimensions (of basic structures) are simultaneously reduced by one.
|
| 21 |
+
|
| 22 |
+
We evaluated our method by LSTMs and RHNs in language modeling of Penn Treebank dataset (Marcus et al. (1993)) and machine Question Answering of SQuAD dataset (Rajpurkar et al. (2016)). Our approach works both in fine-tuning and in training from scratch. In a RNN with two stacked LSTM layers with hidden sizes of 1500 (i.e., 1500 components of ISS) for language modeling (Zaremba et al. (2014)), our method learns that the sizes of 373 and 315 in the first and second LSTMs, respectively, are sufficient for the same perplexity. It achieves $1 0 . 5 9 \times$ speedup of inference time. The result is obtained by training from scratch with the same number of epochs. Directly training LSTMs with sizes of 373 and 315 cannot achieve the same perplexity, which proves the advantage of learning ISS for model compression. Encouraging results are also obtained in more compact and state-of-the-art models – the RHN models (Zilly et al. (2017)) and BiDAF model (Seo et al. (2017)).
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
A major approach in DNN compression is to reduce the complexity of structures within DNNs. The studies can be categorized to three classes: removing redundant structures in original DNNs, approximating the original function of DNNs (Denil et al. (2013), Jaderberg et al. (2014), Hinton et al. (2015), Lu et al. (2016), Prabhavalkar et al. (2016), Molchanov et al. (2017)), and designing DNNs with inherently compact structures (Szegedy et al. (2015), He et al. (2016), Wu et al. (2017), Bradbury et al. (2016)). Our method belongs to the first category.
|
| 27 |
+
|
| 28 |
+
Research on removing redundant structures in Feed-forward Neural Networks (FNNs), typically in CNNs, has been extensively studied. Based on $\ell _ { 1 }$ regularization (Liu et al. (2015), Park et al. (2017)) or connection pruning (Han et al. (2015b), Guo et al. (2016)), the number of connections/parameters can be dramatically reduced. Group Lasso based methods were proved to be effective in reducing coarse-grain structures (e.g., neurons, filters, channels, filter shapes, and even layers) in CNNs (Wen et al. (2016), Alvarez & Salzmann (2016), Lebedev & Lempitsky (2016), Yoon & Hwang (2017)). For instance, Wen et al. (2016) reduced the number of layers from 32 to 18 in ResNet without any accuracy loss for CIFAR-10 dataset. A recent work by Narang et al. (2017) advances connection pruning techniques for RNNs. It compresses the size of Deep Speech 2 (Amodei et al. (2016)) from $2 6 8 \mathrm { M B }$ to around $3 2 \mathrm { { M B } }$ . However, to the best of our knowledge, little work has been carried out to reduce coarse-grain structures beyond fine-grain connections in RNNs. To fill this gap, our work targets to develop a method that can learn to reduce the number of basic structures within LSTM units. After learning those structures, final LSTMs are still regular LSTMs with the same connectivity, but have the sizes reduced.
|
| 29 |
+
|
| 30 |
+
Another line of related research is Structure Learning of FNNs or CNNs. Zoph & Le (2017) uses reinforcement learning to search good neural architectures. Philipp & Carbonell (2017) dynamically adds and eliminates neurons in FNNs by using group Lasso regularization. Cortes et al. (2017) gradually adds sub-networks to current networks to incrementally reduce the objective function. All these works focused on finding optimal structures in FNNs or CNNs for classification accuracy. In contrast, this work aims at learning compact structures in LSTMs for model compression.
|
| 31 |
+
|
| 32 |
+
# 3 LEARNING INTRINSIC SPARSE STRUCTURES
|
| 33 |
+
|
| 34 |
+
# 3.1 INTRINSIC SPARSE STRUCTURES
|
| 35 |
+
|
| 36 |
+
The computation within LSTMs is (Hochreiter & Schmidhuber (1997))
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { r l } & { \mathbf i _ { t } = \sigma \left( \mathbf x _ { t } \cdot \mathbf W _ { x i } + \mathbf h _ { t - 1 } \cdot \mathbf W _ { h i } + \mathbf b _ { i } \right) } \\ & { \mathbf f _ { t } = \sigma \left( \mathbf x _ { t } \cdot \mathbf W _ { x f } + \mathbf h _ { t - 1 } \cdot \mathbf W _ { h f } + \mathbf b _ { f } \right) } \\ & { \mathbf o _ { t } = \sigma \left( \mathbf x _ { t } \cdot \mathbf W _ { x o } + \mathbf h _ { t - 1 } \cdot \mathbf W _ { h o } + \mathbf b _ { o } \right) } \\ & { \mathbf u _ { t } = t a n h \left( \mathbf x _ { t } \cdot \mathbf W _ { x u } + \mathbf h _ { t - 1 } \cdot \mathbf W _ { h u } + \mathbf b _ { u } \right) } \\ & { \mathbf c _ { t } = \mathbf f _ { t } \odot \mathbf c _ { t - 1 } + \mathbf i _ { t } \odot \mathbf u _ { t } } \\ & { \mathbf h _ { t } = \mathbf o _ { t } \odot t a n h \left( \mathbf c _ { t } \right) } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where $\odot$ is element-wise multiplication, $\sigma ( \cdot )$ is sigmoid function, and $t a n h ( \cdot )$ is hyperbolic tangent function. Vectors are row vectors. Ws are weight matrices, which transform the concatenation (of hidden states $\mathbf { h } _ { t - 1 }$ and inputs $\mathbf { x } _ { t }$ ) to input updates $\mathbf { u } _ { t }$ and gates $( \mathbf { i } _ { t } , \mathbf { f } _ { t }$ and $\mathbf { o } _ { t }$ ). Fig. 2 is the schematic of LSTMs in the layout of Olah (2015). The transformations by Ws and the corresponding nonlinear functions are illustrated in rectangle blocks. Our goal is to reduce the size of this sophisticated structure within LSTMs, meanwhile maintaining the original schematic. Because of element-wise operators $ \mathrm { ( } ^ { 6 6 } \mathrm { ( } \oplus ^ { 3 } $ and “ $\circled { \times } \cdot$ ”), all vectors along the blue band in Fig. 2 must have the same dimension. We call this constraint as “dimension consistency”. The vectors required to obey the dimension consistency include input updates, all gates, hidden states, cell states, and outputs. Note that hidden states are usually outputs connected to classifier layer or stacked LSTM layers. As can be seen in Fig. 2, vectors (along the blue band) interweave with each other so removing an individual component from one or a few vectors independently can result in the violation of dimension consistency.
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
Figure 2: Intrinsic Sparse Structures (ISS) in LSTM units.
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 3: Applying Intrinsic Sparse Structures in weight matrices.
|
| 49 |
+
|
| 50 |
+
To overcome this, we propose Intrinsic Sparse Structures (ISS) within LSTMs as shown by the blue band in Fig. 2. One component of ISS is highlighted as the white strip. By decreasing the size of ISS (i.e., the width of the blue band), we are able to simultaneously reduce the dimensions of basic structures.
|
| 51 |
+
|
| 52 |
+
To learn sparse ISS, we turn to weight sparsifying. There are totally eight weight matrices in Eq. (1). We organize them in the form of Fig. 3 as basic LSTM cells in TensorFlow. We can remove one component of ISS by zeroing out all associated weights in the white rows and white columns in Fig. 3. Why? Suppose the $k$ -th hidden state of $\mathbf { h }$ is removable, then the $k$ -th row in the lower four weight matrices can be all zeros (as shown by the left white horizontal line in Fig. 3), because those weights are on connections receiving the $k$ -th useless hidden state. Likewise, all connections receiving the $k$ -th hidden state in next layer(s) can be removed as shown by the right white horizontal line. Note that next layer(s) can be an output layer, LSTM layers, fully-connected layers, or a mix of them. ISS overlay two or more layers, without explicit explanation, we refer to the first LSTM layer as the ownership of ISS. When the $k$ -th hidden state turns useless, the $k$ -th output gate and $k$ -th cell state generating this hidden state are removable. As the $k$ -th output gate is generated by the $k$ -th column in $\mathbf { W } _ { x o }$ and $\mathbf { W } _ { h o }$ , these weights can be zeroed out (as shown by the fourth vertical white line in Fig. 3). Tracing back against the computation flow in Fig. 2, we can reach similar conclusions for forget gates, input gates and input updates, as respectively shown by the first, second and third vertical line in Fig. 3. For convenience, we call the weights in white rows and columns as an “ISS weight group”. Although we propose ISS in LSTMs, variants of ISS for vanilla RNNs, Gated Recurrent Unit (GRU) (Cho et al. (2014)), and Recurrent Highway Networks (RHNs) (Zilly et al. (2017)) can also be realized based on the same philosophy.
|
| 53 |
+
|
| 54 |
+
For even a medium-scale LSTM, the number of weights in one ISS weight group can be very large. It seems to be very aggressive to simultaneously slaughter so many weights to maintain the original recognition performance. However, the proposed ISS intrinsically exists within LSTMs and can even be unveiled by independently sparsifying each weight using $\ell _ { 1 }$ -norm regularization. The experimental result is covered in Appendix A. It unveils that sparse ISS intrinsically exist in LSTMs and the learning process can easily converge to the status with a high ratio of ISS removed. In Section 3.2, we propose a learning method to explicitly remove much more ISS than the implicit $\ell _ { 1 }$ -norm regularization.
|
| 55 |
+
|
| 56 |
+
# 3.2 LEARNING METHOD
|
| 57 |
+
|
| 58 |
+
Suppose $\mathbf { w } _ { k } ^ { ( n ) }$ is a vector of all weights in the $k$ -th component of ISS in the $n$ -th LSTM layer $1 \leq n \leq N$ and $1 \leq k \leq K ^ { ( n ) } )$ , where $N$ is the number of LSTM layers and $K ^ { ( n ) }$ is the number of ISS components (i.e., hidden size) of the $n$ -th LSTM layer. The optimization goal is to remove as many “ISS weight groups” $\mathbf { w } _ { k } ^ { ( n ) }$ as possible without losing accuracy. Methods to remove weight groups (such as filters, channels and layers) have been successfully studied in CNNs as summarized in Section 2. However, how these methods perform in RNNs is unknown. Here, we extend the group Lasso based methods (Yuan & Lin (2006)) to RNNs for ISS sparsity learning. More specific, the group Lasso regularization is added to the minimization function in order to encourage sparsity in ISS. Formally, the ISS regularization is
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
R ( \mathbf { w } ) = \sum _ { n = 1 } ^ { N } \sum _ { k = 1 } ^ { K ^ { ( n ) } } \left| \left| \mathbf { w } _ { k } ^ { ( n ) } \right| \right| _ { 2 } ,
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where w is the vector of all weights and $| | \cdot | | _ { 2 }$ is $\ell _ { 2 }$ -norm (i.e., Euclidean length). In Stochastic Gradient Descent (SGD) training, the step to update each ISS weight group becomes
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\mathbf { w } _ { k } ^ { ( n ) } \mathbf { w } _ { k } ^ { ( n ) } - \eta \cdot ( \frac { \partial E ( \mathbf { w } ) } { \partial \mathbf { w } _ { k } ^ { ( n ) } } + \lambda \cdot \frac { \mathbf { w } _ { k } ^ { ( n ) } } { \mathbf { w } _ { k } ^ { ( n ) } _ { 2 } } ) ,
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where $E ( \mathbf { w } )$ is data loss, $\eta$ is learning rate and $\lambda > 0$ is the coefficient of group Lasso regularization to trade off recognition accuracy and ISS sparsity. The regularization gradient, i.e., the last term in Eq. (3), is a unit vector. It constantly squeezes the Euclidean length of each w(n)k t o zero, such that, a high portion of ISS components can be enforced to fully-zeros after learning. To avoid division by zero in the computation of regularization gradient, we can add a tiny number $\epsilon$ in $| | \cdot | | _ { 2 }$ , that is,
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\left| \left| \mathbf { w } _ { k } ^ { ( n ) } \right| \right| _ { 2 } \triangleq \sqrt { \epsilon + \sum _ { j } \left( w _ { k j } ^ { ( n ) } \right) ^ { 2 } } ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where wkj is the $j$ -th element of $\mathbf { w } _ { k } ^ { ( n ) }$ . We set $\epsilon = 1 . 0 e - 8$ . The learning method can effectively squeeze many groups near zeros, but it is very hard to exactly stabilize them as zeros because of the always-present fluctuating weight updates. Fortunately, the fluctuation is within a tiny ball centered at zero. To stabilize the sparsity during training, we zero out the weights whose absolute values are smaller than a pre-defined threshold $\tau$ . The process of thresholding is applied per mini-batch.
|
| 77 |
+
|
| 78 |
+
# 4 EXPERIMENTS
|
| 79 |
+
|
| 80 |
+
Our experiments use published models as baselines. The application domains include language modeling of Penn TreeBank and machine Question Answering of SQuAD dataset. For more comprehensive evaluation, we sparsify ISS in LSTM models with both a large hidden size of 1500 and a small hidden size of 100. We also extended ISS approach to state-of-the-art Recurrent Highway Networks (RHNs) (Zilly et al. (2017)) to reduce the number of units per layer. We maximize threshold $\tau$ to fully exploit the benefit. For a specific application, we preset $\tau$ by cross validation. The maximum $\tau$ which sparsifies the dense model (baseline) without deteriorating its performance is selected. The validation of $\tau$ is performed only once and no training effort is needed. $\tau$ is $1 . 0 e - 4$ for the stacked LSTMs in Penn TreeBank, and it is $4 . 0 e - 4$ for the RHN and the BiDAF model. We used HyperDrive by Rasley et al. (2017) to explore the hyperparameter of $\lambda$ . More details can be found in our source code.
|
| 81 |
+
|
| 82 |
+
To measure the inference speed, the experiments were run on a dual socket Intel Xeon CPU E5- $2 6 7 3 ~ \mathrm { v } 3 ~ \textcircled { \div } \ 2 . 4 0 \mathrm { G H z }$ processor with a total of 24 cores (12 per socket) and 128GB of memory. Intel MKL library 2017 update 2 was used for matrix-multiplication operations. OpenMP runtime was utilized for parallelism. We used Intel $\mathrm { C } { + + }$ Compiler 17.0 to generate executables that were run on Windows Server 2016. Each of the experiments was run for 1000 iterations, and the execution time was averaged to find the execution latency.
|
| 83 |
+
|
| 84 |
+
Table 1: Learning ISS sparsity from scratch in stacked LSTMs.
|
| 85 |
+
|
| 86 |
+
<table><tr><td>Method</td><td>Dropout keep ratio</td><td>Perplexity (validate, test)</td><td>ISS #in (1st,2nd) LSTM</td><td>Weight #</td><td>Total time*</td><td>Speedup</td><td>Mult-add reduction†</td></tr><tr><td>baseline</td><td>0.35</td><td>(82.57, 78.57)</td><td>(1500,1500)</td><td>66.0M</td><td>157.0ms</td><td>1.00×</td><td>1.00×</td></tr><tr><td>ISS</td><td>0.60</td><td>(82.59,78.65) (80.24,76.03)</td><td>(373,315) (381,535)</td><td>21.8M 25.2M</td><td>14.82ms 22.11ms</td><td>10.59× 7.10×</td><td>7.48× 5.01×</td></tr><tr><td>direct design</td><td>0.55</td><td>(90.31, 85.66)</td><td>(373,315)</td><td>21.8M</td><td>14.82ms</td><td>10.59×</td><td>7.48x</td></tr></table>
|
| 87 |
+
|
| 88 |
+
\* Measured with 10 batch size and 30 unrolled steps. † The reduction of multiplication-add operations in matrix multiplication. Defined as (original Mult-add)/(left Mult-add)
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 4: Intrinsic Sparse Structures learned by group Lasso regularization (zoom in for better view). Original weight matrices are plotted, where blue dots are nonzero weights and white ones refer zeros. For better visualization, original matrices are evenly down-sampled by $1 0 \times 1 0$ .
|
| 92 |
+
|
| 93 |
+
# 4.1 LANGUAGE MODELING
|
| 94 |
+
|
| 95 |
+
# 4.1.1 STACKED LSTMS
|
| 96 |
+
|
| 97 |
+
A RNN with two stacked LSTM layers for language modeling (Zaremba et al. (2014)) is selected as the baseline. It has hidden sizes of 1500 (i.e., 1500 components of ISS) in both LSTM units. The output layer has a vocabulary of 10000 words. The dimension of word embedding in the input layer is 1500. Word embedding layer is not sparsified because the computation of selecting a vector from a matrix is very efficient. The same training scheme as the baseline is adopted to learn ISS sparsity, except a larger dropout keep ratio of 0.6 versus 0.35 of the baseline because group Lasso regularization can also avoid over-fitting. All models are trained from scratch for 55 epochs. The results are shown in Table 1. Note that, when trained using dropout keep ratio of 0.6 without adopting group Lasso regularization, the baseline over-fits and the lowest validation perplexity is 97.73. The trade-off of perplexity and sparsity is controlled by $\lambda$ . In the second row, with tiny perplexity difference from baseline, our approach can reduce the number of ISS in the first and second LSTM unit from 1500, down to 373 and 315, respectively. It reduces the model size from 66.0M to 21.8M and achieves $1 0 . 5 9 \times$ speedup. Remarkably, the practical speedup $( 1 0 . 5 9 \times )$ even goes beyond theoretical mult-add reduction $( 7 . 4 8 \times )$ as shown in Table 1 —which comes from the increased computational efficiency. When applying structured sparsity, the underlying weight matrices become smaller so as to fit into the L3 cache with good locality, which improves the FLOPS (floating point operations per second). This is a key advantage of our approach over non-structurally sparse RNNs generated by connection pruning (Narang et al. (2017)), which suffers from irregular memory access pattern and inferior-theoretical speedup. At last, when learning a compact structure, our method can perform as structure regularization to avoid overfitting. As shown in the third row in Table 1, lower perplexity is achieved by even a smaller (25.2M) and faster $( 7 . 1 0 \times )$ model. Its learned weight matrices are visualized in Fig. 4, where 1119 and 965 ISS components shown by white strips are removed in the first and second LSTM, respectively.
|
| 98 |
+
|
| 99 |
+
A straightforward way to reduce model complexity is to directly design a RNN with a smaller hidden size and train from scratch. Compare with direct design approach, our ISS method can automatically learn optimal structures within LSTMs. More importantly, compact models learned by ISS method have lower perplexity, comparing with direct design method. To evaluate it, we directly design a RNN with exactly the same structure of the second RNN in Table 1 and train it from scratch instead of learning ISS from a larger RNN. The result is included in the last row of Table 1. We tuned dropout keep ratio to get best perplexity for the directly-designed RNN. The final test perplexity is 85.66, which is 7.01 higher that our ISS method.
|
| 100 |
+
|
| 101 |
+
Table 2: Learning ISS sparsity from scratch in RHNs.
|
| 102 |
+
|
| 103 |
+
<table><tr><td>Method</td><td>入</td><td>Perplexity (validate, test)</td><td>RHN width</td><td>Parameter #</td></tr><tr><td>baseline</td><td>0.0</td><td>(67.9, 65.4)</td><td>830</td><td>23.5M</td></tr><tr><td>ISs</td><td>0.004</td><td>(67.5, 65.0)</td><td>726</td><td>18.9M</td></tr><tr><td>ISS*</td><td>0.005</td><td>(68.1, 65.4)</td><td>517</td><td>11.1M</td></tr><tr><td>ISS*</td><td>0.006</td><td>(70.3, 67.7)</td><td>403</td><td>7.6M</td></tr><tr><td>ISS*</td><td>0.007</td><td>(74.5, 71.2)</td><td>328</td><td>5.7M</td></tr></table>
|
| 104 |
+
|
| 105 |
+
\* All dropout ratios are multiplied by $0 . 6 \times$
|
| 106 |
+
|
| 107 |
+
# 4.1.2 EXTENSION TO RECURRENT HIGHWAY NETWORKS
|
| 108 |
+
|
| 109 |
+
Recurrent Highway Networks (RHN) (Zilly et al. (2017)) is a class of state-of-the-art recurrent models, which enable “step-to-step transition depths larger than one”. In a RHN, we define the number of units per layer as RHN width. Specifically, we select the “Variational $\mathrm { R H N } + \mathrm { W T } ^ { \dag }$ model in Table 1 of Zilly et al. (2017) as the baseline. It has depth 10 and width 830, with totally 23.5M parameters. In a nutshell, our approach can reduce the RHN width from 830 to 517 without losing perplexity.
|
| 110 |
+
|
| 111 |
+
Following the same idea of identifying the “ISS weight groups” to reduce the size of basic structures in LSTMs, we can identify the groups in RHNs to reduce the RHN width. In brief, one group include corresponding columns/rows in weight matrices of the $H$ nonlinear transform, of the $T$ and $C$ gates, and of the embedding and output layers. The group size is 46520. The groups are indicated by JSON files in our source code4. By learning ISS in RHNs, we can simultaneously reduce the dimension of word embedding and the number of units per layer.
|
| 112 |
+
|
| 113 |
+
Table 2 summarizes results. All experiments are trained from scratch with the same hyperparameters in the baseline, except that smaller dropout ratios are used in ISS learning. Larger $\lambda$ , smaller RHN width but higher perplexity. More importantly, without losing perplexity, our approach can learn a smaller model with RHN width 517 from an initial model with RHN width 830. This reduces the model size to 11.1M, which is $5 2 . 8 \%$ reduction. Moreover, ISS learning can find a smaller RHN model with width 726, meanwhile improve the state-of-the-art perplexity as shown by the second entry in Table 2.
|
| 114 |
+
|
| 115 |
+
# 4.2 MACHINE READING COMPREHENSION
|
| 116 |
+
|
| 117 |
+
We evaluate ISS method by state-of-the-art dataset (SQuAD) and model (BiDAF). SQuAD (Rajpurkar et al. (2016)) is a recently released reading comprehension dataset, crowdsourced from 100, $0 0 0 +$ question-answer pairs on $5 0 0 +$ Wikipedia articles. ExactMatch (EM) and F1 scores are two major metrics for the task5. The higher those scores are, the better the model is. We adopt BiDAF (Seo et al. (2017)) to evaluate how ISS method works in small LSTM units. BiDAF is a compact machine Question Answering model with totally 2.69M weights. The ISS sizes are only 100 in all LSTM units. The implementation of BiDAF is made available by its authors 6.
|
| 118 |
+
|
| 119 |
+
BiDAF has character, word and contextual embedding layers to extract representations from input sentences, following which are bi-directional attention layer, modeling layer, and final output layer. LSTM units are used in contextual embedding layer, modeling layer, and output layer. All LSTMs are bidirectional (Schuster & Paliwal (1997)). In a bidirectional LSTM, there are one forward plus one backward LSTM branch. The two branches share inputs and their outputs are concatenated for next stacked layers. We found that it is hard to remove ISS components in contextual embedding layer, because the representations are relatively dense as it is close to inputs and the original hidden size (100) is relatively small. In our experiments, we exclude LSTMs in contextual embedding layer and sparsify all other LSTM layers. Those LSTM layers are the computation bottleneck of BiDAF.
|
| 120 |
+
|
| 121 |
+
Table 3: Remaining ISS components in BiDAF by fine-tuning.
|
| 122 |
+
|
| 123 |
+
<table><tr><td>EM</td><td>F1</td><td>ModFwd1</td><td>ModBwd1</td><td>ModFwd2</td><td>ModBwd2</td><td>OutFwd</td><td>OutBwd</td><td>weight #</td><td>Total time*</td></tr><tr><td>67.98</td><td>77.85</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td><td>2.69M</td><td>6.20ms</td></tr><tr><td>67.21</td><td>76.71</td><td>100</td><td>95</td><td>78</td><td>82</td><td>71</td><td>52</td><td>2.08M</td><td>5.79ms</td></tr><tr><td>66.59</td><td>76.40</td><td>84</td><td>90</td><td>38</td><td>46</td><td>34</td><td>21</td><td>1.48M</td><td>4.52ms</td></tr><tr><td>65.29</td><td>75.47</td><td>54</td><td>47</td><td>22</td><td>30</td><td>18</td><td>12</td><td>1.03M</td><td>3.54ms</td></tr><tr><td>64.81</td><td>75.22</td><td>52</td><td>50</td><td>19</td><td>26</td><td>15</td><td>12</td><td>1.01M</td><td>3.51ms</td></tr></table>
|
| 124 |
+
|
| 125 |
+
Measured with batch size 1.
|
| 126 |
+
|
| 127 |
+
Table 4: Remaining ISS components in BiDAF by training from scratch.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>EM</td><td>F1</td><td>ModFwd1</td><td>ModBwd1</td><td>ModFwd2</td><td>ModBwd2</td><td>OutFwd</td><td>OutBwd</td><td>weight #</td><td>Total time*</td></tr><tr><td>67.98</td><td>77.85</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td><td>2.69M</td><td>6.20ms</td></tr><tr><td>67.36</td><td>77.16</td><td>87</td><td>81</td><td>87</td><td>92</td><td>74</td><td>96</td><td>2.29M</td><td>5.83ms</td></tr><tr><td>66.32</td><td>76.22</td><td>51</td><td>33</td><td>42</td><td>58</td><td>37</td><td>26</td><td>1.17M</td><td>4.46ms</td></tr><tr><td>65.36</td><td>75.78</td><td>20</td><td>33</td><td>40</td><td>38</td><td>31</td><td>16</td><td>0.95M</td><td>3.59ms</td></tr><tr><td>64.60</td><td>74.99</td><td>23</td><td>22</td><td>35</td><td>35</td><td>25</td><td>14</td><td>0.88M</td><td>2.74ms</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Measured with batch size 1.
|
| 132 |
+
|
| 133 |
+
We profiled the computation time on CPUs, and find those LSTM layers (excluding contextual embedding layer) consume $7 6 . 4 7 \%$ of total inference time. There are three bi-directional LSTM layers we will sparsify, two of which belong to the modeling layer, and one belongs to the output layer. More details of BiDAF are covered by Seo et al. (2017). For brevity, we mark the forward (backward) path of the 1st bi-directional LSTM in the modeling layer as ModFwd1 (ModBwd1). Similarly, ModFwd2 and ModBwd2 are for the 2nd bi-directional LSTM. Forward (backward) LSTM path in the output layer are marked as OutFwd and OutBwd.
|
| 134 |
+
|
| 135 |
+
As discussed in Section 3.1, multiple parallel layers can receive the hidden states from the same LSTM layer and all connections (weights) receive those hidden states belong to the same ISS. For instance, ModFwd2 and ModBwd2 both receive hidden states of ModFwd1 as inputs, therefore the $k$ -th “ISS weight group” includes the $k$ -th rows of weights in both ModFwd2 and ModBwd2, plus the weights in the $k$ -th ISS component within ModFwd1. For simplicity, we use “ISS of ModFwd1” to refer to the whole group of weights. Structures of six ISS are included in Table 5 in Appendix B. We learn ISS sparsity in BiDAF by both fine-tuning the baseline and training from scratch. All the training schemes keep as the same as the baseline except applying a higher dropout keep ratio. After training, we zero out weights whose absolute values are smaller than 0.02. This does not impact EM and F1 scores, but increase sparsity.
|
| 136 |
+
|
| 137 |
+
Table 3 shows the EM, F1, the number of remaining ISS components, model size, and inference speed. The first row is the baseline BiDAF. Other rows are obtained by fine-tuning baseline using ISS regularization. In the second row by learning ISS, with small EM and F1 loss, we can reduce ISS in all LSTMs except ModFwd1. For example, almost half of the ISS components are removed in OutBwd. By increasing the strength of group Lasso regularization $( \lambda )$ , we can increase the ISS sparsity by losing some EM/F1 scores. The trade-off is listed in Table 3. With 2.63 F1 score loss, the sizes of OutFwd and OutBwd can be reduced from original 100 to 15 and 12, respectively. At last, we find it hard to reduce ISS sizes without losing any EM/F1 score. This implies that BiDAF is compact enough and its scale is suitable for both computation and accuracy. However, our method can still significantly compress this compact model under acceptable performance loss.
|
| 138 |
+
|
| 139 |
+
At last, instead of fine-tuning baseline, we train BiDAF from scratch with ISS learning. The results are summarized in Table 4. Our approach also works well when training from scratch. Overall, training from scratch balances the sparsity across all layers better than fine-tuning, which results in even better compression of model size and speedup of inference time. The histogram of vector lengths of “ISS weight groups” is plotted in Appendix C.
|
| 140 |
+
|
| 141 |
+
# 5 CONCLUSION
|
| 142 |
+
|
| 143 |
+
We proposed Intrinsic Sparse Structures (ISS) within LSTMs and its learning method to simultaneously reduce the sizes of input updates, gates, hidden states, cell states and outputs within the sophisticated LSTM structure. By learning ISS, a structurally sparse LSTM can be obtained, which essentially is a regular LSTM with reduced hidden dimension. Thus, no software or hardware specific customization is required to get storage saving and computation acceleration. Though ISS is proposed with LSTMs, it can be easily extended to vanilla RNNs, Gated Recurrent Unit (GRU) (Cho et al. (2014)), and Recurrent Highway Networks (RHNs) (Zilly et al. (2017)).
|
| 144 |
+
|
| 145 |
+
# ACKNOWLEDGMENTS
|
| 146 |
+
|
| 147 |
+
Thank researchers and engineers in Microsoft for giving valuable feedback on this work, with acknowledgments to Wei He, Freddie Zhang, Yi Liu, Jacob Devlin and Chen Zhou. Also thank Jeff Rasley (intern in Microsoft Research, Brown University) for helping me to use HyperDrive (Rasley et al. (2017)) for hyper-parameter exploration. This work was supported in part by NSF CCF1744082, NSF CCF-1725456 and DOE SC0017030. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of NSF, DOE, or their contractors.
|
| 148 |
+
|
| 149 |
+
# REFERENCES
|
| 150 |
+
|
| 151 |
+
Jose M Alvarez and Mathieu Salzmann. Learning the number of neurons in deep networks. In Advances in Neural Information Processing Systems, 2016.
|
| 152 |
+
|
| 153 |
+
Dario Amodei, Sundaram Ananthanarayanan, Rishita Anubhai, Jingliang Bai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, Qiang Cheng, Guoliang Chen, et al. Deep speech 2: Endto-end speech recognition in english and mandarin. In International Conference on Machine Learning, pp. 173–182, 2016.
|
| 154 |
+
|
| 155 |
+
James Bradbury, Stephen Merity, Caiming Xiong, and Richard Socher. Quasi-recurrent neural networks. arXiv:1611.01576, 2016.
|
| 156 |
+
|
| 157 |
+
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:1406.1078, 2014.
|
| 158 |
+
|
| 159 |
+
Corinna Cortes, Xavi Gonzalvo, Vitaly Kuznetsov, Mehryar Mohri, and Scott Yang. Adanet: Adaptive structural learning of artificial neural networks. In Proceedings of the 34th International Conference on Machine Learning, pp. 874–883, 2017.
|
| 160 |
+
|
| 161 |
+
Misha Denil, Babak Shakibi, Laurent Dinh, Nando de Freitas, et al. Predicting parameters in deep learning. In Advances in Neural Information Processing Systems, 2013.
|
| 162 |
+
|
| 163 |
+
Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In Advances In Neural Information Processing Systems, 2016.
|
| 164 |
+
|
| 165 |
+
Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv:1510.00149, 2015a.
|
| 166 |
+
|
| 167 |
+
Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, 2015b.
|
| 168 |
+
|
| 169 |
+
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.
|
| 170 |
+
|
| 171 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 172 |
+
|
| 173 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 174 |
+
|
| 175 |
+
Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. arXiv:1405.3866, 2014.
|
| 176 |
+
|
| 177 |
+
Vadim Lebedev and Victor Lempitsky. Fast convnets using group-wise brain damage. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2554–2564, 2016.
|
| 178 |
+
|
| 179 |
+
Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In International Conference on Learning Representations (ICLR), 2017.
|
| 180 |
+
|
| 181 |
+
Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 806–814, 2015.
|
| 182 |
+
|
| 183 |
+
Christos Louizos, Karen Ullrich, and Max Welling. Bayesian compression for deep learning. arXiv:1705.08665, 2017.
|
| 184 |
+
|
| 185 |
+
Zhiyun Lu, Vikas Sindhwani, and Tara N Sainath. Learning compact recurrent neural networks. In Acoustics, Speech and Signal Processing (ICASSP), 2016 IEEE International Conference on, pp. 5960–5964. IEEE, 2016.
|
| 186 |
+
|
| 187 |
+
Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 19(2):313–330, 1993.
|
| 188 |
+
|
| 189 |
+
Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. In International Conference on Learning Representations (ICLR), 2017.
|
| 190 |
+
|
| 191 |
+
Sharan Narang, Gregory Diamos, Shubho Sengupta, and Erich Elsen. Exploring sparsity in recurrent neural networks. arXiv:1704.05119, 2017.
|
| 192 |
+
|
| 193 |
+
Christopher Olah. Understanding lstm networks. GITHUB blog, posted on August, 27:2015, 2015.
|
| 194 |
+
|
| 195 |
+
Jongsoo Park, Sheng Li, Wei Wen, Ping Tak Peter Tang, Hai Li, Yiran Chen, and Pradeep Dubey. Faster cnns with direct sparse convolutions and guided pruning. In International Conference on Learning Representations (ICLR), 2017.
|
| 196 |
+
|
| 197 |
+
George Philipp and Jaime G Carbonell. Nonparametric neural networks. In International Conference on Learning Representations (ICLR), 2017.
|
| 198 |
+
|
| 199 |
+
Rohit Prabhavalkar, Ouais Alsharif, Antoine Bruguier, and Lan McGraw. On the compression of recurrent neural networks with an application to lvcsr acoustic modeling for embedded speech recognition. In Acoustics, Speech and Signal Processing (ICASSP), 2016 IEEE International Conference on, pp. 5970–5974. IEEE, 2016.
|
| 200 |
+
|
| 201 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv:1606.05250, 2016.
|
| 202 |
+
|
| 203 |
+
Jeff Rasley, Yuxiong He, Feng Yan, Olatunji Ruwase, and Rodrigo Fonseca. HyperDrive: Exploring Hyperparameters with POP Scheduling. In Proceedings of the 18th International Middleware Conference, Middleware ’17. ACM, 2017.
|
| 204 |
+
|
| 205 |
+
Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, 1997.
|
| 206 |
+
|
| 207 |
+
Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. In International Conference on Learning Representations (ICLR), 2017.
|
| 208 |
+
|
| 209 |
+
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.
|
| 210 |
+
|
| 211 |
+
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, 2016.
|
| 212 |
+
|
| 213 |
+
Wei Wen, Cong Xu, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Coordinating filters for faster deep neural networks. In The IEEE International Conference on Computer Vision (ICCV), October 2017.
|
| 214 |
+
|
| 215 |
+
Chunpeng Wu, Wei Wen, Tariq Afzal, Yongmei Zhang, Yiran Chen, and Hai Li. A compact dnn: Approaching googlenet-level accuracy of classification and domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2017.
|
| 216 |
+
|
| 217 |
+
Jaehong Yoon and Sung Ju Hwang. Combined group and exclusive sparsity for deep neural networks. In International Conference on Machine Learning, pp. 3958–3966, 2017.
|
| 218 |
+
|
| 219 |
+
Ming Yuan and Yi Lin. Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68(1):49–67, 2006.
|
| 220 |
+
|
| 221 |
+
Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv:1409.2329, 2014.
|
| 222 |
+
|
| 223 |
+
Julian Georg Zilly, Rupesh Kumar Srivastava, Jan Koutn´ık, and Jurgen Schmidhuber. Recurrent ¨ highway networks. In Proceedings of the 34th International Conference on Machine Learning, pp. 4189–4198, 2017.
|
| 224 |
+
|
| 225 |
+
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations (ICLR), 2017.
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
Figure 5: Intrinsic Sparse Structures unveiled by $\ell _ { 1 }$ regularization (zoom in for a better view). The top row shows the original weight matrices, where blue dots are nonzero weights and white ones refer zeros; the bottom row are the weight matrices in the format of Fig. 3, where white strips are ISS components whose weights are all zeros. For better visualization, the original matrices are evenly down-sampled by $1 0 \times 1 0$ .
|
| 229 |
+
|
| 230 |
+
We take the large stacked LSTMs by Zaremba et al. (2014) for language modeling as the example. The network has two stacked LSTM layers whose dimensions of inputs and states are both 1500, and it has an output layer with a vocabulary of 10000 words. The sizes of “ISS weight groups” of two LSTM layers are 24000 and 28000. The perplexities of validation set and test set are respectively 82.57 and 78.57. We fine-tune this baseline LSTMs with $\ell _ { 1 }$ -norm regularization. The same training hyper-parameters as the baseline are adopted, except a bigger dropout keep ratio of 0.6 (original 0.35). A weaker dropout is used because $\ell _ { 1 }$ -norm is also a regularization to avoid overfitting. A too strong dropout plus $\ell _ { 1 }$ -norm regularization can result in underfitting. The weight decay of $\ell _ { 1 }$ - norm regularization is 0.0001. The sparsified network has validation perplexity and test perplexity of 82.40 and 78.60, respectively, which is approximately the same with the baseline. The sparsity of weights in the first LSTM layer, the second LSTM layer and the last output layer is $9 1 . 6 6 \%$ , $9 0 . 3 2 \%$ and $9 0 . 2 2 \%$ , respectively. Fig. 5 plots the learned sparse weight matrices. The sparse matrices in the top row reveal some interesting patterns: there are lots of all-zero columns and rows, and their positions are highly correlated. Those patterns are profiled in the bottom row. Much to our surprise, sparsifying individual weight independently can converge to sparse LSTMs with many ISS removed—504 and 220 ISS components in the first and second LSTM layer are all-zeros.
|
| 231 |
+
|
| 232 |
+
# APPENDIX B ISS IN BIDAF
|
| 233 |
+
|
| 234 |
+
Table 5: The ISS in BiDAF.
|
| 235 |
+
|
| 236 |
+
<table><tr><td>LSTM name</td><td>Dimensions of weight matrix</td><td>Receivers of hidden states</td><td>Size of “ISS weight group”</td></tr><tr><td>ModFwd1</td><td>900 × 400</td><td>ModFwd2 ModBwd2</td><td>4800</td></tr><tr><td>ModBwd1</td><td>900 × 400</td><td>ModFwd2 ModBwd2</td><td>4800</td></tr><tr><td>ModFwd2</td><td>300 × 400</td><td>OutFwd OutBwd logit layer for start index</td><td>3201</td></tr><tr><td>ModBwd2</td><td>300 × 400</td><td>OutFwd OutBwd logit layer for start index</td><td>3201</td></tr><tr><td>OutFwd</td><td>1500 × 400</td><td>logit layer for end index</td><td>6401</td></tr><tr><td>OutBwd</td><td>1500 × 400</td><td>logit layer for end index</td><td>6401</td></tr></table>
|
| 237 |
+
|
| 238 |
+

|
| 239 |
+
Figure 6: Histogram of vector lengths of “ISS weight groups” in BiDAF. The ISS-learned BiDAF is the one in the third row of Table 4 with $\mathrm { E M 6 6 . 3 2 }$ and F1 76.22. Using our approach, the lengths are regularized closer to zeros with a peak at the zero, resulting in high ISS sparsity.
|
md/train/rk6qdGgCZ/rk6qdGgCZ.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FIXING WEIGHT DECAY REGULARIZATION IN ADAM
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We note that common implementations of adaptive gradient algorithms, such as Adam, limit the potential benefit of weight decay regularization, because the weights do not decay multiplicatively (as would be expected for standard weight decay) but by an additive constant factor. We propose a simple way to resolve this issue by decoupling weight decay and the optimization steps taken w.r.t. the loss function. We provide empirical evidence that our proposed modification (i) decouples the optimal choice of weight decay factor from the setting of the learning rate for both standard SGD and Adam, and (ii) substantially improves Adam’s generalization performance, allowing it to compete with SGD with momentum on image classification datasets (on which it was previously typically outperformed by the latter). We also demonstrate that longer optimization runs require smaller weight decay values for optimal results and introduce a normalized variant of weight decay to reduce this dependence. Finally, we propose a version of Adam with warm restarts (AdamWR) that has strong anytime performance while achieving state-ofthe-art results on CIFAR-10 and ImageNet32x32. Our source code will become available after the review process.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Adaptive gradient methods, such as AdaGrad (Duchi et al., 2011), RMSProp (Tieleman & Hinton, 2012), and Adam (Kingma & Ba, 2014) have become a default method of choice for training feedforward and recurrent neural networks (Xu et al., 2015; Gregor et al., 2015; Radford et al., 2015). Nevertheless, state-of-the-art results for popular image classification datasets, such as CIFAR-10 and CIFAR-100 Krizhevsky (2009), are still obtained by applying SGD with momentum (Huang et al., 2016; 2017; Loshchilov & Hutter, 2016; Gastaldi, 2017). Furthermore, Wilson et al. (2017) suggested that adaptive gradient methods do not generalize as well as SGD with momentum when tested on a diverse set of deep learning tasks such as image classification, character-level language modeling and constituency parsing. Different hypotheses about the origins of this worse generalization have been investigated, such as the presence of sharp local minima (Keskar et al., 2016; Dinh et al., 2017) and inherent problems of adaptive gradient methods (Wilson et al., 2017). In this paper, we show that a major factor in the poor generalization of the most popular adaptive gradient method, Adam, lies in its dysfunctional implementation of weight decay; the issue we identify in Adam also pertains to other adaptive gradient methods.
|
| 12 |
+
|
| 13 |
+
Specifically, our analysis of Adam given in this paper leads to the following observations:
|
| 14 |
+
|
| 15 |
+
# The standard way to implement $\mathbf { L } _ { 2 }$ regularization/weight decay in Adam is dysfunctional.
|
| 16 |
+
|
| 17 |
+
One possible explanation why Adam and other adaptive gradient methods might be outperformed by SGD with momentum is that $\mathrm { L _ { 2 } }$ regularization/weight decay are implemented suboptimally in common deep learning libraries. Therefore, on tasks/datasets where the use of $\mathrm { L _ { 2 } }$ regularization is beneficial (e.g., on many popular image classification datasets), Adam leads to worse results than SGD with momentum (for which $\mathrm { L _ { 2 } }$ regularization behaves as expected).
|
| 18 |
+
|
| 19 |
+
$\mathbf { L } _ { 2 }$ regularization and weight decay are not the same thing. Contrary to common belief, the two techniques are not equivalent. For SGD, they can be made equivalent by a reparameterization of the weight decay factor based on the learning rate; this is not the case for Adam. In particular, when combined with adaptive gradients, $\mathrm { L _ { 2 } }$ regularization leads to weights with large gradients being regularized less than they would be when using weight decay.
|
| 20 |
+
|
| 21 |
+
Optimal weight decay is a function (among other things) of the total number of batch passes/weight updates.
|
| 22 |
+
|
| 23 |
+
Our empirical analysis of Adam suggests that the longer the runtime/number of batch passes to be performed, the smaller the optimal weight decay. This effect tends to be neglected because hyperparameters are often tuned for a fixed or a comparable number of training epochs. As a result, the values of the weight decay found to perform best for short runs do not generalize to much longer runs.
|
| 24 |
+
|
| 25 |
+
Our contributions are aimed at fixing the issues described above:
|
| 26 |
+
|
| 27 |
+
Decoupling weight decay from the gradient-based update (Section 2). We suggest to decouple the gradient-based update from weight decay for both SGD and Adam. The resulting SGD version SGDW decouples optimal settings of the learning rate and the weight decay factor, and the resulting Adam version AdamW generalizes substantially better than Adam.
|
| 28 |
+
|
| 29 |
+
Normalizing the values of weight decay (Section 3). We propose to parameterize the weight decay factor as a function of the total number of batch passes. This leads to a greater invariance of the hyperparameter settings in the sense that the values found to perform best for short runs also perform well for many times longer runs.
|
| 30 |
+
|
| 31 |
+
Adam with warm restarts and normalized weight decay (Section 4). After we fix the weight decay in Adam and design AdamW, we introduce AdamWR to obtain strong anytime performance by performing warm restarts.
|
| 32 |
+
|
| 33 |
+
The main motivation of this paper is to fix the weight decay in Adam to make it competitive w.r.t. SGD with momentum even for those problems where it did not use to be competitive. We hope that as a result, practitioners do not need to switch between Adam and SGD anymore, which in turn should help to reduce the common issue of selecting dataset/task-specific training algorithms and their hyperparameters.
|
| 34 |
+
|
| 35 |
+
# 2 DECOUPLING THE WEIGHT DECAY FROM THE GRADIENT-BASED UPDATE
|
| 36 |
+
|
| 37 |
+
In the weight decay described by Hanson & Pratt (1988), the weights $\boldsymbol { x }$ decay exponentially as
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\begin{array} { r } { \pmb { x } _ { t + 1 } = ( 1 - w _ { t } ) \pmb { x } _ { t } - \alpha _ { t } \nabla f _ { t } ( \pmb { x } _ { t } ) , } \end{array}
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $w _ { t }$ defines the rate of the weight decay at time-step $t$ and $\nabla f _ { t } ( { \pmb x } _ { t } )$ is the $t { \cdot }$ -th batch gradient multiplied by a learning rate $\alpha _ { t }$ . Following Hanson & Pratt (1988), one can also modify the original batch loss $f _ { t } ( \pmb { x } _ { t } )$ and consider a bias term (also referred to as the regularization term) accounting for “costs” on weights which are, e.g., quadratic in the weight values as for $\mathrm { L _ { 2 } }$ regularization:
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
f _ { t , r e g } ( \pmb { x } _ { t } ) = f _ { t } ( \pmb { x } _ { t } ) + \frac { w _ { t } } { 2 } \left\| \pmb { x } _ { t } \right\| _ { 2 } ^ { 2 } ,
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
where $w _ { t }$ defines the impact of the $\mathrm { L _ { 2 } }$ regularization. In order to consider the weight decay regularization, one can reformulate the objective function as in Eq. (2) or directly adjust $\bar { \nabla } f _ { t } ( \pmb { x } _ { t } )$ as
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\nabla f _ { t , r e g } ( { \pmb x } _ { t } ) = \nabla f _ { t } ( { \pmb x } _ { t } ) + w _ { t } { \pmb x } _ { t } .
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
Historically, stochastic gradient descent methods inherited this way of implementing the weight decay regularization.
|
| 56 |
+
|
| 57 |
+
The currently most common way (e.g., in popular libraries such as TensorFlow, Keras, PyTorch, Torch, and Lasagne) to introduce the weight decay regularization is to use the $\mathrm { L _ { 2 } }$ regularization term as in Eq. (2) or, often equivalently, to directly modify the gradient as in Eq. (3). Let’s first consider the simple case of SGD with momentum; Algorithm 1 demonstrates modifying the gradients directly in this method (see line 6). The weight decay term $w _ { t } \mathbf { x } _ { t - 1 }$ will first modify ${ \pmb g } _ { t }$ (see line 6) and then affect the momentum term $\pmb { m } _ { t }$ (see line 8). While the smoothing of the weight decay factor by $\beta _ { 1 }$
|
| 58 |
+
|
| 59 |
+
1: given learning rate $\alpha _ { t } \in \mathbb { R }$ , momentum factor $\beta _ { 1 } \in \mathbb { R }$ , weight decay factor $w \in \mathbb { R }$
|
| 60 |
+
2: initialize time step $t \gets 0$ , parameter vector $\pmb { x } _ { t = 0 } ~ \in ~ \mathbb { R } ^ { n }$ , first moment vector $\pmb { m } _ { t = 0 } \gets \pmb { \theta }$ ,
|
| 61 |
+
schedule multiplier $\eta _ { t = 0 } \in \mathbb { R }$
|
| 62 |
+
3: repeat
|
| 63 |
+
4: $t \gets t + 1$
|
| 64 |
+
5: $\nabla f _ { t } ( { \pmb x } _ { t - 1 } ) \gets S e l e c t B a t c h ( { \pmb x } _ { t - 1 } )$ . select batch and return the corresponding gradient
|
| 65 |
+
6: $\pmb { \mathscr { g } } _ { t } \gets \nabla f _ { t } ( \pmb { x } _ { t - 1 } ) \ + w _ { t } \pmb { x } _ { t - 1 }$
|
| 66 |
+
7: ηt ← SetScheduleMultiplier(t) . can be fixed, decay, be used for warm restarts
|
| 67 |
+
8: ${ \pmb { m } } _ { t } \gets \beta _ { 1 } { \pmb { m } } _ { t - 1 } + \eta _ { t } \alpha _ { t } \pmb { g } _ { t }$
|
| 68 |
+
9: $\pmb { x } _ { t } \gets \pmb { x } _ { t - 1 } - \pmb { m } _ { t } \gets \eta _ { t } w _ { t } \pmb { x } _ { t - 1 }$
|
| 69 |
+
|
| 70 |
+
<table><tr><td>Algorithm1 SGD with momentum</td><td>and SGDW with momentum</td><td></td></tr></table>
|
| 71 |
+
|
| 72 |
+
10: until stopping criterion is met
|
| 73 |
+
|
| 74 |
+
11: return optimized parameters $\mathbf { \boldsymbol { x } } _ { t }$
|
| 75 |
+
|
| 76 |
+
# Algorithm 2 Adam and AdamW
|
| 77 |
+
|
| 78 |
+
1: given $\alpha _ { t } = 0 . 0 0 1 , \beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9 , \epsilon = 1 0 ^ { - 8 } , w \in \mathbb { R }$
|
| 79 |
+
2: initialize time step $t \gets 0$ , parameter vector $\pmb { x } _ { t = 0 } \in \mathbb { R } ^ { n }$ , first moment vector $\pmb { m } _ { t = 0 } \pmb { \theta }$ , second
|
| 80 |
+
moment vector $\pmb { \nu } _ { t = 0 } \pmb { \theta }$ , schedule multiplier $\eta _ { t = 0 } \in \mathbb { R }$
|
| 81 |
+
3 : repeat
|
| 82 |
+
4: $t \gets t + 1$
|
| 83 |
+
5: $\nabla f _ { t } ( { \pmb x } _ { t - 1 } ) \gets S e l e c t B a t c h ( { \pmb x } _ { t - 1 } )$ . select batch and return the corresponding gradient
|
| 84 |
+
6: $\pmb { \mathrm { g } } _ { t } \nabla f _ { t } ( \pmb { x } _ { t - 1 } ) \ + w _ { t } \pmb { x } _ { t - 1 }$
|
| 85 |
+
7: $\pmb { m } _ { t } \beta _ { 1 } \pmb { m } _ { t - 1 } + \overline { { ( 1 - \beta _ { 1 } ) \pmb { g } _ { t } } }$ . here and below all operations are element-wise
|
| 86 |
+
8: $\pmb { \nu } _ { t } \gets \beta _ { 2 } \pmb { \nu } _ { t - 1 } + ( 1 - \beta _ { 2 } ) \pmb { g } _ { t } ^ { 2 }$
|
| 87 |
+
9: $\hat { \pmb { m } } _ { t } \gets \pmb { m } _ { t } / ( 1 - \beta _ { 1 } ^ { t } )$ $\triangleright$ here, $\beta _ { 1 }$ is taken to the power of $t$
|
| 88 |
+
10: $\hat { \pmb { { \nu } } } _ { t } \gets { \pmb { { \nu } } } _ { t } / ( 1 - \beta _ { 2 } ^ { t } )$ $\triangleright$ here, $\beta _ { 2 }$ is taken to the power of $t$
|
| 89 |
+
11: ηt ← SetScheduleMultiplier(t) . can be fixed, decay, be used for warm restarts
|
| 90 |
+
12: $\pmb { x } _ { t } \pmb { x } _ { t - 1 } - \eta _ { t } ( \alpha _ { t } \hat { m } _ { t } / ( \sqrt { \hat { \nu } _ { t } } + \epsilon ) + w _ { t } \pmb { x } _ { t - 1 } )$
|
| 91 |
+
13: until stopping criterion is met
|
| 92 |
+
14: return optimized parameters $\mathbf { \boldsymbol { x } } _ { t }$
|
| 93 |
+
|
| 94 |
+
(see line 8) might be a feature, we note (for simplicity, we omit $\eta _ { t }$ ) that $\mathbf { \boldsymbol { x } } _ { t }$ will decay by $\alpha _ { t } w _ { t } \pmb { x } _ { t - 1 }$ (see line 9) and not $w _ { t } \mathbf { x } _ { t - 1 }$ as one could expect according to the definition of the weight decay given by Eq. (1). Practically, if one wants to keep the actual weight decay $\alpha _ { t } w _ { t }$ fixed while changing $\alpha _ { t }$ to $\alpha _ { t } ^ { \prime }$ , then $w _ { t }$ should be modified to $\begin{array} { r } { w _ { t } ^ { \prime } = \frac { \alpha _ { t } w _ { t } } { \alpha _ { t } ^ { \prime } } } \end{array}$ αtwtα0 . This renders the problem of hyperparameter selection of $\alpha _ { t }$ and $w _ { t }$ non-separable.
|
| 95 |
+
|
| 96 |
+
We propose to fix this problem by following the original definition of weight decay given by Eq. (1) and decay the weights simultaneously with the update of $\mathbf { \boldsymbol { x } } _ { t }$ based on gradient information in Line 9 of Algorithm 1. This yields our proposed SGD variant SGDW with momentum. Although the proposed simple modification explicitly decouples $w _ { t }$ and $\alpha _ { t }$ , some problem-dependent implicit coupling is likely to remain. In order to account for a possible scheduling of both $\alpha _ { t }$ and $w _ { t }$ , we introduce a scaling factor $\eta _ { t }$ delivered by a user-defined procedure SetScheduleMultiplier $( t )$ . It should be noted that when $\mathrm { L _ { 2 } }$ regularization is used, weight decay contributes to the batch gradient and thus effectively is scheduled in the same way as the learning rate. Now, since we decouple the two we should also remember to schedule both of them with $\eta _ { t }$ .
|
| 97 |
+
|
| 98 |
+
Having shown that using $\mathrm { L _ { 2 } }$ regularization instead of weight decay already couples regularization and learning rate in the simple case of SGD with momentum, we now consider adaptive gradient optimizers, such as the Adam algorithm proposed by Kingma & Ba (2014), in which the coupling leads to even more unintended behavior. As an adaptive gradient method, Adam maintains a vector $\nu _ { t }$ responsible for storing smoothed amplitudes of parameter-wise gradients ${ \pmb g } _ { t } ^ { 2 }$ (see line 8 in Algorithm 2). These factors are used to control parameter-wise learning rates by normalizing parameter-wise√ gradients by $\sqrt { \hat { \nu _ { t } } } + \epsilon$ in line 12 of Algorithm 2. The common way to introduce the weight decay $w _ { t } \mathbf { x } _ { t - 1 }$ to Adam results in an update which only distantly resembles the original weight decay given by Eq. (1) because the $\nu _ { t }$ vectors are not only responsible for the parameter-wise amplitudes of $\pmb { g } _ { t }$ but also for the parameter-wise amplitudes of weights $\mathbf { \boldsymbol { x } } _ { t }$ . The amplitudes are then used to renormalize $\hat { \pmb { m } } _ { t }$ as given in line 12 of Algorithm 2. To gain a bit of intuition, let us consider the case when $t$ is large, causing $\beta _ { 1 } ^ { t }$ and $\beta _ { 2 } ^ { t }$ to go to zero and
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\boldsymbol { x } _ { t } \gets \boldsymbol { x } _ { t - 1 } - \eta _ { t } \alpha _ { t } \frac { \beta _ { 1 } m _ { t - 1 } + ( 1 - \beta _ { 1 } ) g _ { t } } { \sqrt { \beta _ { 2 } \nu _ { t - 1 } + ( 1 - \beta _ { 2 } ) g _ { t } ^ { 2 } } + \epsilon } , \ \mathrm { w i t h } \ g _ { t } = \nabla f _ { t } ( \boldsymbol { x } _ { t - 1 } ) + w _ { t } \boldsymbol { x } _ { t - 1 } ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where operations are performed parameter-wise. Not only the batch gradient $\nabla f _ { t } ( { \pmb x } _ { t - 1 } )$ is normalized but also the weight decay $w _ { t } \mathbf { x } _ { t - 1 }$ itself. Since this formula normalizes updates by their typical amplitudes, the decay of weights does not account for amplitudes anymore, leading to the relative decay being weaker for weights with large gradients. This is a correct implementation of $\mathbf { L } _ { 2 }$ regularization, but not of weight decay. Therefore, it might be misleading to use the two terms interchangeably, as is commonly done in the literature. We note that this difference between the two mechanisms for Adam has not been investigated and/or described before. As in the case of SGDW, we propose to follow the original definition of weight decay and perform it simultaneously with the gradient-based update as shown in line 12 of Algorithm 2 for AdamW. As we will demonstrate experimentally (in Section 5.2), AdamW generalizes much better than Adam.
|
| 105 |
+
|
| 106 |
+
# 3 NORMALIZED WEIGHT DECAY
|
| 107 |
+
|
| 108 |
+
Since our preliminary experiments showed that different weight decay factors are optimal for different computational budgets (defined in terms of the number of batch passes), we introduce a normalized weight decay to reduce this dependence. At iteration $t$ , $w _ { t }$ is set as follows:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
w _ { t } = w _ { n o r m } \sqrt { \frac { b _ { t } } { B T _ { i } } } ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where $b _ { t }$ is the batch size, $B$ is the total number of training points to be used in one epoch and $T _ { i }$ is the total number of epochs within the $i$ -th run/restart of the algorithm. Thus, $w _ { n o r m }$ can be interpreted as the weight decay to be used if only one batch pass is allowed. We note a recent relevant observation of Li et al. (2017) who demonstrated that a smaller batch size (for the same total number of epochs) leads to the shrinking effect of weight decay being more pronounced. Here, we propose to address that effect with normalized weight decay.
|
| 115 |
+
|
| 116 |
+
# 4 ADAM WITH WARM RESTARTS AND NORMALIZED WEIGHT DECAY
|
| 117 |
+
|
| 118 |
+
We now apply warm restarts to Adam, following the recent work of Loshchilov & Hutter (2016). There, the authors proposed Stochastic Gradient Descent with Warm Restarts (SGDR) to improve anytime performance of SGD by quickly cooling down the learning rate and periodically increasing it. SGDR has been successfully adopted to lead to new state-of-the-art results for popular image classification benchmarks (Huang et al., 2017; Gastaldi, 2017), and we therefore tried extending it to Adam. However, while our initial version of Adam with warm restarts had better anytime performance than Adam, it was not competitive with SGD with warm restarts, precisely because of Adam’s dysfunctional weight decay. Now, having fixed weight decay regularization (Section 2) and also having introduced normalized weight decay (Section 3), the work of Loshchilov & Hutter (2016) on warm restarts directly carries over, and we use it to construct AdamWR to fully benefit from warm restarts.
|
| 119 |
+
|
| 120 |
+
In the interest of keeping the presentation self-contained, we briefly describe how SGDR schedules the change of the effective learning rate in order to accelerate the training of DNNs. Here, we decouple the initial learning rate and its multiplier $\eta _ { t }$ used to obtain the actual learning rate at iteration $t$ (see, e.g., line 8 in Algorithm 1). In SGDR, we simulate a new warm-started run/restart of SGD once $T _ { i }$ epochs are performed, where $i$ is the index of the run. Importantly, the restarts are not performed from scratch but emulated by increasing $\eta _ { t }$ while the old value of $\mathbf { } _ { \pmb { x } _ { t } }$ is used as an initial solution. The amount by which $\eta _ { t }$ is increases controls to which extent the previously acquired information (e.g., momentum) is used. Within the $i \cdot$ -th run, the value of $\eta _ { t }$ decays according to the cosine annealing (Loshchilov & Hutter, 2016) for each batch as follows:
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
\eta _ { t } = \eta _ { m i n } ^ { ( i ) } + 0 . 5 ( \eta _ { m a x } ^ { ( i ) } - \eta _ { m i n } ^ { ( i ) } ) ( 1 + \cos ( \pi T _ { c u r } / T _ { i } ) ) ,
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
where η min and $\eta _ { m a x } ^ { ( i ) }$ are ranges for the multiplier and $T _ { c u r }$ accounts for how many epochs have been performed since the last restart. $T _ { c u r }$ is updated at each batch iteration $t$ and is thus not constrained to integer values. Adjusting (e.g., decreasing) η(i)min and $\eta _ { m a x } ^ { ( i ) }$ at every $i$ -th restart (see also Smith (2016)) could potentially improve performance, but we do not consider that option in our experiments because it would involve additional hyperparameters. For $\eta _ { m a x } ^ { ( i ) } = 1$ and $\eta _ { m i n } ^ { ( i ) } = 0$ , one can simplify Eq. (6) to
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
\eta _ { t } = 0 . 5 + 0 . 5 \cos ( \pi T _ { c u r } / T _ { i } ) .
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
In order to maintain a good anytime performance, one can start with an initially small $T _ { i }$ (e.g., from $1 \%$ to $10 \%$ of the expected total budget) and multiply it by a factor of $T _ { m u l t }$ (e.g., $T _ { m u l t } = 2$ ) at every restart. The $( i + 1 )$ -th restart is triggered when $T _ { c u r } = T _ { i }$ by setting $T _ { c u r }$ to 0. An example setting of the schedule multiplier is given in Section 1.1 of the supplementary material. Note that the effective learning rate is controlled by $\eta _ { t } \alpha _ { t }$ where $\alpha _ { t }$ is set to the initial learning rate and stays constant in our experimental setup. The reason why we employ $\alpha _ { t }$ and not simply $\alpha$ is to account for possible practical extensions, e.g., to adapt $\alpha _ { t }$ as a function of batch size in (scheduled) large-batch settings.
|
| 133 |
+
|
| 134 |
+
Our proposed AdamWR algorithm represents AdamW given in Algorithm 2 with $\eta _ { t }$ following Eq. (7) and $w _ { t }$ computed at each iteration using normalized weight decay according to Eq. (5). We note that normalized weight decay allowed us to use a constant parameter setting across short and long runs performed within AdamWR. Equivalently to AdamWR, we define SGDWR as SGDW with warm restarts.
|
| 135 |
+
|
| 136 |
+
# 5 EXPERIMENTAL VALIDATION
|
| 137 |
+
|
| 138 |
+
Our experimental setup follows that of Gastaldi (2017), who proposed, in addition to $\mathrm { L _ { 2 } }$ regularization, to apply the new Shake-Shake regularization to a 3-branch residual neural network. Gastaldi (2017) showed that this regularization allowed to achieve new state-of-the-art results of $2 . 8 6 \%$ on the CIFAR-10 dataset (Krizhevsky, 2009) and of $1 5 . 8 5 \%$ on CIFAR-100. The network was trained by SGDR with batch size 128 for 1800 epochs $\begin{array} { r } { T _ { 0 } = 1 8 0 0 \mathrm { \Omega } } \end{array}$ ) without restarts with the learning rate scheduled by Eq. (6). The regular data augmentation procedure used for the CIFAR datasets was applied. We used the same model/source code based on fb.resnet.torch 1. The base networks are a 26 2x64d ResNet (i.e. the network has a depth of 26, 2 residual branches and the first residual block has a width of 64) and $2 6 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet with 11.6M and 25.6M parameters, respectively. For a detailed description of the network and the Shake-Shake method, we refer the interested reader to Gastaldi (2017).
|
| 139 |
+
|
| 140 |
+
# 5.1 DECOUPLING THE WEIGHT DECAY AND INITIAL LEARNING RATE PARAMETERS
|
| 141 |
+
|
| 142 |
+
In order to verify our hypothesis about the coupling of the initial learning rate $\alpha _ { t }$ and the weight decay factor $w _ { t }$ , we trained a 2x64d ResNet with cosine annealing for 100 epochs with different settings of $\alpha _ { t }$ and $w _ { t }$ . Throughout this paper, we scheduled the learning rate with cosine annealing because it leads to better results than a fixed learning rate (see SuppFigure 1 in the supplementary material). Figure 1 compares SGD vs. SGDW (top row) and Adam vs. AdamW (bottom row). For the case of SGD (Figure 1, top left), weight decay is not decoupled from the learning rate (the common way as described in Algorithm 1), and the figure clearly shows that the basin of best hyperparameter settings (depicted by color and top-10 hyperparameter settings by black circles) is not aligned with the $\mathbf { X }$ -axis or y-axis but lies on the diagonal. This suggests that the two hyperparameters are interdependent and need to be changed simultaneously, while only changing one of them might substantially worsen results. Consider, e.g., the setting at the top left black circle $( \alpha _ { t } = 1 / 2$ , $w _ { t } = 1 / 8 * 0 . 0 0 1 )$ ; only changing either $\alpha _ { t }$ or $w _ { t }$ by itself would worsen results, while changing both of them could still yield clear improvements. We note that this coupling of initial learning rate and weight decay factor might have contributed to SGD’s reputation of being very sensitive to its hyperparameter settings.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 1: The Top-1 test error of a 26 2x64d ResNet on CIFAR-10 measured after 100 epochs. The proposed SGDW and AdamW (right column) have a more separable hyperparameter space.
|
| 146 |
+
|
| 147 |
+
In contrast, the results for our new SGDW in Figure 1 (top right) show that SGDW decouples weight decay and initial learning rate. The proposed approach renders the two hyperparameters more separable: even if the learning rate is not well tuned yet (e.g., consider the value of 1/1024 in Figure 1, top right), leaving it fixed and only optimizing the weight decay factor would yield a good value (of $1 / 4 ^ { * } 0 . 0 0 1$ ). This is not the case for the original SGD shown in Figure 1 (top left).
|
| 148 |
+
|
| 149 |
+
The results for different hyperparameter settings of the original Adam are given in Figure 1 (bottom left). Adam’s best hyperparameter settings performed clearly worse than SGD’s best ones (compare Figure 1, top left). While both methods use the original way to employ weight decay, the original Adam did not benefit from it at all: its best results obtained for non-zero weight decay values were comparable to the best ones obtained without the weight decay regularization, i.e., when $w _ { t } = 0$ . Similarly to the original SGD, the shape of the hyperparameter landscape suggests that the two hyperparameters are coupled.
|
| 150 |
+
|
| 151 |
+
In contrast, the results for our new AdamW in Figure 1 (bottom right) show that AdamW largely decouples weight decay and learning rate. The results for the best hyperparameter settings were substantially better than the best ones of the original Adam and rivaled those of SGD and SGDW.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 2: Learning curves (top row) and generalization results (bottom row) obtained by a $2 6 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet trained with Adam and AdamW on CIFAR-10. See text for details.
|
| 155 |
+
|
| 156 |
+
In summary, the experimental results in Figure 1 support our hypothesis that the weight decay and learning rate hyperparameters can be decoupled, and that this in turn simplifies the problem of hyperparameter tuning in SGD and improves Adam’s performance to be competitive w.r.t. SGD with momentum.
|
| 157 |
+
|
| 158 |
+
# 5.2 BETTER GENERALIZATION OF ADAMW
|
| 159 |
+
|
| 160 |
+
While the previous experiment suggested that the basin of optimal hyperparameters of AdamW is broader and deeper than the one of Adam, we next investigated the results for much longer runs of 1800 epochs to compare the generalization capabilities of AdamW and Adam.
|
| 161 |
+
|
| 162 |
+
We fixed the initial learning rate to 0.001 which represents both the default learning rate for Adam and the one which showed reasonably good results in our experiments. Figure 2 shows the results for 12 settings of the weight decay of Adam and 7 settings of the normalized weight decay of AdamW. Interestingly, while the dynamics of the learning curves of Adam and AdamW often coincided for the first half of the training run, AdamW often led to lower training loss and test errors (see Figure 2 top left and top right, respectively). Importantly, the use of weight decay in Adam did not yield as good results as in AdamW (see also Figure 2, bottom left). Next, we investigated whether AdamW’s better results were only due to better convergence or due to better generalization. The results in Figure 2 (bottom right) for the best settings of Adam and AdamW suggest that AdamW did not only yield better training loss but also yielded better generalization performance for similar training loss values. The results on ImageNet32x32 (see SuppFigure 4 in the supplementary material) lead to the same conclusion of substantially improved generalization performance.
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 3: Top-1 test error on CIFAR-10 (left) and Top-5 test error on ImageNet32x32 (right).
|
| 166 |
+
|
| 167 |
+
5.3 EASIER HYPERPARAMETER SELECTION DUE TO NORMALIZED WEIGHT DECAY
|
| 168 |
+
|
| 169 |
+
Our experimental results with Adam and SGD suggested that the total runtime in terms of the number of epochs affect the basin of optimal hyperparameters (see SuppFigure 3 in the supplementary material). More specifically, the greater the total number of epochs the smaller the values of the weight decay should be. SuppFigure 3 shows that our remedy for this problem, the normalized weight decay defined in Eq. (7), simplifies hyperparameter selection because the optimal values observed for short runs are similar to the ones for much longer runs. While our initial experiments on CIFAR-10 suggested the square root fit we proposed in Eq. (7), to double-check that this is not a coincidence, we also performed experiments on the ImageNet32x32 dataset (Chrabaszcz et al., 2017), a downsampled version of the original ImageNet dataset with 1.2 million $3 2 \times 3 2$ pixels images, where an epoch is 24 times longer than on CIFAR-10. This experiment also supported the square root scaling: the best values of the normalized weight decay observed on CIFAR-10 represented nearly optimal values for ImageNet $3 2 \mathrm { x } 3 2 $ (see SuppFigure 3). In contrast, had we used the same raw weight decay values $w _ { t }$ for ImageNet32x32 as for CIFAR-10 and for the same number of epochs, without the proposed normalization, $w _ { t }$ would have been roughly 5 greater than optimal for ImageNet32x32, leading to much worse performance. The optimal normalized weight decay values were also very similar (e.g., $w _ { n o r m } = 0 . 0 2 5$ and $w _ { n o r m } = 0 . 0 5$ ) across SGDW and AdamW.
|
| 170 |
+
|
| 171 |
+
We investigated whether the use of much longer runs (1800 epochs) of the original Adam with $\mathrm { L _ { 2 } }$ regularization makes the use of cosine annealing unnecessary. The results of Adam without cosine annealing (i.e., with fixed learning rate) for a 4 by 4 logarithmic grid of hyperparameter settings are given in SuppFigure 5 in the supplementary material. Even after taking into account the low resolution of the grid, the results appear to be at best comparable to the ones obtained with AdamW with 18 times less epochs and a smaller network (see SuppFigure 2). These results are not very surprising given Figure 1 (which demonstrates the effectiveness of AdamW) and SuppFigure 2 (which demonstrates the necessity to use some learning rate schedule such as cosine annealing).
|
| 172 |
+
|
| 173 |
+
# 5.4 ADAMWR WITH WARM RESTARTS FOR BETTER ANYTIME PERFORMANCE
|
| 174 |
+
|
| 175 |
+
Finally, we investigated the strong anytime performance AdamWR obtains from warm restarts (using normalized weight decay to avoid the need for a different weight decay factor for restarts with longer annealing schedules). As Figure 3 shows, AdamWR greatly sped up AdamW on CIFAR10 and ImageNet32x32, up to a factor of 10 (see the results at the first restart). For the default learning rate of 0.001, AdamW achieved $15 \%$ relative improvement in test errors compared to Adam both on CIFAR-10 (also see Figure 2) and ImageNet32x32 (also see SuppFigure 4). AdamWR achieved the same improved results but with a much better anytime performance. These improvements closed most of the gap between Adam and SGDWR on CIFAR-10 and yielded comparable performance on ImageNet32x32.
|
| 176 |
+
|
| 177 |
+
# 6 DISCUSSION AND CONCLUSION
|
| 178 |
+
|
| 179 |
+
Following suggestions that adaptive gradient methods such as Adam might lead to worse generalization than SGD with momentum (Wilson et al., 2017), we identified at least one possible explanation to this phenomenon: the dysfunctional use of $\mathrm { L _ { 2 } }$ regularization and weight decay. We proposed a simple fix to deal with this issue, yielding substantially better generalization performance in our AdamW variant. We also proposed normalized weight decay and warm restarts for Adam, showing that a more robust hyperparameteer selection and a better anytime performance can be achieved in our new AdamWR variant.
|
| 180 |
+
|
| 181 |
+
Our preliminary results obtained with AdamW and AdamWR on image classification datasets must be verified on a wider range of tasks, especially the ones where the use of regularization is expected to be important. It would be interesting to integrate our findings on weight decay into other methods which attempt to improve Adam, e.g, normalized direction-preserving Adam (Zhang et al., 2017). While we focussed our experimental analysis on Adam, we believe that similar results also hold for other adaptive gradient methods, such as AdaGrad (Duchi et al., 2011) and RMSProp (Tieleman & Hinton, 2012).
|
| 182 |
+
|
| 183 |
+
The results shown in Figure 2 suggest that Adam and AdamW follow very similar curves most of the time until the third phase of the run where AdamW starts to branch out to outperform Adam. As pointed out by an anonymous reviewer, it would be interesting to investigate what causes this branching and whether the desired effects are observed at the bottom of the landscape. One could investigate this using the approach of Im et al. (2016) to switch from Adam to AdamW at a given epoch index. Since it is quite possible that the effect of regularization is not that pronounced in the early stages of training, one could think of designing a version of Adam which exploits this by being fast in the early stages and well-regularized in the late stages of training. The latter might be achieved with a custom schedule of the weight decay factor.
|
| 184 |
+
|
| 185 |
+
In this paper, we argue that the popular interpretation that weight decay $\mathbf { \tau } = \mathbf { L } _ { 2 }$ regularization is not precise. Instead, the difference between the two leads to the following important consequences. Two algorithms as different as SGD and Adam will exhibit different effective rates of weight decay even if the same regularization coefficient is used to include $\mathrm { L _ { 2 } }$ regularization in the objective function. Moreover, when decoupled weight decay is applied, two algorithms as different as SGDW and AdamW will optimize two effectively different objective functions even if the same weight decay factor is used. Our findings suggest that the original Adam algorithm with $\mathrm { L _ { 2 } }$ regularization affects effective rates of weight decay in a way that precludes effective regularization, and that effective regularization is achievable by decoupling the weight decay.
|
| 186 |
+
|
| 187 |
+
Advani & Saxe (2017) analytically showed that in the limited data regime of deep networks the presence of eigenvalues that are zero forms a frozen subspace in which no learning occurs and thus smaller (e.g., zero) initial weight norms should be used to achieve best generalization results. Our future work shall consider adapting initial weight norms or weight norm constraints (Salimans & Kingma, 2016) at each warm restart. Kawaguchi et al. (2017) proposed a family of regularization techniques which are specific to the current batch and its size. Similarly to $\mathrm { L _ { 2 } }$ regularization and weight decay, the latter techniques might be attempted to be transformed to act directly on weights.
|
| 188 |
+
|
| 189 |
+
# REFERENCES
|
| 190 |
+
|
| 191 |
+
Madhu S. Advani and Andrew M. Saxe. High-dimensional dynamics of generalization error in neural networks. arXiv:1710.03667, 2017.
|
| 192 |
+
Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of ImageNet as an alternative to the CIFAR datasets. arXiv:1707.08819, 2017.
|
| 193 |
+
Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. arXiv:1703.04933, 2017.
|
| 194 |
+
John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. The Journal of Machine Learning Research, 12:2121–2159, 2011.
|
| 195 |
+
Xavier Gastaldi. Shake-Shake regularization. arXiv preprint arXiv:1705.07485, 2017.
|
| 196 |
+
|
| 197 |
+
Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv:1502.04623, 2015.
|
| 198 |
+
|
| 199 |
+
Stephen Jose Hanson and Lorien Y Pratt. Comparing biases for minimal network construction with ´ back-propagation. In Proceedings of the 1st International Conference on Neural Information Processing Systems, pp. 177–185, 1988.
|
| 200 |
+
|
| 201 |
+
Gao Huang, Zhuang Liu, and Kilian Q Weinberger. Densely connected convolutional networks. arXiv:1608.06993, 2016.
|
| 202 |
+
|
| 203 |
+
Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E Hopcroft, and Kilian Q Weinberger. Snapshot ensembles: Train 1, get m for free. arXiv:1704.00109, 2017.
|
| 204 |
+
|
| 205 |
+
Daniel Jiwoong Im, Michael Tao, and Kristin Branson. An empirical analysis of deep network loss surfaces. arXiv preprint arXiv:1612.04010, 2016.
|
| 206 |
+
|
| 207 |
+
Kenji Kawaguchi, Leslie Pack Kaelbling, and Yoshua Bengio. Generalization in deep learning. arXiv:1710.05468, 2017.
|
| 208 |
+
|
| 209 |
+
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:1609.04836, 2016.
|
| 210 |
+
|
| 211 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv:1412.6980, 2014.
|
| 212 |
+
|
| 213 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
|
| 214 |
+
|
| 215 |
+
Hao Li, Zheng Xu, Gavin Taylor, and Tom Goldstein. Visualizing the loss landscape of neural nets. arXiv preprint arXiv:1712.09913, 2017.
|
| 216 |
+
|
| 217 |
+
Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with warm restarts. arXiv:1608.03983, 2016.
|
| 218 |
+
|
| 219 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv:1511.06434, 2015.
|
| 220 |
+
|
| 221 |
+
Tim Salimans and Diederik 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.
|
| 222 |
+
|
| 223 |
+
Leslie N Smith. Cyclical learning rates for training neural networks. arXiv:1506.01186v3, 2016.
|
| 224 |
+
|
| 225 |
+
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, 4(2):26– 31, 2012.
|
| 226 |
+
|
| 227 |
+
Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nathan Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. arXiv:1705.08292, 2017.
|
| 228 |
+
|
| 229 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International Conference on Machine Learning, pp. 2048–2057, 2015.
|
| 230 |
+
|
| 231 |
+
Zijun Zhang, Lin Ma, Zongpeng Li, and Chuan Wu. Normalized direction-preserving adam. arXiv:1709.04546, 2017.
|
| 232 |
+
|
| 233 |
+
# 1 SUPPLEMENTARY MATERIAL
|
| 234 |
+
|
| 235 |
+
# 1.1 AN EXAMPLE SETTING OF THE SCHEDULE MULTIPLIER
|
| 236 |
+
|
| 237 |
+
An example schedule of the schedule multiplier $\eta _ { t }$ is given in SuppFigure 1 for $T _ { i = 0 } = 1 0 0$ and $T _ { m u l t } = 2$ . After the initial 100 epochs the learning rate will reach 0 because $\eta _ { t = 1 0 0 } = 0$ . Then, since $T _ { c u r } = T _ { i = 0 }$ , we restart by resetting $T _ { c u r } = 0$ , causing the multiplier $\eta _ { t }$ to be reset to 1 due to Eq. (7). This multiplier will then decrease again from 1 to 0, but now over the course of 200 epochs because $T _ { i = 1 } = T _ { i = 0 } T _ { m u l t } = 2 0 0$ . Solutions obtained right before the restarts, when $\eta _ { t } = 0$ (e.g., at epoch indexes 100, 300, 700 and 1500 as shown in SuppFigure 1) are recommended by the optimizer as the solutions, with more recent solutions prioritized.
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
SuppFigure 1: An example schedule of the learning rate multiplier as a function of epoch index. The first run is scheduled to converge at epoch $T _ { i = 0 } = 1 0 0$ , then the budget for the next run is doubled as $T _ { i = 1 } = T _ { i = 0 } T _ { m u l t } = 2 0 0$ , etc.
|
| 241 |
+
|
| 242 |
+

|
| 243 |
+
SuppFigure 2: Adam with fixed learning rate (left) and with cosine annealing (right). We show the final test error of a $2 6 ~ 2 \mathrm { x } 6 4 \mathrm { d }$ ResNet on CIFAR-10 after 100 epochs of SGD with momentum. The results where the learning rate is fixed (left) are inferior to the ones where the learning rate is scheduled according to cosine annealing (right). Therefore, we schedule the learning rate with cosine annealing for all methods given in the paper.
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
SuppFigure 3: Effect of normalized weight decay. We show the final test Top-1 error on CIFAR10 (first two rows for AdamW without and with normalized weight decay) and Top-5 error on ImageNet32x32 (last two rows for AdamW and SGDW, both with normalized weight decay) of a $2 6 2 \mathrm { x } 6 4 \mathrm { d }$ ResNet after different numbers of epochs (see columns). While the optimal settings of the raw weight decay change significantly for different runtime budgets (see the first row), the values of the normalized weight decay remain very similar for different budgets (see the second row) and different datasets (here, CIFAR-10 and ImageNet32x32), and even across AdamW and SGDW.
|
| 247 |
+
|
| 248 |
+

|
| 249 |
+
SuppFigure 4: Learning curves (top row) and generalization results (Top-5 errors in bottom row) obtained by a $2 6 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet trained with Adam and AdamW on ImageNet32x32.
|
| 250 |
+
|
| 251 |
+

|
| 252 |
+
SuppFigure 5: Adam without cosine annealing, i.e., with fixed learning rate. We show the final test error of a $2 6 ~ 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet on CIFAR-10 after 1800 epochs of the original Adam for different settings of learning rate and weight decay used for $\mathrm { L _ { 2 } }$ regularization. These results can be compared to the ones of AdamW shown in SuppFigure 3 (top row). The results of AdamW with only 100 epochs and a smaller network seem to be at least as good as the ones of Adam with 18 times as many epochs and a bigger network.
|
md/train/rk8wKk-R-/rk8wKk-R-.md
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CONVOLUTIONAL SEQUENCE MODELING REVISITED
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
This paper revisits the problem of sequence modeling using convolutional architectures. Although both convolutional and recurrent architectures have a long history in sequence prediction, the current “default” mindset in much of the deep learning community is that generic sequence modeling is best handled using recurrent networks. The goal of this paper is to question this assumption. Specifically, we consider a simple generic temporal convolution network (TCN), which adopts features from modern ConvNet architectures such as a dilations and residual connections. We show that on a variety of sequence modeling tasks, including many frequently used as benchmarks for evaluating recurrent networks, the TCN outperforms baseline RNN methods (LSTMs, GRUs, and vanilla RNNs) and sometimes even highly specialized approaches. We further show that the potential “infinite memory” advantage that RNNs have over TCNs is largely absent in practice: TCNs indeed exhibit longer effective history sizes than their recurrent counterparts. As a whole, we argue that it may be time to (re)consider ConvNets as the default “go to” architecture for sequence modeling.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Since the re-emergence of neural networks to the forefront of machine learning, two types of network architectures have played a pivotal role: the convolutional network, often used for vision and higher-dimensional input data; and the recurrent network, typically used for modeling sequential data. These two types of architectures have become so ingrained in modern deep learning that they can be viewed as constituting the “pillars” of deep learning approaches. This paper looks at the problem of sequence modeling, predicting how a sequence will evolve over time. This is a key problem in domains spanning audio, language modeling, music processing, time series forecasting, and many others. Although exceptions certainly exist in some domains, the current “default” thinking in the deep learning community is that these sequential tasks are best handled by some type of recurrent network. Our aim is to revisit this default thinking, and specifically ask whether modern convolutional architectures are in fact just as powerful for sequence modeling.
|
| 12 |
+
|
| 13 |
+
Before making the main claims of our paper, some history of convolutional and recurrent models for sequence modeling is useful. In the early history of neural networks, convolutional models were specifically proposed as a means of handling sequence data, the idea being that one could slide a 1-D convolutional filter over the data (and stack such layers together) to predict future elements of a sequence from past ones (Hinton, 1989; LeCun et al., 1995). Thus, the idea of using convolutional models for sequence modeling goes back to the beginning of convolutional architectures themselves. However, these models were subsequently largely abandoned for many sequence modeling tasks in favor of recurrent networks (Elman, 1990). The reasoning for this appears straightforward: while convolutional architectures have a limited ability to look back in time (i.e., their receptive field is limited by the size and layers of the filters), recurrent networks have no such limitation. Because recurrent networks propagate forward a hidden state, they are theoretically capable of infinite memory, the ability to make predictions based upon data that occurred arbitrarily long ago in the sequence. This possibility seems to be realized even moreso for the now-standard architectures of Long ShortTerm Memory networks (LSTMs) (Hochreiter & Schmidhuber, 1997), or recent incarnations such as the Gated Recurrent Unit (GRU) (Cho et al., 2014); these architectures aim to avoid the “vanishing gradient” challenge of traditional RNNs and appear to provide a means to actually realize this infinite memory.
|
| 14 |
+
|
| 15 |
+
Given the substantial limitations of convolutional architectures at the time that RNNs/LSTMs were initially proposed (when deep convolutional architectures were difficult to train, and strategies such as dilated convolutions had not reached widespread use), it is no surprise that CNNs fell out of favor to RNNs. While there have been a few notable examples in recent years of CNNs applied to sequence modeling (e.g., the WaveNet (Oord et al., 2016a) and PixelCNN (Oord et al., 2016b) architectures), the general “folk wisdom” of sequence modeling prevails, that the first avenue of attack for these problems should be some form of recurrent network.
|
| 16 |
+
|
| 17 |
+
The fundamental aim of this paper is to revisit this folk wisdom, and thereby make a counterclaim. We argue that with the tools of modern convolutional architectures at our disposal (namely the ability to train very deep networks via residual connections and other similar mechanisms, plus the ability to increase receptive field size via dilations), in fact convolutional architectures typically outperform recurrent architectures on sequence modeling tasks, especially (and perhaps somewhat surprisingly) on domains where a long effective history length is needed to make proper predictions.
|
| 18 |
+
|
| 19 |
+
This paper consists of two main contributions. First, we describe a generic, baseline temporal convolutional network (TCN) architecture, combining best practices in the design of modern convolutional architectures, including residual layers and dilation. We emphasize that we are not claiming to invent the practice of applying convolutional architectures to sequence prediction, and indeed the TCN architecture here mirrors closely architectures such as WaveNet (in fact TCN is notably simpler in some respects). We do, however, want to propose a generic modern form of convolutional sequence prediction for subsequent experimentation. Second, and more importantly, we extensively evaluate the TCN model versus alternative approaches on a wide variety of sequence modeling tasks, spanning many domains and datasets that have typically been the purview of recurrent models, including word- and character-level language modeling, polyphonic music prediction, and other baseline tasks commonly used to evaluate recurrent architectures. Although our baseline TCN can be outperformed by specialized (and typically highly-tuned) RNNs in some cases, for the majority of problems the TCN performs best, with minimal tuning on the architecture or the optimization. This paper also analyzes empirically the myth of “infinite memory” in RNNs, and shows that in practice, TCNs of similar size and complexity may actually demonstrate longer effective history sizes. Our chief claim in this paper is thus an empirical one: rather than presuming that RNNs will be the default best method for sequence modeling tasks, it may be time to (re)consider ConvNets as the “go-to” approach when facing a new dataset or task in sequence modeling.
|
| 20 |
+
|
| 21 |
+
# 2 RELATED WORK
|
| 22 |
+
|
| 23 |
+
In this section we highlight some of the key innovations in the history of recurrent and convolutional architectures for sequence prediction.
|
| 24 |
+
|
| 25 |
+
Recurrent networks broadly refer to networks that maintain a vector of hidden activations, which are kept over time by propagating them through the network. The intuitive appeal of this approach is that the hidden state can act as a sort of “memory” of everything that has been seen so far in a sequence, without the need for keeping an explicit history. Unfortunately, such memory comes at a cost, and it is well-known that the na¨ıve RNN architecture is difficult to train due to the exploding/vanishing gradient problem (Bengio et al., 1994).
|
| 26 |
+
|
| 27 |
+
A number of solutions have been proposed to address this issue. More than twenty years ago, Hochreiter & Schmidhuber (1997) introduced the now-ubiquitous Long Short-Term Memory (LSTM) which uses a set of gates to explicitly maintain memory cells that are propagated forward in time. Other solutions or refinements include a simplified variant of LSTM, the Gated Recurrent Unit (GRU) (Cho et al., 2014), peephole connections (Gers et al., 2002), Clockwork RNN (Koutnik et al., 2014) and recent works such as MI-RNN (Wu et al., 2016) and the Dilated RNN (Chang et al., 2017). Alternatively, several regularization techniques have been proposed to better train LSTMs, such as those based upon the properties of the RNN dynamical system (Pascanu et al., 2013); more recently, strategies such as Zoneout (Krueger et al., 2017) and AWD-LSTM (Merity et al., 2017) were also introduced to regularize LSTM in various ways, and have achieved exceptional results in the field of language modeling.
|
| 28 |
+
|
| 29 |
+
While it is frequently criticized as a seemingly “ad-hoc” architecture, LSTMs have proven to be extremely robust and is very hard to improve upon by other recurrent architectures, at least for general problems. Jozefowicz et al. (2015) concluded that if there were “architectures much better than the LSTM”, then they were “not trivial to find”. However, while they evaluated a variety of recurrent architectures with different combinations of components via an evolutionary search, they did not consider architectures that were fundamentally different from the recurrent ones.
|
| 30 |
+
|
| 31 |
+
The history of convolutional architectures for time series is comparatively shorter, as they soon fell out of favor compared to recurrent architectures for these tasks, though are also seeing a resurgence in recent years. Waibel et al. (1989) and Bottou et al. (1990) studied the usage of time-delay networks (TDNNs) for sequences, one of the earliest local-connection-based networks in this domain. LeCun et al. (1995) then proposed and examined the usage of CNNs on time-series data, pointing out that the same kind of feature extraction used in images could work well on sequence modeling with convolutional filters. Recent years have seen a re-emergence of convolutional models for sequence data. Perhaps most notably, the WaveNet (Oord et al., 2016a) applied a stacked convolutional architecture to model audio signals, using a combination of dilations (Yu & Koltun, 2015), skip connections, gating, and conditioning on context stacks; the WaveNet mode was additionally applied to a few other contexts, such as financial applications (Borovykh et al., 2017). Non-dilated gated convolutions have also been applied in the context of language modeling (Dauphin et al., 2017). And finally, convolutional models have seen a recent adoption in sequence to sequence modeling and machine translations applications, such as the ByteNet (Kalchbrenner et al., 2016) and ConvS2S architectures (Gehring et al., 2017).
|
| 32 |
+
|
| 33 |
+
Despite these successes, the general consensus of the deep learning community seems to be that RNNs (here meaning all RNNs including LSTM and its variants) are better suited to sequence modeling for two apparent reasons: 1) as discussed before, RNNs are theoretically capable of infinite memory; and 2) RNN models are inherently suitable for sequential inputs of varying length, whereas CNNs seem to be more appropriate in domains with fixed-size inputs (e.g., vision).
|
| 34 |
+
|
| 35 |
+
With this as the context, this paper reconsiders convolutional sequence modeling in general, first introducing a simple general-purpose convolutional sequence modeling architecture that can be applied in all the same scenarios as an RNN (the architecture acts as a “drop-in” replacement for RNNs of any kind). We then extensively evaluate the performance of the architecture on tasks from different domains, focusing on domains and settings that have been used explicitly as applications and benchmarks for RNNs in the recent past. With regard to the specific architectures mentioned above (e.g. WaveNet, ByteNet, gated convolutional language models), the primary goal here is to describe a simple, application-independent architecture that avoids much of the extra specialized components of these architectures (gating, complex residuals, context stacks, or the encoder-decoder architectures of seq2seq models), and keeps only the “standard” convolutional components from most image architectures, with the restriction that the convolutions be causal. In several cases we specifically compare the architecture with and without additional components (e.g., gating elements), and highlight that it does not seem to substantially improve performance of the architecture across domains. Thus, the primary goal of this paper is to provide a baseline architecture for convolutional sequence prediction tasks, and to evaluate the performance of this model across multiple domains.
|
| 36 |
+
|
| 37 |
+
# 3 CONVOLUTIONAL SEQUENCE MODELING
|
| 38 |
+
|
| 39 |
+
In this section, we propose a generic architecture for convolutional sequence prediction, and generally refer to it as Temporal Convolution Networks (TCNs). We emphasize that we adopt this term not as a label for a truly new architecture, but as a simple descriptive term for this and similar architectures. The distinguishing characteristics of the TCN are that: 1) the convolutions in the architecture are causal, meaning that there is no information “leakage” between future and past; 2) the architecture can take a sequence of any length and map it to an output sequence of the same length, just as with an RNN. Beyond this, we emphasize how to build very long effective history sizes (i.e., the ability for the networks to look very far into the past to make a prediction) using a combination of very deep networks (augmented with residual layers) and dilated convolutions.
|
| 40 |
+
|
| 41 |
+
# 3.1 THE SEQUENCE MODELING TASK
|
| 42 |
+
|
| 43 |
+
Before defining the network structure, we highlight the nature of the sequence modeling task. We suppose that we are given a sequence of inputs $x _ { 0 } , \ldots , x _ { T }$ , and we wish to predict some correspond
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 1: A simple causal convolution with filter size 3.
|
| 47 |
+
|
| 48 |
+
ing outputs $y _ { 0 } , \ldots , y _ { T }$ at each time. The key constraint is that to predict the output $y _ { t }$ for some time $t$ , we are constrained to only use those inputs that have been previously observed: $x _ { 0 } , \ldots , x _ { t }$ . Formally, a sequence modeling network is any function $f : \mathcal { X } ^ { T + \bar { 1 } } \mathcal { Y } ^ { T + \bar { 1 } }$ that produces this mapping
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\hat { y } _ { 0 } , \dots , \hat { y } _ { T } = f ( x _ { 0 } , \dots , x _ { T } )
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
if it satisfies the causal constraint that $y _ { t }$ depends only on $x _ { 0 } , \ldots , x _ { t }$ , and not on any “future” inputs $x _ { t + 1 } , \dots , x _ { T }$ . The goal of learning in the sequence modeling setting is to find the network $f$ minimizing some expected loss between the actual outputs and predictions $L ( y _ { 0 } , \dots , y _ { T } , f ( x _ { 0 } , \dots , x _ { T } ) )$ where the sequences and outputs are drawn according to some distribution.
|
| 55 |
+
|
| 56 |
+
This formalism encompasses many settings such as auto-regressive prediction (where we try to predict some signal given its past) by setting the target output to be simply the input shifted by one time step. It does not, however, directly capture domains such as machine translation, or sequenceto-sequence prediction in general, since in these cases the entire input sequence (including “future” states) can be used to predict each output (though the techniques can naturally be extended to work in such settings).
|
| 57 |
+
|
| 58 |
+
# 3.2 CAUSAL CONVOLUTIONS AND THE TCN
|
| 59 |
+
|
| 60 |
+
As mentioned above, the TCN is based upon two principles: the fact that the network produces an output of the same length as the input, and the fact that there can be no leakage from the future into the past. To accomplish the first point, the TCN uses a 1D fully-convolutional network (FCN) architecture (Long et al., 2015), where each hidden layer is the same length as the input layer, and zero padding of length (kernel size − 1) is added to keep subsequent layers the same length as previous ones. To achieve the second point, the TCN uses causal convolutions, convolutions where a subsequent output at time $t$ is convolved only with elements from time $t$ and before in the previous layer.1 Graphically, the network is shown in Figure 1. Put in a simple manner:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\mathrm { T C N } = \mathrm { 1 D F C N } + \mathrm { c a u s a l ~ c o n v o l u t i o n s }
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
It is worth emphasizing that this is essentially the same architecture as the time delay neural network proposed nearly 30 years ago by Waibel et al. (1989), with the sole tweak of zero padding to ensure equal sizes of all layers.
|
| 67 |
+
|
| 68 |
+
However, a major disadvantage of this “na¨ıve” approach is that in order to achieve a long effective history size, we need an extremely deep network or very large filters, neither of which were particularly feasible when the methods were first introduced. Thus, in the following sections, we describe how techniques from modern convolutional architectures can be integrated into the TCN to allow for both very deep networks and very long effective history.
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 2: A dilated causal convolution with dilation factors $d = 1 , 2 , 4$ and filter size $k = 3$ . The receptive field is able to cover all values from the input sequence.
|
| 72 |
+
|
| 73 |
+
# 3.3 DILATED CONVOLUTIONS
|
| 74 |
+
|
| 75 |
+
Through convolutional filters, as previously addressed, a simple causal convolution is only able to look back at a history with size linear in the depth of the network. This makes it challenging to apply the aforementioned causal convolution on sequence tasks, especially those requiring longer history. Our solution here, used previously for example in audio synthesis by Oord et al. (2016a), is to employ dilated convolutions (Yu & Koltun, 2015) that enable an exponentially large receptive field. More formally, for a 1-D sequence input $\mathbf { x } \in \mathbb { R } ^ { n }$ and a filter $f : \bar { \{ 0 , \dots , k - 1 \bar { \} } } \mathbb { R }$ , the dilated convolution operation $F$ on element $s$ of the sequence is defined as
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
F ( s ) = ( \mathbf { x } * _ { d } f ) ( s ) = \sum _ { i = 0 } ^ { k - 1 } f ( i ) \cdot \mathbf { x } _ { s + d \cdot i }
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $d$ is the dilation factor and $k$ is the filter size. Dilation is thus equivalent to introducing a fixed step between every two adjacent filter taps. When taking $d = 1$ , for example, a dilated convolution is trivially a normal convolution operation. Using larger dilations enables an output at the top level to represent a wider range of inputs, thus effectively expanding the receptive field of a ConvNet.
|
| 82 |
+
|
| 83 |
+
This gives us two ways to increase the receptive field of the TCN: by choosing larger filter sizes $k$ , and by increasing the dilation factor $d$ , where the effective history of one such layer is $( k - 1 ) d$ . As is common when using dilated convolutions, we increase $d$ exponentially with the depth of the network (i.e., $d = O ( 2 ^ { i } )$ at level $i$ of the network). This ensures that there is some filter that hits each input within the effective history, while also allowing for an extremely large effective history using deep networks. We provide an illustration in Figure 2. Using filter size $k = 3$ and dilation factor $d = 1 , 2 , 4$ , the receptive field is able to cover all values from the input sequence.
|
| 84 |
+
|
| 85 |
+
# 3.4 RESIDUAL CONNECTIONS
|
| 86 |
+
|
| 87 |
+
Proposed by He et al. (2016), residual functions have proven to be especially useful in effectively training deep networks. In a residual network, each residual block contains a branch leading out to a series of transformations $\mathcal { F }$ , whose outputs are added to the input $\mathbf { x }$ of the block:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
o = \mathrm { A c t i v a t i o n } ( \mathbf { x } + \mathcal { F } ( \mathbf { x } ) )
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
This effectively allows for the layers to learn modifications to the identity mapping rather than the entire transformation, which has been repeatedly shown to benefit very deep networks.
|
| 94 |
+
|
| 95 |
+
As the TCN’s receptive field depends on the network depth $n$ as well as filter size $k$ and dilation factor $d$ , stabilization of deeper and larger TCNs becomes important. For example, in a case where the prediction could depend on a history of size $2 ^ { 1 2 }$ and a high-dimensional input sequence, a network of up to 12 layers could be needed. Each layer, more specifically, consists of multiple filters for feature extraction. In our design of the generic TCN model, we therefore employed a generic residual module in place of a convolutional layer.
|
| 96 |
+
|
| 97 |
+
The residual block for our baseline TCN is shown in figure 3a. Within a residual block, the TCN has 2 layers of dilated causal convolution and non-linearity, for which we used the rectified linear unit
|
| 98 |
+
|
| 99 |
+
(a) TCN residual block. An 1x1 convolution is added when residual input and output have different dimensions.
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 3: A visualization of the TCN residual block
|
| 103 |
+
|
| 104 |
+
(b) An example of residual connection in TCN. The blue lines are filters in the residual function, and the green lines are identity mappings.
|
| 105 |
+
|
| 106 |
+
(ReLU) (Nair & Hinton, 2010). For normalization, we applied Weight Normalization (Salimans & Kingma, 2016) to the filters in the dilated convolution (where we note that the filters are essentially vectors of size $k \times 1 \AA$ ). In addition, a 2-D dropout (Srivastava et al., 2014) layer was added after each dilated convolution for regularization: at each training step, a whole channel (in the width dimension) is zeroed out.
|
| 107 |
+
|
| 108 |
+
However, whereas in standard ResNet the input is passed in and added directly to the output of the residual function, in TCN (and ConvNet in general) the input and output could have different widths. Therefore in our TCN, when the input-output widths disagree, we use an additional 1x1 convolution to ensure that element-wise addition $\oplus$ receives tensors of the same shape (see Figure 3a, 3b).
|
| 109 |
+
|
| 110 |
+
Note that many further optimizations (e.g., gating, skip connections, context stacking as in audio generation using WaveNet) are possible in a TCN than what we described here. However, in this paper, we aim to present a generic, general-purpose TCN, to which additional twists can be added as needed. As we are going to show in Section 4, this general-purpose architecture is already able to outperform recurrent units like LSTM on a number of tasks by a good margin.
|
| 111 |
+
|
| 112 |
+
# 3.5 ADVANTAGES OF TCN SEQUENCE MODELING
|
| 113 |
+
|
| 114 |
+
There are several key advantages to a TCN model with the ingredients that we described above.
|
| 115 |
+
|
| 116 |
+
• Parallelism. Unlike in RNNs where the predictions for later timesteps must wait for their predecessors to complete, in a convolutional architecture these computations can be done in parallel since the same filter is used in each layer. Therefore, in training and evaluation, a (possibly long) input sequence can be processed as a whole in TCN, instead of serially as in RNN, which depends on the length of the sequence and could be less efficient.
|
| 117 |
+
|
| 118 |
+
• Flexible receptive field size. With a TCN, we can change its receptive field size in multiple ways. For instance, stacking more dilated (causal) convolutional layers, using larger dilation factors, or increasing the filter size are all viable options (with possibly different interpretations). TCN is thus easy to tune and adapt to different domains, since we now can directly control the size of the model’s memory.
|
| 119 |
+
|
| 120 |
+
• Stable gradients. Unlike recurrent architectures, TCN has a backpropagation path that is different from the temporal direction of the sequence. This enables it to avoid the problem of exploding/vanishing gradients, which is a major issue for RNNs (and which led to the development of LSTM, GRU, HF-RNN, etc.).
|
| 121 |
+
|
| 122 |
+
• Low memory requirement for training. In a task where the input sequence is long, a structure such as LSTM can easily use up a lot of memory to store the partial results for backpropagation (e.g., the results for each gate of the cell). However, in TCN, the backpropagation path only depends on the network depth and the filters are shared in each layer, which means that in practice, as model size or sequence length gets large, TCN is likely to use less memory than RNNs.
|
| 123 |
+
|
| 124 |
+
# 3.6 DISADVANTAGES OF TCN SEQUENCE MODELING
|
| 125 |
+
|
| 126 |
+
We also summarize two disadvantages of using TCN instead of RNNs.
|
| 127 |
+
|
| 128 |
+
• Data storage in evaluation. In evaluation/testing, RNNs only need to maintain a hidden state and take in a current input $x _ { t }$ in order to generate a prediction. In other words, a “summary” of the entire history is provided by the fixed-length set of vectors $h _ { t }$ , which means that the actual observed sequence can be discarded (and indeed, the hidden state can be used as a kind of encoder for all the observed history). In contrast, the TCN still needs to take in a sequence with non-trivial length (precisely the effective history length) in order to predict, thus possibly requiring more memory during evaluation. • Potential parameter change for a transfer of domain. Different domains can have different requirements on the amount of history the model needs to memorize. Therefore, when transferring a model from a domain where only little memory is needed (i.e., small $k$ and $d$ ) to a domain where much larger memory is required (i.e., much larger $k$ and $d$ ), TCN may perform poorly for not having a sufficiently large receptive field.
|
| 129 |
+
|
| 130 |
+
We want to emphasize, though, that we believe the notable lack of “infinite memory” for a TCN is decidedly not a practical disadvantage, since, as we show in Section 4, the TCN method actually outperforms RNNs in terms of the ability to deal with long temporal dependencies.
|
| 131 |
+
|
| 132 |
+
# 4 EXPERIMENTS
|
| 133 |
+
|
| 134 |
+
In this section, we conduct a series of experiments using the baseline TCN (described in section 3) and generic RNNs (namely LSTMs, GRUs, and vanilla RNNs). These experiments cover tasks and datasets from various domains, aiming to test different aspects of a model’s ability to learn sequence modeling. In several cases, specialized RNN models, or methods with particular forms of regularization can indeed vastly outperform both generic RNNs and the TCN on particular problems, which we highlight when applicable. But as a general-purpose architecture, we believe the experiments make a compelling case for the TCN as the “first attempt” approach for many sequential problems.
|
| 135 |
+
|
| 136 |
+
All experiments reported in this section used the same TCN architecture, just varying the depth of the network and occasionally the kernel size. We use an exponential dilation $d = 2 ^ { n }$ for layer $n$ in the network, and the Adam optimizer (Kingma & Ba, 2015) with learning rate 0.002 for TCN (unless otherwise noted). We also empirically find that gradient clipping helped training convergence of TCN, and we pick the maximum norm to clip from [0.3, 1]. When training recurrent models, we use a simple grid search to find a good set of hyperparameters (in particular, optimizer, recurrent drop $p \in [ 0 . 0 5 , 0 . 5 ]$ , the learning rate, gradient clipping, and initial forget-gate bias), while keeping the network around the same size as TCN. No other optimizations, such as gating mechanism (see Appendix D), or highway network, were added to TCN or the RNNs. The hyperparameters we use for TCN on different tasks are reported in Table 2 in Appendix B. In addition, we conduct a series controlled experiments to investigate the effects of filter size and residual function on the TCN’s performance. These results can be found in Appendix C.
|
| 137 |
+
|
| 138 |
+
# 4.1 TASKS AND RESULTS SUMMARY
|
| 139 |
+
|
| 140 |
+
In this section we highlight the general performance of generic TCNs vs generic LSTMs for a variety of domains from the sequential modeling literature. A complete description of each task, as well as references to some prior works that evaluated them, is given in Appendix A. In brief, the tasks we consider are: the adding problem, sequential MNIST, permuted MNIST (P-MNIST), the copy memory task, the Nottingham and JSB Chorales polyphonic music tasks, Penn Treebank (PTB), Wikitext-103 and LAMBADA word-level language modeling, as well as PTB and text8 characterlevel language modeling.
|
| 141 |
+
|
| 142 |
+
Table 1: Complete comparison of the TCN to regularized recurrent architectures in various tasks.
|
| 143 |
+
|
| 144 |
+
<table><tr><td rowspan="2">Sequential Tasks</td><td rowspan="2">Model Size (≈)</td><td colspan="4">Models</td></tr><tr><td>LSTM</td><td>GRU</td><td>RNN</td><td>TCN (ours)</td></tr><tr><td>Seq. MNIST (accuracy)</td><td>70K</td><td>87.2</td><td>96.2</td><td>21.5</td><td>99.0</td></tr><tr><td>P-Seq. MNIST (accuracy)</td><td>70K</td><td>85.7</td><td>87.3</td><td>25.3</td><td>97.2</td></tr><tr><td>The Adding Problem T=600 (loss)</td><td>70K</td><td>0.164</td><td>5.3e-5</td><td>0.177</td><td>5.8e-5</td></tr><tr><td>Copy Memory T=1000 (loss)</td><td>16K</td><td>0.0204</td><td>0.0197</td><td>1</td><td>3.5e-5</td></tr><tr><td>Music JSB Chorales (loss)</td><td>300K</td><td>8.45</td><td>8.43</td><td>8.91</td><td>8.10</td></tr><tr><td>Music Nottingham (loss)</td><td>1M</td><td>3.29</td><td>3.46</td><td>-</td><td>3.07</td></tr><tr><td>Word-level PTB (ppl)</td><td>13M</td><td>84.77</td><td>92.48</td><td>114.50</td><td>90.17</td></tr><tr><td>Word-level Wiki-103 (ppl)</td><td>-</td><td>48.4 (large)</td><td>-</td><td>1</td><td>45.19</td></tr><tr><td>Word-level LAMBADA (ppl)</td><td>-</td><td>4186</td><td>-</td><td>14725</td><td>1279</td></tr><tr><td>Char-level PTB (bpc)</td><td>3M</td><td>1.41</td><td>1.42</td><td>1.52</td><td>1.35</td></tr><tr><td>Char-level text8 (bpc)</td><td>5M</td><td>1.52</td><td>1.56</td><td>1.69</td><td>1.45</td></tr></table>
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 4: Results of TCN vs. recurrent architectures on the adding problem
|
| 148 |
+
|
| 149 |
+
A summary comparison of TCNs to the standard RNN architectures (LSTM, GRU, and vanilla RNN) is shown in Table 1. We will highlight many of these results below, and want to emphasize that for several tasks the baseline RNN architectures are still far from the state of the art (see Table 4), but in total the results make a strong case that the TCN architecture, as a generic sequence modeling framework, is often superior to generic RNN approaches. We now consider several of these experiments in detail, generally distinguishing between the “recurrent benchmark” tasks designed to show the limitations of networks for sequence modeling (adding problem, sequential & permuted MNIST, copy memory), and the “applied” tasks (polyphonic music and language modeling).
|
| 150 |
+
|
| 151 |
+
# 4.2 BASELINE RECURRENT TASKS
|
| 152 |
+
|
| 153 |
+
We first compare the results of the TCN architecture to those of RNNs on the toy baseline tasks that have been frequently used to evaluate sequential modeling (Hochreiter & Schmidhuber, 1997; Martens & Sutskever, 2011; Pascanu et al., 2013; Le et al., 2015; Cooijmans et al., 2016; Zhang et al., 2016; Krueger et al., 2017; Wisdom et al., 2016; Arjovsky et al., 2016).
|
| 154 |
+
|
| 155 |
+
The Adding Problem. Convergence results for the adding problem, for problem sizes $T =$ 200, 400, 600, are shown in Figure 4; all models were chosen to have roughly 70K parameters. In all three cases, TCNs quickly converged to a virtually perfect solution (i.e., an MSE loss very close to 0). LSTMs and vanilla RNNs performed significantly worse, while on this task GRUs also performed quite well, even though their convergence was slightly slower than TCNs.
|
| 156 |
+
|
| 157 |
+
Sequential MNIST and P-MNIST. Results on sequential and permuted MNIST, run over 10 epochs, are shown in Figures 5a and 5b; all models were picked to have roughly 70K parameters. For both problems, TCNs substantially outperform the alternative architectures, both in terms of convergence time and final performance level on the task. For the permuted sequential MNIST, TCNs outperform state of the art results using recurrent nets $( 9 5 . 9 \% )$ with Zoneout+Recurrent BatchNorm (Cooijmans et al., 2016; Krueger et al., 2017), a highly optimized method for regularizing RNNs.
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 5: Results of TCN vs. recurrent architectures on the Sequential MNIST and P-MNIST
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 6: Result of TCN vs. recurrent architectures on the Copy Memory Task, for different $T$
|
| 164 |
+
|
| 165 |
+
Copy Memory Task. Finally, Figure 6 shows the results of the different methods (with roughly the same size) on the copy memory task. Again, the TCNs quickly converge to correct answers, while the LSTM and GRU simply converge to the same loss as predicting all zeros. In this case we also compare to the recently-proposed EURNN (Jing et al., 2017), which was highlighted to perform well on this task. While both perform well for sequence length $T = 5 0 0$ , the TCN again has a clear advantage for $T = 1 0 0 0$ and $T = 2 0 0 0$ (in terms of both loss and convergence).
|
| 166 |
+
|
| 167 |
+
# 4.3 RESULTS ON POLYPHONIC MUSIC AND LANGUAGE MODELING
|
| 168 |
+
|
| 169 |
+
Next, we compare the results of the TCN architecture to recurrent architectures on 6 different real datasets in polyphonic music as well as word- and character-level language modeling. These are areas where sequence modeling has been used most frequently. As domains where there is considerable practical interests, there have also been many specialized RNNs developed for these tasks (e.g., Zhang et al. (2016); Ha et al. (2017); Krueger et al. (2017); Grave et al. (2016); Greff et al. (2017); Merity et al. (2017)). We mention some of these comparisons when useful, but the primary goal here is to compare the generic TCN model to other generic RNN architectures, so we focus mainly on these comparisons.
|
| 170 |
+
|
| 171 |
+
Polyphonic Music. On the Nottingham and JSB Chorales datasets, the TCN with virtually no tuning is again able to beat the other models by a considerable margin (see Table 1), and even outperforms some improved recurrent models for this task such as HF-RNN (Boulanger-Lewandowski et al., 2012) and Diagonal RNN (Subakan & Smaragdis, 2017). Note however that other models such as the Deep Belief Net LSTM (Vohra et al., 2015) perform substantially better on this task; we believe this is likely due to the fact that the datasets involved in polyphonic music are relatively small, and thus the right regularization method or generative modeling procedure can improve performance significantly. This is largely orthogonal to the RNN/TCN distinction, as a similar variant of TCN may well be possible.
|
| 172 |
+
|
| 173 |
+
Word-level Language Modeling. Language modeling remains one of the primary applications of recurrent networks in general, where many recent works have been focusing on optimizing the usage of LSTMs (see Krueger et al. (2017); Merity et al. (2017)). In our implementation, we follow standard practices such as tying the weights of encoder and decoder layers for both TCN and RNNs (Press & Wolf, 2016), which significantly reduces the number of parameters in the model. When training the language modeling tasks, we use SGD optimizer with annealing learning rate (by a factor of 0.5) for TCN and RNNs.
|
| 174 |
+
|
| 175 |
+
Results on word-level language modeling are reported in Table 1. With a fine-tuned LSTM (i.e., with recurrent and embedding dropout, etc.), we find LSTM can outperform TCN in perplexity on the Penn TreeBank (PTB) dataset, where the TCN model still beats both GRU and vanilla RNN. On the much larger Wikitext-103 corpus, however, without performing much hyperparameter search (due to lengthy training process), we still observe that TCN outperforms the state of the art LSTM results (48.4 in perplexity) by Grave et al. (2016) (without continuous cache pointer; see Table 4). The same superiority is observed on the LAMBADA test (Paperno et al., 2016), where TCN achieves a much lower perplexity than its recurrent counterparts in predicting the last word based on a very long context (see Appendix A). We will further analyze this in section 4.4.
|
| 176 |
+
|
| 177 |
+
Character-level Language Modeling. The results of applying TCN and alternative models on PTB and text8 data for character-level language modeling are shown in Table 1, with performance measured in bits per character (bpc). While beaten by the state of the art (see Table 4), the generic TCN outperforms regularized LSTM and GRU as well as methods such as Norm-stabilized LSTM (Krueger & Memisevic, 2015). Moreover, we note that using a filter size of $k \leq 4$ works better than larger filter sizes in character-level language modeling, which suggests that capturing short history is more important than longer dependencies in these tasks.
|
| 178 |
+
|
| 179 |
+
# 4.4 MEMORY SIZE OF TCN AND RNNS
|
| 180 |
+
|
| 181 |
+
Finally, one of the important reasons why RNNs have been preferred over CNNs for general sequence modeling is that theoretically, recurrent architectures are capable of an infinite memory. We therefore attempt to study here how much memory TCN and LSTM/GRU are able to actually “backtrack”, via the copy memory task and the LAMBADA language modeling task.
|
| 182 |
+
|
| 183 |
+
The copy memory task is a simple but perfect task to examine a model’s ability to pick up its memory from a (possibly) distant past (by varying the value of sequence length $T$ ). However, different from the setting in Section 4.2, in order to compare the results for different sequence lengths, here we only report the accuracy on the last $I O$ elements of the output sequence. We used a model size of 10K for both TCN and RNNs.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 7: Accuracy on the copy memory task for varying sequence length $T$ .
|
| 187 |
+
|
| 188 |
+
The results are shown in Figure 7. TCNs consistently converge to $100 \%$ accuracy for all sequence lengths, whereas it is increasingly challenging for recurrent models to memorize as $T$ grows (with accuracy converging to that of a random guess). LSTM’s accuracy quickly falls below $20 \%$ for $T \geq 5 0$ , which suggests that instead of infinite memory, LSTMs are only good at recalling a short history instead.
|
| 189 |
+
|
| 190 |
+
This observation is also backed up by the experiments of TCN on the LAMBADA dataset, which is specifically designed to test a model’s textual understanding in a broader discourse. The objective of LAMBADA dataset is to predict the last word of the target sentence given a sufficiently long context (see Appendix A for more details). Most of the existing models fail to guess accurately on this task. As shown in Table 1, TCN outperforms LSTMs by a significant margin in perplexity on LAMBADA (with a smaller network and virtually no tuning).
|
| 191 |
+
|
| 192 |
+
These results indicate that TCNs, despite their apparent finite history, in practice maintain a longer effective history than their recurrent counterparts. We would like to emphasize that this empirical observation does not contradict the good results that prior works have achieved using LSTM, such as in language modeling on PTB. In fact, the very success of $n$ -gram models (Brown et al., 1992) suggested that language modeling might not need a very long memory, a conclusion also reached by prior works such as Dauphin et al. (2017).
|
| 193 |
+
|
| 194 |
+
# 5 DISCUSSION
|
| 195 |
+
|
| 196 |
+
In this work, we revisited the topic of modeling sequence predictions using convolutional architectures. We introduced the key components of the TCN and analyzed some vital advantages and disadvantages of using TCN for sequence predictions instead of RNNs. Further, we compared our generic TCN model to the recurrent architectures on a set of experiments that span a wide range of domains and datasets. Through these experiments, we have shown that TCN with minimal tuning can outperform LSTM/GRU of the same model size (and with standard regularizations) in most of the tasks. Further experiments on the copy memory task and LAMBADA task revealed that TCNs actually has a better capability for long-term memory than the comparable recurrent architectures, which are commonly believed to have unlimited memory.
|
| 197 |
+
|
| 198 |
+
It is still important to note that, however, we only presented a generic architecture here, with components all coming from standard modern convolutional networks (e.g., normalization, dropout, residual network). And indeed, on specific problems, the TCN model can still be beaten by some specialized RNNs that adopt carefully designed optimization strategies. Nevertheless, we believe the experiment results in Section 4 might be a good signal that instead of considering RNNs as the “default” methodology for sequence modeling, convolutional networks too, can be a promising and powerful toolkit in studying time-series data.
|
| 199 |
+
|
| 200 |
+
# REFERENCES
|
| 201 |
+
|
| 202 |
+
Allan, M. and Williams, C. Harmonising chorales by probabilistic inference. In Advances in neural information processing systems, pp. 25–32, 2005.
|
| 203 |
+
Arjovsky, M., Shah, A., and Bengio, Y. Unitary evolution recurrent neural networks. In International Conference on Machine Learning (ICML-16), pp. 1120–1128, 2016.
|
| 204 |
+
Bengio, Y., Simard, P., and Frasconi, P. Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 5(2):157–166, 1994.
|
| 205 |
+
Borovykh, A., Bohte, S., and Oosterlee, C. W. Conditional time series forecasting with convolutional neural networks. arXiv preprint arXiv:1703.04691, 2017.
|
| 206 |
+
Bottou, L., Soulie, F. F., Blanchet, P., and Lienard, J.-S. Speaker-independent isolated digit recog- ´ nition: Multilayer perceptrons vs. dynamic time warping. Neural Networks, 3(4):453–465, 1990.
|
| 207 |
+
Boulanger-Lewandowski, N., Bengio, Y., and Vincent, P. Modeling temporal dependencies in highdimensional sequences: Application to polyphonic music generation and transcription. arXiv preprint arXiv:1206.6392, 2012.
|
| 208 |
+
Brown, P. F., Desouza, P. V., Mercer, R. L., Pietra, V. J. D., and Lai, J. C. Class-based n-gram models of natural language. Computational linguistics, 18(4):467–479, 1992.
|
| 209 |
+
Chang, S., Zhang, Y., Han, W., Yu, M., Guo, X., Tan, W., Cui, X., Witbrock, M., Hasegawa-Johnson, M., and Huang, T. Dilated recurrent neural networks. arXiv preprint arXiv:1710.02224, 2017.
|
| 210 |
+
Cho, K., Van Merrienboer, B., Bahdanau, D., and Bengio, Y. On the properties of neural machine ¨ translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014.
|
| 211 |
+
Chung, J., Gulcehre, C., Cho, K., and Bengio, Y. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
|
| 212 |
+
Chung, J., Ahn, S., and Bengio, Y. Hierarchical multiscale recurrent neural networks. arXiv preprint arXiv:1609.01704, 2016.
|
| 213 |
+
Cooijmans, T., Ballas, N., Laurent, C., Gulc¸ehre, C¸ ., and Courville, A. Recurrent batch normaliza- ¨ tion. In International Conference on Learning Representations, 2016.
|
| 214 |
+
Dauphin, Y. N., Fan, A., Auli, M., and Grangier, D. Language modeling with gated convolutional networks. In International Conference on Machine Learning (ICML-17), pp. 933–941, 2017.
|
| 215 |
+
Elman, J. L. Finding structure in time. Cognitive science, 14(2):179–211, 1990.
|
| 216 |
+
Gehring, J., Auli, M., Grangier, D., Yarats, D., and Dauphin, Y. N. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017.
|
| 217 |
+
Gers, F. A., Schraudolph, N. N., and Schmidhuber, J. Learning precise timing with lstm recurrent networks. Journal of machine learning research, 3(Aug):115–143, 2002.
|
| 218 |
+
Grave, E., Joulin, A., and Usunier, N. Improving neural language models with a continuous cache. In International Conference on Learning Representations, 2016.
|
| 219 |
+
Greff, K., Srivastava, R. K., Koutn´ık, J., Steunebrink, B. R., and Schmidhuber, J. Lstm: A search space odyssey. IEEE transactions on neural networks and learning systems, 2017.
|
| 220 |
+
Ha, D., Dai, A., and Le, Q. V. Hypernetworks. In International Conference on Learning Representations, 2017.
|
| 221 |
+
He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Computer Vision and Pattern Recognition, pp. 770–778, 2016.
|
| 222 |
+
Hinton, G. E. Connectionist learning procedures. Artificial intelligence, 40(1-3):185–234, 1989.
|
| 223 |
+
Hochreiter, S. and Schmidhuber, J. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
|
| 224 |
+
Jing, L., Shen, Y., Dubcek, T., Peurifoy, J., Skirlo, S., LeCun, Y., Tegmark, M., and Soljaciˇ c, M. ´ Tunable efficient unitary neural networks (EUNN) and their application to RNNs. In International Conference on Machine Learning (ICML-17), pp. 1733–1741, 2017.
|
| 225 |
+
Jozefowicz, R., Zaremba, W., and Sutskever, I. An empirical exploration of recurrent network architectures. In International Conference on Machine Learning (ICML-15), pp. 2342–2350, 2015.
|
| 226 |
+
Kalchbrenner, N., Espeholt, L., Simonyan, K., Oord, A. v. d., Graves, A., and Kavukcuoglu, K. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099, 2016.
|
| 227 |
+
Kingma, D. and Ba, J. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 228 |
+
Koutnik, J., Greff, K., Gomez, F., and Schmidhuber, J. A clockwork rnn. In International Conference on Machine Learning (ICML-14), pp. 1863–1871, 2014.
|
| 229 |
+
Krueger, D. and Memisevic, R. Regularizing rnns by stabilizing activations. arXiv preprint arXiv:1511.08400, 2015.
|
| 230 |
+
Krueger, D., Maharaj, T., Kramar, J., Pezeshki, M., Ballas, N., Ke, N. R., Goyal, A., Bengio, Y., ´ Larochelle, H., Courville, A., et al. Zoneout: Regularizing rnns by randomly preserving hidden activations. In International Conference on Learning Representations, 2017.
|
| 231 |
+
Le, Q. V., Jaitly, N., and Hinton, G. E. A simple way to initialize recurrent networks of rectified linear units. arXiv preprint arXiv:1504.00941, 2015.
|
| 232 |
+
LeCun, Y., Bengio, Y., et al. Convolutional networks for images, speech, and time series. In The handbook of brain theory and neural networks, volume 3361, pp. 1995. 1995.
|
| 233 |
+
Lecun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, pp. 2278–2324, 1998.
|
| 234 |
+
Long, J., Shelhamer, E., and Darrell, T. Fully convolutional networks for semantic segmentation. In Computer Vision and Pattern Recognition, pp. 3431–3440, 2015.
|
| 235 |
+
Marcus, M. P., Marcinkiewicz, M. A., and Santorini, B. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 19(2):313–330, 1993.
|
| 236 |
+
Martens, J. and Sutskever, I. Learning recurrent neural networks with hessian-free optimization. In International Conference on Machine Learning (ICML-11), pp. 1033–1040, 2011.
|
| 237 |
+
Merity, S., Xiong, C., Bradbury, J., and Socher, R. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
|
| 238 |
+
Merity, S., Keskar, N. S., and Socher, R. Regularizing and Optimizing LSTM Language Models. arXiv preprint arXiv:1708.02182, 2017.
|
| 239 |
+
Mikolov, T., Sutskever, I., Deoras, A., Le, H.-S., Kombrink, S., and Cernocky, J. Subword language modeling with neural networks. preprint, 2012.
|
| 240 |
+
Miyamoto, Y. and Cho, K. Gated word-character recurrent language model. arXiv preprint arXiv:1606.01700, 2016.
|
| 241 |
+
Nair, V. and Hinton, G. E. Rectified linear units improve restricted boltzmann machines. In International Conference on Machine Learning (ICML-10), pp. 807–814, 2010.
|
| 242 |
+
Oord, A. v. d., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A., and Kavukcuoglu, K. Wavenet: A generative model for raw audio. In International Conference on Learning Representations, 2016a.
|
| 243 |
+
Oord, A. v. d., Kalchbrenner, N., Vinyals, O., Espeholt, L., Graves, A., and Kavukcuoglu, K. Conditional image generation with pixelcnn decoders. In Advances in Neural Information Processing Systems, pp. 4790–4798, 2016b.
|
| 244 |
+
Paperno, D., Kruszewski, G., Lazaridou, A., Pham, Q. N., Bernardi, R., Pezzelle, S., Baroni, M., Boleda, G., and Fernandez, R. The lambada dataset: Word prediction requiring a broad discourse ´ context. arXiv preprint arXiv:1606.06031, 2016.
|
| 245 |
+
Pascanu, R., Mikolov, T., and Bengio, Y. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning (ICML-13), pp. 1310–1318, 2013.
|
| 246 |
+
Press, O. and Wolf, L. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016.
|
| 247 |
+
Salimans, T. and Kingma, D. P. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909. 2016.
|
| 248 |
+
Srivastava, N., Hinton, G. E., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. Dropout: a simple way to prevent neural networks from overfitting. Journal of machine learning research, 15(1): 1929–1958, 2014.
|
| 249 |
+
Subakan, Y. C. and Smaragdis, P. Diagonal rnns in symbolic music modeling. arXiv preprint arXiv:1704.05420, 2017.
|
| 250 |
+
Vohra, R., Goel, K., and Sahoo, J. Modeling temporal dependencies in data using a dbn-lstm. In Data Science and Advanced Analytics (DSAA), 2015. 36678 2015. IEEE International Conference on, pp. 1–4. IEEE, 2015.
|
| 251 |
+
Waibel, A., Hanazawa, T., Hinton, G., Shikano, K., and Lang, K. J. Phoneme recognition using time-delay neural networks. IEEE transactions on acoustics, speech, and signal processing, 37 (3):328–339, 1989.
|
| 252 |
+
Wisdom, S., Powers, T., Hershey, J., Le Roux, J., and Atlas, L. Full-capacity unitary recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 4880–4888, 2016.
|
| 253 |
+
Wu, Y., Zhang, S., Zhang, Y., Bengio, Y., and Salakhutdinov, R. R. On multiplicative integration with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 2856– 2864, 2016.
|
| 254 |
+
Yu, F. and Koltun, V. Multi-scale context aggregation by dilated convolutions. In International Conference on Learning Representations, 2015.
|
| 255 |
+
Zhang, S., Wu, Y., Che, T., Lin, Z., Memisevic, R., Salakhutdinov, R. R., and Bengio, Y. Architectural complexity measures of recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1822–1830. 2016.
|
| 256 |
+
|
| 257 |
+
# A DESCRIPTION OF BENCHMARK TASKS
|
| 258 |
+
|
| 259 |
+
The Adding Problem: In this task, each input consists of a length- $\mathbf { \nabla } \cdot n$ sequence of depth 2, with all values randomly chosen in [0, 1], and the second dimension being all zeros expect for two elements that are marked by 1. The objective is to sum the two random values whose second dimensions are marked by 1. Simply predicting the sum to be 1 should give an MSE of about 0.1767. First introduced by Hochreiter & Schmidhuber (1997), the addition problem have been consistently used as a pathological test for evaluating sequential models (Pascanu et al., 2013; Le et al., 2015; Zhang et al., 2016; Arjovsky et al., 2016).
|
| 260 |
+
|
| 261 |
+
Sequential MNIST & P-MNIST: Sequential MNIST is frequently used to test a recurrent network’s ability to combine its information from a long memory context in order to make classification prediction (Le et al., 2015; Zhang et al., 2016; Cooijmans et al., 2016; Krueger et al., 2017; Jing et al., 2017). In this task, MNIST (Lecun et al., 1998) images are presented to the model as a $7 8 4 \times 1$ sequence for digit classification In a more challenging setting, we also permuted the order of the sequence by a random (fixed) order and tested the TCN on this permuted MNIST (P-MNIST) task.
|
| 262 |
+
|
| 263 |
+
Copy Memory Task: In copy memory task, each input sequence has length $T + 2 0$ . The first 10 values are chosen randomly from digit [1-8] with the rest being all zeros, except for the last 11 entries which are marked by 9 (the first $" 9 "$ is a delimiter). The goal of this task is to generate an output of same length that is zero everywhere, except the last 10 values after the delimiter, where the model is expected to repeat the same 10 values at the start of the input. This was used by prior works such as Arjovsky et al. (2016); Wisdom et al. (2016); Jing et al. (2017); but we also extended the sequence lengths to up to $T = 2 0 0 0$ .
|
| 264 |
+
|
| 265 |
+
JSB Chorales: JSB Chorales dataset (Allan & Williams, 2005) is a polyphonic music dataset consisting of the entire corpus of 382 four-part harmonized chorales by J. S. Bach. In a polyphonic music dataset, each input is a sequence of elements having 88 dimensions, representing the 88 keys on a piano. Therefore, each element $x _ { t }$ is a chord written in as binary vector, in which a “1” indicates a key pressed.
|
| 266 |
+
|
| 267 |
+
Nottingham: Nottingham dataset 2 is a collection of 1200 British and American folk tunes. Nottingham is a much larger dataset than JSB Chorales. Along with JSB Chorales, Nottingham has been used in a number of works that investigated recurrent models’ applicability in polyphonic music (Greff et al., 2017; Chung et al., 2014), and the performance for both tasks are measured in terms of negative log-likelihood (NLL) loss.
|
| 268 |
+
|
| 269 |
+
PennTreebank: We evaluated TCN on the PennTreebank (PTB) dataset (Marcus et al., 1993), for both character-level and word-level language modeling. When used as a character-level language corpus, PTB contains 5059K characters for training, 396K for validation and 446K for testing, with an alphabet size of 50. When used as a word-level language corpus, PTB contains 888K words for training, 70K for validation and 79K for testing, with vocabulary size 10000. This is a highly studied dataset in the field of language modeling (Miyamoto & Cho, 2016; Krueger et al., 2017; Merity et al., 2017), with exceptional results have been achieved by some highly optimized RNNs.
|
| 270 |
+
|
| 271 |
+
Wikitext-103: Wikitext-103 (Merity et al., 2016) is almost 110 times as large as PTB, featuring a vocabulary size of about 268K. The dataset contains 28K Wikipedia articles (about 103 million words) for training, 60 articles (about 218K words) for validation and 60 articles (246K words) for testing. This is a more representative (and realistic) dataset than PTB as it contains a much larger vocabulary, including many rare vocabularies.
|
| 272 |
+
|
| 273 |
+
LAMBADA: Introduced by Paperno et al. (2016), LAMBADA (LA nguage Modeling Boadened to Account for Discourse Aspects) is a dataset consisting of 10K passages extracted from novels, with on average 4.6 sentences as context, and 1 target sentence whose last word is to be predicted. This dataset was built so that human can guess naturally and perfectly when given the context, but would fail to do so when only given the target sentence. Therefore, LAMBADA is a very challenging dataset that evaluates a model’s textual understanding and ability to keep track of information in the broader discourse. Here is an example of a test in the LAMBADA dataset, where the last word “miscarriage” is to be predicted (which is not in the context):
|
| 274 |
+
|
| 275 |
+
Context: “Yes, I thought I was going to lose the baby.”“I was scared too.” he stated, sincerity flooding his eyes. “You were?”“Yes, of course. Why do you even ask?”“This baby wasn’t exactly planned for.”
|
| 276 |
+
|
| 277 |
+
Target Sentence: “Do you honestly think that I would want you to have a ”
|
| 278 |
+
|
| 279 |
+
Target Word: miscarriage
|
| 280 |
+
|
| 281 |
+
This dataset was evaluated in prior works such as Paperno et al. (2016); Grave et al. (2016). In general, better results on LAMBADA indicate that a model is better at capturing information from longer and broader context. The training data for LAMBADA is the full text of 2,662 novels with more than 200M words 3, and the vocabulary size is about 93K.
|
| 282 |
+
|
| 283 |
+
text8: We also used tex $8 ^ { 4 }$ dataset for character level language modeling (Mikolov et al., 2012). Compared to PTB, text8 is about 20 times as large, with about 100 million characters from Wikipedia (90M for training, 5M for validation and 5M for testing). The corpus contains 27 unique alphabets.
|
| 284 |
+
|
| 285 |
+
# B HYPERPARAMETERS SETTINGS
|
| 286 |
+
|
| 287 |
+
# B.1 HYPERPARAMETERS FOR TCN
|
| 288 |
+
|
| 289 |
+
In this supplementary section, we report in a table (see Table 2) the hyperparameters we used when applying the generic TCN model on the different tasks/datasets. The most important factor for picking parameters is to make sure that the TCN has a sufficiently large receptive field by choosing $k$ and $n$ that can cover the amount of context needed for the task.
|
| 290 |
+
|
| 291 |
+
Table 2: TCN parameter settings for experiments in Section. 4
|
| 292 |
+
|
| 293 |
+
<table><tr><td colspan="7">TCN SETTINGS</td></tr><tr><td>Dataset/Task</td><td>Subtask</td><td>k n</td><td>Hidden</td><td>Dropout</td><td>Grad Clip</td><td>Note</td></tr><tr><td rowspan="3">The Adding Problem</td><td>T=200</td><td>6</td><td>7 27</td><td></td><td></td><td></td></tr><tr><td>T= 400</td><td>7</td><td>7 27</td><td>0.0</td><td>N/A</td><td></td></tr><tr><td>T= 600</td><td>8</td><td>8 24</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Seq. MNIST</td><td></td><td>7</td><td>8</td><td>25</td><td>0.0</td><td>N/A</td></tr><tr><td></td><td>6</td><td>8 20</td><td></td><td></td><td></td></tr><tr><td>Permuted MNIST</td><td></td><td>7 6</td><td>8 8</td><td>25 0.0 20</td><td>N/A</td><td></td></tr><tr><td rowspan="3">Copy Memory Task</td><td>T=500</td><td>6</td><td>9</td><td>10</td><td></td><td></td></tr><tr><td>T= 1000</td><td>8</td><td>8</td><td>10 0.05</td><td>1.0</td><td>RMSprop 5e-4</td></tr><tr><td>T= 2000</td><td>8</td><td>9 10</td><td></td><td></td><td></td></tr><tr><td>Music JSB Chorales</td><td>1</td><td>3</td><td>2</td><td>150</td><td>0.5 0.4</td><td></td></tr><tr><td>Music Nottingham</td><td>1</td><td>6</td><td>4</td><td>150</td><td>0.2 0.4</td><td></td></tr><tr><td rowspan="3">Word-level LM</td><td>PTB</td><td>3</td><td>4 600</td><td></td><td></td><td>Embed. size 600</td></tr><tr><td>Wiki-103</td><td>3</td><td>5 1000</td><td>0.4</td><td>0.3</td><td>Embed. size 400</td></tr><tr><td>LAMBADA</td><td>4</td><td>5 500</td><td></td><td></td><td>Embed. size 500</td></tr><tr><td rowspan="2">Char-level LM</td><td>PTB</td><td>3</td><td>3</td><td>450</td><td></td><td></td></tr><tr><td>text8</td><td>2</td><td>5</td><td>0.1 520</td><td>0.15</td><td>Embed. size 100</td></tr></table>
|
| 294 |
+
|
| 295 |
+
As previously mentioned in Section 4, the number of hidden units was chosen based on $k$ and $n$ such that the model size is approximately at the same level as the recurrent models. In the table above, a gradient clip of N/A means no gradient clipping was applied. However, in larger tasks, we empirically found that adding a gradient clip value (we randomly picked from [0.2, 1]) helps the training convergence.
|
| 296 |
+
|
| 297 |
+
# B.2 HYPERPARAMETERS FOR LSTM/GRU
|
| 298 |
+
|
| 299 |
+
We also report the parameter setting for LSTM in Table 3. These values are picked from hyperparameter search for LSTMs that have up to 3 layers, and the optimizers are chosen from {SGD, Adam, RMSprop, Adagrad}.
|
| 300 |
+
|
| 301 |
+
GRU hyperparameters were chosen in a similar fashion, but with more hidden units to keep the total model size approximately the same (since a GRU cell is smaller).
|
| 302 |
+
|
| 303 |
+
# B.3 COMPARE TO THE STATE OF THE ART RESULTS
|
| 304 |
+
|
| 305 |
+
As previously noted, TCN can still be outperformed by optimized RNNs in some of the tasks, whose results are summarized in Table 4 below. The same TCN architecture is used across all tasks.
|
| 306 |
+
|
| 307 |
+
Note that the size of the SoTA model may be different from the size of the TCN.
|
| 308 |
+
|
| 309 |
+
Table 3: LSTM parameter settings for experiments in Section 4.
|
| 310 |
+
|
| 311 |
+
<table><tr><td colspan="8">LSTM SETTINGS(KEY PARAMETERS)</td></tr><tr><td>Dataset/Task</td><td>Subtask</td><td>n</td><td>Hidden</td><td>Dropout</td><td>Grad Clip</td><td>Bias</td><td>Note</td></tr><tr><td rowspan="3">The Adding Problem</td><td>T= 200</td><td>2</td><td>77</td><td></td><td>50</td><td>5.0</td><td>SGD 1e-3</td></tr><tr><td>T= 400</td><td>2</td><td>77</td><td>0.0</td><td>50</td><td>10.0</td><td>Adam 2e-3</td></tr><tr><td>T= 600</td><td>1</td><td>130</td><td></td><td>5</td><td>1.0</td><td>1</td></tr><tr><td>Seq. MNIST</td><td>:</td><td>1</td><td>130</td><td>0.0</td><td>1</td><td>1.0</td><td>RMSprop 1e-3</td></tr><tr><td>Permuted MNIST</td><td>1</td><td>1</td><td>130</td><td>0.0</td><td>1</td><td>10.0</td><td>RMSprop 1e-3</td></tr><tr><td rowspan="3">Copy Memory Task</td><td>T= 500</td><td>1</td><td>50</td><td></td><td>0.25</td><td></td><td></td></tr><tr><td>T=1000</td><td>1</td><td>50</td><td>0.05</td><td>1</td><td>1</td><td>RMSprop/Adam</td></tr><tr><td>T= 2000</td><td>3</td><td>28</td><td></td><td>1</td><td></td><td></td></tr><tr><td>Music JSB Chorales</td><td>1</td><td>2</td><td>200</td><td>0.2</td><td>1</td><td>10.0</td><td>SGD/Adam</td></tr><tr><td>Music Nottingham</td><td>-</td><td>3</td><td>280</td><td>0.1</td><td>0.5</td><td>-</td><td>Adam 4e-3</td></tr><tr><td rowspan="3">Word-level LM</td><td></td><td>1</td><td>500</td><td></td><td>1</td><td>-</td><td></td></tr><tr><td>PTB</td><td>3</td><td>700</td><td>0.4</td><td>0.3</td><td>1.0</td><td>SGD 30,Emb. 700, etc.</td></tr><tr><td>Wiki-103</td><td>-</td><td>-</td><td>·</td><td>·</td><td>·</td><td>Grave et al. (2016)</td></tr><tr><td></td><td>LAMBADA</td><td>-</td><td>-</td><td>-</td><td>1</td><td>-</td><td>Grave et al. (2016)</td></tr><tr><td rowspan="2">Char-level LM</td><td>PTB</td><td></td><td>600</td><td>0.1</td><td>0.5</td><td>-</td><td>Emb. size 120</td></tr><tr><td>text8</td><td>21</td><td>1024</td><td>0.15</td><td>0.5</td><td>1</td><td>Adam 1e-2</td></tr></table>
|
| 312 |
+
|
| 313 |
+
Table 4: State of the art (SoTA) results for tasks in Section 4.
|
| 314 |
+
|
| 315 |
+
<table><tr><td rowspan=1 colspan=6>TCN VS. SoTA RESULTS</td></tr><tr><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=1>TCN Result</td><td rowspan=1 colspan=1>Size</td><td rowspan=1 colspan=1>SoTA</td><td rowspan=1 colspan=1>Size</td><td rowspan=1 colspan=1>Model</td></tr><tr><td rowspan=1 colspan=1>Seq. MNIST (acc.)</td><td rowspan=1 colspan=1>99.0</td><td rowspan=1 colspan=1>21K</td><td rowspan=1 colspan=1>99.0</td><td rowspan=1 colspan=1>21K</td><td rowspan=1 colspan=1>Dilated GRU (Chang et al., 2017)</td></tr><tr><td rowspan=1 colspan=1>P-MNIST (acc.)</td><td rowspan=1 colspan=1>97.2</td><td rowspan=1 colspan=1>42K</td><td rowspan=1 colspan=1>95.9</td><td rowspan=1 colspan=1>42K</td><td rowspan=1 colspan=1> Zoneout (Krueger et al., 2017)</td></tr><tr><td rowspan=1 colspan=1>Adding Prob. 600 (loss)</td><td rowspan=1 colspan=1>5.8e-5</td><td rowspan=1 colspan=1>70K</td><td rowspan=1 colspan=1>5.3e-5</td><td rowspan=1 colspan=1>70K</td><td rowspan=1 colspan=1>Regularized GRU</td></tr><tr><td rowspan=1 colspan=1>Copy Memory 1000 (loss)</td><td rowspan=1 colspan=1>3.5e-5</td><td rowspan=1 colspan=1>70K</td><td rowspan=1 colspan=1>0.011</td><td rowspan=1 colspan=1>70K</td><td rowspan=1 colspan=1>EURNN (Jing et al., 2017)</td></tr><tr><td rowspan=1 colspan=1>JSB Chorales (loss)</td><td rowspan=1 colspan=1>8.10</td><td rowspan=1 colspan=1>300K</td><td rowspan=1 colspan=1>3.47</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>DBN+LSTM(Vohra et al., 2015)</td></tr><tr><td rowspan=1 colspan=1>Nottingham (loss)</td><td rowspan=1 colspan=1>3.07</td><td rowspan=1 colspan=1>1M</td><td rowspan=1 colspan=1>1.32</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>DBN+LSTM (Vohra et al., 2015)</td></tr><tr><td rowspan=1 colspan=1>Word PTB (ppl)</td><td rowspan=1 colspan=1>90.17</td><td rowspan=1 colspan=1>13M</td><td rowspan=1 colspan=1>52.8</td><td rowspan=1 colspan=1>24M</td><td rowspan=1 colspan=1>AWD-LSTM + Cont.Cache(Merity et al., 2017)</td></tr><tr><td rowspan=1 colspan=1>Word Wiki-103 (ppl)</td><td rowspan=1 colspan=1>45.19</td><td rowspan=1 colspan=1>148M</td><td rowspan=1 colspan=1>40.4</td><td rowspan=1 colspan=1>>300M</td><td rowspan=1 colspan=1>Neural Cache Model (Large)(Grave et al., 2016)</td></tr><tr><td rowspan=1 colspan=1>Word LAMBADA (ppl)</td><td rowspan=1 colspan=1>1279</td><td rowspan=1 colspan=1>56M</td><td rowspan=1 colspan=1>138</td><td rowspan=1 colspan=1>>100M</td><td rowspan=1 colspan=1>Neural Cache Model (Large)(Grave et al., 2016)</td></tr><tr><td rowspan=1 colspan=1>Char PTB (bpc)</td><td rowspan=1 colspan=1>1.35</td><td rowspan=1 colspan=1>3M</td><td rowspan=1 colspan=1>1.22</td><td rowspan=1 colspan=1>14M</td><td rowspan=1 colspan=1>2-LayerNorm HyperLSTM(Ha et al., 2017)</td></tr><tr><td rowspan=1 colspan=1>Char text8 (bpc)</td><td rowspan=1 colspan=1>1.45</td><td rowspan=1 colspan=1>4.6M</td><td rowspan=1 colspan=1>1.29</td><td rowspan=1 colspan=1>>12M</td><td rowspan=1 colspan=1>HM-LSTM (Chung et al., 2016)</td></tr></table>
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
Figure 8: Controlled experiments that examine different components of the TCN model
|
| 319 |
+
|
| 320 |
+
In this section we briefly study, via controlled experiments, the effect of filter size and residual block on the TCN’s ability to model different sequential tasks. Figure 8 shows the results of this ablative analysis. We kept the model size and the depth of the networks exactly the same within each experiment so that dilation factor is controlled. We conducted the experiment on three very different tasks: the copy memory task, permuted MNIST (P-MNIST), as well as word-level PTB language modeling.
|
| 321 |
+
|
| 322 |
+
Through these experiments, we empirically confirm that both filter sizes and residuals play important roles in TCN’s capability of modeling potentially long dependencies. In both the copy memory and the permuted MNIST task, we observed faster convergence and better result for larger filter sizes (e.g. in the copy memory task, a filter size $k \geq 3$ led to only suboptimal convergence). In word-level PTB, we find a filter size of $k = 3$ works best. This is not a complete surprise, since a size- $k$ filter on the inputs is analogous to a $k$ -gram model in language modeling.
|
| 323 |
+
|
| 324 |
+
Results of control experiments on the residual function are shown in Figure 8d, 8e and 8f. In all three scenarios, we observe that the residual stabilizes the training by bringing a faster convergence as well as better final results, compared to TCN with the same model size but no residual block.
|
| 325 |
+
|
| 326 |
+
# D EXPERIMENTS: GATING MECHANISM ON TCN
|
| 327 |
+
|
| 328 |
+
One component that has shown to be effective in adapting a TCN to language modeling is the gating mechanism within the residual block, which was used in works such as Dauphin et al. (2017). In this section, we empirically evaluate the effects of adding gated units to TCN.
|
| 329 |
+
|
| 330 |
+
We replace the ReLU within the TCN residual block with a gating mechanism, represented by an elementwise product between two convolutional layers, with one of them also passing through a sigmoid function $\sigma ( x ) ^ { 5 }$ . Prior works such as Dauphin et al. (2017) has used similar gating to control the path through which information flows in the network, and achieved great performance on language modeling tasks.
|
| 331 |
+
|
| 332 |
+
Table 5: TCN with Gating Mechanism within Residual Block.
|
| 333 |
+
|
| 334 |
+
<table><tr><td rowspan=1 colspan=3>RELU TCN VS.GATED TCN RESULTS</td></tr><tr><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=1>TCN</td><td rowspan=1 colspan=1>TCN + Gating</td></tr><tr><td rowspan=1 colspan=1>Seq. MNIST (acc.)</td><td rowspan=1 colspan=1>99.0</td><td rowspan=1 colspan=1>99.0</td></tr><tr><td rowspan=1 colspan=1>P-MNIST (acc.)</td><td rowspan=1 colspan=1>97.2</td><td rowspan=1 colspan=1>96.9</td></tr><tr><td rowspan=1 colspan=1>Adding Prob. 600 (loss)</td><td rowspan=1 colspan=1>5.8e-5</td><td rowspan=1 colspan=1>5.6e-5</td></tr><tr><td rowspan=1 colspan=1>CopyMemory 11000 (loss)</td><td rowspan=1 colspan=1>3.5e-5</td><td rowspan=1 colspan=1>0.00508</td></tr><tr><td rowspan=1 colspan=1>JSB Chorales (loss)</td><td rowspan=1 colspan=1>8.10</td><td rowspan=1 colspan=1>8.13</td></tr><tr><td rowspan=1 colspan=1>Nottingham (loss)</td><td rowspan=1 colspan=1>3.07</td><td rowspan=1 colspan=1>3.12</td></tr><tr><td rowspan=1 colspan=1>Word PTB (ppl)</td><td rowspan=1 colspan=1>90.17</td><td rowspan=1 colspan=1>88.91</td></tr><tr><td rowspan=1 colspan=1>Char PTB (bpc)</td><td rowspan=1 colspan=1>1.35</td><td rowspan=1 colspan=1>1.343</td></tr><tr><td rowspan=1 colspan=1>Char text8 (bpc)</td><td rowspan=1 colspan=1>1.45</td><td rowspan=1 colspan=1>1.48</td></tr></table>
|
| 335 |
+
|
| 336 |
+
Through these comparisons, we notice that gating components do further improve the TCN results on certain language modeling datasets like PTB, which agrees with prior works. However, we do not observe such benefits to exist in general on sequence prediction tasks, such as on polyphonic music datasets, and those simpler benchmark tasks requiring more long-term memories. For example, on the copy memory task with $T = 1 0 0 0$ , we find that gating mechanism deteriorates the convergence of TCN to a suboptimal result that is only slightly better than random guess.
|
md/train/rk9eAFcxg/rk9eAFcxg.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VARIATIONAL RECURRENT ADVERSARIALDEEP DOMAIN ADAPTATION
|
| 2 |
+
|
| 3 |
+
Sanjay Purushotham\*, Wilka Carvalho\*, Tanachat Nilanon, Yan Liu
|
| 4 |
+
|
| 5 |
+
Department of Computer Science
|
| 6 |
+
University of Southern California
|
| 7 |
+
Los Angeles, CA 90089, USA
|
| 8 |
+
{spurusho,wcarvalh,nilanon,yanliu.cs}@usc.edu
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
We study the problem of learning domain invariant representations for time series data while transferring the complex temporal latent dependencies between domains. Our model termed as Variational Recurrent Adversarial Deep Domain Adaptation (VRADA) is built atop a variational recurrent neural network (VRNN) and trains adversarially to capture complex temporal relationships that are domain-invariant. This is (as far as we know) the first to capture and transfer temporal latent dependencies of multivariate time-series data. Through experiments on real-world multivariate healthcare time-series datasets, we empirically demonstrate that learning temporal dependencies helps our model’s ability to create domain-invariant representations, allowing our model to outperform current state-of-the-art deep domain adaptation approaches.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Many real-world applications require effective machine learning algorithms that can learn invariant representations across related time-series datasets. For example, precision medicine for patients of various age groups, mobile application recommendation for users based on locations, and so on. In these examples, while the domains (i.e. age group and location) may vary, there exist common predictive patterns that can aid in inferring knowledge from one domain to another. More often than not, some domains have a significantly larger number of observations than others (e.g., respiratory failure in adults vs. children). Therefore effective domain adaption of time-series data is in great demand.
|
| 17 |
+
|
| 18 |
+
The general approach to tackling domain adaptation has been explored under many facets which include reducing the domain discrepancy between the source and target domains(Ben-David et al. (2007)), instance re-weighting (Jiang & Zhai (2007)), subspace alignment (Fernando et al. (2013)), and deep learning (Tzeng et al. (2015); Ganin & Lempitsky (2014)). Many of these approaches work very well for non-sequential data but are not suitable for multivariate time-series data as they do not usually capture the temporal dependencies present in the data. For sequential data, earlier work has successfully used dynamic Bayesian Networks(Huang & Yates (2009)) and Recurrent Neural Networks (Socher et al. (2011)) to learn latent feature representations which were domaininvariant. Unfortunately, these works were not flexible enough to model non-linear dynamics or did not explicitly capture and transfer the complex latent dependencies needed to perform domain adaptation of time-series data.
|
| 19 |
+
|
| 20 |
+
In this paper, we address this problem with a model that learns temporal latent dependencies (i.e. dependencies between the latent variables across timesteps) that can be transferred across domains that experience different distributions in their features. We draw inspiration from the Variational Recurrent Neural Network (Chung et al. (2016)) and use variational methods to produce a latent representation that captures underlying temporal latent dependencies. Motivated by the theory of domain adaptation (Ben-David et al. (2010)), we perform adversarial training on this representation
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: A Story of Temporal Dependency and Domain Invariance
|
| 24 |
+
|
| 25 |
+
t-SNE projections for the latent representations of DNN, R-DANN, and our VRADA model. We show adaption
|
| 26 |
+
from Adult-AHRF to Child-AHRF data. Source data is represented with red circles and target data with blue
|
| 27 |
+
circles. From left to right, one can see that domain adaptation results in mixing the source and target domain data distributions. We can also see a story of how encoding more temporal dependency into the latent
|
| 28 |
+
representation induces more domain-invariant representations. As models capture more underlying factors of
|
| 29 |
+
variation, post domain adaptation representations gradually smoothen and become evenly dispersed, indicating that temporal dependency acts synergestically with domain adaptation.
|
| 30 |
+
|
| 31 |
+
similarly to the Domain Adversarial Neural Network (DANN) (Ganin et al. (2016)) to make the representations invariant across domains. We call our model the Variational Recurrent Adversarial Deep Domain Adaptation (VRADA) model. As far as we know, this is the first model capable of accomplishing unsupervised domain adaptation while transferring temporal latent dependencies for complex multivariate time-series data. Figure 1 shows an example of the domain invariant representations learned by different deep learning models including our VRADA model. From this figure, we can see that our model (VRADA) shows better mixing of the domain distributions than the competing models indicating that it learns better domain invariant representations.
|
| 32 |
+
|
| 33 |
+
In order to prove the efficacy of our model, we perform domain adaptation using real-world healthcare time-series data. We choose healthcare data for two primary reasons. (1) Currently, a standard protocol in healthcare is to build, evaluate, and deploy machine learning models for particular datasets that may perform poorly on unseen datasets with different distributions. For example, models built around patient data from particular age groups perform poorly on other age groups because the features used to train the models have different distributions across the groups (Alemayehu & Warner (2004); Lao et al. (2004); Seshamani & Gray (2004)). Knowledge learned from one group is not transferrable to the other group. Domain adaptation seems like a natural solution to this problem as knowledge needs to be transferred across domains which share features that exhibit different distributions. (2) Healthcare data has multiple attributes recorded per patient visit, and it is longitudinal and episodic in nature. Thus, healthcare data is a suitable platform on which to study a model which seeks to capture complex temporal representations and transfer this knowledge across domains.
|
| 34 |
+
|
| 35 |
+
The rest of the paper is structured as follows. In the following section, we briefly discuss the current state-of-the-art deep domain adaptation approaches. Afterwards, we present our model mathematically, detailing how it simultaneously learns to capture temporal latent dependencies and create domain-invariant representations. In Section 4, we compare and contrast the performance of proposed approach with other approaches on two real-world health care datasets, and provide analysis on our domain-invariant representations.
|
| 36 |
+
|
| 37 |
+
# 2 RELATED WORK
|
| 38 |
+
|
| 39 |
+
Domain adaptation is a specific instance of transfer learning in which the feature spaces are shared but their marginal distributions are different. A good survey on the two has been done in several previous works (Pan & Yang (2009); Jiang (2008); Patel et al. (2015)). Domain adaptation has been thoroughly studied in computer vision(Saenko et al. (2010); Gong et al. (2012); Fernando et al. (2013)) and natural language processing (NLP) (Blitzer (2007); Foster et al. (2010)) applications. Recently, the deep learning paradigm has become popular in domain adaptation (Chen et al. (2012); Tzeng et al. (2015); Yang & Eisenstein; Long & Wang (2015)) due to its ability to learn rich, flexible, non-linear domain-invariant representations. Here, we briefly discuss two deep domain adaptation approaches which are closely related to our proposed model. Domain Adversarial Neural Networks (DANN)
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
Figure 2: Block diagram of VRADA. Blue lines show the inference process, $q _ { \theta _ { e } } \left( z _ { t } | \boldsymbol { x } _ { \le t } , \boldsymbol { z } _ { < t } \right)$ . Brown lines show the generation process, $p _ { \theta _ { g } } ( x _ { t } | \boldsymbol { z } _ { \le t } , \boldsymbol { x } _ { < t } )$ . Red lines show the recurrence process where $h _ { t }$ is informed by $h _ { t - 1 }$ , which is informed by $z _ { t - 1 }$ and $x _ { t - 1 }$ . Black lines indicate classification.
|
| 43 |
+
|
| 44 |
+
(Ganin et al. (2016)) is a deep domain adaptation model which uses two core components to create domain-invariant representations, a feature extractor that produces the data’s latent representation, and an adversarial domain labeler that attempts to classify that data’s domain to help the feature extractor produce latent representations which are domain-invariant. In Louizos et al. (2015), the authors propose Variational Fair AutoEncoder, which uses Variational Autoencoding architecture (Kingma & Welling (2013)) to learn latent representations where most of the information about certain known factors of variation are purged from the representation while still retaining as much information about the data as possible. While, these deep learning approaches learn domain-invariant representations, they fail to capture and transfer the underlying complex temporal latent relationships from one domain to another as they use convolutional or feed forward neural networks which we claim are not suitable for multivariate time-series data.
|
| 45 |
+
|
| 46 |
+
Other works such as Huang & Yates (2009); Xiao & Guo (2013) have used distributed representations for domain adaptation in NLP sequence labeling tasks. However, they either induce hidden states as latent features using dynamic Bayesian networks (DBNs) or learn generalizable distributed representations of words using Recurrent Neural Networks (RNN) (Socher et al. (2011)) to enable domain adaptation. These works either model the highly non-linear dynamics, as one can with RNN, or capture the complex latent dependencies present in sequential data, as one can with DBNs, but not both. To overcome the challenges of DBNs and RNNs, Variational Recurrent Neural Network (VRNN)( Chung et al. (2016)) was proposed recently to capture the complex relationship between the underlying hidden factors of variation and the output variables at different time-steps. The VRNN uses Variational Autoencoders (VAEs)( Kingma & Welling (2013); Goodfellow et al. (2016)) at each time-step to learn a complex relationship between the latent hidden factors across time-steps. Like the VAE, its latent variable is parametric. Combined, these things make it well-suited for multimodal sequential data such as multivariate time-series. In the following section, we discuss our approach, Variational Adversarial Deep Domain Adaptation (VRADA), which uses a VRNN to model and transfer complex domain-invariant temporal latent relationships for unsupervised domain adaptation of multivariate time-series.
|
| 47 |
+
|
| 48 |
+
# 3 VARIATIONAL RECURRENT ADVERSARIAL DEEP DOMAIN ADAPTATION
|
| 49 |
+
|
| 50 |
+
In this section, we present our Variational Recurrent Adversarial Deep Domain Adaptation (VRADA) model for the purpose of capturing and transferring temporal latent dependencies across domains via domain-invariant representations. First, we introduce the notations used in this paper and then discuss our VRADA model in detail.
|
| 51 |
+
|
| 52 |
+
# 3.1 NOTATIONS
|
| 53 |
+
|
| 54 |
+
Let us denote a multivariate variable-length time series with $N$ data samples as $\{ \mathbf { x ^ { i } } = ( x _ { t } ^ { i } ) _ { t = 1 } ^ { T ^ { i } } \} _ { i = 1 } ^ { N }$ where . (Note: in our experiments, for all data samples , but for generality we maintain $T ^ { i }$ ). We denote $\{ \mathbf { x } _ { \mathcal { S } } ^ { \mathbf { i } } \} _ { i = 1 } ^ { n }$ as source domain data and $\{ \dot { \mathbf { x } } _ { \mathcal { T } } ^ { \mathbf { i } } \} _ { i = n + 1 } ^ { N }$ as target domain data. We assume that each source domain data sample $\mathbf { x } _ { \mathcal { S } } ^ { \mathbf { i } }$ comes with $L$ labels $y _ { i } \in \{ 0 , 1 \} ^ { L }$ (for example, these labels may correspond to a clinical outcome such as mortality or ICD9 diagnosis codes), while target domain has no labeled data samples. We assign a domain label $d _ { i } \in \{ 0 , 1 \}$ to each data sample to indicate if it comes from the source or target domain. $d _ { i }$ will be used for adversarial training.
|
| 55 |
+
|
| 56 |
+
# 3.2 VRADA
|
| 57 |
+
|
| 58 |
+
The block diagram of our VRADA model is shown in Figure 2. To explicitly model the dependencies between the latent random variable across time steps, the VRADA model utilizes Variational Recurrent Neural Networks (VRNN) (Chung et al. (2016)). The VRNN effectively contains a Variational AutoEncoders (Kingma & Welling (2013)) at every time step, all of which are conditioned on previous auto-encoders via the hidden state $h _ { t - 1 }$ of an RNN, such as an LSTM (Hochreiter & Schmidhuber (1997)). Therefore, for each time-step of $\ v { x } _ { t } ^ { i }$ , we infer a latent random variable $z _ { t } ^ { i }$ via
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\begin{array} { r } { z _ { t } ^ { i } | x _ { t } ^ { i } \sim \mathcal { N } ( \mu _ { z , t } , \mathrm { d i a g } ( \sigma _ { z , t } ) ) , \quad \mathrm { w h e r e } \ [ \mu _ { z , t } , \sigma _ { z , t } ] = \varphi _ { \tau } ^ { e n c } ( \varphi _ { \tau } ^ { x } ( x _ { t } ^ { i } ) , h _ { t - 1 } ) } \end{array}
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
with prior
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
z _ { t } ^ { i } \sim \mathcal { N } ( \mu _ { 0 , t } , \mathrm { d i a g } ( \sigma _ { 0 , t } ) ) , \quad \mathrm { w h e r e } \ [ \mu _ { 0 , t } , \sigma _ { 0 , t } ] = \varphi _ { \tau } ^ { p r i o r } ( h _ { t - 1 } )
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where $\mu _ { * , t } , \sigma _ { * , t }$ denote parameters of a generating distribution, and $\boldsymbol { \varphi } _ { \tau } ^ { \ast }$ can be any highly flexible function such as deep neural networks. For each $z _ { t } ^ { i } , x _ { t } ^ { i }$ is generated via
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
x _ { t } ^ { i } | z _ { t } ^ { i } \sim { \mathcal { N } } ( \mu _ { x , t } , \mathrm { d i a g } ( \sigma _ { x , t } ) ) , \quad { \mathrm { w h e r e ~ } } [ \mu _ { x , t } , \sigma _ { x , t } ] = \varphi _ { \tau } ^ { d e c } ( \varphi _ { \tau } ^ { z } ( z _ { t } ^ { i } ) , h _ { t - 1 } )
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
and learned by optimizing the VRNN objective function:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\overset { \cdot } { \underset { t = t } { \cdot } } ( x _ { t } ^ { i } ; \theta _ { \epsilon } , \theta _ { g } ) = E _ { q _ { \theta _ { \epsilon } } ( z _ { \leq T ^ { i } } ^ { i } | x _ { \leq T ^ { i } } ^ { i } ) } [ \underset { t = 1 } { \overset { T ^ { i } } { \sum } } ( - D ( q _ { \theta _ { \epsilon } } ( z _ { t } ^ { i } | x _ { \leq t } ^ { i } , z _ { < t } ^ { i } ) | | p ( z _ { t } ^ { i } | x _ { < t } ^ { i } , z _ { < t } ^ { i } ) ) + \log p _ { \theta _ { g } } ( x _ { t } ^ { i } | z _ { \leq t } ^ { i } , x _ { < t } ^ { i } ) ) ] .
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $q _ { \theta _ { e } } \big ( z _ { t } ^ { i } | \boldsymbol { x } _ { \le t } ^ { i } , \boldsymbol { z } _ { < t } ^ { i } \big )$ is the inference model, $p ( z _ { t } ^ { i } | x _ { < t } ^ { i } , z _ { < t } ^ { i } )$ is the prior, $p _ { \theta _ { g } } ( x _ { t } ^ { i } | \boldsymbol { z } _ { \le t } ^ { i } , x _ { < t } ^ { i } )$ is the generative model, $\theta _ { e }$ is the parameters of the VRNN’s encoder, $\theta _ { g }$ the parameters of the VRNN’s decoder, and $D ( \cdot | | \cdot )$ refers to KL-Divergence. Note: $z _ { \le T }$ refers to the set of all $z _ { t }$ such that $t \leq T$ , likewise for $z _ { < T }$ . For each $\mathbf { x ^ { i } }$ , we use $\tilde { z } ^ { i } \sim q _ { \theta _ { e } } ( z _ { T ^ { i } } ^ { i } | x _ { \le T ^ { i } } ^ { i } , z _ { < T ^ { i } } ^ { i } )$ as our feature representation for source domain classification task since it captures temporal latent dependencies across the time-steps. Training the VRNN for the source domain classification involves solving the following optimization:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\operatorname* { m i n } _ { \theta _ { e } , \theta _ { g } , \theta _ { y } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { 1 } { T ^ { i } } \mathcal { L } _ { r } ( \mathbf { x ^ { i } } ; \theta _ { e } , \theta _ { g } ) + \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { y } ( \mathbf { x ^ { i } } ; \theta _ { y } , \theta _ { e } ) + \lambda \mathcal { R } ( \theta _ { e } )
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $\mathcal { R } ( \theta _ { e } )$ is a regularizer for the parameters of VRNN encoder (which is also the feature extractor of VRADA) with a tuning hyperparameter $\lambda$ .
|
| 89 |
+
|
| 90 |
+
As we are interested in achieving domain adaptation via the latent representation $\tilde { z } ^ { i }$ (i.e. to make $\tilde { z } ^ { i }$ domain-invariant), we can adversarially train the above objective function (equation 1) by employing the domain adaptation idea proposed in Ganin et al. (2016). Let $G _ { y } ( \tilde { z } ^ { i } ; \theta _ { y } )$ and $G _ { d } ( \tilde { z } ^ { i } ; \theta _ { d } )$ represent the source label classifier (to predict source labels $y _ { i }$ ) and domain label classifier (to predict domain labels $d _ { i }$ ) respectively with parameters $\theta _ { y }$ and $\theta _ { d }$ for a given input $\tilde { z } ^ { i }$ . Here, $G _ { y } ( . )$ and $G _ { d } ( . )$ can be deep neural networks. Let us denote their loss functions respectively as
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mathcal { L } _ { y } ( \mathbf { x ^ { i } } ; \theta _ { y } , \theta _ { e } ) = \mathcal { L } _ { B } ( G _ { y } ( V _ { e } ( \mathbf { x ^ { i } } ; \theta _ { e } ) ; \theta _ { y } ) , y _ { i } ) ; \quad \mathcal { L } _ { d } ( \mathbf { x ^ { i } } ; \theta _ { d } , \theta _ { e } ) = \mathcal { L } _ { B } ( G _ { d } ( V _ { e } ( \mathbf { x ^ { i } } ; \theta _ { e } ) ; \theta _ { d } ) , d _ { i } )
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $\mathcal { L } _ { B }$ is the classification loss such as a binary or categorical cross-entropy loss function and $V _ { e } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { e } )$ is the VRNN encoder that maps input $\mathbf { x ^ { i } }$ to $\tilde { z } ^ { i }$ .
|
| 97 |
+
|
| 98 |
+
Now, for adversarial training, we consider the following domain adaptation term as the regularizer of equation 1.
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\mathcal { R } ( \theta _ { e } ) = \operatorname* { m a x } _ { \theta _ { d } } \Big [ - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } , \theta _ { e } ) - \frac { 1 } { n ^ { \prime } } \sum _ { i = n + 1 } ^ { N } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } , \theta _ { e } ) \Big ]
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $n ^ { \prime }$ is the number of target domain samples. As shown in Ganin et al. (2016), $\mathcal { R }$ is the domain regularizer and it is derived from the empirical $\varkappa -$ divergence between the source domain and target domain samples( Ben-David et al. (2010)).
|
| 105 |
+
|
| 106 |
+
Combining the joint optimization problem of equations 1 and 2 leads to our VRADA model, where we minimize the source classification risk and at the same time achieve domain adaptation. Mathematically, we optimize the following complete objective function:
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\boldsymbol { \mathrm { 5 } } ( \theta _ { e } , \theta _ { g } , \theta _ { y } , \theta _ { d } ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \frac { 1 } { T ^ { i } } \mathcal { L } _ { r } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { e } , \theta _ { g } ) + \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { y } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { y } ) - \boldsymbol { \lambda } ( \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } ) + \frac { 1 } { n ^ { \prime } } \sum _ { i = n + 1 } ^ { N } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } ) ) = \frac { 1 } { n }
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
where $\lambda$ is a trade-off between optimizing on making domain-invariant representations and optimizing source classification accuracy. Our optimization involves minimization with respect to some parameters, and maximization with respect to the others, i.e., we iteratively solve the following:
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { c } { { ( \hat { \theta } _ { g } , \hat { \theta } _ { y } , \hat { \theta } _ { e } ) = \arg \underset { \theta _ { g } , \theta _ { y } , \theta _ { e } } { \operatorname* { m i n } } E ( \theta _ { e } , \theta _ { g } , \theta _ { y } , \hat { \theta } _ { d } ) } } \\ { { \hat { \theta } _ { d } = \arg \underset { \theta _ { d } } { \operatorname* { m a x } } E ( \hat { \theta } _ { e } , \hat { \theta } _ { g } , \hat { \theta } _ { y } , \theta _ { d } ) } } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
with the gradient updates calculated as:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
\begin{array} { r } { \theta _ { e } \theta _ { e } - \eta ( \frac { \partial \mathcal { L } _ { r } } { \partial \theta _ { e } } + \frac { \partial \mathcal { L } _ { y } } { \partial \theta _ { y } } - \lambda \frac { \partial \mathcal { L } _ { d } } { \partial \theta _ { d } } ) } \\ { \theta _ { g } \theta _ { g } - \eta \frac { \partial \mathcal { L } _ { r } } { \partial \theta _ { g } } } \\ { \theta _ { d } \theta _ { d } - \eta \frac { \partial \mathcal { L } _ { d } } { \partial \theta _ { d } } } \\ { \theta _ { y } \theta _ { y } - \eta \lambda \frac { \partial \mathcal { L } _ { y } } { \partial \theta _ { y } } } \end{array}
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
where $\eta$ is the learning rate. We can use stochastic gradient descent (SGD) to solve the equations (5-7). To solve equation (4), we can use SGD and the gradient reversal layer (GRL)(Ganin et al. (2016)). The role of GRL is to reverse the gradient sign while performing backpropagation. This ensures that the domain classification loss is maximized which makes the feature representations domain-invariant.
|
| 125 |
+
|
| 126 |
+
Thus, VRADA results in learning feature representations which are domain-invariant (due to domain regressor $\mathcal { R }$ ) and which capture the temporal latent dependencies (due to optimizing VRNN objective function $\mathcal { L } _ { r }$ ). These things combine to allow the VRADAs’ discriminative power on the source domain to transfer to the target domain.
|
| 127 |
+
|
| 128 |
+
# 4 EXPERIMENTS
|
| 129 |
+
|
| 130 |
+
We conduct experiments on two real-world health care datasets to answer the following questions: (a) How does our VRADA model perform when compared to the state-of-the-art domain adaptation and non-adaptation approaches? (b) How different are the domain-invariant representations learned by various domain adaptation methods? (c) How do we show that the temporal latent dependencies are transferred between domains? In the remainder of this section, we will describe the datasets, methods, empirical results, and show visualizations to answer the above questions.
|
| 131 |
+
|
| 132 |
+
# 4.1 DATASET DESCRIPTION
|
| 133 |
+
|
| 134 |
+
We conduct experiments on two health care datasets, including the MIMIC-III dataset and a Pediatric ICU (PICU) dataset from Children’s Hospital Los Angeles.
|
| 135 |
+
|
| 136 |
+
MIMIC-III( Johnson et al. (2016)) is a public dataset with deidentified clinical care data collected at Beth Israel Deaconess Medical Center from 2001 to 2012. It contains over 58,000 hospital admission records of 38,645 adults and 7,875 neonates. For our experiments, we extracted the following two datasets:
|
| 137 |
+
|
| 138 |
+
• Adult-AHRF dataset: To study domain adaptation for adult patients with acute hypoxemic respiratory failure (AHRF), we extracted 20 time series features (such as Base excess, blood pH value, Mean Air Pressure, PaO2, etc.) from 5527 admission records based on Khemani et al. (2009). We grouped the patients into 4 groups/cohorts based on their age[1] - Group 2: working-age adult (20 to 45 yrs, 508 patients); Group 3: old working-age adult (46 to 65 yrs, 1888 patients); Group 4: elderly (66 to 85 yrs, 2394 patients); Group 5: old elderly (85 yrs and up, 437 patients). We treated each group as a separate domain with which we could perform domain adaptation. For each patient, we used the first 4 day after admission (with each day serving as a single time-step) as time series data for training and testing our models.
|
| 139 |
+
|
| 140 |
+
• ICD9 dataset: For this dataset we extracted 99 time series features from 19714 admission records from 4 modalities including input-events (fluids into patient, e.g., insulin), outputevents (fluids out of the patient, e.g., urine), lab-events (lab test results, e.g., blood pH values, platelet count, etc.) and prescription-events (drugs prescribed by doctors, e.g., aspirin, potassium chloride, etc.). These modalities are known to be extremely useful for monitoring ICU patients. All the time series are of more than 48 hours of duration, and only the first 24 hours (after admission) 2-hourly sampled time series data is used for training and testing our models. We use this dataset to predict the ICD9 Diagnosis code categories for each patient’s admission record.
|
| 141 |
+
|
| 142 |
+
Child-AHRF dataset: This is a PICU dataset which contains health records of 398 children patient with acute hypoxemic respiratory failure in the intensive care unit at Children’s Hospital Los Angeles (CHLA)(Khemani et al. (2009)). Similar to Adult-AHRF, this dataset has 20 time series features collected for 4 days after ICU admission. This dataset is considered as one group (Group 1: children, age 0 to 19 yrs) and represents one domain.
|
| 143 |
+
|
| 144 |
+
# 4.1.1 PREDICTION AND DOMAIN ADAPTATION TASKS
|
| 145 |
+
|
| 146 |
+
Mortality Prediction: For Adult-AHRF and Child-AHRF datasets, we are interested in predicting mortality, i.e. whether a patient dies from AHRF during their hospital stay. $2 0 . 1 0 \%$ of all the patients in Child-AHRF and $1 3 . 8 4 \%$ of all patients in Adult-AHRF have a positive mortality label (i.e. the patients who die in hospital).
|
| 147 |
+
|
| 148 |
+
ICD9 Code Prediction: Each admission record in MIMIC-III dataset has multiple ICD-9 diagnosis codes. We group all the occurrences of the ICD-9 codes into 20 diagnosis groups[2]. For the ICD9 dataset, we are interested in predicting these 20 ICD-9 Diagnosis Categories for each admission record. We treat this as a multi-task prediction problem.
|
| 149 |
+
|
| 150 |
+
Domain Adaptation Tasks: We study unsupervised domain adaptation (i.e. target domain labels are unavailable during training and validation) task with-in age groups of Adult-AHRF dataset, ICD9 dataset and across Adult and Child-AHRF datasets. For Adult-AHRF and ICD9 datasets, we created 12 source-target domain pairs using the age groups, pairing up each domain $D _ { i }$ with another domain $D _ { j \neq i }$ , for example, the source-target pair 2-5 was used for adapting from group 2 (working-age adult) to group 5 (old elderly). We also created 4 source-target pairs for performing domain adaptation from 4 adult age-groups to 1 child age-group.
|
| 151 |
+
|
| 152 |
+
# 4.2 METHODS AND IMPLEMENTATION DETAILS
|
| 153 |
+
|
| 154 |
+
We categorize the methods used in our main experiments into the following groups:
|
| 155 |
+
|
| 156 |
+
• Non-adaptive baseline methods: Logistic Regression (LR), Adaboost with decision regressors (Adaboost), and feed forward deep neural networks (DNN) Deep Domain adaptation methods: Domain Adversarial Neural Networks (DANN) (Ganin et al. (2016)); DANN with a RNN (LSTM) as feature extractor (R-DANN); Variational Fair Autocoder (VFAE)(Louizos et al. (2015))
|
| 157 |
+
• Our method: Variational Recurrent Adversarial Deep Domain Adaptation (VRADA)[3].
|
| 158 |
+
|
| 159 |
+
In all our experiments, we conducted unsupervised domain adaptation where target domain labels are unavailable during training and validation. For R-DANN, we used LSTM(Hochreiter & Schmidhuber (1997)) as the feature extractor network instead of the feed-forward neural networks used in DANN. For VFAE, DANN and all the non-domain adaptive approaches we flattened the time series along time axis and treat it as the input to the model. For fairness, the classifier and feature extractors of the VRADA and R-DANN were equivalent in depth and both had the same model capacity. We also ensure that the size of latent feature representation $\tilde { z } ^ { i }$ are similar for VRADA and DANN models. The model capacity of VFAE was chosen to be similar to VRADA. All the deep domain adaptation models including ours had depth of size 8 (including output classifier layers). We used the Adam optimizer ( Kingma & Ba (2014)) and ran all models for 500 epochs with a learning rate of $3 e { - 4 }$ We set an early stopping criteria that the model does not experience a decrease in the validation loss for 20 epochs. Source domain data was split into train/validation subsets with a 70/30 ratio and target domain data into train/validation/test subsets with a 70/15/15 ratio. In order to compare all the methods, we report AUC scores on the entire target domain set, and the test subset for each target domain data of a source-target pair.
|
| 160 |
+
|
| 161 |
+
# 4.3 QUANTITATIVE RESULTS
|
| 162 |
+
|
| 163 |
+
In Table 1, we compare non domain adaptation and domain adaptation models’ performance on the target domain test subset for the AHRF mortality prediction task. It is immediately clear that domain adaptation methods consistently outperform non domain adaptation methods. We see that generally the VRADA outperforms both variants of the DANN with it consistently seeing scores $\sim 4 \%$ higher. While the standard deviation for the VRADA was about $1 \%$ , it was about $2 \%$ for the R-DANN, further showing our models efficacy as it converges to more stable local optima. Our model VRADA beats state-of-the-art DANN(Ganin et al. (2016)) and VFAE(Louizos et al. (2015)) on all the source-pair domain adaptation tasks for Adult-AHRF dataset. For the domain adaptation from Adult-AHRF to Child-AHRF dataset, we observe that VRADA mostly outperforms all the competing models. This shows that our model can perform well even for smaller target domain datasets.
|
| 164 |
+
|
| 165 |
+
Table 1: AUC Comparison for AHRF Mortality Prediction task with and without Domain Adaptation
|
| 166 |
+
|
| 167 |
+
<table><tr><td>Source-Target</td><td>LR</td><td>Adaboost</td><td>DNN</td><td>DANN</td><td>VFAE</td><td>R-DANN</td><td>VRADA</td></tr><tr><td>3-2</td><td>0.555</td><td>0.562</td><td>0.569</td><td>0.572</td><td>0.615</td><td>0.603</td><td>0.654</td></tr><tr><td>4-2</td><td>0.624</td><td>0.645</td><td>0.569</td><td>0.589</td><td>0.635</td><td>0.584</td><td>0.656</td></tr><tr><td>5-2</td><td>0.527</td><td>0.554</td><td>0.551</td><td>0.540</td><td>0.588</td><td>0.611</td><td>0.616</td></tr><tr><td>2-3</td><td>0.627</td><td>0.621</td><td>0.550</td><td>0.563</td><td>0.585</td><td>0.708</td><td>0.724</td></tr><tr><td>4-3</td><td>0.681</td><td>0.636</td><td>0.542</td><td>0.527</td><td>0.722</td><td>0.821</td><td>0.770</td></tr><tr><td>5-3</td><td>0.655</td><td>0.706</td><td>0.503</td><td>0.518</td><td>0.608</td><td>0.769</td><td>0.782</td></tr><tr><td>2-4</td><td>0.585</td><td>0.591</td><td>0.530</td><td>0.560</td><td>0.582</td><td>0.716</td><td>0.777</td></tr><tr><td>3-4</td><td>0.652</td><td>0.629</td><td>0.531</td><td>0.527</td><td>0.697</td><td>0.769</td><td>0.764</td></tr><tr><td>5-4</td><td>0.689</td><td>0.699</td><td>0.538</td><td>0.532</td><td>0.614</td><td>0.728</td><td>0.738</td></tr><tr><td>2-5</td><td>0.565</td><td>0.543</td><td>0.549</td><td>0.526</td><td>0.555</td><td>0.659</td><td>0.719</td></tr><tr><td>3-5</td><td>0.576</td><td>0.587</td><td>0.510</td><td>0.526</td><td>0.533</td><td>0.630</td><td>0.721</td></tr><tr><td>4-5</td><td>0.682</td><td>0.587</td><td>0.575</td><td>0.548</td><td>0.712</td><td>0.747</td><td>0.775</td></tr><tr><td>5-1</td><td>0.502</td><td>0.573</td><td>0.557</td><td>0.563</td><td>0.618</td><td>0.563</td><td>0.639</td></tr><tr><td>4-1</td><td>0.565</td><td>0.533</td><td>0.572</td><td>0.542</td><td>0.668</td><td>0.577</td><td>0.636</td></tr><tr><td>3-1</td><td>0.500</td><td>0.500</td><td>0.542</td><td>0.535</td><td>0.570</td><td>0.591</td><td>0.631</td></tr><tr><td>2-1</td><td>0.520</td><td>0.500</td><td>0.534</td><td>0.559</td><td>0.578</td><td>0.630</td><td>0.637</td></tr></table>
|
| 168 |
+
|
| 169 |
+
In the above table, we test classification without adaptation using Logistic Regression (LR), Adaboost with decision tree classifiers and Feed forward Deep Neural Networks (DNN); and with adaptation using Deep Domain Adversarial Neural Networks (DANN), a DANN with an LSTM in its feature extractor (R-DANN), Variational Fair Autoencoder (VFAE) and our Variational Adversarial Domain Adaptation Model (VRADA). All results are reported on the target domain test subset dataset.
|
| 170 |
+
|
| 171 |
+
As the AHRF mortality prediction task made it clear that domain adaptation is necessary for intergroup adaptation, for the ICD9 multi-task prediction task that involved data with time-steps of length 12, we focused strictly on domain adaptive models (i.e. the DANN, R-DANN, and VRADA). Table 2 shows the aggregated AUC scores on the entire target domain dataset and test data of the target domain for the 20 tasks of the ICD9 Code Prediction task. Here, we clearly see that VRADA and
|
| 172 |
+
|
| 173 |
+
Table 2: AUC Comparison for ICD9 Diagnosis Code Prediction task
|
| 174 |
+
|
| 175 |
+
<table><tr><td>Model</td><td></td><td>23</td><td>24</td><td>25</td><td>32</td><td>34</td><td>35</td><td>42 43</td><td>45</td><td>52</td><td>53</td><td></td><td>54</td></tr><tr><td rowspan="2">DANN</td><td>entire target</td><td>0.513</td><td>0.508</td><td>0.509</td><td>0.511</td><td>0.508</td><td>0.514</td><td>0.511</td><td>0.507</td><td>0.512</td><td>0.505</td><td>0.508</td><td>0.506</td></tr><tr><td>target test</td><td>0.509</td><td>0.513</td><td>0.531</td><td>0.527</td><td>0.515</td><td>0.531</td><td>0.515</td><td>0.521</td><td>0.521</td><td>0.518</td><td>0.514</td><td>0.519</td></tr><tr><td rowspan="2">R-DANN</td><td>entire target</td><td>0.608</td><td>0.581</td><td>0.562</td><td>0.618</td><td>0.610</td><td>0.586</td><td>0.604</td><td>0.607</td><td>0.575</td><td>0.573</td><td>0.558</td><td>0.566</td></tr><tr><td>target test</td><td>0.605</td><td>0.579</td><td>0.570</td><td>0.628</td><td>0.609</td><td>0.589</td><td>0.614</td><td>0.616</td><td>0.586</td><td>0.573</td><td>0.563</td><td>0.564</td></tr><tr><td rowspan="2">VRADA</td><td>entire target</td><td>0.620</td><td>0.564</td><td>0.557</td><td>0.611</td><td>0.617</td><td>0.580</td><td>0.598</td><td>0.615</td><td>0.588</td><td>0.571</td><td>0.582</td><td>0.576</td></tr><tr><td>target test</td><td>0.609</td><td>0.563</td><td>0.560</td><td>0.620</td><td>0.617</td><td>0.580</td><td>0.606</td><td>0.623</td><td>0.594</td><td>0.576</td><td>0.581</td><td>0.576</td></tr></table>
|
| 176 |
+
|
| 177 |
+
Here, we compare results for the ICD9 Diagnosis Code Prediction task on the ICD9 dataset. For each model, the top row corresponds to the performance on the entire target domain dataset and the bottom row corresponds to performance on the test subset $( 1 5 \% )$ of the target domain dataset.
|
| 178 |
+
|
| 179 |
+
R-DANN models outperform DANN Ganin et al. (2016) by significant margins. We also observe that VRADA outperforms R-DANN by $1 . 5 \sim 2 \%$ when averaged over all the source-target domain pairs.
|
| 180 |
+
|
| 181 |
+
# 4.4 DISCUSSION
|
| 182 |
+
|
| 183 |
+
Figure 3 shows the temporal latent dependencies captured by our VRADA as compared to the R-DANN for $_ { 3 - 4 }$ source-target pair. While both models learn temporal latent dependencies fairly well, the VRADA outperforms the R-DANN in two ways. First, the VRADA’s neurons learned stronger predictions of whether features are relevant towards modeling the data. If we look at the VRADA row, for both AHRF and ICD9 we see that the neural activation patterns are more consistent across time-steps than for R-DANN. Figure 4 shows the unrolled memory cell states (in the form Examples $\times$ (Time $^ *$ Neurons)) for all the source and target domain data points. We see a consistent activation firing patterns across all these data points for VRADA but not for R-DANN. Together with the stronger performance on 3-4 for AHRF and 2-5 for ICD9, this potentially indicates that VRADA is better learning the temporal dependencies.
|
| 184 |
+
|
| 185 |
+
Second, nuanced values are consistent across time-steps for the VRADA, exhibiting a gradual transition towards stronger activation with time, whereas the temporal activation pattern of the RDANN seems somewhat sporadic. While activation gradients across time are consistent for both the R-DANN and VRADA, more consistent inhibitory and excitatory neuron firing patterns indicate that the VRADA better transfers knowledge. Another indication of domain adaptation was shown in Figure 1c. Looking at the t-SNE projections of feature representations of DNN, R-DANN, and VRADA we can see that the addition of temporal latent dependencies might help in better mixing of the domain distributions since we observe that the data is more evenly spread out. Figure 1c and Figure 3 together indicate that the VRADA’s temporal latent dependency capturing power and ability to create domain-invariant representations act synergistically. For plots of activation patterns without domain adaptation, please see appendix section 6.2.3.
|
| 186 |
+
|
| 187 |
+
# 5 SUMMARY
|
| 188 |
+
|
| 189 |
+
Because of its diverse range of patients and its episodic and longitudal nature, healthcare data provides a good platform to test domain adaptation techniques for temporal data. With it as our example, we showcase the Variational Recurrent Adversarial Domain Adaptation (VRADA) model’s ability to learn temporal latent representations that are domain-invariant. By comparing our model’s latent representations to others’, we show its ability to use variational methods to capture hidden factors of variation and produce more robust domain-invariant representations. We hope this work serves as a bedrock for future work capturing and adapting temporal latent representations across domains.
|
| 190 |
+
|
| 191 |
+
# ACKNOWLEDGMENTS
|
| 192 |
+
|
| 193 |
+
This material is based upon work supported by the NSF research grants IIS-1134990, IIS-1254206, Samsung GRO Grant and the NSF Graduate Research Fellowship Program under Grant No. DGE1418060. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the funding agencies. We also acknowledge Thailand’s Development and Promotion of Science and Technology Talents Project for financial support. We thank Dr. Robinder Khemani for sharing the Child-AHRF dataset.
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 3: Cell states of memory cell for R-DANN and VRADA showing temporal latent dependencies captured by neurons of the R-DANN and VRADA for the source domain and transferred to the target domain. Each step along the y-axis refers to the activation of a single neuron with blue for strong inhibition and yellow for strong excitation. Step along the $\mathbf { X }$ -axis refers to activation per time-step. The left shows a single example in adapting 3-4 and the right for adapting 2-5.
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
Figure 4: Cell states of memory cell for R-DANN and VRADA showing activation for all ICD9 2-5 adaptation examples. Here, we show temporal dependencies learned across time, feature pairs for examples in a domain. The y-axis values refer to values per data point and the $\mathbf { X }$ -axis shows activation at time, feature pairs with the time and feature dimensions being flattened.
|
| 200 |
+
|
| 201 |
+
# REFERENCES
|
| 202 |
+
|
| 203 |
+
Berhanu Alemayehu and Kenneth E Warner. The lifetime distribution of health care costs. Health services research, 39(3):627–642, 2004.
|
| 204 |
+
|
| 205 |
+
S Ben-David, J Blitzer, and K Crammer. Analysis of representations for domain adaptation. Advances in Neural . . . , pp. 137–144, 2007.
|
| 206 |
+
|
| 207 |
+
Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010.
|
| 208 |
+
|
| 209 |
+
John Blitzer. Domain adaptation of natural language processing systems. PhD thesis, University of Pennsylvania, 2007.
|
| 210 |
+
|
| 211 |
+
Minmin Chen, Zhixiang Xu, Kilian Weinberger, and Fei Sha. Marginalized denoising autoencoders for domain adaptation. arXiv preprint arXiv:1206.4683, 2012.
|
| 212 |
+
|
| 213 |
+
Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron Courville, and Yoshua Bengio. A Recurrent Latent Variable Model for Sequential Data. arXiv.org, May 2016.
|
| 214 |
+
|
| 215 |
+
Basura Fernando, Amaury Habrard, Marc Sebban, and Tinne Tuytelaars. Unsupervised visual domain adaptation using subspace alignment. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2960–2967, 2013.
|
| 216 |
+
|
| 217 |
+
George Foster, Cyril Goutte, and Roland Kuhn. Discriminative instance weighting for domain adaptation in statistical machine translation. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pp. 451–459. Association for Computational Linguistics, 2010.
|
| 218 |
+
|
| 219 |
+
Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. arXiv preprint arXiv:1409.7495, 2014.
|
| 220 |
+
|
| 221 |
+
Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1), 2016.
|
| 222 |
+
|
| 223 |
+
Boqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pp. 2066–2073. IEEE, 2012.
|
| 224 |
+
|
| 225 |
+
Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. Mit Press, December 2016.
|
| 226 |
+
|
| 227 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 228 |
+
|
| 229 |
+
Fei Huang and Alexander Yates. Distributional representations for handling sparsity in supervised sequence-labeling. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP: Volume 1-Volume 1, pp. 495–503. Association for Computational Linguistics, 2009.
|
| 230 |
+
|
| 231 |
+
Jing Jiang. A literature survey on domain adaptation of statistical classifiers. URL: http://sifaka. cs. uiuc. edu/jiang4/domainadaptation/survey, 2008.
|
| 232 |
+
|
| 233 |
+
Jing Jiang and ChengXiang Zhai. Instance weighting for domain adaptation in nlp. In ACL, volume 7, pp. 264–271, 2007.
|
| 234 |
+
|
| 235 |
+
AEW Johnson, TJ Pollard, L Shen, L Lehman, M Feng, M Ghassemi, B Moody, P Szolovits, LA Celi, and RG Mark. Mimic-iii, a freely accessible critical care database. Scientific Data, 2016.
|
| 236 |
+
|
| 237 |
+
Robinder G Khemani, David Conti, Todd A Alonzo, Robert D Bart III, and Christopher JL Newth. Effect of tidal volume in children with acute hypoxemic respiratory failure. Intensive care medicine, 35(8):1428–1437, 2009.
|
| 238 |
+
|
| 239 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
|
| 240 |
+
|
| 241 |
+
Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. arXiv.org, December 2013.
|
| 242 |
+
|
| 243 |
+
Zhiqiang Lao, Dinggang Shen, Zhong Xue, Bilge Karacali, Susan M Resnick, and Christos Davatzikos. Morphological classification of brains via high-dimensional shape transformations and machine learning methods. Neuroimage, 21(1):46–57, 2004.
|
| 244 |
+
|
| 245 |
+
Mingsheng Long and Jianmin Wang. Learning transferable features with deep adaptation networks. CoRR, abs/1502.02791, 1:2, 2015.
|
| 246 |
+
|
| 247 |
+
Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair auto encoder. arXiv preprint arXiv:1511.00830, 2015.
|
| 248 |
+
|
| 249 |
+
Sinno Jialin Pan and Qiang Yang. A Survey on Transfer Learning. IEEE Transactions on Knowledge and Data Engineering, 22(10):1345–1359, 2009.
|
| 250 |
+
|
| 251 |
+
Vishal M Patel, Raghuraman Gopalan, Ruonan Li, and Rama Chellappa. Visual domain adaptation: A survey of recent advances. IEEE signal processing magazine, 32(3):53–69, 2015.
|
| 252 |
+
|
| 253 |
+
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.
|
| 254 |
+
|
| 255 |
+
Meena Seshamani and Alastair M Gray. A longitudinal study of the effects of age and time to death on hospital costs. Journal of health economics, 23(2):217–235, 2004.
|
| 256 |
+
|
| 257 |
+
Table 3: AUC Comparison for AHRF Mortality Prediction task for different types of VRADA training
|
| 258 |
+
|
| 259 |
+
<table><tr><td>Training</td><td>23</td><td>24</td><td>25</td><td>32</td><td>34 35</td><td>42</td><td>43</td><td>45</td><td>52</td><td>53</td><td>54</td></tr><tr><td>I</td><td>0.704</td><td>0.777</td><td>0.682</td><td>0.540</td><td>0.764</td><td>0.721</td><td>0.603</td><td>0.727 0.710</td><td>0.616</td><td>0.782</td><td>0.738</td></tr><tr><td>II</td><td>0.724</td><td>0.656</td><td>0.719</td><td>0.627</td><td>0.748</td><td>0.683</td><td>0.656</td><td>0.770 0.755</td><td>0.595</td><td>0.736</td><td>0.732</td></tr><tr><td>ⅢI</td><td>0.721</td><td>0.688</td><td>0.656</td><td>0.654</td><td>0.757</td><td>0.691</td><td>0.609 0.766</td><td>0.775</td><td>0.602</td><td>0.709</td><td>0.714</td></tr></table>
|
| 260 |
+
|
| 261 |
+
Richard Socher, Cliff C Lin, Chris Manning, and Andrew Y Ng. Parsing natural scenes and natural language with recursive neural networks. In Proceedings of the $2 8 t h$ international conference on machine learning (ICML-11), pp. 129–136, 2011.
|
| 262 |
+
|
| 263 |
+
Eric Tzeng, Judy Hoffman, Trevor Darrell, and Kate Saenko. Simultaneous deep transfer across domains and tasks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4068–4076, 2015.
|
| 264 |
+
|
| 265 |
+
Min Xiao and Yuhong Guo. Domain adaptation for sequence labeling tasks with a probabilistic language adaptation model. In ICML (1), pp. 293–301, 2013.
|
| 266 |
+
|
| 267 |
+
Yi Yang and Jacob Eisenstein. Unsupervised multi-domain adaptation with feature embeddings.
|
| 268 |
+
|
| 269 |
+
# 6 APPENDIX
|
| 270 |
+
|
| 271 |
+
# 6.1 TRAINING VARIATIONS
|
| 272 |
+
|
| 273 |
+
We tested 3 variations of training VRADA: (a) training VRADA regularly as discussed in Section 3 (denoted by I), (b) loading a pretrained VRNN encoder and optimizing strictly off the classification errors, i.e.
|
| 274 |
+
|
| 275 |
+
$$
|
| 276 |
+
E ( \theta _ { e } , \theta _ { y } , \theta _ { d } ) = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \mathcal { L } } _ { y } ( \mathbf { x ^ { i } } ; \theta _ { y } ) - \lambda ( { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \mathcal { L } } _ { d } ( \mathbf { x ^ { i } } ; \theta _ { d } ) + { \frac { 1 } { n ^ { \prime } } } \sum _ { i = n + 1 } ^ { N } { \mathcal { L } } _ { d } ( \mathbf { x ^ { i } } ; \theta _ { d } ) ) )
|
| 277 |
+
$$
|
| 278 |
+
|
| 279 |
+
and (c) loading a pretrained VRNN encoder and using the objective as presented in equation 3 (denoted by $\mathbf { I I I }$ ). Key to note is that in method $\mathbf { I }$ , we do not apply variational methods towards learning the shared latent representation. This was done to test whether they were helpful or harmful towards the learned latent representation used for classification. In method III, we train VRADA as normal but load a pretrained encoder. We pretrain the encoder by training the VRNN on all source and target domain samples for a desired source-target adaptation pair. In order to choose how many samples would be used for training, we looked at which domain had more examples and chose the larger of the two. For example, if the source domain was group 2 with 508 patients and the target domain was group 5 with 437 patients, the VRNN would see 508 samples of each domain, with group 5 being sampled with replacement after seeing all its samples. As the encoder was used for learning latent representations, we thought it worth investigating whether if pretrained it better captured the latent representations that were being used by the domain classifier for adversarial training. We thought beginning domain classification at a better initialization point might help VRADA avoid local minima. For each method, we fed one source domain sample to $G _ { y }$ and either a source or target domain sample to $G _ { d }$ . (For this training and all training samples, order was randomized.) We only calculated the loss $\mathcal { L } _ { r }$ once for the $G _ { d }$ samples so as to not bias the optimization of the VRNN.
|
| 280 |
+
|
| 281 |
+
Table 3 shows the results of AHRF Mortality Prediction task for different types of VRADA training. From these experiments, we found that jointly training VRADA (i.e method I) usually performed better than the other pretrained training approaches.
|
| 282 |
+
|
| 283 |
+
# 6.2 MODEL VARIATIONS
|
| 284 |
+
|
| 285 |
+
# 6.2.1 ADVERSARIAL TRAINING AT EVERY TIME-STEP
|
| 286 |
+
|
| 287 |
+
A natural question is whether adversarial training at every time-step is more effective than adversarial training at the last time-step of a latent representation. If done at every time-step, the network learns to create domain-invariant representations of subsets of your input $x _ { \le T }$ . Do these domain-invariant representations help the network find more optimal domain-invariant representations of $x$ ? We empirically tested this scenario (Table 4) and found the results to be sub-optimal when compared to only performing adversarial training at the last time-step (Table 1). Below are results for the R-DANN and VRADA models for adversarial training at every time-step.
|
| 288 |
+
|
| 289 |
+
Table 4: AUC Comparison for AHRF Mortality Prediction task with adversarial training done at every time-step
|
| 290 |
+
|
| 291 |
+
<table><tr><td>Model</td><td>23 24</td><td>25</td><td>34</td><td>35</td><td>42</td><td>43</td><td>45</td><td>52 53 54</td></tr><tr><td>R-DANN</td><td>.651 .599</td><td>.598</td><td>.557 .679</td><td>.534</td><td>.563 .768</td><td>.588</td><td>.528</td><td>.696 .669</td></tr><tr><td>VRADA</td><td>.681 .691</td><td>.643</td><td>.594 .733</td><td>.641</td><td>.733 .794</td><td>.675</td><td>.583</td><td>.755 .726</td></tr></table>
|
| 292 |
+
|
| 293 |
+
# 6.2.2 EFFECT OF RECONSTRUCTION LOSS
|
| 294 |
+
|
| 295 |
+
Table 5 shows the effect of reconstruction loss for our VRADA model. We observe that reconstructing the original data (i.e. using the decoder for reconstructing the data) helps in the overall performance improvement of our VRADA model.
|
| 296 |
+
|
| 297 |
+
Table 5: AUC Comparison of VRADA model for AHRF Mortality Prediction task with and without reconstruction loss
|
| 298 |
+
|
| 299 |
+
<table><tr><td>Model</td><td>23</td><td>24</td><td>25</td><td>32</td><td>34</td><td>35</td><td>42</td><td>43</td><td>45</td><td>52</td><td>53</td><td>54</td></tr><tr><td>Without reconstruction</td><td>0.703</td><td>0.623</td><td>0.570</td><td>0.647</td><td>0.622</td><td>0.564</td><td>0.577</td><td>0.608</td><td>0.552</td><td>0.599</td><td>0.640</td><td>0.676</td></tr><tr><td>With reconstruction</td><td>0.724</td><td>0.777</td><td>0.719</td><td>0.654</td><td>0.764</td><td>0.721</td><td>0.656</td><td>0.770</td><td>0.775</td><td>0.616</td><td>0.782</td><td>0.738</td></tr></table>
|
| 300 |
+
|
| 301 |
+
# 6.2.3 IMPACT OF ADVERSARIAL TRAINING
|
| 302 |
+
|
| 303 |
+
In figures 5 and 6 we show the cell state activations for the VRADA and R-DANN without domain adaptation (i.e. no adversarial training). From these figures, we see that the dependencies between source and target domains are not transferred correctly since we do not perform adversarial training. On the otherhand, as discussed in section 4.4, figure 3 shows that adversarial training helps in transferring the dependencies between source and target domains efficiently.
|
| 304 |
+
|
| 305 |
+
# 6.3 R-DANN MODEL INFORMATION
|
| 306 |
+
|
| 307 |
+
Here we provide more details on the network architectures of the R-DANN and DANN. Please refer to Figure 7 for a diagram of the R-DANN model showing the dimensions of each layer and the connections between layers. The R-DANN and DANN were essentially identical except that, for the DANN, the first layer used a fully-connected layer instead of an RNN and took input flattened over the time-dimension. Thus the input dimensions corresponded to $f$ and $t \times f$ for the R-DANN and DANN, respectively, where $f$ is the number of features and $t$ is the length of the time-dimension.
|
| 308 |
+
|
| 309 |
+

|
| 310 |
+
Figure 5: Cell states of memory cell for R-DANN and VRADA showing temporal latent dependencies captured by neurons of the R-DANN and VRADA for the source domain and the target domain. Each step along the y-axis refers to the activation of a single neuron with blue for strong inhibition and yellow for strong excitation. Step along the $\mathbf { X }$ -axis refers to activation per time-step. The figure shows a single example in adapting 3-4 for AHRF dataset.
|
| 311 |
+
|
| 312 |
+

|
| 313 |
+
Figure 6: Cell states of memory cell for R-DANN and VRADA showing temporal latent dependencies captured by neurons of the R-DANN and VRADA for the source domain and the target domain. Each step along the y-axis refers to the activation of a single neuron with blue for strong inhibition and yellow for strong excitation. Step along the $\mathbf { X }$ -axis refers to activation per time-step. The figure shows a single example in adapting 2-5 for ICD9 dataset.
|
| 314 |
+
|
| 315 |
+

|
| 316 |
+
Figure 7: Block diagram of the R-DANN showing the number of neurons used in each layer and how the layers were connected. This model had a capacity of about 46, 000 parameters.
|
md/train/rkA1f3NpZ/rkA1f3NpZ.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ENSEMBLE METHODS AS A DEFENSE TO ADVERSARIAL PERTURBATIONS AGAINST DEEP NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Deep learning has become the state of the art approach in many machine learning problems such as classification. It has recently been shown that deep learning is highly vulnerable to adversarial perturbations. Taking the camera systems of self-driving cars as an example, small adversarial perturbations can cause the system to make errors in important tasks, such as classifying traffic signs or detecting pedestrians. Hence, in order to use deep learning without safety concerns a proper defense strategy is required. We propose to use ensemble methods as a defense strategy against adversarial perturbations. We find that an attack leading one model to misclassify does not imply the same for other networks performing the same task. This makes ensemble methods an attractive defense strategy against adversarial attacks. We empirically show for the MNIST and the CIFAR-10 data sets that ensemble methods not only improve the accuracy of neural networks on test data but also increase their robustness against adversarial perturbations.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In recent years, deep neural networks (DNNs) led to significant improvements in many areas ranging from computer vision (Krizhevsky et al., 2012; LeCun et al., 2015) to speech recognition (Hinton et al., 2012; Dahl et al., 2012). Some applications that can be solved with DNNs are sensitive from the security perspective, for example camera systems of self driving cars for detecting traffic signs or pedestrians (Papernot et al., 2016b; Sermanet & LeCun, 2011). Recently, it has been shown that DNNs can be highly vulnerable to adversaries (Szegedy et al., 2013; Goodfellow et al., 2014; Papernot et al., 2016a;b). The adversary produces some kind of noise on the input of the system to mislead its output behavior, producing undesirable outcomes or misclassification. Adversarial perturbations are carefully chosen in order to be hard, if not impossible, to be detected by the human eye (see figure 1). Attacks occur after the training of the DNN is completed. Furthermore, it has been shown that the exact structure of the DNN does not need to be known in order to mislead the system as one can send inputs to the unknown system in order to record its outputs to train a new DNN that imitates its behavior (Papernot et al., 2016b). Hence, in this manuscript it is assumed that the DNN and all its parameters are fully known to the adversary.
|
| 12 |
+
|
| 13 |
+
There are many methods on how to attack neural networks appearing in the literature. Some of the most well-known ones are the Fast Gradient Sign Method (Goodfellow et al., 2014) and its iterative extension (Kurakin et al., 2016), DeepFool (Moosavi-Dezfooli et al., 2016), Jacobian-Based Saliency Map Attack (Papernot et al., 2016c), and the L-BFGS Attack (Szegedy et al., 2013). This shows the need of building neural networks that are themselves robust against any kind of adversarial perturbations.
|
| 14 |
+
|
| 15 |
+
Novel methods on defending against adversarial attacks are appearing more and more frequently in the literature. Some of those defense methods are to train the network with different kinds of adversarially perturbated training data (Goodfellow et al., 2014; Papernot et al., 2016c), the use of distillation to reduce the effectiveness of the perturbation (Papernot et al., 2016d) or to apply denoising autoencoders to preprocess the data used by the DNN (Gu & Rigazio, 2014). It also has been noted that adversarial attacks can be detected (Metzen et al., 2017; Feinman et al., 2017), but these detection systems are again vulnerable to adversarial attacks. To our knowledge, there is no method that can reliably defend or detect all kinds of adversarial attacks.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: The first line shows original and correctly classified MNIST test data images. In the second line are the corresponding adversarial BIM attacks on a single classifier ( $\epsilon = 0 . 2$ , $\alpha = 0 . 0 2 5$ , $n = 8$ ) which predicts (from left to right): 6, 8, 1, 5, 9, 3, 0, 2, 2, and 4. Analogously, the third line corresponds to correctly predicted examples of the CIFAR-10 test data set. In the bottom line are the corresponding adversarial BIM attacks on a single classifier $\epsilon = 0 . 0 2$ , $\alpha = 0 . 0 0 2 5$ , $n = 8$ ) which predicts (from left to right): deer, cat, deer, ship, bird, deer, deer, frog, automobile, and automobile.
|
| 19 |
+
|
| 20 |
+
In this manuscript, ensemble methods are used to obtain a classification system that is more robust against adversarial perturbations. The term ensemble method refers to constructing a set of classifiers used to classify new data points by the weighted or unweighted average of their predictions. Many ensemble methods have been introduced in the literature such as Bayesian averaging, Bagging (Breiman, 1996) and boosting (Dietterich et al., 2000). These methods frequently win machine learning competitions, for example the Netflix prize (Koren, 2009). Initial results on using ensembles of classifiers in adversarial context can be found in (Abbasi & Gagne, 2017; He et al., 2017). ´ However, to the best of our knowledge this is the first manuscript that empirically evaluates the robustness of ensemble methods to adversarial perturbations.
|
| 21 |
+
|
| 22 |
+
One advantage of using ensemble methods as defense against adversarial perturbations is that they also increase the accuracy on unperturbed test data. This is not the case in general for other defense methods (see Table 4). However, in most applications a perturbated input can be considered as exception. Hence, it is desirable to obtain a state of the art result on unperturbed test data while making the model more robust against adversarial attacks. Another advantage is that ensemble methods can easily be combined with other defense mechanisms to improve the robustness against adversarial perturbations further (see Table 4). However, the advantages come at a cost of an increase of computational complexity and memory requirements which are proportional to the number of classifiers in the ensemble.
|
| 23 |
+
|
| 24 |
+
This paper is organized as follows: In section 2, some methods for producing adversarial perturbations are briefly introduced. Section 3 describes the defense strategy proposed in this manuscript. In section 4, the previous methods are tested on the MNIST and CIFAR-10 data sets and are compared to other defense strategies appearing in the literature. Finally, in section 5 the conclusions are presented.
|
| 25 |
+
|
| 26 |
+
# 2 ADVERSARIAL ATTACK
|
| 27 |
+
|
| 28 |
+
In this section, two methods for producing adversarial attacks shall be briefly described. In the following, let $\theta$ be the parameters of a model, $x$ the input of the model and $y$ the output value associated with the input value $x$ . Further, let $J ( \theta , x , y )$ be the cost function used to train the DNN.
|
| 29 |
+
|
| 30 |
+
# FAST GRADIENT SIGN METHOD
|
| 31 |
+
|
| 32 |
+
The fast gradient sign method (FGSM) by Goodfellow et al. (2014) simply adds some small perturbations of size $\epsilon > 0$ to the input $x$ ,
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
x _ { \mathrm { F G S M } } = x + \epsilon \mathrm { s i g n } [ \nabla _ { x } J ( \theta , x , y ) ] ,
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where the gradient $\nabla _ { x } J ( \theta , x , y )$ can be computed using backpropagation. This relatively cheap and simple adversarial perturbation performs well on many DNNs. It is believed that this behavior is due to linear elements such as ReLUs or maxout networks in the DNNs (Goodfellow et al., 2014).
|
| 39 |
+
|
| 40 |
+
# BASIC ITERATIVE METHOD
|
| 41 |
+
|
| 42 |
+
The basic iterative method (BIM) by Kurakin et al. (2016) is an iterative extension of FGSM. The idea is to choose $\epsilon \geq \alpha > 0$ and then apply some perturbations similar to FGSM to the input $x$ and repeat the process $n$ times:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\begin{array} { r l } & { x _ { 0 } = x , } \\ & { x _ { i } = \mathrm { c l i p } _ { x , \epsilon } \left( x _ { i - 1 } + \alpha \mathrm { s i g n } [ \nabla _ { x _ { i - 1 } } J ( \theta , x _ { i - 1 } , y ) ] \right) , } \\ & { x _ { \mathrm { B I M } } = x _ { n } . } \end{array}
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
Here, $\mathrm { c l i p } _ { x , \epsilon } ( \cdot )$ refers to clipping the values of the adversarial sample so that they remain within an $\epsilon$ -neighborhood of $x$ .
|
| 49 |
+
|
| 50 |
+
# 3 ENSEMBLE METHODS
|
| 51 |
+
|
| 52 |
+
Ensemble methods are widely used to improve classifiers in supervised learning (Dietterich et al., 2000). The idea is to construct a set of classifiers that is used to classify a new data point by the weighted or unweighted average of their predictions. In order for an ensemble to outperform a single classifier it must be both accurate and diverse (Hansen & Salamon, 1990). A classifier is said to be accurate if it is better than random guessing, and a set of classifiers is said to be diverse if different classifiers make different errors on new data points.
|
| 53 |
+
|
| 54 |
+
As expected, when performing adversarial perturbations on new data points different classifiers perform quite differently on these points. Hence, we conclude that diversity on adversarial perturbations is given. Furthermore, for adversarial perturbations with small $\epsilon > 0$ , the vast majority of classifiers was accurate. In other words, for any small $\epsilon > 0$ , we could not find an adversarial attack that would turn the majority of classifiers into non-accurate classifiers.
|
| 55 |
+
|
| 56 |
+
In section 4, the following ensemble methods are used. Note that random initialization of the model parameters is used in all methods.
|
| 57 |
+
|
| 58 |
+
(i) The first method is to train multiple classifiers with the same network architecture but with random initial weights. This results in quite diverse classifiers with different final weights (Kolen & Pollack, 1991).
|
| 59 |
+
(ii) The second method is to train multiple classifiers with different but similar network architectures to ensure obtaining a set of even more diverse classifiers. That is, extra filters are used in one classifier or an extra convolution layer is added to another classifier.
|
| 60 |
+
(iii) Third, Bagging (Breiman, 1996) is used on the training data. The term Bagging is derived from bootstrap aggregation and it consists of drawing $m$ samples with replacement from the training data set of $m$ data points. Each of these new data sets is called a bootstrap replicate. At average each of them contains $6 3 . 2 \%$ of the training data, where many data points are repeated in the bootstrap replicates. A different bootstrap replicate is used as training data for each classifier in the ensemble.
|
| 61 |
+
(iv) The last method is to add some small Gaussian noise to the training data so that all classifiers are trained on similar but different training sets. Note that adding Gaussian noise to the training data also makes each classifier somewhat more robust against adversarial perturbations.
|
| 62 |
+
|
| 63 |
+
Once an ensemble of classifiers is trained, it predicts by letting each classifier vote for a label. More specifically, the predicted value is chosen to be the label that maximizes the average of the output probabilities from the classifiers in the ensemble.
|
| 64 |
+
|
| 65 |
+
In order to attack a network with the methods from section 2 the gradient $\nabla _ { x } J ( \theta , x , y )$ must be computed. However, obtaining the gradient for an ensemble requires to calculate the gradient of each of its classifiers. Nevertheless, the following two methods are used to estimate the gradient of an ensemble, which are referred to as Grad. 1 and Grad. 2 for the rest of this manuscript:
|
| 66 |
+
|
| 67 |
+
Grad. 1 Use $\nabla _ { x } J ( \theta _ { i } , x , y )$ of the $i$ -th classifier. This is clearly not the correct gradient for an ensemble. But the question is whether an attack with this gradient can already mislead all classifiers in the ensemble in a similar manner.
|
| 68 |
+
Grad. 2 Compute the average of the gradients $\begin{array} { r } { \frac { 1 } { n } \sum _ { i } \nabla _ { x } J ( \theta _ { i } , x , y ) \ } \end{array}$ from all classifiers in the ensemble.
|
| 69 |
+
|
| 70 |
+
A comparison of the effects of these two gradients for attacking ensembles can be found in section 4.
|
| 71 |
+
|
| 72 |
+
# 4 EXPERIMENTS
|
| 73 |
+
|
| 74 |
+
In this section the ensemble methods from section 3 are empirically evaluated on the MNIST (LeCun et al., 1998) and the CIFAR-10 (Krizhevsky & Hinton, 2009) data sets which are scaled to the unit interval. All experiments have been performed on ensembles of 10 classifiers. Note that this choice has been done for comparability. That is, in some cases the best performance was already reached with ensembles of less classifiers while in others more classifiers might improve the results.
|
| 75 |
+
|
| 76 |
+
A summary of the experimental results can be found in Table 2 and the corresponding visualization in Figure 2. A comparison of ensembles with other defense methods and a combination of those with ensembles can be found in Table 4. In the following all FGSM perturbations are done with $\epsilon = 0 . 3$ on MNIST and with $\epsilon = 0 . 0 3$ on CIFAR-10. Furthermore, all BIM perturbations are done with $\epsilon = 0 . 2$ , $\alpha = 0 . 0 2 5$ and $n = 8$ iterations on MNIST and with $\epsilon = 0 . 0 2$ , $\alpha = 0 . 0 0 2 5$ and $n = 8$ on CIFAR-10. The abbreviations in Table 2 and in Figure 2 shall be interpreted in the following way: Rand. Ini. refers to random initialization of the weights of the neural network, Mix. Mod. means that the network architecture was slightly different for each classifier in an ensemble, Bagging refers to classifiers trained on bootstrap replicates of the training data, and Gauss noise implies that small Gaussian noise has been added to the training data. Each ensemble is attacked with FGSM and BIM based on the gradients from Grad. 1 and Grad. 2. In Table 2, the term Single refers to evaluating a single classifier.
|
| 77 |
+
|
| 78 |
+
# MNIST
|
| 79 |
+
|
| 80 |
+
The MNIST data set consists of 60,000 training and 10,000 test data samples of black and white encoded handwritten digits. The objective is to classify these digits in the range from 0 to 9. A selection of images from the data set and some adversarial perturbations can be found in the top two rows of figure 1. In the experiments, the network architecture in Table 1 is used and it is trained with 10 epochs. All results from the experiments are summarized in Table 2.
|
| 81 |
+
|
| 82 |
+
On unperturbed test data the classification accuracy is roughly $9 9 \%$ . The difference between single classifiers and ensembles is below one percent throughout. The ensembles slightly outperform the single classifiers in all cases.
|
| 83 |
+
|
| 84 |
+
Table 1: MNIST Network Architecture
|
| 85 |
+
|
| 86 |
+
<table><tr><td>Layer Type</td><td>Parameters</td></tr><tr><td>Relu Convolutional</td><td>32 filters (3×3)</td></tr><tr><td>Relu Convolutional</td><td>32 filters (3×3)</td></tr><tr><td>Max Pooling</td><td>2×2</td></tr><tr><td>Relu Fully Connected</td><td>128 units</td></tr><tr><td>Dropout</td><td>0.5</td></tr><tr><td>Relu Fully Connected</td><td>10 units</td></tr><tr><td>Softmax</td><td>10 units</td></tr></table>
|
| 87 |
+
|
| 88 |
+
Table 2: Experimental results on the MNIST and the CIFAR-10 data sets
|
| 89 |
+
MNIST Accuracy
|
| 90 |
+
|
| 91 |
+
<table><tr><td colspan="2">Test Data</td><td colspan="2">No Attack</td><td colspan="2">Grad. 1</td><td>Grad. 2</td></tr><tr><td>Type</td><td>Method</td><td>Single</td><td>Ensemble</td><td>Single</td><td>Ensemble</td><td>Ensemble</td></tr><tr><td rowspan="4">FGSM</td><td>Rand. Ini.</td><td>0.9912</td><td>0.9942</td><td>0.3791</td><td>0.6100</td><td>0.4517</td></tr><tr><td>Mix. Mod.</td><td>0.9918</td><td>0.9942</td><td>0.3522</td><td>0.5681</td><td>0.4609</td></tr><tr><td>Bagging</td><td>0.9900</td><td>0.9927</td><td>0.4045</td><td>0.6738</td><td>0.5716</td></tr><tr><td>Gauss Noise</td><td>0.9898</td><td>0.9920</td><td>0.5587</td><td>0.7816</td><td>0.7043</td></tr><tr><td rowspan="4">BIM</td><td>Rand. Ini.</td><td>0.9912</td><td>0.9942</td><td>0.0906</td><td>0.6518</td><td>0.8875</td></tr><tr><td>Mix.Mod.</td><td>0.9918</td><td>0.9942</td><td>0.0582</td><td>0.6656</td><td>0.9076</td></tr><tr><td>Bagging</td><td>0.9900</td><td>0.9927</td><td>0.1110</td><td>0.7068</td><td>0.9233</td></tr><tr><td>Gauss Noise</td><td>0.9898</td><td>0.9920</td><td>0.5429</td><td>0.9152</td><td>0.9768</td></tr></table>
|
| 92 |
+
|
| 93 |
+
CIFAR-10 Accuracy
|
| 94 |
+
|
| 95 |
+
<table><tr><td colspan="2">Test Data</td><td colspan="2">No Attack</td><td colspan="2">Grad. 1</td><td>Grad. 2</td></tr><tr><td>Type</td><td>Method</td><td>Single</td><td>Ensemble</td><td>Single</td><td>Ensemble</td><td>Ensemble</td></tr><tr><td rowspan="4">FGSM</td><td>Rand. Ini.</td><td>0.7984</td><td>0.8448</td><td>0.1778</td><td>0.4538</td><td>0.3302</td></tr><tr><td>Mix. Mod.</td><td>0.7898</td><td>0.8400</td><td>0.1643</td><td>0.4339</td><td>0.3140</td></tr><tr><td>Bagging</td><td>0.7815</td><td>0.8415</td><td>0.1822</td><td>0.4788</td><td>0.3571</td></tr><tr><td>Gauss Noise</td><td>0.7160</td><td>0.7687</td><td>0.2966</td><td>0.6097</td><td>0.4707</td></tr><tr><td rowspan="4">BIM</td><td>Rand. Ini.</td><td>0.7984</td><td>0.8448</td><td>0.1192</td><td>0.5232</td><td>0.6826</td></tr><tr><td>Mix. Mod.</td><td>0.7898</td><td>0.8400</td><td>0.1139</td><td>0.5259</td><td>0.6768</td></tr><tr><td>Bagging</td><td>0.7815</td><td>0.8415</td><td>0.1280</td><td>0.5615</td><td>0.7166</td></tr><tr><td>Gauss Noise</td><td>0.7160</td><td>0.7687</td><td>0.3076</td><td>0.6735</td><td>0.7277</td></tr></table>
|
| 96 |
+
|
| 97 |
+
This picture changes dramatically if the networks are attacked by one of the methods described in section 2. Using the FGSM attack with gradients from Grad. 1 on a single classifier, the classification rate drops down to a range of roughly $3 5 \% { - } 5 6 \%$ . The ensembles perform significantly better by producing an accuracy of $5 7 \% - 7 8 \%$ . Evaluating the same with gradients from Grad. 2 it turns out that ensemble methods still obtain an accuracy of $45 \% - 7 0 \%$ . The higher accuracy of Grad. 1 is expected since in contrast to Grad. 2 it computes the gradients with respect to just one classifier. Nevertheless, the ensembles outperform single classifiers in each case by approximately $7 \% - 2 2 \%$ .
|
| 98 |
+
|
| 99 |
+
The decrease of the accuracy is even more extreme for single classifiers if the BIM method is used. Here, the accuracy can be as low as around $6 \%$ and only the classifiers trained with Gaussian noise significantly exceed the $10 \%$ . The accuracy of the ensemble methods against attacks using Grad. 1 is considerably higher with $6 5 \% { - } 9 2 \%$ . Furthermore, ensembles are even more robust against BIM attacks based on Grad. 2 with a correct classification rate of $89 \% - 9 8 \%$ . It is surprising that BIM attacks using Grad. 1 are more successful than those using Grad. 2, because Grad. 1 only attacks a single classifier in the ensemble. Concluding, the ensemble methods outperform single classifiers significantly by $3 7 \% 8 5 \%$ on BIM attacks.
|
| 100 |
+
|
| 101 |
+
Focusing on the different defense strategies, we observe that using random initialization of the network weights as well as using several networks of similar architectures for an ensemble generally improves the robustness against adversarial attacks considerably in comparison with single classifiers. Bagging outperforms both of the previous methods on adversarial perturbations, but performs slightly worse on unperturbed test data. Using ensembles with small Gaussian noise on the training data results in the best defense mechanism against adversarial attacks. This may be due to the fact that using additive noise on the training data already makes every single classifier in the ensemble more robust against adversarial perturbations. On the down-side, adding Gaussian noise to the training data performs worst from all considered ensemble methods on test data. However, such an ensemble still performs better than all single classifiers on MNIST.
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 2: Visual comparisons of the accuracies presented in Table 2. Compared are the MNIST (top row) and CIFAR-10 (bottom row) data sets on the FGSM (left column) and the BIM (right column) attacks. Grad. 1 Single refers to attacks based on Grad. 1 on single classifiers, Grad. 1 Ensemble refers to attacks based on Grad. 1 on ensembles, Grad. 2 Ensemble refers to attacks based on Grad. 2 on ensemble classifiers, No Attack Single refers to single classifier on unperturbed data, and finally No Attack Ensemble refers to ensemble classifiers on unperturbed data.
|
| 105 |
+
|
| 106 |
+
# CIFAR-10
|
| 107 |
+
|
| 108 |
+
The CIFAR-10 data set consists of 50,000 training and 10,000 test data samples of three-color component encoded images of ten mutually exclusive classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck. A selection of images from the data set and some adversarial perturbations can be found in the two bottom rows of figure 1. In all experiments the network architecture described in Table 3 is used and the networks are trained with 25 epochs.
|
| 109 |
+
|
| 110 |
+
In general, the observations on the MNIST data set are confirmed by the experiments on CIFAR10. Since the latter data set is more demanding to classify, the overall classification rate is already lower in the attack-free case, where single classifiers reach an accuracy of roughly $7 2 \% - 8 0 \%$ , while ensembles show a higher accuracy of $7 7 \% - 8 4 \%$ . Note that there are network architectures in the literature that outperform our classifiers considerably on test data (Graham, 2014).
|
| 111 |
+
|
| 112 |
+
The FGSM attacks on single classifiers using method Grad. 1 show a drop-down of the accuracy to $1 6 \% - 3 0 \%$ . In contrast, ensembles are significantly better reaching accuracies of $4 3 \% - 6 1 \%$ when attacked using Grad. 1 and $3 1 \% - 4 7 \%$ when attacked with Grad. 2.
|
| 113 |
+
|
| 114 |
+
Table 3: CIFAR-10 Network Architecture
|
| 115 |
+
|
| 116 |
+
<table><tr><td>Layer Type</td><td>Parameters</td></tr><tr><td>Relu Convolutional Relu Convolutional Max Pooling Dropout</td><td>32 filters (3×3) 32 filters (3×3) 2×2 0.2</td></tr><tr><td>Relu Convolutional Relu Convolutional Max Pooling Dropout Relu Convolutional</td><td>64 filters (3×3) 64 filters (3×3) 2×2 0.3</td></tr><tr><td>Relu Convolutional</td><td>128 filters (3×3)</td></tr><tr><td></td><td>128 filters (3×3)</td></tr><tr><td>Max Pooling Dropout Relu Fully Connected Dropout Relu Fully Connected Softmax</td><td>2×2 0.4 512 units 0.5 10 units</td></tr></table>
|
| 117 |
+
|
| 118 |
+
When using BIM attacks accuracies for single classifiers lie between $11 \%$ and $31 \%$ . Again, the ensemble methods outperform the single classifiers reaching accuracies of $5 2 \% - 6 7 \%$ when attacked using Grad. 1 and $6 8 \% - 7 3 \%$ when attacked with Grad. 2.
|
| 119 |
+
|
| 120 |
+
The same observations as on the MNIST data set can be made on the CIFAR-10 data set. All ensemble methods outperform single classifiers when comparing their robustness against adversarial perturbations. FGSM attacks on an ensemble using Grad. 2 outperform those using Grad. 1, as expected. Similar to the MNIST experiments, when using BIM attacks, ensembles are surprisingly more robust against gradient attacks from Grad. 2 than against gradient attacks from Grad. 1. The reason for this might be that the gradient portion from different classifiers using Grad. 2 in the ensemble try to reach a different local maximum and block each other in the following iterations.
|
| 121 |
+
|
| 122 |
+
As already observed on the MNIST data set, Bagging performs better than random initialization and than using similar but different network architectures. Again, adding small Gaussian noise on the training data performs best on adversarial perturbations but relatively poor on real test data on CIFAR-10.
|
| 123 |
+
|
| 124 |
+
# COMPARISON WITH OTHER METHODS
|
| 125 |
+
|
| 126 |
+
In this section, we compare the previous results with two of the most popular defense methods: adversarial training (Goodfellow et al., 2014; Papernot et al., 2016c) and defensive distillation (Papernot et al., 2016d). Furthermore, we show the positive effects of combining those methods with ensembles. For simplicity, we only consider the gradient Grad. 2 whenever an ensemble is attacked. The results are summarized in Table 4. Here, the content shall be interpreted in the following way: Bagging refers to ensembles trained with bagging, Adv. Train. to adversarial training, Def. Dist. to defensive distillation, the operator $^ +$ to combinations of the previous methods, bold text to the best performance of the first three methods, and the asterisk to the best method including combinations of defensive strategies.
|
| 127 |
+
|
| 128 |
+
Adversarial training (AT) is a method that uses FGSM as regularizer of the original cost function:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
J _ { A T } ( \theta , x , y ) = \rho J ( \theta , x , y ) + ( 1 - \rho ) J ( \theta , x + \epsilon \operatorname { s i g n } ( \nabla _ { x } J ( \theta , x , y ) ) , y ) ,
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $\rho \in [ 0 , 1 ]$ . This method iteratively increases the robustness against adversarial perturbations.
|
| 135 |
+
In our experiments, we use $\rho = { \textstyle { \frac { 1 } { 2 } } }$ as proposed in Goodfellow et al. (2014).
|
| 136 |
+
|
| 137 |
+
Table 4: Accuracies of different defense mechanisms
|
| 138 |
+
|
| 139 |
+
<table><tr><td></td><td colspan="3">MNIST</td><td colspan="3">CIFAR-10</td></tr><tr><td>Methods</td><td>No Attack</td><td>FGSM</td><td>BIM</td><td>No Attack</td><td>FGSM</td><td>BIM</td></tr><tr><td>Bagging</td><td>0.9927*</td><td>0.5716</td><td>0.9233</td><td>0.8415*</td><td>0.3571</td><td>0.7166*</td></tr><tr><td>Adv.Train.</td><td>0.9902</td><td>0.3586</td><td>0.5420</td><td>0.7712</td><td>0.1778</td><td>0.3107</td></tr><tr><td>Def. Dist.</td><td>0.9840</td><td>0.0798</td><td>0.3829</td><td>0.7140</td><td>0.1828</td><td>0.3635</td></tr><tr><td>Bagging + Adv. Train.</td><td>0.9927*</td><td>0.8703*</td><td>0.9840*</td><td>0.8320</td><td>0.5010*</td><td>0.7017</td></tr><tr><td>Bagging + Def. Dist.</td><td>0.9875</td><td>0.0954</td><td>0.4514</td><td>0.7323</td><td>0.1839</td><td>0.4569</td></tr></table>
|
| 140 |
+
|
| 141 |
+
In defensive distillation a teacher model $F$ is trained on a training data set $X$ . Then smoothed labels at temperature $T$ are computed by
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
F ^ { T } ( X ) = \left[ \frac { \exp ( F _ { i } ( X ) / T ) } { \sum _ { i = 1 } ^ { N } \exp ( F _ { i } ( X ) / T ) } \right] _ { i \in \{ 1 , \ldots , N \} } ,
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
where $F _ { i } ( X )$ refers to the probability of the $i$ -th out of $N$ possible classes. A distilled network is a network that is trained on the training data $X$ using the smoothed labels $F ^ { T } ( X )$ . In the following, we use $T = 1 0$ based on the experimental results in Papernot et al. (2016d).
|
| 148 |
+
|
| 149 |
+
We found that single networks trained with adversarial training or defensive distillation have a lower accuracy than ensembles trained with bagging (see the top three rows in Table 4). This is not only the case on the considered attacked data but also on unperturbated test data. Combining ensembles with adversarial training can improve the robustness against adversarial perturbations further, while a combination with defensive distillation does not reveal the same tendency (see the two bottom rows in Table 4). We emphasize that already the standard ensemble method does not only outperform both adversarial training and defensive distillation throughout but also has the overall highest accuracy on unperturbated test data.
|
| 150 |
+
|
| 151 |
+
# 5 CONCLUSION
|
| 152 |
+
|
| 153 |
+
With the rise of deep learning as the state-of-the-art approach for many classification tasks, researchers noted that neural networks are highly vulnerable to adversarial perturbations. This is particularly problematic when neural networks are used in security sensitive applications such as autonomous driving. Hence, with the development of more efficient attack methods against neural networks it is desirable to obtain neural networks that are themselves robust against adversarial attacks.
|
| 154 |
+
|
| 155 |
+
In this manuscript, it is shown that several ensemble methods such as random initialization or Bagging do not only increase the accuracy on the test data, but also make the classifiers considerably more robust against certain adversarial attacks. We consider ensemble methods as sole defense methods, but more robust classifiers can be obtained by combining ensemble methods with other defense mechanisms such as adversarial training. Although only having tested simple attack scenarios, it can be expected that ensemble methods may improve the robustness against other adversarial attacks.
|
| 156 |
+
|
| 157 |
+
# REFERENCES
|
| 158 |
+
|
| 159 |
+
Mahdieh Abbasi and Christian Gagne. Robustness to adversarial examples through an ensemble of ´ specialists. arXiv preprint arXiv:1702.06856, 2017.
|
| 160 |
+
|
| 161 |
+
Leo Breiman. Bagging predictors. Machine learning, 24(2):123–140, 1996.
|
| 162 |
+
|
| 163 |
+
George E Dahl, Dong Yu, Li Deng, and Alex Acero. Context-dependent pre-trained deep neural networks for large-vocabulary speech recognition. IEEE Transactions on audio, speech, and language processing, 20(1):30–42, 2012.
|
| 164 |
+
|
| 165 |
+
Thomas G Dietterich et al. Ensemble methods in machine learning. Multiple classifier systems, 1857:1–15, 2000.
|
| 166 |
+
|
| 167 |
+
Reuben Feinman, Ryan R Curtin, Saurabh Shintre, and Andrew B Gardner. Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017.
|
| 168 |
+
|
| 169 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 170 |
+
|
| 171 |
+
Benjamin Graham. Fractional max-pooling. arXiv preprint arXiv:1412.6071, 2014.
|
| 172 |
+
|
| 173 |
+
Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
|
| 174 |
+
|
| 175 |
+
Lars Kai Hansen and Peter Salamon. Neural network ensembles. IEEE transactions on pattern analysis and machine intelligence, 12(10):993–1001, 1990.
|
| 176 |
+
|
| 177 |
+
Warren He, James Wei, Xinyun Chen, Nicholas Carlini, and Dawn Song. Adversarial example defenses: Ensembles of weak defenses are not strong. arXiv preprint arXiv:1706.04701, 2017.
|
| 178 |
+
|
| 179 |
+
Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012.
|
| 180 |
+
|
| 181 |
+
John F Kolen and Jordan B Pollack. Back propagation is sensitive to initial conditions. In Advances in neural information processing systems, pp. 860–867, 1991.
|
| 182 |
+
|
| 183 |
+
Yehuda Koren. The bellkor solution to the netflix grand prize. Netflix prize documentation, 81:1–10, 2009.
|
| 184 |
+
|
| 185 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
|
| 190 |
+
|
| 191 |
+
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.
|
| 192 |
+
|
| 193 |
+
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
|
| 194 |
+
|
| 195 |
+
Jan Hendrik Metzen, Tim Genewein, Volker Fischer, and Bastian Bischoff. On detecting adversarial perturbations. arXiv preprint arXiv:1702.04267, 2017.
|
| 196 |
+
|
| 197 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2574–2582, 2016.
|
| 198 |
+
|
| 199 |
+
Nicolas Papernot, Ian Goodfellow, Ryan Sheatsley, Reuben Feinman, and Patrick McDaniel. cleverhans v1. 0.0: an adversarial machine learning library. arXiv preprint arXiv:1610.00768, 2016a.
|
| 200 |
+
|
| 201 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. arXiv preprint arXiv:1602.02697, 2016b.
|
| 202 |
+
|
| 203 |
+
Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016c.
|
| 204 |
+
|
| 205 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016d.
|
| 206 |
+
|
| 207 |
+
Pierre Sermanet and Yann LeCun. Traffic sign recognition with multi-scale convolutional networks. In Neural Networks (IJCNN), The 2011 International Joint Conference on, pp. 2809–2813. IEEE, 2011.
|
| 208 |
+
|
| 209 |
+
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.
|
md/train/rkE3y85ee/rkE3y85ee.md
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CATEGORICAL REPARAMETERIZATION WITH GUMBEL-SOFTMAX
|
| 2 |
+
|
| 3 |
+
Eric Jang
|
| 4 |
+
Google Brain
|
| 5 |
+
ejang@google.com Shixiang $\mathbf { G u } ^ { * }$
|
| 6 |
+
University of Cambridge MPI Tubingen ¨
|
| 7 |
+
sg717@cam.ac.uk
|
| 8 |
+
Ben Poole∗
|
| 9 |
+
Stanford University
|
| 10 |
+
poole@cs.stanford.edu
|
| 11 |
+
|
| 12 |
+
# ABSTRACT
|
| 13 |
+
|
| 14 |
+
Categorical variables are a natural choice for representing discrete structure in the world. However, stochastic neural networks rarely use categorical latent variables due to the inability to backpropagate through samples. In this work, we present an efficient gradient estimator that replaces the non-differentiable sample from a categorical distribution with a differentiable sample from a novel Gumbel-Softmax distribution. This distribution has the essential property that it can be smoothly annealed into a categorical distribution. We show that our Gumbel-Softmax estimator outperforms state-of-the-art gradient estimators on structured output prediction and unsupervised generative modeling tasks with categorical latent variables, and enables large speedups on semi-supervised classification.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
Stochastic neural networks with discrete random variables are a powerful technique for representing distributions encountered in unsupervised learning, language modeling, attention mechanisms, and reinforcement learning domains. For example, discrete variables have been used to learn probabilistic latent representations that correspond to distinct semantic classes (Kingma et al., 2014), image regions (Xu et al., 2015), and memory locations (Graves et al., 2014; Graves et al., 2016). Discrete representations are often more interpretable (Chen et al., 2016) and more computationally efficient (Rae et al., 2016) than their continuous analogues.
|
| 19 |
+
|
| 20 |
+
However, stochastic networks with discrete variables are difficult to train because the backpropagation algorithm — while permitting efficient computation of parameter gradients — cannot be applied to non-differentiable layers. Prior work on stochastic gradient estimation has traditionally focused on either score function estimators augmented with Monte Carlo variance reduction techniques (Paisley et al., 2012; Mnih & Gregor, 2014; Gu et al., 2016; Gregor et al., 2013), or biased path derivative estimators for Bernoulli variables (Bengio et al., 2013). However, no existing gradient estimator has been formulated specifically for categorical variables. The contributions of this work are threefold:
|
| 21 |
+
|
| 22 |
+
1. We introduce Gumbel-Softmax, a continuous distribution on the simplex that can approximate categorical samples, and whose parameter gradients can be easily computed via the reparameterization trick.
|
| 23 |
+
2. We show experimentally that Gumbel-Softmax outperforms all single-sample gradient estimators on both Bernoulli variables and categorical variables.
|
| 24 |
+
3. We show that this estimator can be used to efficiently train semi-supervised models (e.g. Kingma et al. (2014)) without costly marginalization over unobserved categorical latent variables.
|
| 25 |
+
|
| 26 |
+
The practical outcome of this paper is a simple, differentiable approximate sampling mechanism for categorical variables that can be integrated into neural networks and trained using standard backpropagation.
|
| 27 |
+
|
| 28 |
+
# 2 THE GUMBEL-SOFTMAX DISTRIBUTION
|
| 29 |
+
|
| 30 |
+
We begin by defining the Gumbel-Softmax distribution, a continuous distribution over the simplex that can approximate samples from a categorical distribution. Let $z$ be a categorical variable with class probabilities $\pi _ { 1 } , \pi _ { 2 } , . . . \pi _ { k }$ . For the remainder of this paper we assume categorical samples are encoded as $k$ -dimensional one-hot vectors lying on the corners of the $\left( k - 1 \right)$ -dimensional simplex, $\Delta ^ { k - 1 }$ . This allows us to define quantities such as the element-wise mean $\vec { \mathbb { E } } _ { p } [ z ] = [ \pi _ { 1 } , . . . , \bar { \pi _ { k } } ]$ of these vectors.
|
| 31 |
+
|
| 32 |
+
The Gumbel-Max trick (Gumbel, 1954; Maddison et al., 2014) provides a simple and efficient way to draw samples $z$ from a categorical distribution with class probabilities $\pi$ :
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
z = { \mathrm { o n e \_ h o t } } \left( \operatorname { a r g m a x } _ { i } \left[ g _ { i } + \log \pi _ { i } \right] \right)
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where $g _ { 1 } . . . g _ { k }$ are i.i.d samples drawn from Gumbel $( 0 , 1 ) ^ { 1 }$ . We use the softmax function as a continuous, differentiable approximation to arg max, and generate $k$ -dimensional sample vectors $y \in \Delta ^ { k - 1 }$ where
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
y _ { i } = { \frac { \exp ( ( \log ( \pi _ { i } ) + g _ { i } ) / \tau ) } { \sum _ { j = 1 } ^ { k } \exp ( ( \log ( \pi _ { j } ) + g _ { j } ) / \tau ) } } \qquad { \mathrm { f o r ~ } } i = 1 , . . . , k .
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
The density of the Gumbel-Softmax distribution (derived in Appendix B) is:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
p _ { \pi , \tau } ( y _ { 1 } , . . . , y _ { k } ) = \Gamma ( k ) \tau ^ { k - 1 } \left( \sum _ { i = 1 } ^ { k } \pi _ { i } / y _ { i } ^ { \tau } \right) ^ { - k } \prod _ { i = 1 } ^ { k } \left( \pi _ { i } / y _ { i } ^ { \tau + 1 } \right)
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
This distribution was independently discovered by Maddison et al. (2016), where it is referred to as the concrete distribution. As the softmax temperature $\tau$ approaches 0, samples from the GumbelSoftmax distribution become one-hot and the Gumbel-Softmax distribution becomes identical to the categorical distribution $p ( z )$ .
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
Figure 1: The Gumbel-Softmax distribution interpolates between discrete one-hot-encoded categorical distributions and continuous categorical densities. (a) For low temperatures $( \tau = 0 . 1 , \tau = 0 . 5 )$ , the expected value of a Gumbel-Softmax random variable approaches the expected value of a categorical random variable with the same logits. As the temperature increases $\tau = 1 . 0$ , $\tau = 1 0 . 0 $ ), the expected value converges to a uniform distribution over the categories. (b) Samples from GumbelSoftmax distributions are identical to samples from a categorical distribution as $\tau 0$ . At higher temperatures, Gumbel-Softmax samples are no longer one-hot, and become uniform as $\tau \infty$ .
|
| 54 |
+
|
| 55 |
+
# 2.1 GUMBEL-SOFTMAX ESTIMATOR
|
| 56 |
+
|
| 57 |
+
The Gumbel-Softmax distribution is smooth for $\tau > 0$ , and therefore has a well-defined gradient $\partial y / \partial \pi$ with respect to the parameters $\pi$ . Thus, by replacing categorical samples with GumbelSoftmax samples we can use backpropagation to compute gradients (see Section 3.1). We denote this procedure of replacing non-differentiable categorical samples with a differentiable approximation during training as the Gumbel-Softmax estimator.
|
| 58 |
+
|
| 59 |
+
While Gumbel-Softmax samples are differentiable, they are not identical to samples from the corresponding categorical distribution for non-zero temperature. For learning, there is a tradeoff between small temperatures, where samples are close to one-hot but the variance of the gradients is large, and large temperatures, where samples are smooth but the variance of the gradients is small (Figure 1). In practice, we start at a high temperature and anneal to a small but non-zero temperature.
|
| 60 |
+
|
| 61 |
+
In our experiments, we find that the softmax temperature $\tau$ can be annealed according to a variety of schedules and still perform well. If $\tau$ is a learned parameter (rather than annealed via a fixed schedule), this scheme can be interpreted as entropy regularization (Szegedy et al., 2015; Pereyra et al., 2016), where the Gumbel-Softmax distribution can adaptively adjust the “confidence” of proposed samples during the training process.
|
| 62 |
+
|
| 63 |
+
# 2.2 STRAIGHT-THROUGH GUMBEL-SOFTMAX ESTIMATOR
|
| 64 |
+
|
| 65 |
+
Continuous relaxations of one-hot vectors are suitable for problems such as learning hidden representations and sequence modeling. For scenarios in which we are constrained to sampling discrete values (e.g. from a discrete action space for reinforcement learning, or quantized compression), we discretize $y$ using arg max but use our continuous approximation in the backward pass by approximating $\nabla _ { \theta } z \approx \nabla _ { \theta } y$ . We call this the Straight-Through (ST) Gumbel Estimator, as it is reminiscent of the biased path derivative estimator described in Bengio et al. (2013). ST Gumbel-Softmax allows samples to be sparse even when the temperature $\tau$ is high.
|
| 66 |
+
|
| 67 |
+
# 3 RELATED WORK
|
| 68 |
+
|
| 69 |
+
In this section we review existing stochastic gradient estimation techniques for discrete variables (illustrated in Figure 2). Consider a stochastic computation graph (Schulman et al., 2015) with discrete random variable $z$ whose distribution depends on parameter $\theta$ , and cost function $f ( z )$ . The objective is to minimize the expected cost $L ( \bar { \theta } ) = \mathbb { E } _ { z \sim p _ { \theta } ( z ) } [ f ( z ) ]$ via gradient descent, which requires us to estimate $\nabla _ { \theta } \mathbb { E } _ { z \sim p _ { \theta } ( z ) } [ f ( z ) ]$ .
|
| 70 |
+
|
| 71 |
+
# 3.1 PATH DERIVATIVE GRADIENT ESTIMATORS
|
| 72 |
+
|
| 73 |
+
For distributions that are reparameterizable, we can compute the sample $z$ as a deterministic function $g$ of the parameters $\theta$ and an independent random variable $\epsilon$ , so that $z = g ( \theta , \epsilon )$ . The path-wise gradients from $f$ to $\theta$ can then be computed without encountering any stochastic nodes:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\frac { \partial } { \partial \theta } \mathbb { E } _ { z \sim p _ { \theta } } \left[ f ( z ) ) \right] = \frac { \partial } { \partial \theta } \mathbb { E } _ { \epsilon } \left[ f ( g ( \theta , \epsilon ) ) \right] = \mathbb { E } _ { \epsilon \sim p _ { \epsilon } } \left[ \frac { \partial f } { \partial g } \frac { \partial g } { \partial \theta } \right]
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
For example, the normal distribution $z \sim \mathcal { N } ( \mu , \sigma )$ can be re-written as $\mu + \sigma \cdot \mathcal { N } ( 0 , 1 )$ , making it trivial to compute $\partial z / \partial \mu$ and $\partial z / \partial \sigma$ . This reparameterization trick is commonly applied to training variational autooencoders with continuous latent variables using backpropagation (Kingma $\&$ Welling, 2013; Rezende et al., 2014b). As shown in Figure 2, we exploit such a trick in the construction of the Gumbel-Softmax estimator.
|
| 80 |
+
|
| 81 |
+
Biased path derivative estimators can be utilized even when $z$ is not reparameterizable. In general, we can approximate $\nabla _ { \theta } z \approx \nabla _ { \theta } m ( \theta )$ , where $m$ is a differentiable proxy for the stochastic sample. For Bernoulli variables with mean parameter $\theta$ , the Straight-Through (ST) estimator (Bengio et al., 2013) approximates $m = \mu _ { \theta } ( z )$ , implying $\nabla _ { \theta } m = 1$ . For $k = 2$ (Bernoulli), ST Gumbel-Softmax is similar to the slope-annealed Straight-Through estimator proposed by Chung et al. (2016), but uses a softmax instead of a hard sigmoid to determine the slope. Rolfe (2016) considers an alternative approach where each binary latent variable parameterizes a continuous mixture model. Reparameterization gradients are obtained by backpropagating through the continuous variables and marginalizing out the binary variables.
|
| 82 |
+
|
| 83 |
+
One limitation of the ST estimator is that backpropagating with respect to the sample-independent mean may cause discrepancies between the forward and backward pass, leading to higher variance.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 2: Gradient estimation in stochastic computation graphs. (1) $\nabla _ { \boldsymbol { \theta } } f ( { \boldsymbol { x } } )$ can be computed via backpropagation if $x ( \theta )$ is deterministic and differentiable. (2) The presence of stochastic node $z$ precludes backpropagation as the sampler function does not have a well-defined gradient. (3) The score function estimator and its variants (NVIL, DARN, MuProp, VIMCO) obtain an unbiased estimate of $\nabla _ { \boldsymbol { \theta } } f ( { \boldsymbol { x } } )$ by backpropagating along a surrogate loss $\hat { f } \log p _ { \theta } ( z )$ , where ${ \hat { f } } = f ( x ) - b$ and $b$ is a baseline for variance reduction. (4) The Straight-Through estimator, developed primarily for Bernoulli variables, approximates $\nabla _ { \theta } z \approx 1$ . (5) Gumbel-Softmax is a path derivative estimator for a continuous distribution $y$ that approximates $z$ . Reparameterization allows gradients to flow from $f ( y )$ to $\theta$ . $y$ can be annealed to one-hot categorical variables over the course of training.
|
| 87 |
+
|
| 88 |
+
Gumbel-Softmax avoids this problem because each sample $y$ is a differentiable proxy of the corresponding discrete sample $z$ .
|
| 89 |
+
|
| 90 |
+
# 3.2 SCORE FUNCTION-BASED GRADIENT ESTIMATORS
|
| 91 |
+
|
| 92 |
+
The score function estimator (SF, also referred to as REINFORCE (Williams, 1992) and likelihood ratio estimator (Glynn, 1990)) uses the identity $\nabla _ { \boldsymbol { \theta } } \log { p _ { \boldsymbol { \theta } } ( z ) } = p _ { \boldsymbol { \theta } } ( z ) \nabla _ { \boldsymbol { \theta } } \log { p _ { \boldsymbol { \theta } } ( z ) }$ to derive the following unbiased estimator:
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\nabla _ { \boldsymbol { \theta } } \mathbb { E } _ { z } \left[ f ( \boldsymbol { z } ) \right] = \mathbb { E } _ { z } \left[ f ( \boldsymbol { z } ) \nabla _ { \boldsymbol { \theta } } \log p _ { \boldsymbol { \theta } } ( \boldsymbol { z } ) \right]
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
SF only requires that $p _ { \theta } ( z )$ is continuous in $\theta$ , and does not require backpropagating through $f$ or the sample $z$ . However, SF suffers from high variance and is consequently slow to converge. In particular, the variance of SF scales linearly with the number of dimensions of the sample vector (Rezende et al., 2014a), making it especially challenging to use for categorical distributions.
|
| 99 |
+
|
| 100 |
+
The variance of a score function estimator can be reduced by subtracting a control variate $b ( z )$ from the learning signal $f$ , and adding back its analytical expectation $\mu _ { b } = \bar { \mathbb { E } _ { z } } \left[ b ( z ) \nabla _ { \theta } \log p _ { \theta } ( z ) \right]$ to keep the estimator unbiased:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\begin{array} { r l } & { \nabla _ { \theta } \mathbb { E } _ { z } \left[ f ( z ) \right] = \mathbb { E } _ { z } \left[ f ( z ) \nabla _ { \theta } \log p _ { \theta } ( z ) + ( b ( z ) \nabla _ { \theta } \log p _ { \theta } ( z ) - b ( z ) \nabla _ { \theta } \log p _ { \theta } ( z ) ) \right] } \\ & { \qquad = \mathbb { E } _ { z } \left[ ( f ( z ) - b ( z ) ) \nabla _ { \theta } \log p _ { \theta } ( z ) \right] + \mu _ { b } } \end{array}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
We briefly summarize recent stochastic gradient estimators that utilize control variates. We direct the reader to $\mathrm { G u }$ et al. (2016) for further detail on these techniques.
|
| 107 |
+
|
| 108 |
+
• NVIL (Mnih & Gregor, 2014) uses two baselines: (1) a moving average $\bar { f }$ of $f$ to center the learning signal, and (2) an input-dependent baseline computed by a 1-layer neural network fitted to $f - { \bar { f } }$ (a control variate for the centered learning signal itself). Finally, variance normalization divides the learning signal by $\operatorname* { m a x } ( 1 , \sigma _ { f } )$ , where $\sigma _ { f } ^ { 2 }$ is a moving average of $\mathrm { V a r } [ f ]$ .
|
| 109 |
+
|
| 110 |
+
• DARN (Gregor et al., 2013) uses $b = f ( \bar { z } ) + f ^ { \prime } ( \bar { z } ) ( \bar { z } - z )$ , where the baseline corresponds to the first-order Taylor approximation of $f ( z )$ from $f ( \bar { z } )$ . $\bar { z }$ is chosen to be $1 / 2$ for Bernoulli variables, which makes the estimator biased for non-quadratic $f$ , since it ignores the correction term $\mu _ { b }$ in the estimator expression.
|
| 111 |
+
MuProp (Gu et al., 2016) also models the baseline as a first-order Taylor expansion: $b =$ $f ( { \bar { z } } ) \stackrel { \_ } { + } f ^ { \prime } ( { \bar { z } } ) ( z - { \bar { z } } )$ and $\mu _ { b } \ = \ f ^ { \prime } ( \bar { z } ) \nabla _ { \theta } \mathbb { E } _ { z } \left[ z \right]$ . To overcome backpropagation through discrete sampling, a mean-field approximation $f _ { M F } ( \mu _ { \theta } ( z ) )$ is used in place of $f ( z )$ to compute the baseline and derive the relevant gradients.
|
| 112 |
+
• VIMCO (Mnih & Rezende, 2016) is a gradient estimator for multi-sample objectives that uses the mean of other samples $\textstyle b = 1 / m \sum _ { j \neq i } f ( z _ { j } )$ to construct a baseline for each sample $z _ { i } \in z _ { 1 : m }$ . We exclude VIMCO from our experiments because we are comparing estimators for single-sample objectives, although Gumbel-Softmax can be easily extended to multisample objectives.
|
| 113 |
+
|
| 114 |
+
# 3.3 SEMI-SUPERVISED GENERATIVE MODELS
|
| 115 |
+
|
| 116 |
+
Semi-supervised learning considers the problem of learning from both labeled data $( x , y ) \sim \mathcal { D } _ { L }$ and unlabeled data $x \sim \mathcal { D } _ { U }$ , where $x$ are observations (i.e. images) and $y$ are corresponding labels (e.g. semantic class). For semi-supervised classification, Kingma et al. (2014) propose a variational autoencoder (VAE) whose latent state is the joint distribution over a Gaussian “style” variable $z$ and a categorical “semantic class” variable $y$ (Figure 6, Appendix). The VAE objective trains a discriminative network $q _ { \phi } ( y | x )$ , inference network $q _ { \phi } ( z | x , y )$ , and generative network $p _ { \theta } ( x | y , z )$ end-to-end by maximizing a variational lower bound on the log-likelihood of the observation under the generative model. For labeled data, the class $y$ is observed, so inference is only done on $z \sim$ $q ( \boldsymbol { z } | \bar { \boldsymbol { x } } , \boldsymbol { y } )$ . The variational lower bound on labeled data is given by:
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\log p _ { \theta } ( x , y ) \geq - \mathcal { L } ( x , y ) = \mathbb { E } _ { z \sim q _ { \phi } ( z \mid x , y ) } \left[ \log p _ { \theta } ( x | y , z ) \right] - K L [ q ( z | x , y ) | | p _ { \theta } ( y ) p ( z ) ]
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
For unlabeled data, difficulties arise because the categorical distribution is not reparameterizable. Kingma et al. (2014) approach this by marginalizing out $y$ over all classes, so that for unlabeled data, inference is still on $\bar { \boldsymbol { q } } _ { \phi } ( z | x , y )$ for each $y$ . The lower bound on unlabeled data is:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\begin{array} { l } { \displaystyle \log p _ { \theta } ( x ) \geq - \mathcal { U } ( x ) = \mathbb { E } _ { z \sim q _ { \phi } ( y , z \mid x ) } [ \log p _ { \theta } ( x \mid y , z ) + \log p _ { \theta } ( y ) + \log p ( z ) - q _ { \phi } ( y , z \mid x ) ] } \\ { = \displaystyle \sum _ { y } q _ { \phi } ( y \mid x ) ( - \mathcal { L } ( x , y ) + \mathcal { H } ( q _ { \phi } ( y \mid x ) ) ) } \end{array}
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
The full maximization objective is:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\mathcal { I } = \mathbb { E } _ { ( x , y ) \sim \mathcal { D } _ { L } } \left[ - \mathcal { L } ( x , y ) \right] + \mathbb { E } _ { x \sim \mathcal { D } _ { U } } \left[ - \mathcal { U } ( x ) \right] + \alpha \cdot \mathbb { E } _ { ( x , y ) \sim \mathcal { D } _ { L } } \left[ \log q _ { \phi } ( y | x ) \right]
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
ere $\alpha$ is the scalar trade-off between the generative and discriminative objectives.
|
| 135 |
+
|
| 136 |
+
One limitation of this approach is that marginalization over all $k$ class values becomes prohibitively expensive for models with a large number of classes. If $D , I , G$ are the computational cost of sampling from $q _ { \phi } ( y | x )$ , $q _ { \phi } ( z | x , y )$ , and $p _ { \theta } ( x | y , z )$ respectively, then training the unsupervised objective requires $\mathcal { O } ( D + k ( I + G ) )$ for each forward/backward step. In contrast, Gumbel-Softmax allows us to backpropagate through $y \sim q _ { \phi } ( y | x )$ for single sample gradient estimation, and achieves a cost of $\mathcal { O } ( D + I + G )$ per training step. Experimental comparisons in training speed are shown in Figure 5.
|
| 137 |
+
|
| 138 |
+
# 4 EXPERIMENTAL RESULTS
|
| 139 |
+
|
| 140 |
+
In our first set of experiments, we compare Gumbel-Softmax and ST Gumbel-Softmax to other stochastic gradient estimators: Score-Function (SF), DARN, MuProp, Straight-Through (ST), and
|
| 141 |
+
|
| 142 |
+
Slope-Annealed ST. Each estimator is evaluated on two tasks: (1) structured output prediction and (2) variational training of generative models. We use the MNIST dataset with fixed binarization for training and evaluation, which is common practice for evaluating stochastic gradient estimators (Salakhutdinov & Murray, 2008; Larochelle & Murray, 2011).
|
| 143 |
+
|
| 144 |
+
Learning rates are chosen from $\{ 3 \mathrm { e } { - } 5 , 1 \mathrm { e } { - } 5 , 3 \mathrm { e } { - } 4 , 1 \mathrm { e } { - } 4 , 3 \mathrm { e } { - } 3 , 1 \mathrm { e } { - } 3 \}$ ; we select the best learning rate for each estimator using the MNIST validation set, and report performance on the test set. Samples drawn from the Gumbel-Softmax distribution are continuous during training, but are discretized to one-hot vectors during evaluation. We also found that variance normalization was necessary to obtain competitive performance for SF, DARN, and MuProp. We used sigmoid activation functions for binary (Bernoulli) neural networks and softmax activations for categorical variables. Models were trained using stochastic gradient descent with momentum 0.9.
|
| 145 |
+
|
| 146 |
+
# 4.1 STRUCTURED OUTPUT PREDICTION WITH STOCHASTIC BINARY NETWORKS
|
| 147 |
+
|
| 148 |
+
The objective of structured output prediction is to predict the lower half of a $2 8 \times 2 8$ MNIST digit given the top half of the image $( 1 4 \times 2 8 )$ . This is a common benchmark for training stochastic binary networks (SBN) (Raiko et al., 2014; Gu et al., 2016; Mnih & Rezende, 2016). The minimization objective for this conditional generative model is an importance-sampled estimate of the likelihood objective, Eh∼pθ(hi|xupper) - $\begin{array} { r } { \mathbb E _ { h \sim p _ { \theta } ( h _ { i } | x _ { \mathrm { u p p e r } } ) } \left[ \frac { 1 } { m } et { } { ' } \sum _ { i = 1 } ^ { m } \log p _ { \theta } ( x _ { \mathrm { l o w e r } } | h _ { i } ) \right] } \end{array}$ , where $m = 1$ is used for training and $m =$ 1000 is used for evaluation.
|
| 149 |
+
|
| 150 |
+
We trained a SBN with two hidden layers of 200 units each. This corresponds to either 200 Bernoulli variables (denoted as 392-200-200-392) or 20 categorical variables (each with 10 classes) with binarized activations (denoted as $3 9 2 - ( 2 0 \times 1 0 ) - ( 2 0 \times 1 0 ) - 3 9 2 )$ .
|
| 151 |
+
|
| 152 |
+
As shown in Figure 3, ST Gumbel-Softmax is on par with the other estimators for Bernoulli variables and outperforms on categorical variables. Meanwhile, Gumbel-Softmax outperforms other estimators on both Bernoulli and Categorical variables. We found that it was not necessary to anneal the softmax temperature for this task, and used a fixed $\tau = 1$ .
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 3: Test loss (negative log-likelihood) on the structured output prediction task with binarized MNIST using a stochastic binary network with (a) Bernoulli latent variables (392-200-200-392) and (b) categorical latent variables (392- $( 2 0 \times 1 0 )$ - $( 2 0 \times 1 0 )$ -392).
|
| 156 |
+
|
| 157 |
+
# 4.2 GENERATIVE MODELING WITH VARIATIONAL AUTOENCODERS
|
| 158 |
+
|
| 159 |
+
We train variational autoencoders (Kingma & Welling, 2013), where the objective is to learn a generative model of binary MNIST images. In our experiments, we modeled the latent variable as a single hidden layer with 200 Bernoulli variables or 20 categorical variables $( 2 0 \times 1 0 )$ . We use a learned categorical prior rather than a Gumbel-Softmax prior in the training objective. Thus, the minimization objective during training is no longer a variational bound if the samples are not discrete. In practice, we find that optimizing this objective in combination with temperature annealing still minimizes actual variational bounds on validation and test sets. Like the structured output prediction task, we use a multi-sample bound for evaluation with $m = 1 0 0 0$ .
|
| 160 |
+
|
| 161 |
+
The temperature is annealed using the schedule $\tau = \operatorname* { m a x } ( 0 . 5 , \exp ( - r t ) )$ of the global training step $t$ , where $\tau$ is updated every $N$ steps. $N \in \{ 5 0 0 , 1 0 0 0 \}$ and $r \in \{ 1 \mathrm { e } { - } 5 , 1 \mathrm { e } { - } 4 \}$ are hyperparameters for which we select the best-performing estimator on the validation set and report test performance.
|
| 162 |
+
|
| 163 |
+
As shown in Figure 4, ST Gumbel-Softmax outperforms other estimators for Categorical variables, and Gumbel-Softmax drastically outperforms other estimators in both Bernoulli and Categorical variables.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 4: Test loss (negative variational lower bound) on binarized MNIST VAE with (a) Bernoulli latent variables $( 7 8 4 - 2 0 0 - 7 8 4 )$ and (b) categorical latent variables $( 7 8 4 - ( 2 0 \times 1 0 ) - 2 0 0 )$ .
|
| 167 |
+
|
| 168 |
+
Table 1: The Gumbel-Softmax estimator outperforms other estimators on Bernoulli and Categorical latent variables. For the structured output prediction (SBN) task, numbers correspond to negative log-likelihoods (nats) of input images (lower is better). For the VAE task, numbers correspond to negative variational lower bounds (nats) on the log-likelihood (lower is better).
|
| 169 |
+
|
| 170 |
+
<table><tr><td></td><td>SF</td><td>DARN</td><td>MuProp</td><td>ST</td><td>Annealed ST</td><td>Gumbel-S.</td><td>ST Gumbel-S.</td></tr><tr><td>SBN (Bern.)</td><td>72.0</td><td>59.7</td><td>58.9</td><td>58.9</td><td>58.7</td><td>58.5</td><td>59.3</td></tr><tr><td>SBN (Cat.)</td><td>73.1</td><td>67.9</td><td>63.0</td><td>61.8</td><td>61.1</td><td>59.0</td><td>59.7</td></tr><tr><td>VAE (Bern.)</td><td>112.2</td><td>110.9</td><td>109.7</td><td>116.0</td><td>111.5</td><td>105.0</td><td>111.5</td></tr><tr><td>VAE (Cat.)</td><td>110.6</td><td>128.8</td><td>107.0</td><td>110.9</td><td>107.8</td><td>101.5</td><td>107.8</td></tr></table>
|
| 171 |
+
|
| 172 |
+
# 4.3 GENERATIVE SEMI-SUPERVISED CLASSIFICATION
|
| 173 |
+
|
| 174 |
+
We apply the Gumbel-Softmax estimator to semi-supervised classification on the binary MNIST dataset. We compare the original marginalization-based inference approach (Kingma et al., 2014) to single-sample inference with Gumbel-Softmax and ST Gumbel-Softmax.
|
| 175 |
+
|
| 176 |
+
We trained on a dataset consisting of 100 labeled examples (distributed evenly among each of the 10 classes) and 50,000 unlabeled examples, with dynamic binarization of the unlabeled examples for each minibatch. The discriminative model $q _ { \phi } ( y | x )$ and inference model $q _ { \phi } ( z | x , y )$ are each implemented as 3-layer convolutional neural networks with ReLU activation functions. The generative model $p _ { \theta } ( x | y , z )$ is a 4-layer convolutional-transpose network with ReLU activations. Experimental details are provided in Appendix A.
|
| 177 |
+
|
| 178 |
+
Estimators were trained and evaluated against several values of $\alpha = \{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 8 , 1 . 0 \}$ and the best unlabeled classification results for test sets were selected for each estimator and reported in Table 2. We used an annealing schedule of $\tau = \operatorname* { m a x } ( 0 . 5 , \exp ( - 3 \mathrm { e } - 5 \cdot t ) )$ , updated every 2000 steps.
|
| 179 |
+
|
| 180 |
+
In Kingma et al. (2014), inference over the latent state is done by marginalizing out $y$ and using the reparameterization trick for sampling from $q _ { \phi } ( z | x , y )$ . However, this approach has a computational cost that scales linearly with the number of classes. Gumbel-Softmax allows us to backpropagate directly through single samples from the joint $q _ { \phi } ( y , z | x )$ , achieving drastic speedups in training without compromising generative or classification performance. (Table 2, Figure 5).
|
| 181 |
+
|
| 182 |
+
Table 2: Marginalizing over $y$ and single-sample variational inference perform equally well when applied to image classification on the binarized MNIST dataset (Larochelle & Murray, 2011). We report variational lower bounds and image classification accuracy for unlabeled data in the test set.
|
| 183 |
+
|
| 184 |
+
<table><tr><td></td><td>ELBO</td><td>Accuracy</td></tr><tr><td>Marginalization</td><td>-106.8</td><td>92.6%</td></tr><tr><td>Gumbel</td><td>-109.6</td><td>92.4%</td></tr><tr><td>ST Gumbel-Softmax</td><td>-110.7</td><td>93.6%</td></tr></table>
|
| 185 |
+
|
| 186 |
+
In Figure 5, we show how Gumbel-Softmax versus marginalization scales with the number of categorical classes. For these experiments, we use MNIST images with randomly generated labels. Training the model with the Gumbel-Softmax estimator is $2 \times$ as fast for 10 classes and $9 . 9 \times$ as fast for 100 classes.
|
| 187 |
+
|
| 188 |
+

|
| 189 |
+
Figure 5: Gumbel-Softmax allows us to backpropagate through samples from the posterior $q _ { \phi } ( y | x )$ , providing a scalable method for semi-supervised learning for tasks with a large number of classes. (a) Comparison of training speed (steps/sec) between Gumbel-Softmax and marginalization (Kingma et al., 2014) on a semi-supervised VAE. Evaluations were performed on a GTX Titan $\mathbf { X } ^ { \mathbb { \left( R \right) } }$ GPU. (b) Visualization of MNIST analogies generated by varying style variable $z$ across each row and class variable $y$ across each column.
|
| 190 |
+
|
| 191 |
+
# 5 DISCUSSION
|
| 192 |
+
|
| 193 |
+
The primary contribution of this work is the reparameterizable Gumbel-Softmax distribution, whose corresponding estimator affords low-variance path derivative gradients for the categorical distribution. We show that Gumbel-Softmax and Straight-Through Gumbel-Softmax are effective on structured output prediction and variational autoencoder tasks, outperforming existing stochastic gradient estimators for both Bernoulli and categorical latent variables. Finally, Gumbel-Softmax enables dramatic speedups in inference over discrete latent variables.
|
| 194 |
+
|
| 195 |
+
# ACKNOWLEDGMENTS
|
| 196 |
+
|
| 197 |
+
We sincerely thank Luke Vilnis, Vincent Vanhoucke, Luke Metz, David Ha, Laurent Dinh, George Tucker, and Subhaneil Lahiri for helpful discussions and feedback.
|
| 198 |
+
|
| 199 |
+
REFERENCES
|
| 200 |
+
Y. Bengio, N. Leonard, and A. Courville. Estimating or propagating gradients through stochastic ´ neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 201 |
+
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.
|
| 202 |
+
J. Chung, S. Ahn, and Y. Bengio. Hierarchical multiscale recurrent neural networks. arXiv preprint arXiv:1609.01704, 2016.
|
| 203 |
+
P. W Glynn. Likelihood ratio gradient estimation for stochastic systems. Communications of the ACM, 33(10):75–84, 1990.
|
| 204 |
+
A. Graves, G. Wayne, M. Reynolds, T. Harley, I. Danihelka, A. Grabska-Barwinska, S. G. Col-´ menarejo, E. Grefenstette, T. Ramalho, J. Agapiou, et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471–476, 2016.
|
| 205 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014.
|
| 206 |
+
K. Gregor, I. Danihelka, A. Mnih, C. Blundell, and D. Wierstra. Deep autoregressive networks. arXiv preprint arXiv:1310.8499, 2013.
|
| 207 |
+
S. Gu, S. Levine, I. Sutskever, and A Mnih. MuProp: Unbiased Backpropagation for Stochastic Neural Networks. ICLR, 2016.
|
| 208 |
+
E. J. Gumbel. Statistical theory of extreme values and some practical applications: a series of lectures. Number 33. US Govt. Print. Office, 1954.
|
| 209 |
+
D. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 210 |
+
D. P. Kingma, S. Mohamed, D. J. Rezende, and M. Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pp. 3581–3589, 2014.
|
| 211 |
+
H. Larochelle and I. Murray. The neural autoregressive distribution estimator. In AISTATS, volume 1, pp. 2, 2011.
|
| 212 |
+
C. J. Maddison, D. Tarlow, and T. Minka. A\* sampling. In Advances in Neural Information Processing Systems, pp. 3086–3094, 2014.
|
| 213 |
+
C. J. Maddison, A. Mnih, and Y. Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. ArXiv e-prints, November 2016.
|
| 214 |
+
A. Mnih and K. Gregor. Neural variational inference and learning in belief networks. ICML, 31, 2014.
|
| 215 |
+
A. Mnih and D. J. Rezende. Variational inference for monte carlo objectives. arXiv preprint arXiv:1602.06725, 2016.
|
| 216 |
+
J. Paisley, D. Blei, and M. Jordan. Variational Bayesian Inference with Stochastic Search. ArXiv e-prints, June 2012.
|
| 217 |
+
Gabriel Pereyra, Geoffrey Hinton, George Tucker, and Lukasz Kaiser. Regularizing neural networks by penalizing confident output distributions. 2016.
|
| 218 |
+
J. W Rae, J. J Hunt, T. Harley, I. Danihelka, A. Senior, G. Wayne, A. Graves, and T. P Lillicrap. Scaling Memory-Augmented Neural Networks with Sparse Reads and Writes. ArXiv e-prints, October 2016.
|
| 219 |
+
T. Raiko, M. Berglund, G. Alain, and L. Dinh. Techniques for learning binary stochastic feedforward neural networks. arXiv preprint arXiv:1406.2989, 2014.
|
| 220 |
+
D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014a.
|
| 221 |
+
D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of The 31st International Conference on Machine Learning, pp. 1278–1286, 2014b.
|
| 222 |
+
J. T. Rolfe. Discrete Variational Autoencoders. ArXiv e-prints, September 2016.
|
| 223 |
+
R. Salakhutdinov and I. Murray. On the quantitative analysis of deep belief networks. In Proceedings of the 25th international conference on Machine learning, pp. 872–879. ACM, 2008.
|
| 224 |
+
J. Schulman, N. Heess, T. Weber, and P. Abbeel. Gradient estimation using stochastic computation graphs. In Advances in Neural Information Processing Systems, pp. 3528–3536, 2015.
|
| 225 |
+
C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. arXiv preprint arXiv:1512.00567, 2015.
|
| 226 |
+
R. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 227 |
+
K. Xu, J. Ba, R. Kiros, K. Cho, A. C. Courville, R. Salakhutdinov, R. S. Zemel, and Y. Bengio. Show, attend and tell: Neural image caption generation with visual attention. CoRR, abs/1502.03044, 2015.
|
| 228 |
+
|
| 229 |
+
# A SEMI-SUPERVISED CLASSIFICATION MODEL
|
| 230 |
+
|
| 231 |
+
Figures 6 and 7 describe the architecture used in our experiments for semi-supervised classification (Section 4.3).
|
| 232 |
+
|
| 233 |
+

|
| 234 |
+
Figure 6: Semi-supervised generative model proposed by Kingma et al. (2014). (a) Generative model $p _ { \theta } ( x | y , z )$ synthesizes images from latent Gaussian “style” variable $z$ and categorical class variable $y$ . (b) Inference model $q _ { \phi } ( y , z | x )$ samples latent state $y , z$ given $x$ . Gaussian $z$ can be differentiated with respect to its parameters because it is reparameterizable. In previous work, when $y$ is not observed, training the VAE objective requires marginalizing over all values of $y$ . (c) GumbelSoftmax reparameterizes $y$ so that backpropagation is also possible through $y$ without encountering stochastic nodes.
|
| 235 |
+
|
| 236 |
+
# B DERIVING THE DENSITY OF THE GUMBEL-SOFTMAX DISTRIBUTION
|
| 237 |
+
|
| 238 |
+
Here we derive the probability density function of the Gumbel-Softmax distribution with probabilities $\pi _ { 1 } , . . . , \pi _ { k }$ and temperature $\tau$ . We first define the logits $x _ { i } = \log \pi _ { i }$ , and Gumbel samples
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 7: Network architecture for (a) classification $q _ { \phi } ( y | x )$ (b) inference $q _ { \phi } ( z | x , y )$ , and (c) generative $p _ { \theta } ( x | y , z )$ models. The output of these networks parameterize Categorical, Gaussian, and Bernoulli distributions which we sample from.
|
| 242 |
+
|
| 243 |
+
$g _ { 1 } , . . . , g _ { k }$ , where $g _ { i } \sim \mathrm { G u m b e l } ( 0 , 1 )$ . A sample from the Gumbel-Softmax can then be computed as:
|
| 244 |
+
|
| 245 |
+
$$
|
| 246 |
+
y _ { i } = { \frac { \exp ( { \bigl ( } x _ { i } + g _ { i } { \bigr ) } / \tau { \bigr ) } } { \sum _ { j = 1 } ^ { k } \exp ( { \bigl ( } x _ { j } + g _ { j } { \bigr ) } / \tau { \bigr ) } } } \qquad { \mathrm { f o r ~ } } i = 1 , . . . , k
|
| 247 |
+
$$
|
| 248 |
+
|
| 249 |
+
# B.1 CENTERED GUMBEL DENSITY
|
| 250 |
+
|
| 251 |
+
The mapping from the Gumbel samples $g$ to the Gumbel-Softmax sample $y$ is not invertible as the normalization of the softmax operation removes one degree of freedom. To compensate for this, we define an equivalent sampling process that subtracts off the last element, $( x _ { k } \bar { + } g _ { k } ) / \tau$ before the softmax:
|
| 252 |
+
|
| 253 |
+
$$
|
| 254 |
+
y _ { i } = { \frac { \exp { \big ( } ( x _ { i } + g _ { i } - ( x _ { k } + g _ { k } ) ) / \tau { \big ) } } { \sum _ { j = 1 } ^ { k } \exp { \big ( } ( x _ { j } + g _ { j } - ( x _ { k } + g _ { k } ) ) / \tau { \big ) } } } \qquad { \mathrm { f o r ~ } } i = 1 , . . . , k
|
| 255 |
+
$$
|
| 256 |
+
|
| 257 |
+
To derive the density of this equivalent sampling process, we first derive the density for the ”centered” multivariate Gumbel density corresponding to:
|
| 258 |
+
|
| 259 |
+
$$
|
| 260 |
+
u _ { i } = x _ { i } + g _ { i } - ( x _ { k } + g _ { k } ) \qquad { \mathrm { f o r ~ } } i = 1 , . . . , k - 1
|
| 261 |
+
$$
|
| 262 |
+
|
| 263 |
+
where $g _ { i } \sim \mathrm { G u m b e l } ( 0 , 1 )$ . Note the probability density of a Gumbel distribution with scale parameter $\beta = 1$ and mean $\mu$ at $z$ is: $f ( z , \mu ) = e ^ { \mu - z - e ^ { \mu - z } }$ . We can now compute the density of this distribution by marginalizing out the last Gumbel sample, $g _ { k }$ :
|
| 264 |
+
|
| 265 |
+
$$
|
| 266 |
+
\begin{array} { l } { p ( u _ { 1 } , . . . , u _ { k - 1 } ) = \displaystyle \int _ { - \infty } ^ { \infty } d g _ { k } p ( u _ { 1 } , . . . , u _ { k } | g _ { k } ) p ( g _ { k } ) } \\ { = \displaystyle \int _ { - \infty } ^ { \infty } d g _ { k } p ( g _ { k } ) \prod _ { i = 1 } ^ { k - 1 } p ( u _ { i } | g _ { k } ) } \\ { = \displaystyle \int _ { - \infty } ^ { \infty } d g _ { k } f ( g _ { k } , 0 ) \prod _ { i = 1 } ^ { k - 1 } f ( x _ { k } + g _ { k } , x _ { i } - u _ { i } ) } \\ { = \displaystyle \int _ { - \infty } ^ { \infty } d g _ { k } e ^ { - g _ { k } - e ^ { - g _ { k } } } \prod _ { i = 1 } ^ { k - 1 } e ^ { x _ { i } - x _ { k } - g _ { k } - e ^ { x _ { i } - u _ { i } - x _ { k } - g _ { k } } } } \end{array}
|
| 267 |
+
$$
|
| 268 |
+
|
| 269 |
+
We perform a change of variables with $v = e ^ { - g _ { k } }$ , so $d v = - e ^ { - g _ { k } } d g _ { k }$ and $d g _ { k } = - d v e ^ { g _ { k } } = d v / v$ , and define $u _ { k } = 0$ to simplify notation:
|
| 270 |
+
|
| 271 |
+
$$
|
| 272 |
+
\begin{array} { l } { \displaystyle p ( u _ { 1 } , \dots , u _ { k , - 1 } ) = \delta ( u _ { k } = 0 ) \int _ { 0 } ^ { \infty } { d v \frac { 1 } { v } v e ^ { x _ { k } - v } \prod _ { i = 1 } ^ { k - 1 } { v e ^ { x _ { i } - u _ { i } - x _ { k } - v e ^ { u _ { i } - u _ { i } - x _ { k } } } } } } \\ { = \displaystyle \exp \left( x _ { k } + \sum _ { i = 1 } ^ { k - 1 } ( x _ { i } - u _ { i } ) \right) \left( e ^ { x _ { k } } + \sum _ { i = 1 } ^ { k - 1 } \left( e ^ { x _ { i } - u _ { i } } \right) \right) ^ { - k } \Gamma ( k ) } \\ { = \displaystyle \Gamma ( k ) \exp \left( \sum _ { i = 1 } ^ { k } ( x _ { i } - u _ { i } ) \right) \left( \sum _ { i = 1 } ^ { k } \left( e ^ { x _ { i } - u _ { i } } \right) \right) ^ { - k } } \\ { = \displaystyle \Gamma ( k ) \left( \prod _ { i = 1 } ^ { k } \exp \left( x _ { i } - u _ { i } \right) \right) \left( \sum _ { i = 1 } ^ { k } \exp \left( x _ { i } - u _ { i } \right) \right) ^ { - k } } \end{array}
|
| 273 |
+
$$
|
| 274 |
+
|
| 275 |
+
# B.2 TRANSFORMING TO A GUMBEL-SOFTMAX
|
| 276 |
+
|
| 277 |
+
Given samples $u _ { 1 } , . . . , u _ { k , - 1 }$ from the centered Gumbel distribution, we can apply a deterministic transformation $h$ to yield the first $k - 1$ coordinates of the sample from the Gumbel-Softmax:
|
| 278 |
+
|
| 279 |
+
$$
|
| 280 |
+
y _ { 1 : k } = h ( u _ { 1 : k - 1 } ) , \qquad h = \frac { \exp ( u _ { i } / \tau ) } { 1 + \sum _ { j = 1 } ^ { k - 1 } \exp ( u _ { j } / \tau ) }
|
| 281 |
+
$$
|
| 282 |
+
|
| 283 |
+
Note that the final coordinate probability, $y _ { k }$ , is fixed given the first $k - 1$ as $\textstyle \sum _ { i = 1 } ^ { k } y _ { i } = 1$
|
| 284 |
+
|
| 285 |
+
$$
|
| 286 |
+
y _ { k } = \left( 1 + \sum _ { j = 1 } ^ { k - 1 } \exp ( { u _ { j } / \tau } ) \right) ^ { - 1 }
|
| 287 |
+
$$
|
| 288 |
+
|
| 289 |
+
We can thus compute the probability of a sample from the Gumbel-Softmax using the change of variables formula on only the first $k - 1$ variables:
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
p ( y _ { 1 : k } ) = p \left( h ^ { - 1 } ( y _ { 1 : k - 1 } ) \right) \left| \frac { \partial h ^ { - 1 } ( y _ { 1 : k - 1 } ) } { \partial y _ { 1 : k - 1 } } \right|
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
So to compute the probability of the Gumbel-Softmax we need two more pieces: the inverse of $h$ and its Jacobian determinant. The inverse of $h$ is:
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
h ^ { - 1 } ( y _ { 1 : k - 1 } ) = \tau \times \left( \log y _ { i } - \log \left( 1 - \sum _ { j = 1 } ^ { k - 1 } y _ { j } \right) \right)
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
The determinant of the Jacobian can then be computed:
|
| 302 |
+
|
| 303 |
+
$$
|
| 304 |
+
\left| \frac { \partial h ^ { - 1 } ( y _ { 1 : k - 1 } ) } { \partial y _ { 1 : k - 1 } } \right| = \tau ^ { k - 1 } \left( 1 - \sum _ { j = 1 } ^ { k - 1 } y _ { j } \right) \prod _ { i = 1 } ^ { k - 1 } y _ { i } ^ { - 1 } = \tau ^ { k - 1 } \prod _ { i = 1 } ^ { k } y _ { i } ^ { - 1 }
|
| 305 |
+
$$
|
| 306 |
+
|
| 307 |
+
We can then plug into the change of variables formula (Eq. 21) using the density of the centered Gumbel (Eq.15), the inverse of $h$ (Eq. 22) and its Jacobian determinant (Eq. 24):
|
| 308 |
+
|
| 309 |
+
$$
|
| 310 |
+
{ \begin{array} { l } { p ( y _ { 1 } , . . , y _ { k } ) = \Gamma ( k ) \left( { \displaystyle \prod _ { i = 1 } ^ { k } } \exp \left( x _ { i } \right) { \frac { y _ { k } ^ { \tau } } { y _ { i } ^ { \tau } } } \right) \left( { \displaystyle \sum _ { i = 1 } ^ { k } } \exp \left( x _ { i } \right) { \frac { y _ { k } ^ { \tau } } { y _ { i } ^ { \tau } } } \right) ^ { - k } \tau ^ { k - 1 } \prod _ { i = 1 } ^ { k } y _ { i } ^ { - 1 } } \\ { = \Gamma ( k ) \tau ^ { k - 1 } \left( { \displaystyle \sum _ { i = 1 } ^ { k } } \exp \left( x _ { i } \right) / y _ { i } ^ { \tau } \right) ^ { - k } \prod _ { i = 1 } ^ { k } \left( \exp \left( x _ { i } \right) / y _ { i } ^ { \tau + 1 } \right) } \end{array} }
|
| 311 |
+
$$
|
md/train/rkE8pVcle/rkE8pVcle.md
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING THROUGH DIALOGUE INTERACTIONS BY ASKING QUESTIONS
|
| 2 |
+
|
| 3 |
+
Jiwei Li, Alexander H. Miller, Sumit Chopra, Marc’Aurelio Ranzato, Jason Weston
|
| 4 |
+
Facebook AI Research,
|
| 5 |
+
New York, USA
|
| 6 |
+
{jiwel,ahm,spchopra,ranzato,jase}@fb.com
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
A good dialogue agent should have the ability to interact with users by both responding to questions and by asking questions, and importantly to learn from both types of interaction. In this work, we explore this direction by designing a simulator and a set of synthetic tasks in the movie domain that allow such interactions between a learner and a teacher. We investigate how a learner can benefit from asking questions in both offline and online reinforcement learning settings, and demonstrate that the learner improves when asking questions. Finally, real experiments with Mechanical Turk validate the approach. Our work represents a first step in developing such end-to-end learned interactive dialogue agents.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
When a student is asked a question by a teacher, but is not confident about the answer, they may ask for clarification or hints. A good conversational agent (a learner/bot/student) should have this ability to interact with a dialogue partner (the teacher/user). However, recent efforts have mostly focused on learning through fixed answers provided in the training set, rather than through interactions. In that case, when a learner encounters a confusing situation such as an unknown surface form (phrase or structure), a semantically complicated sentence or an unknown word, the agent will either make a (usually poor) guess or will redirect the user to other resources (e.g., a search engine, as in Siri). Humans, in contrast, can adapt to many situations by asking questions.
|
| 15 |
+
|
| 16 |
+
We identify three categories of mistakes a learner can make during dialogue1: (1) the learner has problems understanding the surface form of the text of the dialogue partner, e.g., the phrasing of a question; (2) the learner has a problem with reasoning, e.g. they fail to retrieve and connect the relevant knowledge to the question at hand; (3) the learner lacks the knowledge necessary to answer the question in the first place – that is, the knowledge sources the student has access to do not contain the needed information.
|
| 17 |
+
|
| 18 |
+
All the situations above can be potentially addressed through interaction with the dialogue partner. Such interactions can be used to learn to perform better in future dialogues. If a human student has problems understanding a teacher’s question, they might ask the teacher to clarify the question. If the student doesn’t know where to start, they might ask the teacher to point out which known facts are most relevant. If the student doesn’t know the information needed at all, they might ask the teacher to tell them the knowledge they’re missing, writing it down for future use.
|
| 19 |
+
|
| 20 |
+
In this work, we try to bridge the gap between how a human and an end-to-end machine learning dialogue agent deal with these situations: our student has to learn how to learn. We hence design a simulator and a set of synthetic tasks in the movie question answering domain that allow a bot to interact with a teacher to address the issues described above. Using this framework, we explore how a bot can benefit from interaction by asking questions in both offline supervised settings and online reinforcement learning settings, as well as how to choose when to ask questions in the latter setting. In both cases, we find that the learning system improves through interacting with users.
|
| 21 |
+
|
| 22 |
+
Finally, we validate our approach on real data where the teachers are humans using Amazon Mechanical Turk, and observe similar results.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
Learning language through interaction and feedback can be traced back to the 1950s, when Wittgenstein argued that the meaning of words is best understood from their use within given language games (Wittgenstein, 2010). The direction of interactive language learning through language games has been explored in the early seminal work of Winograd (Winograd, 1972), and in the recent SHRDLURN system (Wang et al., 2016). In a broader context, the usefulness of feedback and interactions has been validated in the setting of multiple language learning, such as second language learning (Bassiri, 2011) and learning by students (Higgins et al., 2002; Latham, 1997; Werts et al., 1995).
|
| 27 |
+
|
| 28 |
+
In the context of dialogue, with the recent popularity of deep learning models, many neural dialogue systems have been proposed. These include the chit-chat type end-to-end dialogue systems (Vinyals & Le, 2015; Li et al., 2015; Sordoni et al., 2015), which directly generate a response given the previous history of user utterance. It also include a collection of goal-oriented dialogue systems (Wen et al., 2016; Su et al., 2016; Bordes & Weston, 2016), which complete a certain task such as booking a ticket or making a reservation at a restaurant. Another line of research focuses on supervised learning for question answering from dialogues (Dodge et al., 2015; Weston, 2016), using either a given database of knowledge (Bordes et al., 2015; Miller et al., 2016) or short stories (Weston et al., 2015). As far as we know, current dialogue systems mostly focus on learning through fixed supervised signals rather than interacting with users.
|
| 29 |
+
|
| 30 |
+
Our work is closely related to the recent work of Weston (2016), which explores the problem of learning through conducting conversations, where supervision is given naturally in the response during the conversation. Their work introduced multiple learning schemes from dialogue utterances. In particular the authors discussed Imitation Learning, where the agent tries to learn by imitating the dialogue interactions between a teacher and an expert student; Reward-Based Imitation Learning, which only learns by imitating the dialogue interactions which have have correct answers; and Forward Prediction, which learns by predicting the teacher’s feedback to the student’s response. Despite the fact that Forward Prediction does not uses human-labeled rewards, the authors show that it yields promising results. However, their work did not fully explore the ability of an agent to learn via questioning and interaction. Our work can be viewed as a natural extension of theirs.
|
| 31 |
+
|
| 32 |
+
# 3 THE TASKS
|
| 33 |
+
|
| 34 |
+
In this section we describe the dialogue tasks we designed2. They are tailored for the three different situations described in Section 1 that motivate the bot to ask questions: (1) Question Clarification, in which the bot has problems understanding its dialogue partner’s text; (2) Knowledge Operation, in which the bot needs to ask for help to perform reasoning steps over an existing knowledge base; and (3) Knowledge Acquisition, in which the bot’s knowledge is incomplete and needs to be filled.
|
| 35 |
+
|
| 36 |
+
For our experiments we adapt the WikiMovies dataset (Weston et al., 2015), which consists of roughly $1 0 0 \mathrm { k }$ questions over 75k entities based on questions with answers in the open movie dataset (OMDb). The training/dev/test sets respectively contain 181638 / 9702 / 9698 examples. The accuracy metric corresponds to the percentage of times the student gives correct answers to the teacher’s questions.
|
| 37 |
+
|
| 38 |
+
Each dialogue takes place between a teacher and a bot. In this section we describe how we generate tasks using a simulator. Section 4.2 discusses how we test similar setups with real data using Mechanical Turk.
|
| 39 |
+
|
| 40 |
+
The bot is first presented with facts from the OMDb KB. This allows us to control the exact knowledge the bot has access to. Then, we include several teacher-bot question-answer pairs unrelated to the question the bot needs to answer, which we call conversation histories3. In order to explore the benefits of asking clarification questions during a conversation, for each of the three scenarios, our simulator generated data for two different settings, namely, Question-Answering (denoted by QA), and Asking-Question (denoted by AQ). For both $Q A$ and $A Q$ , the bot needs to give an answer to the teacher’s original question at the end. The details of the simulator can be found in the appendix.
|
| 41 |
+
|
| 42 |
+
# 3.1 QUESTION CLARIFICATION.
|
| 43 |
+
|
| 44 |
+
In this setting, the bot does not understand the teacher’s question. We focus on a special situation where the bot does not understand the teacher because of typo/spelling mistakes, as shown in Figure 1. We intentionally misspell some words in the questions such as replacing the word “movie” with “movvie” or “star” with “sttar”.4 To make sure that the bot will have problems understanding the question, we guarantee that the bot has never encountered the misspellings before—the misspellingintroducing mechanisms in the training, dev and test sets are different, so the same word will be misspelled in different ways in different sets. We present two $A Q$ tasks: (i) Question Paraphrase where the student asks the teacher to use a paraphrase that does not contain spelling mistakes to clarify the question by asking “what do you mean?”; and (ii) Question Verification where the student asks the teacher whether the original typo-bearing question corresponds to another question without the spelling mistakes (e.g., “Do you mean which film did Tom Hanks appear in?”). The teacher will give feedback by giving a paraphrase of the original question without spelling mistakes (e.g., “I mean which film did Tom Hanks appear in”) in Question Paraphrase or positive/negative feedback in Question Verification. Next the student will give an answer and the teacher will give positive/negative feedback depending on whether the student’s answer is correct. Positive and negative feedback are variants of “No, that’s incorrect” or “Yes, that’s right”5. In these tasks, the bot has access to all relevant entries in the KB.
|
| 45 |
+
|
| 46 |
+
# 3.2 KNOWLEDGE OPERATION
|
| 47 |
+
|
| 48 |
+
The bot has access to all the relevant knowledge (facts) but lacks the ability to perform necessary reasoning operations over them; see Figure 2. We focus on a special case where the bot will try to understand what are the relevant facts. We explore two settings: Ask For Relevant Knowledge (Task 3) where the bot directly asks the teacher to point out the relevant KB fact and Knowledge Verification (Task 4) where the bot asks whether the teacher’s question is relevant to one particular KB fact. The teacher will point out the relevant KB fact in the Ask For Relevant Knowledge setting or give a positive or negative response in the Knowledge Verification setting. Then the bot will give an answer to the teacher’s original question and the teacher will give feedback on the answer.
|
| 49 |
+
|
| 50 |
+
# 3.3 KNOWLEDGE ACQUISITION
|
| 51 |
+
|
| 52 |
+
For the tasks in this subsection, the bot has an incomplete KB and there are entities important to the dialogue missing from it, see Figure 3. For example, given the question “Which movie did Tom Hanks star in?”, the missing part could either be the entity that the teacher is asking about (question entity for short, which is Tom Hanks in this example), the relation entity (starred actors), the answer to the question (Forrest Gump), or the combination of the three. In all cases, the bot has little chance of giving the correct answer due to the missing knowledge. It needs to ask the teacher the answer to acquire the missing knowledge. The teacher will give the answer and then move on to other questions (captured in the conversational history). They later will come back to reask the question. At this point, the bot needs to give an answer since the entity is not new any more.
|
| 53 |
+
|
| 54 |
+
Though the correct answer has effectively been included in the earlier part of the dialogue as the answer to the bot’s question, as we will show later, many of the tasks are not as trivial as they look when the teacher reasks the question. This is because the bot’s model needs to memorize the missing entity and then construct the links between the missing entities and known ones. This is akin to the real world case where a student might make the same mistake again and again even though each time the teacher corrects them if their answer is wrong. We now detail each task in turn.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 1: Sample dialogues for the two Question Clarification tasks (rows) using both the traditional $Q A$ setting (left column) and $A Q$ setting (right column). In each case the same example is given for simplicity. Black text prefixed by “kb:” denotes KB knowledge that the student has access to. Blue text is spoken by the teacher, denoted by T. $( + )$ denotes a reward of 1 (and 0 otherwise) that the teacher assigns to the bot. Red text denotes responses or questions posed by the bot, denoted by S. Brown denotes typos deliberately introduced by the authors. For the Question Verification setting, the student can either ask a correct (pertinent) question (as in this example) or an incorrect (irrelevant) one. The teacher will give positive or negative feedback based on the correctness of the student’s question. In our offline superised learning experiments, the probability of asking pertinent questions and correctly answering the original question from the teacher is set to 0.5. Finally, T/S denotes 5 pairs of questions and answers that are irrelevant to the rest of the conversation.
|
| 58 |
+
|
| 59 |
+
Task 1: Question Paraphrase (AQ):
|
| 60 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 61 |
+
kb: Forrest Gump starred actors Tom Hanks, Robin Wright, Gary Sinise
|
| 62 |
+
kb: Forrest Gump directed by Robert Zemeckis T/S : Conversation History.
|
| 63 |
+
T : Which movvie did Tom Hanks sttar in ? S : What do you mean ?
|
| 64 |
+
T : I mean which film did Tom Hanks appear in. T : Which movvie did Tom Hanks sttar in ? S : Forrest Gump
|
| 65 |
+
T : That’s correct. $( + )$
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 2: Sample dialogues for Knowledge Operation tasks.
|
| 69 |
+
|
| 70 |
+
Missing Question Entity: The entity that the teacher is asking about is missing from the knowledge base. All KB facts containing the question entity will be hidden from the bot. In the example for Task 5 in Figure 3, since the teacher’s question contains the entity Tom Hanks, the KB facts that contain Tom Hanks are hidden from the bot.
|
| 71 |
+
|
| 72 |
+
Task 5: Missing Question Entity (QA)
|
| 73 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 74 |
+
kb: Forrest Gump starred actors Tom Hanks kb: Forrest Gump starred actors Sally Field kb: Forrest Gump directed by Robert Zemeckis T/S : Conversation History.
|
| 75 |
+
T : Which movie did Tom Hanks star in ?
|
| 76 |
+
S : Forrest Gump
|
| 77 |
+
T : That’s correct. $( + )$ Task 5: Missing Question Entity (AQ)
|
| 78 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 79 |
+
kb: Forrest Gump starred actors Tom Hanks, kb: Forrest Gump starred actors Sally Field kb: Forrest Gump directed by Robert Zemeckis T : Which movie did Tom Hanks star in ?
|
| 80 |
+
S : I don’t know. What’s the answer?
|
| 81 |
+
T : The answer is Forrest Gump.
|
| 82 |
+
T/S : Conversation History.
|
| 83 |
+
T : Which movie did Tom Hanks star in ?
|
| 84 |
+
S : Forrest Gump
|
| 85 |
+
T : That’s correct. $( + )$ Task 6: Missing Answer Entity (AQ)
|
| 86 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 87 |
+
kb: Forrest Gump starred actors Tom Hanks kb: Forrest Gump starred actors Sally Field kb: Forrest Gump directed by Robert Zemeckis T : Which movie did Tom Hanks star in ?
|
| 88 |
+
S : I don’t know. What’s the answer?
|
| 89 |
+
T : The answer is Forrest Gump.
|
| 90 |
+
T/S : Conversation History.
|
| 91 |
+
T : Which movie did Tom Hanks star in ?
|
| 92 |
+
S : Forrest Gump
|
| 93 |
+
T : That’s correct. $( + )$ Task 7: Missing Relation Entity (AQ)
|
| 94 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 95 |
+
kb: Forrest Gump starred actors Tom Hanks, kb: Forrest Gump starred actors Sally Field kb: Forrest Gump directed by Robert Zemeckis T : Which movie did Tom Hanks star in ?
|
| 96 |
+
S : I don’t know. What’s the answer?
|
| 97 |
+
T : The answer is Forrest Gump.
|
| 98 |
+
T/S : Conversation History.
|
| 99 |
+
T : Which movie did Tom Hanks star in ?
|
| 100 |
+
S : Forrest Gump
|
| 101 |
+
T : That’s correct. $( + )$
|
| 102 |
+
|
| 103 |
+
# Task 8: Missing Triple (AQ)
|
| 104 |
+
|
| 105 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 106 |
+
kb: Forrest Gump starred actors Tom Hanks kb: Forrest Gump starred actors Sally Field kb: Forrest Gump directed by Robert Zemeckis T : Which movie did Tom Hanks star in ?
|
| 107 |
+
S : I don’t know. What’s the answer?
|
| 108 |
+
T : The answer is Forrest Gump.
|
| 109 |
+
T/S : Conversation History.
|
| 110 |
+
T : Which movie did Tom Hanks star in ?
|
| 111 |
+
S : Forrest Gump
|
| 112 |
+
T : That’s correct. (+) Task 9: Missing Everything (AQ)
|
| 113 |
+
kb: Larry Crowne directed by Tom Hanks
|
| 114 |
+
kb: Forrest Gump starred actors Tom Hanks, kb: Forrest Gump starred actors Sally Field kb: Forrest Gump directed by Robert Zemeckis T : Which movie did Tom Hanks star in ?
|
| 115 |
+
S : I don’t know. What’s the answer?
|
| 116 |
+
T : The answer is Forrest Gump.
|
| 117 |
+
T/S : Conversation History.
|
| 118 |
+
T : Which movie did Tom Hanks star in ?
|
| 119 |
+
S : Forrest Gump
|
| 120 |
+
T : That’s correct. (+)
|
| 121 |
+
|
| 122 |
+
Missing Answer Entity: The answer entity to the question is unknown to the bot. All KB facts that contain the answer entity will be hidden. Hence, in Task $6$ of Figure 3, all KB facts containing the answer entity Forrest Gump will be hidden from the bot.
|
| 123 |
+
|
| 124 |
+
Missing Relation Entity: The relation type is unknown to the bot. In Task 7 of Figure 3, all KB facts that express the relation starred actors are hidden from the bot.
|
| 125 |
+
|
| 126 |
+
Missing Triples: The triple that expresses the relation between the question entity and the answer entity is hidden from the bot. In Task 8 of Figure 3, the triple “Forrest Gump (question entity) starred actors Tom Hanks (answer entity)” will be hidden.
|
| 127 |
+
|
| 128 |
+
Missing Everything: The question entity, the relation entity, the answer entity are all missing from the KB. All KB facts in Task 9 of Figure 3 will be removed since they either contain the relation entity (i.e., starred actors), the question entity (i.e., Forrest Gump) or the answer entity Tom Hanks.
|
| 129 |
+
|
| 130 |
+
# 4 TRAIN/TEST REGIME
|
| 131 |
+
|
| 132 |
+
We now discuss in detail the regimes we used to train and test our models, which are divided between evaluation within our simulator and using real data collected via Mechanical Turk.
|
| 133 |
+
|
| 134 |
+
# 4.1 SIMULATOR
|
| 135 |
+
|
| 136 |
+
Using our simulator, our objective was twofold. We first wanted to validate the usefulness of asking questions in all the settings described in Section 3. Second, we wanted to assess the ability of our student bot to learn when to ask questions. In order to accomplish these two objectives we explored training our models with our simulator using two methodologies, namely, Offline Supervised Learning and Online Reinforcement Learning.
|
| 137 |
+
|
| 138 |
+
# 4.1.1 OFFLINE SUPERVISED LEARNING
|
| 139 |
+
|
| 140 |
+
The motivation behind training our student models in an offline supervised setting was primarily to test the usefulness of the ability to ask questions. The dialogues are generated as described in the previous section, and the bot’s role is generated with a fixed policy. We chose a policy where answers to the teacher’s questions are correct answers $50 \%$ of the time, and incorrect otherwise, to add a degree of realism. Similarly, in tasks where questions can be irrelevant they are only asked correctly $50 \%$ of the time.6
|
| 141 |
+
|
| 142 |
+
The offline setting explores different combinations of training and testing scenarios, which mimic different situations in the real world. The aim is to understand when and how observing interactions between two agents can help the bot improve its performance for different tasks. As a result we construct training and test sets in three ways across all tasks, resulting in 9 different scenarios per task, each of which correspond to a real world scenario.
|
| 143 |
+
|
| 144 |
+
The three training sets we generated are referred to as TrainQA, TrainAQ, and TrainMix. TrainQA follows the QA setting discussed in the previous section: the bot never asks questions and only tries to immediately answer. TrainAQ follows the AQ setting: the student, before answering, first always asks a question in response to the teacher’s original question. TrainMix is a combination of the two where $5 0 \%$ of time the student asks a question and $5 0 \%$ does not.
|
| 145 |
+
|
| 146 |
+
The three test sets we generated are referred to as TestQA, TestAQ, and TestModelAQ. TestQA and TestAQ are generated similarly to TrainQA and TrainAQ, but using a perfect fixed policy (rather than $50 \%$ correct) for evaluation purposes. In the TestModelAQ setting the model has to get the form of the question correct as well. In the Question Verification and Knowledge Verification tasks there are many possible ways of forming the question and some of them are correct – the model has to choose the right question to ask. E.g. it should ask “Does it have something to do with the fact that Larry Crowne directed by Tom Hanks?”rather than “Does it have something to do with the fact that Forrest Gump directed by Robert Zemeckis?” when the latter is irrelevant (the candidate list of questions is generated from the known knowledge base entries with respect to that question). The policy is trained using either the TrainAQ or TrainMix set, depending on the training scenario. The teacher will reply to the question, giving positive feedback if the student’s question is correct and no response and negative feedback otherwise. The student will then give the final answer. The difference between TestModelAQ and TestAQ only exists in the Question Verification and Knowledge Verification tasks; in other tasks there is only one way to ask the question and TestModelAQ and TestAQ are identical.
|
| 147 |
+
|
| 148 |
+
To summarize, for every task listed in Section 3 we train one model for each of the three training sets (TrainQA, TrainAQ, TrainMix) and test each of these models on the three test sets (TestQA, TestAQ, and TestModelAQ), resulting in 9 combinations. For the purpose of notation the train/test combination is denoted by “TrainSetting+TestSetting”. For example, TrainA $Q +$ TestQA denotes a model which is trained using the TrainAQ dataset and tested on TestQA dataset. Each combination has a real world interpretation. For instance, $T r a i n A Q + T e s t Q A$ would refer to a scenario where a student can ask the teacher questions during learning but cannot to do so while taking an exam. Similarly, $T r a i n Q A + T e s t Q A$ describes a stoic teacher that never answers a student’s question at either learning or examination time. The setting $T r a i n Q A + T e s t A Q$ corresponds to the case where a lazy student never asks question at learning time but gets anxious during the examination and always asks a question.
|
| 149 |
+
|
| 150 |
+
# 4.1.2 ONLINE REINFORCEMENT LEARNING (RL)
|
| 151 |
+
|
| 152 |
+
We also explored scenarios where the student learns the ability to decide when to ask a question. In other words, the student learns how to learn.
|
| 153 |
+
|
| 154 |
+
Although it is in the interest of the student to ask questions at every step of the conversation, since the response to its question will contain extra information, we don’t want our model to learn this behavior. Each time a human student asks a question, there’s a cost associated with that action. This cost is a reflection of the patience of the teacher, or more generally of the users interacting with the bot in the wild: users won’t find the bot engaging if it always asks clarification questions. The student should thus be judicious about asking questions and learn when and what to ask. For instance, if the student is confident about the answer, there is no need for it to ask. Or, if the teacher’s question is so hard that clarification is unlikely to help enough to get the answer right, then it should also refrain from asking.
|
| 155 |
+
|
| 156 |
+
We now discuss how we model this problem under the Reinforcement Learning framework. The bot is presented with KB facts (some facts might be missing depending on the task) and a question. It needs to decide whether to ask a question or not at this point. The decision whether to ask is made by a binary policy $P _ { R L Q u e s t i o n }$ . If the student chooses to ask a question, it will be penalized by $c o s t _ { A Q }$ . We explored different values of $c o s t _ { A Q }$ ranging from $[ 0 , 2 ]$ , which we consider as modeling the patience of the teacher. The goal of this setting is to find the best policy for asking/notasking questions which would lead to the highest cumulative reward. The teacher will appropriately reply if the student asks a question. The student will eventually give an answer to the teacher’s initial question at the end using the policy $P _ { R L A n s w e r }$ , regardless of whether it had asked a question. The student will get a reward of $+ 1$ if its final answer is correct and $- 1$ otherwise. Note that the student can ask at most one question and that the type of question is always specified by the task under consideration. The final reward the student gets is the cumulative reward over the current dialogue episode. In particular the reward structure we propose is the following:
|
| 157 |
+
|
| 158 |
+
Final Answer Correct Final Answer Incorrect
|
| 159 |
+
|
| 160 |
+
<table><tr><td>Asking Question</td><td>Not asking Question</td></tr><tr><td>1-cost AQ</td><td>1</td></tr><tr><td>-1-cost AQ</td><td>-1</td></tr></table>
|
| 161 |
+
|
| 162 |
+
For each of the tasks described in Section 3, we consider three different RL scenarios.
|
| 163 |
+
|
| 164 |
+
Good-Student: The student will be presented with all relevant KB facts. There are no misspellings or unknown words in the teacher’s question. This represents a knowledgable student in the real world that knows as much as it needs to know (e.g., a large knowledge base, large vocabulary). This setting is identical across all missing entity tasks (5 - 9).
|
| 165 |
+
|
| 166 |
+
Poor-Student: The KB facts or the questions presented to the student are flawed depending on each task. For example, for the Question Clarification tasks, the student does not understand the question due to spelling mistakes. For the Missing Question Entity task the entity that the teacher asks about is unknown by the student and all facts containing the entity will be hidden from the student. This setting is similar to a student that is underprepared for the tasks.
|
| 167 |
+
|
| 168 |
+
Medium-Student: The combination of the previous two settings where for $5 0 \%$ of the questions, the student has access to the full KB and there are no new words or phrases or entities in the question, and $5 0 \%$ of the time the question and KB are taken from the Poor-Student setting.
|
| 169 |
+
|
| 170 |
+
# 4.2 MECHANICAL TURK DATA
|
| 171 |
+
|
| 172 |
+
Finally, to validate our approach beyond our simulator by using real language, we collected data via Amazon Mechanical Turk. Due to the cost of data collection, we focused on real language versions of Tasks 4 (Knowledge Verification) and 8 (Missing Triple), see Secs. 3.2 and 3.3 for the simulator versions. That is, we collect dialogues and use them in an offline supervised learning setup similar to Section 4.1.1. This setup allows easily reproducible experiments.
|
| 173 |
+
|
| 174 |
+
For Mechanical Turk Task 4, the bot is asked a question by a human teacher, but before answering can ask the human if the question is related to one of the facts it knows about from its memory.
|
| 175 |
+
|
| 176 |
+

|
| 177 |
+
Reward: 1-CostAQ
|
| 178 |
+
Figure 4: An illustration of the poor-student setting for RL Task 1 (Question Paraphrase).
|
| 179 |
+
|
| 180 |
+
It is then required to answer the original question, after some additional dialog turns relating to other question/answer pairs (called “conversational history”, as before). For Task 8, the bot is asked a question by a human but lacks the triple in its memory that would be needed to answer it. It is allowed to ask for the missing information, the human responds to the question in free-form language. The bot is then required to answer the original question, again after some “conversational history” has transpired.
|
| 181 |
+
|
| 182 |
+
We collect around 10,000 episodes (dialogues) for training, 1000 for validation, and 2500 for testing for each of the two tasks. In each case, we give instructions to the Turkers that still follow the original form of the task, but make the tasks contain realistic language written by humans. The instructions given to the Turkers are given in the appendix.
|
| 183 |
+
|
| 184 |
+
For both tasks, while the human turkers replace the simulator that the bot was previously conversing with, the bot’s dialogue actions (capabilities) are essentially unchanged from before. That is, when answering questions, now the bot is required to answer a human’s questions rather than templated questions from the simulator. When the bot is asking questions, the bot still asks in the same form as before, e.g. questions like “Does it have something to do with X” for Task 4 or “I don’t know. What’s the answer?” for Task 8. However, now its questions are answered by a human. In both cases (asking and answering) the human data is richer with potentially more complex language and lexical variability. Examples of the collected dialogues are given in Figure 5.
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 5: Sample dialogues for Mechanical Turk versions of Tasks 4 and 8. Compared to the original tasks (see Figs 2 and 3) the teacher’s questions, and the teacher responses to the student’s questions, are written by humans and are more complex and contain more variety.
|
| 188 |
+
|
| 189 |
+
# 5 MODELS
|
| 190 |
+
|
| 191 |
+
For both offline supervised and online RL settings, we use the End-to-End Memory Network model (MemN2N) (Sukhbaatar et al., 2015) as a backbone. The model takes as input the last utterance of the dialogue history (the question from the teacher) as well as a set of memory contexts including short-term memories (the dialogue history between the bot and the teacher) and long-term memories (the knowledge base facts that the bot has access to), and outputs a label. We refer readers to the Appendix for more details about MemN2N.
|
| 192 |
+
|
| 193 |
+
Offline Supervised Settings: The first learning strategy we adopt is the reward-based imitation strategy (denoted vanilla-MemN2N) described in (Weston, 2016), where at training time, the model maximizes the log likelihood probability of the correct answers the student gave (examples with incorrect final answers are discarded). Candidate answers are words that appear in the memories, which means the bot can only predict the entities that it has seen or known before.
|
| 194 |
+
|
| 195 |
+
We also use a variation of MemN2N called “context MemN2N” (Cont-MemN2N for short) where we replace each word’s embedding with the average of its embedding (random for unseen words) and the embeddings of the other words that appear around it. We use both the preceeding and following words as context and the number of context words is a hyperparameter selected on the dev set.
|
| 196 |
+
|
| 197 |
+
An issue with both vanilla-MemN2N and Cont-MemN2N is that the model only makes use of the bot’s answers as signals and ignores the teacher’s feedback. We thus propose to use a model that jointly predicts the bot’s answers and the teacher’s feedback (denoted as TrainQA $\left( + F P \right) )$ . The bot’s answers are predicted using a vanilla-MemN2N and the teacher’s feedback is predicted using the Forward Prediction (FP) model as described in (Weston, 2016). We refer the readers to the Appendix for the FP model details. At training time, the models learn to jointly predict the teacher’s feedback and the answers with positive reward. At test time, the model will only predict the bot’s answer.
|
| 198 |
+
|
| 199 |
+
For the TestModelAQ setting described in Section 4, the model needs to decide the question to ask. Again, we use vanilla-MemN2N that takes as input the question and contexts, and outputs the question the bot will ask.
|
| 200 |
+
|
| 201 |
+
Online RL Settings: A binary vanilla-MemN2N (denoted as $P _ { R L } ( Q u e s t i o n ) )$ is used to decide whether the bot should or should not ask a question, with the teacher replying if the bot does ask something. A second MemN2N is then used to decide the bot’s answer, denoted as $P _ { R L } ( A n s w e r )$ . $P _ { R L } ( A n s w e r )$ for $Q A$ and $A Q$ are two separate models, which means the bot will use different models for final-answer prediction depending on whether it chooses to ask a question or not.7
|
| 202 |
+
|
| 203 |
+
We use the REINFORCE algorithm (Williams, 1992) to update $P _ { R L } ( Q u e s t i o n )$ and $P _ { R L } ( A n s w e r )$ . For each dialogue, the bot takes two sequential actions $( a _ { 1 } , a _ { 2 } )$ : to ask or not to ask a question (denoted as $a _ { 1 }$ ); and guessing the final answer (denoted as $a _ { 2 }$ ). Let $r ( a _ { 1 } , a _ { 2 } )$ denote the cumulative reward for the dialogue episode, computed using Table 1. The gradient to update the policy is given by:
|
| 204 |
+
|
| 205 |
+
$$
|
| 206 |
+
\begin{array} { r l } & { p ( a _ { 1 } , a _ { 2 } ) = P _ { R L } ( Q u e s t i o n ) ( a _ { 1 } ) \cdot P _ { R L } ( a n s w e r ) ( a _ { 2 } ) } \\ & { \nabla J ( \theta ) \approx \nabla \log p ( a _ { 1 } , a _ { 2 } ) [ r ( a _ { 1 } , a _ { 2 } ) - b ] } \end{array}
|
| 207 |
+
$$
|
| 208 |
+
|
| 209 |
+
where $b$ is the baseline value, which is estimated using another MemN2N model that takes as input the query $x$ and memory $C$ , and outputs a scalar $b$ denoting the estimation of the future reward. The baseline model is trained by minimizing the mean squared loss between the estimated reward $b$ and actual cumulative reward $r$ , $| | \boldsymbol { r } - \boldsymbol { b } | | ^ { 2 }$ . We refer the readers to (Ranzato et al., 2015; Zaremba & Sutskever, 2015) for more details. The baseline estimator model is independent from the policy models and the error is not backpropagated back to them.
|
| 210 |
+
|
| 211 |
+
In practice, we find the following training strategy yields better results: first train only $P _ { R L } ( a n s w e r )$ , updating gradients only for the policy that predicts the final answer. After the bot’s final-answer policy is sufficiently learned, train both policies in parallel8. This has a real-world analogy where the bot first learns the basics of the task, and then learns to improve its performance via a question-asking policy tailored to the user’s patience (represented by $c o s t _ { A Q }$ ) and its own ability to asnwer questions.
|
| 212 |
+
|
| 213 |
+
Table 2: Results for Cont-MemN2N on different tasks.
|
| 214 |
+
|
| 215 |
+
<table><tr><td></td><td colspan="5">Question Clarification</td><td colspan="5">Knowledge Operation</td></tr><tr><td></td><td colspan="2">Task 1:Q.Paraphrase TestAQ</td><td colspan="2">Task 2:Q.Verification</td><td colspan="2"></td><td colspan="2">Task 3:Ask For Relevant K.</td><td colspan="2">Task 4:K.Verification TestQA</td></tr><tr><td>Train\Test</td><td colspan="2">TestQA</td><td colspan="2">TestQA</td><td colspan="2">TestAQ TestQA</td><td colspan="2">TestAQ</td><td colspan="2">TestAQ</td></tr><tr><td>TrainQA (Context)</td><td>0.754</td><td>0.726</td><td>0.742</td><td>0.684</td><td></td><td>0.883 0.716</td><td>0.947</td><td>0.888</td><td>0.959</td><td></td></tr><tr><td>TrainAQ(Context)</td><td>0.640</td><td>0.889</td><td colspan="2">0.643</td><td colspan="2">0.807 0.789</td><td colspan="2">0.985</td><td>0.852 0.875</td><td>0.987</td></tr><tr><td>TrainMix (Context)</td><td>0.751</td><td>0.846</td><td colspan="2">0.740</td><td colspan="2">0.870</td><td colspan="2">0.985</td><td>0.985</td><td></td></tr><tr><td colspan="10">Knowledge Acquisition TestAQ TestAQ</td></tr><tr><td>TrainTest</td><td>TestQA</td><td>TestAQ</td><td colspan="2">TestQA</td><td colspan="2">TestQA</td><td colspan="2">TestQA</td><td>TestAQ</td><td>TestQA TestAQ</td></tr><tr><td></td><td>Task 5:Q.Entity</td><td></td><td colspan="2">Task 6:Answer Entity</td><td colspan="2">Task7:Relation Entity</td><td colspan="2">Task 8:Triple</td><td></td><td>Task 9:Everything</td></tr><tr><td>TrainQA (Context)</td><td><0.01</td><td>0.224</td><td colspan="2"><0.01</td><td colspan="2">0.241</td><td colspan="2">0.339</td><td>0.251 <0.01</td><td>0.058</td></tr><tr><td>TrainAQ(Context)</td><td><0.01</td><td>0.639</td><td colspan="2"><0.01</td><td colspan="2">0.143</td><td colspan="2">0.154</td><td>0.884 <0.01</td><td>0.908</td></tr><tr><td>TrainMix (Context)</td><td><0.01</td><td>0.632</td><td colspan="2"><0.01</td><td colspan="2">0.216</td><td colspan="2">0.298</td><td>0.886 <0.01</td><td>0.903</td></tr></table>
|
| 216 |
+
|
| 217 |
+
# 6 EXPERIMENTS
|
| 218 |
+
|
| 219 |
+
# 6.1 SIMULATOR
|
| 220 |
+
|
| 221 |
+
Offline Results: Offline results are presented in Tables 2, 7 and 8 (the latter two are in the appendix). Table 7 presents results for the vanilla-MemN2N and Forward Prediction models. Table 2 presents results for Cont-MemN2N, which is better at handling unknown words. We repeat each experiment 10 times and report the best result. Finally, Table 8 presents results for the test scenario where the bot itself chooses when to ask questions. Observations can be summarized as as follows:
|
| 222 |
+
|
| 223 |
+
- Asking questions helps at test time, which is intuitive since it provides additional evidence:
|
| 224 |
+
|
| 225 |
+
• Train $1 Q + T e s t A Q$ (questions can be asked at both training and test time) performs the best across all the settings. Tra $i n Q A { + } T e s t A Q$ (questions can be asked at training time but not at test time) performs worse than $T r a i n Q A + T e s t Q A$ (questions can be asked at neither training nor test time) in tasks Question Clarification and Knowledge Operation due to the discrepancy between training and testing. $T r a i n Q A + T e s t A Q$ performs better than $T r a i n Q A + T e s t Q A$ on all Knowledge Acquisition tasks, the only exception being the Cont-MemN2N model on the Missing Triple setting. The explanation is that for most tasks in Knowledge Acquisition, the learner has no chance of giving the correct answer without asking questions. The benefit from asking is thus large enough to compensate for the negative effect introduced by data discrepancy between training and test time. TrainMix offers flexibility in bridging the gap between datasets generated using QA and AQ, very slightly underperforming TrainAQ+TestAQ, but gives competitive results on both TestQA and TestAQ in the Question Clarification and Knowledge Operations tasks. $I r a i n A Q + T e s t Q A$ (allowing questions at training time but forbid questions at test time) performs the worst, even worse than $T r a i n Q A + T e s t Q A$ . This has a real-world analogy where a student becomes dependent on the teacher answering their questions, later struggling to answer the test questions without help.
|
| 226 |
+
In the Missing Question Entity task (the student does not know about the question entity), the Missing Answer Entity task (the student does not know about the answer entity), and Missing Everything task, the bot achieves accuracy less than 0.01 if not asking questions at test time (i.e., TestQA). The performance of TestModelAQ, where the bot relies on its model to ask questions at test time (and thus can ask irrelevant questions) performs similarly to asking the correct question at test time (TestAQ) and better than not asking questions (TestQA).
|
| 227 |
+
|
| 228 |
+
- Cont-MemN2N significantly outperforms vanilla-MemN2N. One explanation is that considering context provides significant evidence distinguishing correct answers from candidates in the dialogue history, especially in cases where the model encounters unfamiliar words.
|
| 229 |
+
|
| 230 |
+
RL Results For the RL settings, we present results for Task 2 (Question Verification) and Task 6 (Missing Answer Entities) in Figure 6. Task 2 represents scenarios where different types of student have different abilities to correctly answer questions (e.g., a poor student can still sometimes give correct answers even when they do not fully understand the question). Task 6 represents tasks where a poor learner who lacks the knowledge necessary to answer the question can hardly give a correct answer. All types of students including the good student will theoretically benefit from asking questions (asking for the correct answer) in Task 6. We show the percentage of question-asking versus the cost of AQ on the test set and the accuracy of question-answering on the test set vs the cost of AQ. Our main findings were:
|
| 231 |
+
|
| 232 |
+

|
| 233 |
+
Figure 6: Results of online learning for Task 2 and Task 6
|
| 234 |
+
|
| 235 |
+
• A good student does not need to ask questions in Task 2 (Question Verification), because they already understand the question. The student will raise questions asking for the correct answer when cost is low for Task 6 (Missing Answer Entities). A poor student always asks questions when the cost is low. As the cost increases, the frequency of question-asking declines. As the AQ cost increases gradually, good students will stop asking questions earlier than the medium and poor students. The explanation is intuitive: poor students benefit more from asking questions than good students, so they continue asking even with higher penalties.
|
| 236 |
+
• As the probability of question-asking declines, the accuracy for poor and medium students drops. Good students are more resilient to not asking questions.
|
| 237 |
+
|
| 238 |
+
# 6.2 MECHANICAL TURK
|
| 239 |
+
|
| 240 |
+
Results for the Mechanical Turk Tasks are given in Table 3. We again compare vanilla-MemN2N and Cont-MemN2N, using the same TrainAQ/TrainQA and TestAQ/TestQA combinations as before, for Tasks 4 and 8 as described in Section 4.2. We tune hyperparameters on the validation set and repeat each experiment 10 times and report the best result.
|
| 241 |
+
|
| 242 |
+
While performance is lower than on the related Task 4 and Task 8 simulator tasks, we still arrive at the same trends and conclusions when real data from humans is used. The performance was expected to be lower because (i) real data has more lexical variety, complexity and noise; and (ii) the training set was smaller due to data collection costs (10k vs. 180k). We perform an analysis of the difference between simulated and real training data (or combining the two) in the appendix, which shows that using real data is indeed important and measurably superior to using simulated data.
|
| 243 |
+
|
| 244 |
+
Table 3: Mechanical Turk Task Results. Asking Questions (AQ) outperforms only answering questions without asking (QA).
|
| 245 |
+
|
| 246 |
+
<table><tr><td></td><td colspan="4">vanilla-MemN2N</td><td colspan="4">Cont-MemN2N</td></tr><tr><td></td><td colspan="2">Task4:K.Verification</td><td colspan="2">Task 8:Triple</td><td colspan="2">Task 4:K.Verification</td><td colspan="2">Task 8:Triple</td></tr><tr><td>Train\Test</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td></tr><tr><td>TrainQA</td><td>0.331</td><td>0.313</td><td>0.133</td><td>0.162</td><td>0.712</td><td>0.703</td><td>0.308</td><td>0.234</td></tr><tr><td>TrainAQ</td><td>0.318</td><td>0.375</td><td>0.072</td><td>0.422</td><td>0.679</td><td>0.774</td><td>0.137</td><td>0.797</td></tr></table>
|
| 247 |
+
|
| 248 |
+
More importantly, the same main conclusion is observed as before: TrainAQ $^ +$ TestAQ (questions can be asked at both training and test time) performs the best across all the settings. That is, we show that a bot asking questions to humans learns to outperform one that only answers them.
|
| 249 |
+
|
| 250 |
+
# 7 CONCLUSIONS
|
| 251 |
+
|
| 252 |
+
In this paper, we explored how an intelligent agent can benefit from interacting with users by asking questions. We developed tasks where interaction via asking questions is desired. We explore both online and offline settings that mimic different real world situations and show that in most cases, teaching a bot to interact with humans facilitates language understanding, and consequently leads to better question answering ability.
|
| 253 |
+
|
| 254 |
+
# REFERENCES
|
| 255 |
+
|
| 256 |
+
Mohammad Amin Bassiri. Interactional feedback and the impact of attitude and motivation on noticing l2 form. English Language and Literature Studies, 1(2):61, 2011.
|
| 257 |
+
Antoine Bordes and Jason Weston. Learning end-to-end goal-oriented dialog. arXiv preprint arXiv:1605.07683, 2016.
|
| 258 |
+
Antoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. arXiv preprint arXiv:1506.02075, 2015.
|
| 259 |
+
Jesse Dodge, Andreea Gane, Xiang Zhang, Antoine Bordes, Sumit Chopra, Alexander Miller, Arthur Szlam, and Jason Weston. Evaluating prerequisite qualities for learning end-to-end dialog systems. arXiv preprint arXiv:1511.06931, 2015.
|
| 260 |
+
Richard Higgins, Peter Hartley, and Alan Skelton. The conscientious consumer: Reconsidering the role of assessment feedback in student learning. Studies in higher education, 27(1):53–64, 2002.
|
| 261 |
+
Andrew S Latham. Learning through feedback. Educational Leadership, 54(8):86–87, 1997.
|
| 262 |
+
Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. arXiv preprint arXiv:1510.03055, 2015.
|
| 263 |
+
Alexander Miller, Adam Fisch, Jesse Dodge, Amir-Hossein Karimi, Antoine Bordes, and Jason Weston. Key-value memory networks for directly reading documents. arXiv preprint arXiv:1606.03126, 2016.
|
| 264 |
+
Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. arXiv preprint arXiv:1511.06732, 2015.
|
| 265 |
+
Alessandro Sordoni, Michel Galley, Michael Auli, Chris Brockett, Yangfeng Ji, Margaret Mitchell, Jian-Yun Nie, Jianfeng Gao, and Bill Dolan. A neural network approach to context-sensitive generation of conversational responses. arXiv preprint arXiv:1506.06714, 2015.
|
| 266 |
+
Pei-Hao Su, Milica Gasic, Nikola Mrksic, Lina Rojas-Barahona, Stefan Ultes, David Vandyke, Tsung-Hsien Wen, and Steve Young. Continuously learning neural dialogue management. arXiv preprint arXiv:1606.02689, 2016.
|
| 267 |
+
Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. In Advances in neural information processing systems, pp. 2440–2448, 2015.
|
| 268 |
+
|
| 269 |
+
Oriol Vinyals and Quoc Le. A neural conversational model. arXiv preprint arXiv:1506.05869, 2015.
|
| 270 |
+
|
| 271 |
+
Sida I Wang, Percy Liang, and Christopher D Manning. Learning language games through interaction. arXiv preprint arXiv:1606.02447, 2016.
|
| 272 |
+
|
| 273 |
+
Tsung-Hsien Wen, Milica Gasic, Nikola Mrksic, Lina M Rojas-Barahona, Pei-Hao Su, Stefan Ultes, David Vandyke, and Steve Young. A network-based end-to-end trainable task-oriented dialogue system. arXiv preprint arXiv:1604.04562, 2016.
|
| 274 |
+
|
| 275 |
+
Margaret G Werts, Mark Wolery, Ariane Holcombe, and David L Gast. Instructive feedback: Review of parameters and effects. Journal of Behavioral Education, 5(1):55–75, 1995.
|
| 276 |
+
|
| 277 |
+
Jason Weston. Dialog-based language learning. arXiv preprint arXiv:1604.06045, 2016.
|
| 278 |
+
|
| 279 |
+
Jason Weston, Antoine Bordes, Sumit Chopra, Alexander M Rush, Bart van Merrienboer, Armand ¨ Joulin, and Tomas Mikolov. Towards ai-complete question answering: A set of prerequisite toy tasks. arXiv preprint arXiv:1502.05698, 2015.
|
| 280 |
+
|
| 281 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 282 |
+
|
| 283 |
+
Terry Winograd. Understanding natural language. Cognitive psychology, 3(1):1–191, 1972.
|
| 284 |
+
|
| 285 |
+
Ludwig Wittgenstein. Philosophical investigations. John Wiley & Sons, 2010.
|
| 286 |
+
|
| 287 |
+
Wojciech Zaremba and Ilya Sutskever. Reinforcement learning neural turing machines. arXiv preprint arXiv:1505.00521, 362, 2015.
|
| 288 |
+
|
| 289 |
+
# Appendix
|
| 290 |
+
|
| 291 |
+
End-to-End Memory Networks The input to an end-to-end memory network model (MemN2N) is the last utterance of the dialogue history $x$ as well as a set of memories (context) $\scriptstyle { C = c _ { 1 } }$ , $c _ { 2 }$ , ..., $c _ { N } .$ ). Memory $C$ encodes both short-term memory, e..g, dialogue histories between the bot and the teacher and long-term memories, e.g., the knowledgebase facts that the bot has access to. Given the input $x$ and $C$ , the goal is to produce an output/label $a$ .
|
| 292 |
+
|
| 293 |
+
In the first step, the query $x$ is transformed to a vector representation $u _ { 0 }$ by summing up its constituent word embeddings: $u _ { 0 } = A x$ . The input $\mathbf { X }$ is a bag-of-words vector and $A$ is the $d \times V$ word embedding matrix where $d$ denotes the vector dimensionality and $V$ denotes the vocabulary size. Each memory $c _ { i }$ is similarly transformed to vector $m _ { i }$ . The model will read information from the memory by linking input representation $q$ with memory vectors $m _ { i }$ using softmax weights:
|
| 294 |
+
|
| 295 |
+
$$
|
| 296 |
+
o _ { 1 } = \sum _ { i } p _ { i } ^ { 1 } m _ { i } \qquad p _ { i } ^ { 1 } = \mathsf { s o f t m a x } ( u _ { 0 } ^ { T } m _ { i } )
|
| 297 |
+
$$
|
| 298 |
+
|
| 299 |
+
The goal is to select memories relevant to the last utterance $x$ , i.e., the memories with large values of $p _ { i } ^ { 1 }$ . The queried memory vector $o _ { 1 }$ is the weighted sum of memory vectors. The queried memory vector $o _ { 1 }$ will be added on top of original input, $u _ { 1 } = o _ { 1 } + u _ { 0 } . \ u$ $u _ { 1 }$ is then used to query the memory vector. Such a process is repeated by querying the memory $_ \mathrm { N }$ times (so called “hops”). $N$ is set to three in all experiments in this paper.
|
| 300 |
+
|
| 301 |
+
In the end, $u _ { N }$ is input to a softmax function for the final prediction:
|
| 302 |
+
|
| 303 |
+
$$
|
| 304 |
+
\boldsymbol { a } = \mathsf { s o f t m a x } ( u _ { N } ^ { T } y _ { 1 } , u _ { N } ^ { T } y _ { 2 } , . . . , u _ { N } ^ { T } y _ { L } )
|
| 305 |
+
$$
|
| 306 |
+
|
| 307 |
+
where $L$ denotes the number of candidate answers and $y$ denotes the representation of the answer. If the answer is a word, $y$ is the corresponding word embedding. If the answer is a sentence, $y$ is the embedding for the sentence achieved in the same way as we obtain embeddings for query $x$ and memory $c$ .
|
| 308 |
+
|
| 309 |
+
Reward Based Imitation (RBI) and Forward Prediction (FP) RBI and $F P$ are two dialogue learning strategies proposed in (Weston, 2016) by harnessing different types of dialogue signals. RBI handles the case where the reward or the correctness of a bot’s answer is explicitly given (for example, $+ 1$ if the bot’s answer is correct and 0 otherwise). The model is directly trained to predict the correct answers (with label 1) at training time, which can be done using End-to-End Memory Networks (MemN2N) (Sukhbaatar et al., 2015) that map a dialogue input to a prediction.
|
| 310 |
+
|
| 311 |
+
$F P$ handles the situation where a real-valued reward for a bot’s answer is not available, meaning that there is no $+ 1$ or 0 labels paired with a student’s utterance. However, the teacher will give a response to the bot’s answer, taking the form of a dialogue utterance. More formally, suppose that $x$ denotes the teacher’s question and $C { = } c _ { 1 }$ , $c _ { 2 }$ , ..., $c _ { N }$ denotes the dialogue history. In our $A Q$ settings, the bot will ask a question $a$ regarding the teacher’s question, denoted as $a \in \mathbb { A }$ , where A denotes the student’s question pool. The teacher will provide an utterance in response to the student question $a$ . In $F P$ , the model first maps the teacher’s initial question $x$ and dialogue history $C$ to vector representation $u$ using a memory network with multiple hops. Then the model will perform another hopof attention over all possible student’s questions in A, with an additional part that incorporates the information of which candidate (i.e., $a$ ) was actually selected in the dialogue:
|
| 312 |
+
|
| 313 |
+
$$
|
| 314 |
+
p _ { \hat { a } } = { \tt s o f t m a x } ( u ^ { T } y _ { \hat { a } } ) \quad o = \sum _ { \hat { a } \in \mathbb { A } } p _ { \hat { a } } ( y _ { \hat { a } } + \beta \cdot { \bf 1 } [ \hat { a } = a ] )
|
| 315 |
+
$$
|
| 316 |
+
|
| 317 |
+
where $y _ { \hat { a } }$ denotes the vector representation for the student’s question candidate $\hat { a }$ . $\beta$ is a ddimensional vector to signify the actual action $a$ that the student chooses. For tasks where the student only has one way to ask questions (e.g., “what do you mean”), there is no need to perform hops of attention over candidates since the cardinality of $\mathbb { A }$ is just 1. We thus directly assign a probability of 1 to the student’s question, making $o$ the sum of vector representation of $y _ { a }$ and $\beta$ .
|
| 318 |
+
|
| 319 |
+
$o$ is then combined with $u$ to predict the teacher’s feedback $t$ using a softmax:
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
\boldsymbol { u } _ { 1 } = o + \boldsymbol { u } \quad t = \mathrm { s o f t m a x } \big ( \boldsymbol { u } _ { 1 } ^ { T } x _ { r _ { 1 } } , \boldsymbol { u } _ { 1 } ^ { T } x _ { r _ { 2 } } , . . . , \boldsymbol { u } _ { 1 } ^ { T } x _ { r _ { N } } \big )
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
where $\boldsymbol { x } _ { r _ { i } }$ denotes the embedding for the $i ^ { t h }$ response.
|
| 326 |
+
|
| 327 |
+
Dialogue Simulator In this section we further detail the simulator and the datasets we generated in order to realize the various scenarios discussed in Section 3. We focused on the problem of movieQA where we adapted the WikiMovies dataset proposed in Weston et al. (2015). The dataset consists of roughly $1 0 0 \mathrm { k }$ questions with over $7 5 \mathrm { k }$ entities from the open movie dataset (OMDb).
|
| 328 |
+
|
| 329 |
+
Each dialogue generated by the simulator takes place between a student and a teacher. The simulator samples a random question from the WikiMovies dataset and fetches the set of all KB facts relevant to the chosen question. This question is assumed to be the one the teacher asks its student, and is referred to as the “original” question. The student is first presented with the relevant KB facts followed by the original question. Providing the KB facts to the student allows us to control the exact knowledge the student is given access to while answering the questions. At this point, depending on the task at hand and the student’s ability to answer, the student might choose to directly answer it or ask a “followup” question. The nature of the followup question will depend on the scenario under consideration. If the student answers the question, it gets a response from the teacher about its correctness and the conversation ends. However if the student poses a followup question, the teacher gives an appropriate response, which should give additional information to the student to answer the original question. In order to make things more complicated, the simulator pads the conversation with several unrelated student-teacher question-answer pairs. These question-answer pairs can be viewed as distractions and are used to test the student’s ability to remember the additional knowledge provided by the teacher after it was queried. For each dialogue, the simulator incorporates 5 such pairs (10 sentences). We refer to these pairs as conversational histories.
|
| 330 |
+
|
| 331 |
+
For the $Q A$ setting (see Section 3), the dialogues generated by the simulator are such that the student never asks a clarification question. Instead, it simply responds to the original question, even if it is wrong. For the dialogs in the $A Q$ setting, the student always asks a clarification question. The nature of the question asked is dependent on the scenario (whether it is Question Clarification, Knowledge Operation, or Knowledge Acquisition) under consideration. In order to simulate the case where the student sometimes choses to directly answer the original question and at other times choses to ask question, we created training datasets, which were a combination of $Q A$ and $A Q$ (called “Mixed”). For all these cases, the student needs to give an answer to the teacher’s original question at the end.
|
| 332 |
+
|
| 333 |
+
# Instructions given to Turkers
|
| 334 |
+
|
| 335 |
+
These are the instructions given for the textual feedback Mechanical Turk task (we also constructed a separate task to collect the questions to ask the bot with similar instructions, not described here):
|
| 336 |
+
|
| 337 |
+
Task 4 (answers to bot’s questions):
|
| 338 |
+
|
| 339 |
+
Title: Write brief responses to given dialogue exchanges (about $1 5 \mathrm { m i n }$ )
|
| 340 |
+
|
| 341 |
+
Description: Write a brief response answering a provided question (25 questions per HIT).
|
| 342 |
+
|
| 343 |
+
Directions:
|
| 344 |
+
|
| 345 |
+
Each task consists of the following triplets:
|
| 346 |
+
|
| 347 |
+
1) a question by the teacher
|
| 348 |
+
2) the correct answer(s) to the question (separated by “OR”), unknown to the student
|
| 349 |
+
3) a clarifying question asking for feedback from the teacher
|
| 350 |
+
|
| 351 |
+
Consider the scenario where you are the teacher and have already asked the question, and received the reply from the student. Please compose a brief response replying to the student’s question. The correct answers are provided so that you know whether the student’s question was relevant or not.
|
| 352 |
+
|
| 353 |
+
For example, given 1) question: “what is a color in the united states flag?”; 2) correct answer: “white OR blue OR red”; 3) student reply: “does this have to do with ‘US Flag has colors red,white,blue‘?”, your response could be something like “that’s right!”; for 3) reply: “does this have to do with ‘United States has population 320 million”, you might say “No, that fact is not relevant” or “Not really”.
|
| 354 |
+
|
| 355 |
+
Please vary responses and try to minimize spelling mistakes. If the same responses are copied/pasted or similar responses are overused, we’ll reject the HIT. Avoid naming the student or addressing “the class” directly. We will consider bonuses for higher quality responses during review.
|
| 356 |
+
|
| 357 |
+
Task 8: answers to bot’s questions:
|
| 358 |
+
|
| 359 |
+
Title: Write brief responses to given dialogue exchanges (about 10 min)
|
| 360 |
+
|
| 361 |
+
Description: Write a sentence describing the answer to a question (25 questions per HIT).
|
| 362 |
+
|
| 363 |
+
Directions:
|
| 364 |
+
|
| 365 |
+
Each task consists of the following triplets:
|
| 366 |
+
|
| 367 |
+
1) a question by the teacher
|
| 368 |
+
2) the correct answer(s) to the question (separated by “OR”), unknown to the student
|
| 369 |
+
3) a question from the student asking the teacher for the answer
|
| 370 |
+
|
| 371 |
+
Consider the scenario where you are the teacher and have already asked the question, and received the reply from the student. Please compose a brief response replying to the student’s question. The correct answers are provided so that you know which answers to provide.
|
| 372 |
+
|
| 373 |
+
For example, given 1) question: “what is a color in the united states flag?”; 2) correct answer: “white OR blue OR red”; 3) student reply: “i dont know. what’s the answer ?”, your response could be something like “the color white is in the US flag” or “blue and red both appear in it”.
|
| 374 |
+
|
| 375 |
+
Please vary responses and try to minimize spelling mistakes, and do not include the capitalized “OR” in your response. If the same responses are copied/pasted or similar responses are overused, we’ll reject the HIT. You don’t need to mention every correct answer in your response. Avoid naming the student or addressing “the class” directly. We will consider bonuses for higher quality responses during review.
|
| 376 |
+
|
| 377 |
+
# Additional Mechanical Turk Experiments
|
| 378 |
+
|
| 379 |
+
Here we provide additional experiments to supplement the ones described in Section 6.2. In the main paper, results were shown when training and testing on the collected Mechanical Turk data (around 10,000 episodes of training dialogues for training). As we collected the data in the same settings as Task 4 and 8 of our simulator, we could also consider supplementing training with simulated data as well, of which we have a larger amount (over 100,000 episodes). Note this is only for training, we will still test on the real (Mechanical Turk collected) data. Although the simulated data has less lexical variety as it is built from templates, the larger size might obtain improve results.
|
| 380 |
+
|
| 381 |
+
Results are given Table 5 when training on the combination of real and simulator data, and testing on real data. This should be compared to training on only the real data (Table 4) and only on the simulator data (Table 6). The best results are obtained from the combination of simulator and real data. The best real data only results (selecting over algorithm and training strategy) on both tasks outperform the best results using simulator data, i.e. using Cont-MemN2N with the Train AQ / TestAQ setting) 0.774 and 0.797 is obtained vs. 0.714 and 0.788 for Tasks 4 and 8 respectively. This is despite there being far fewer examples of real data compared to simulator data. Overall we obtain two main conclusions from this additional experiment: (i) real data is indeed measurably superior to simulated data for training our models; (ii) in all cases (across different algorithms, tasks and data types – be they real data, simulated data or combinations) the bot asking questions (AQ) outperforms it only answering questions and not asking them (QA). The latter reinforces the main result of the paper.
|
| 382 |
+
|
| 383 |
+
Table 4: Mechanical Turk Task Results, using real data for training and testing.
|
| 384 |
+
|
| 385 |
+
<table><tr><td></td><td colspan="4">vanilla-MemN2N</td><td colspan="3">Cont-MemN2N</td></tr><tr><td></td><td colspan="2">Task 4:K.Verification</td><td colspan="2">Task 8: Triple</td><td>Task 4:K.Verification</td><td colspan="2">Task 8:Triple</td></tr><tr><td>Train\Test</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td></tr><tr><td>TrainQA</td><td>0.331</td><td>0.313</td><td>0.133</td><td>0.162</td><td>0.712 0.703</td><td>0.308</td><td>0.234</td></tr><tr><td>TrainAQ</td><td>0.318</td><td>0.375</td><td>0.072</td><td>0.422</td><td>0.679 0.774</td><td>0.137</td><td>0.797</td></tr></table>
|
| 386 |
+
|
| 387 |
+
<table><tr><td></td><td colspan="4">vanilla-MemN2N</td><td colspan="4">Cont-MemN2N</td></tr><tr><td></td><td colspan="2">Task 4:K.Verification</td><td colspan="2">Task 8: Triple</td><td colspan="2">Task 4:K.Verification</td><td colspan="2">Task 8: Triple</td></tr><tr><td>Train\Test</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td></tr><tr><td>TrainQA</td><td>0.356</td><td>0.311</td><td>0.128</td><td>0.174</td><td>0.733</td><td>0.717</td><td>0.368</td><td>0.352</td></tr><tr><td>TrainAQ</td><td>0.340</td><td>0.445</td><td>0.150</td><td>0.487</td><td>0.704</td><td>0.792</td><td>0.251</td><td>0.825</td></tr></table>
|
| 388 |
+
|
| 389 |
+
Table 5: Results on Mechanical Turk Tasks using a combination of real and simulated data for training, testing on real data.
|
| 390 |
+
|
| 391 |
+
Table 6: Results on Mechanical Turk Tasks using only simulated data for training, but testing on real data.
|
| 392 |
+
|
| 393 |
+
<table><tr><td></td><td colspan="4">vanilla-MemN2N</td><td colspan="3">Cont-MemN2N</td></tr><tr><td></td><td colspan="2">Task4:K.Verification</td><td colspan="2">Task 8: Triple</td><td>Task4:K.Verification</td><td colspan="2">Task 8:Triple</td></tr><tr><td>TrainTest</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA TestAQ</td><td>TestQA</td><td>TestAQ</td></tr><tr><td>TrainQA</td><td>0.340</td><td>0.311</td><td>0.120</td><td>0.165</td><td>0.665 0.648</td><td>0.349</td><td>0.342</td></tr><tr><td>TrainAQ</td><td>0.326</td><td>0.390</td><td>0.067</td><td>0.405</td><td>0.642 0.714</td><td>0.197</td><td>0.788</td></tr></table>
|
| 394 |
+
|
| 395 |
+
Additional Offline Supervised Learning Experiments
|
| 396 |
+
|
| 397 |
+
<table><tr><td></td><td colspan="4">Question Clarification</td><td colspan="4">Knowledge Operation</td><td rowspan="3"></td></tr><tr><td></td><td colspan="2">Task1:Q.Paraphrase</td><td colspan="2">Task 2:Q.Verification</td><td colspan="2">Task3:AskForRelevantK.</td><td colspan="2">Task4:K.Verification</td></tr><tr><td>TrainTest</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td></tr><tr><td>TrainQA</td><td>0.338</td><td>0.284</td><td>0.340</td><td>0.271 0.373</td><td>0.462</td><td>0.344</td><td>0.482</td><td>0.322</td></tr><tr><td>TrainAQ</td><td>0.213</td><td>0.450</td><td>0.225</td><td></td><td>0.187 0.632 0.342</td><td></td><td>0.283</td><td>0.540</td></tr><tr><td>TrainAQ(+FP) TrainMix</td><td>0.288 0.326</td><td>0.464</td><td>0.146</td><td>0.320</td><td>0.631</td><td></td><td>0.311</td><td>0.524</td></tr><tr><td></td><td>0.373</td><td></td><td>0.329</td><td>0.326</td><td>0.442</td><td>0.558</td><td>0.476</td><td>0.491</td></tr><tr><td colspan="9">Knowledge Acquisition</td></tr><tr><td>TrainTest</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td><td>TestQA</td><td>TestAQ</td></tr><tr><td></td><td>Task 5:Q.Entity</td><td></td><td>Task 6: Answer Entity</td><td></td><td>Task 7: Relation Entity</td><td>Task 8: Triple</td><td></td><td></td><td>Task 9:Everything</td></tr><tr><td>TrainQA (vanila)</td><td><0.01</td><td>0.223</td><td><0.01</td><td><0.01</td><td>0.109 0.129</td><td>0.201</td><td>0.259</td><td><0.01</td><td><0.01</td></tr><tr><td>TrainAQ (vanila)</td><td><0.01</td><td>0.660</td><td><0.01</td><td><0.01</td><td>0.082 0.156</td><td>0.124</td><td>0.664</td><td><0.01</td><td><0.01</td></tr><tr><td>TrainAQ(+FP)</td><td><0.01</td><td>0.742</td><td><0.01</td><td><0.01</td><td>0.085 0.188 0.152</td><td>0.064 0.180</td><td>0.702 0.572</td><td><0.01 <0.01</td><td><0.01</td></tr><tr><td>Mix (vanila)</td><td><0.01</td><td>0.630</td><td><0.01</td><td><0.01</td><td>0.070</td><td></td><td></td><td></td><td><0.01</td></tr></table>
|
| 398 |
+
|
| 399 |
+
Table 7: Results for offline settings using memory networks.
|
| 400 |
+
Table 8: Results for TestModelAQ settings.
|
| 401 |
+
|
| 402 |
+
<table><tr><td></td><td>Question Clarification</td><td>Knowledge Acquisition</td></tr><tr><td></td><td>Task 2:Q.Verification</td><td>Task4:K.Verification</td></tr><tr><td></td><td>TestModelAQ</td><td>TestModelAQ</td></tr><tr><td>TrainAQ</td><td>0.382</td><td>0.480</td></tr><tr><td>TrainAQ(+FP)</td><td>0.344</td><td>0.501</td></tr><tr><td>TrainMix</td><td>0.352</td><td>0.469</td></tr></table>
|
md/train/rkEFLFqee/rkEFLFqee.md
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DECOMPOSING MOTION AND CONTENT FOR NATURAL VIDEO SEQUENCE PREDICTION
|
| 2 |
+
|
| 3 |
+
Ruben Villegas1 Jimei Yang2 Seunghoon Hong3,∗ Xunyu Lin4,\* Honglak Lee1,5
|
| 4 |
+
|
| 5 |
+
1University of Michigan, Ann Arbor, USA
|
| 6 |
+
2Adobe Research, San Jose, CA 95110
|
| 7 |
+
3POSTECH, Pohang, Korea
|
| 8 |
+
4Beihang University, Beijing, China
|
| 9 |
+
5Google Brain, Mountain View, CA 94043
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
We propose a deep neural network for the prediction of future frames in natural video sequences. To effectively handle complex evolution of pixels in videos, we propose to decompose the motion and content, two key components generating dynamics in videos. Our model is built upon the Encoder-Decoder Convolutional Neural Network and Convolutional LSTM for pixel-level prediction, which independently capture the spatial layout of an image and the corresponding temporal dynamics. By independently modeling motion and content, predicting the next frame reduces to converting the extracted content features into the next frame content by the identified motion features, which simplifies the task of prediction. Our model is end-to-end trainable over multiple time steps, and naturally learns to decompose motion and content without separate training. We evaluate the proposed network architecture on human activity videos using KTH, Weizmann action, and UCF-101 datasets. We show state-of-the-art performance in comparison to recent approaches. To the best of our knowledge, this is the first end-to-end trainable network architecture with motion and content separation to model the spatio-temporal dynamics for pixel-level future prediction in natural videos.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Understanding videos has been one of the most important tasks in the field of computer vision. Compared to still images, the temporal component of videos provides much richer descriptions of the visual world, such as interaction between objects, human activities, and so on. Amongst the various tasks applicable on videos, the task of anticipating the future has recently received increased attention in the research community. Most prior works in this direction focus on predicting high-level semantics in a video such as action (Vondrick et al., 2015; Ryoo, 2011; Lan et al., 2014), event (Yuen and Torralba, 2010; Hoai and Torre, 2013) and motion (Pintea et al., 2014; Walker et al., 2014; Pickup et al., 2014; Walker et al., 2016). Forecasting semantics provides information about what will happen in a video, and is essential to automate decision making. However, the predicted semantics are often specific to a particular task and provide only a partial description of the future. Also, training such models often requires heavily labeled training data which leads to tremendous annotation costs especially with videos.
|
| 18 |
+
|
| 19 |
+
In this work, we aim to address the problem of prediction of future frames in natural video sequences. Pixel-level predictions provide dense and direct description of the visual world, and existing video recognition models can be adopted on top of the predicted frames to infer various semantics of the future. Spatio-temporal correlations in videos provide a self-supervision for frame prediction, which enables purely unsupervised training of a model by observing raw video frames. Unfortunately, estimating frames is an extremely challenging task; not only because of the inherent uncertainty of the future, but also various factors of variation in videos leading to complicated dynamics in raw pixel values. There have been a number of recent attempts on frame prediction (Srivastava et al., 2015; Mathieu et al., 2015; Oh et al., 2015; Goroshin et al., 2015; Lotter et al., 2015; Ranzato et al., 2014), which use a single encoder that needs to reason about all the different variations occurring in videos in order to make predictions of the future, or require extra information like foreground-background segmentation masks and static background (Vondrick et al., 2016).
|
| 20 |
+
|
| 21 |
+
We propose a Motion-Content Network (MCnet) for robust future frame prediction. Our intuition is to split the inputs for video prediction into two easily identifiable groups, motion and content, and independently capture each information stream with separate encoder pathways. In this architecture, the motion pathway encodes the local dynamics of spatial regions, while the content pathway encodes the spatial layout of the salient parts of an image. The prediction of the future frame is then achieved by transforming the content of the last observed frame given the identified dynamics up to the last observation. Somewhat surprisingly, we show that such a network is end-to-end trainable without individual path way supervision. Specifically, we show that an asymmetric architecture for the two pathways enables such decompositions without explicit supervision. The contributions of this paper are summarized below:
|
| 22 |
+
|
| 23 |
+
• We propose MCnet for the task of frame prediction, which separates the information streams (motion and content) into different encoder pathways.
|
| 24 |
+
• The proposed network is end-to-end trainable and naturally learns to decompose motion and content without separate training, and reduces the task of frame prediction to transforming the last observed frame into the next by the observed motion.
|
| 25 |
+
• We evaluate the proposed model on challenging real-world video datasets, and show that it outperforms previous approaches on frame prediction.
|
| 26 |
+
|
| 27 |
+
The rest of the paper is organized as follows. We briefly review related work in Section 2, and introduce an overview of the proposed algorithm in Section 3. The detailed configuration of the proposed network is described in Section 4. Section 5 describes training and inference procedure. Section 6 illustrates implementation details and experimental results on challenging benchmarks.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
The problem of visual future prediction has received growing interests in the computer vision community. It has led to various tasks depending on the objective of future prediction, such as human activity (Vondrick et al., 2015; Ryoo, 2011; Lan et al., 2014), event (Yuen and Torralba, 2010; Hoai and Torre, 2013) and geometric path (Walker et al., 2014). Although previous work achieved reasonable success in specific tasks, they are often limited to estimating predefined semantics, and require fully-labeled training data. To alleviate this issue, approaches predicting representation of the future beyond semantic labels have been proposed. Walker et al. (2014) proposed a data-driven approach to predict the motion of a moving object, and coarse hallucination of the predicted motion. Vondrick et al. (2015) proposed a deep regression network to predict feature representations of the future frames. These approaches are supervised and provide coarse predictions of how the future will look like. Our work also focuses on unsupervised learning for prediction of the future, but to a more direct visual prediction task: frame prediction.
|
| 32 |
+
|
| 33 |
+
Compared to predicting semantics, pixel-level prediction has been less investigated due to the difficulties in modeling evolution of raw pixels over time. Fortunately, recent advances in deep learning provide a powerful tool for sequence modeling, and enable the creation of novel architectures for modeling complex sequential data. Ranzato et al. (2014) applied a recurrent neural network developed for language modeling to frame prediction by posing the task as classification of each image region to one of quantized patch dictionaries. Srivastava et al. (2015) applied a sequence-tosequence model to video prediction, and showed that Long Short-Term Memory (LSTM) is able to capture pixel dynamics. Oh et al. (2015) proposed an action-conditional encoder-decoder network to predict future frames in Atari games. In addition to the different choices of architecture, some other works addressed the importance of selecting right objective function: Lotter et al. (2015) used adversarial loss with combined CNN and LSTM architectures, and Mathieu et al. (2015) employed similar adversarial loss with additional regularization using a multi-scale encoder-decoder network. Finn et al. (2016) constructed a network that predicts transformations on the input pixels for next frame prediction. Patraucean et al. (2015) proposed a network that by explicitly predicting optical flow features is able to predict the next frame in a video. Vondrick et al. (2016) proposed a generative adversarial network for video which, by generating a background-foreground mask, is able to generate realistic-looking video sequences. However, none of the previously mentioned approaches exploit spatial and temporal information separately in an unsupervised fashion. In terms of the way data is observed, the closest work to ours is Xue et al. (2016). The differences are (1) Our model is deterministic and theirs is probabilistic, (2) our motion encoder is based on convolutional LSTM (Shi et al., 2015) which is a more natural module to model long-term dynamics, (3) our content encoder observes a single scale input and theirs observes many scales, and (4) we directly generate image pixels values, which is a more complicated task. We aim to exploit the existing spatio-temporal correlations in videos by decomposing the motion and content in our network architecture.
|
| 34 |
+
|
| 35 |
+
To the best of our knowledge, the idea of separating motion and content has not been investigated in the task of unsupervised deterministic frame prediction. The proposed architecture shares similarities to the two-stream CNN (Simonyan and Zisserman, 2014), which is designed for action recognition to jointly exploit the information from frames and their temporal dynamics. However, in contrast to their network we aim to learn features for temporal dynamics directly from the raw pixels, and we use the identified features from the motion in combination with spatial features to make pixel-level predictions of the future.
|
| 36 |
+
|
| 37 |
+
# 3 ALGORITHM OVERVIEW
|
| 38 |
+
|
| 39 |
+
In this section, we formally define the task of frame prediction and the role of each component in the proposed architecture. Let ${ \bf x } _ { t } \in \mathrm { R } ^ { w \times h \times c }$ denote the $t$ -th frame in an input video $\mathbf { x }$ , where $w , h$ , and $c$ denote width, height, and number of channels, respectively. The objective of frame prediction is to generate the future frame $\hat { \mathbf { x } } _ { t + 1 }$ given the input frames $\mathbf { x } _ { 1 : t }$ .
|
| 40 |
+
|
| 41 |
+
At the $t { \cdot }$ -th time step, our network observes a history of previous consecutive frames up to frame $t$ and generates the prediction of the next frame $\hat { \mathbf { x } } _ { t + 1 }$ as follows:
|
| 42 |
+
|
| 43 |
+
• Motion Encoder recurrently takes an image difference input between frame $\mathbf { x } _ { t }$ and $\mathbf { x } _ { t - 1 }$ starting from $t = 2$ , and produces the hidden representation $\mathbf { d } _ { t }$ encoding the temporal dynamics of the scene components (Section 4.1).
|
| 44 |
+
Content Encoder takes the last observed frame $\mathbf { x } _ { t }$ as an input, and outputs the hidden representation $\mathbf { s } _ { t }$ that encodes the spatial layout of the scene (Section 4.2).
|
| 45 |
+
Multi-Scale Motion-Content Residual takes the computed features, from both the motion and content encoders, at every scale right before pooling and computes residuals $\mathbf { r } _ { t }$ (He et al., 2015) to aid the information loss caused by pooling in the encoding phase (Section 4.3).
|
| 46 |
+
Combination Layers and Decoder takes the outputs from both encoder pathways and residual connections, $\mathbf { d } _ { t }$ , $\mathbf { s } _ { t }$ , and $\mathbf { r } _ { t }$ , and combines them to produce a pixel-level prediction of the next frame $\hat { \mathbf { x } } _ { t + 1 }$ (Section 4.4).
|
| 47 |
+
|
| 48 |
+
The overall architecture of the proposed algorithm is described in Figure 1. The prediction of multiple frames, $\hat { \mathbf { x } } _ { t + 1 : t + T }$ , can be achieved by recursively performing the above procedures over $T$ time steps (Section 5). Each component in the proposed architecture is described in the following section.
|
| 49 |
+
|
| 50 |
+
# 4 ARCHITECTURE
|
| 51 |
+
|
| 52 |
+
This section describes the detailed configuration of the proposed architecture, including the two encoder pathways, multi-scale residual connections, combination layers, and decoder.
|
| 53 |
+
|
| 54 |
+
# 4.1 MOTION ENCODER
|
| 55 |
+
|
| 56 |
+
The motion encoder captures the temporal dynamics of the scene’s components by recurrently observing subsequent difference images computed from $\mathbf { x } _ { t - 1 }$ and $\mathbf { x } _ { t }$ , and outputs motion features by
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\left[ \mathbf { d } _ { t } , \mathbf { c } _ { t } \right] = f ^ { \mathrm { d y n } } \left( \mathbf { x } _ { t } - \mathbf { x } _ { t - 1 } , \mathbf { d } _ { t - 1 } , \mathbf { c } _ { t - 1 } \right) ,
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where ${ \bf x } _ { t } - { \bf x } _ { t - 1 }$ denotes element-wise subtraction between frames at time $t$ and $t - 1$ , $\mathbf { d } _ { t } \in \mathbb { R } ^ { w ^ { \prime } \times h ^ { \prime } \times c ^ { \prime } }$ is the feature tensor encoding the motion across the observed difference image inputs, and $\mathbf { c } _ { t } ~ \in$ $\mathbb { R } ^ { w ^ { \prime } \times h ^ { \prime } \times c ^ { \prime } }$ is a memory cell that retains information of the dynamics observed through time. $f ^ { \mathrm { d y n } }$ is implemented in a fully-convolutional way to allow our model to identify local dynamics of frames rather than complicated global motion. For this, we use an encoder CNN with a Convolutional LSTM (Shi et al., 2015) layer on top.
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
Figure 1: Overall architecture of the proposed network. (a) illustrates MCnet without the MotionContent Residual skip connections, and (b) illustrates MCnet with such connections. Our network observes a history of image differences through the motion encoder and last observed image through the content encoder. Subsequently, our network proceeds to compute motion-content features and communicates them to the decoder for the prediction of the next frame.
|
| 66 |
+
|
| 67 |
+
# 4.2 CONTENT ENCODER
|
| 68 |
+
|
| 69 |
+
The content encoder extracts important spatial features from a single frame, such as the spatial layout 64 64 64 64of the scene and salient objects in a video. Specifically, it takes the last observed frame $\mathbf { x } _ { t }$ as an input, and produces content features by
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
{ \bf s } _ { t } = f ^ { \mathrm { c o n t } } \left( { \bf x } _ { t } \right) ,
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where $\mathbf { s } _ { t } \in \mathbb { R } ^ { w ^ { \prime } \times h ^ { \prime } \times c ^ { \prime } }$ is the feature encoding the spatial content of the last observed frame, and $f ^ { \mathrm { c o n t } }$ is implemented by a Convolutional Neural Network (CNN) that specializes on extracting features from single frame.
|
| 76 |
+
|
| 77 |
+
It is important to note that our model employs an asymmetric architecture for the motion and content encoder. The content encoder takes the last observed frame, which keeps the most critical clue to reconstruct spatial layout of near future, but has no information about dynamics. On the other hand, the motion encoder takes a history of previous image differences, which are less informative about the future spatial layout compared to the last observed frame, yet contain important spatio-temporal variations occurring over time. This asymmetric architecture encourages encoders to exploit each of two pieces of critical information to predict the future content and motion individually, and enables the model to learn motion and content decomposition naturally without any supervision.
|
| 78 |
+
|
| 79 |
+
# 4.3 MULTI-SCALE MOTION-CONTENT RESIDUAL
|
| 80 |
+
|
| 81 |
+
To prevent information loss after the pooling operations in our motion and content encoders, we use residual connections (He et al., 2015). The residual connections in our network communicate motion-content features at every scale into the decoder layers after unpooling operations. The residual feature at layer $l$ is computed by
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\mathbf { r } _ { t } ^ { l } = f ^ { \mathrm { r e s } } \left( \left[ \mathbf { s } _ { t } ^ { l } , \mathbf { d } _ { t } ^ { l } \right] \right) ^ { l } ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $\mathbf { r } _ { t } ^ { l }$ is the residual output at layer $l$ , $\left[ \mathbf { s } _ { t } ^ { l } , \mathbf { d } _ { t } ^ { l } \right]$ is the concatenation of the motion and content features along the depth dimension at layer $l$ of their respective encoders, $f ^ { \mathrm { r e s } } \left( . \right) ^ { l }$ the residual function at layer $l$ implemented as consecutive convolution layers and rectification with a final linear layer.
|
| 88 |
+
|
| 89 |
+
# 4.4 COMBINATION LAYERS AND DECODER
|
| 90 |
+
|
| 91 |
+
The outputs from the two encoder pathways, $\mathbf { d } _ { t }$ and $\mathbf { s } _ { t }$ , encode a high-level representation of motion and content, respectively. Given these representations, the objective of the decoder is to generate a
|
| 92 |
+
|
| 93 |
+
pixel-level prediction of the next frame $\hat { \mathbf { x } } _ { t + 1 } \in \mathbb { R } ^ { w \times h \times c }$ . To this end, it first combines the motion and content back into a unified representation by
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\mathbf { f } _ { t } = g ^ { \mathrm { c o m b } } \left( \left[ \mathbf { d } _ { t } , \mathbf { s } _ { t } \right] \right) ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $[ \mathbf { d } _ { t } , \mathbf { s } _ { t } ] \in \mathbb { R } ^ { w ^ { \prime } \times h ^ { \prime } \times 2 c ^ { \prime } }$ denotes the concatenation of the higher-level motion and content features in the depth dimension, and $\mathbf { f } _ { t } \in \mathbb { R } ^ { w ^ { \prime } \times h ^ { \prime } \times c ^ { \prime } }$ denotes the combined high-level representation of motion and content. $g ^ { \mathrm { c o m b } }$ is implemented by a CNN with bottleneck layers (Hinton and Salakhutdinov, 2006); it first projects both $\mathbf { d } _ { t }$ and $\mathbf { s } _ { t }$ into a lower-dimensional embedding space, and then puts it back to the original size to construct the combined feature $\mathbf { f } _ { t }$ . Intuitively, $\mathbf { f } _ { t }$ can be viewed as the content feature of the next time step, $\mathbf { s } _ { t + 1 }$ , which is generated by transforming $\mathbf { s } _ { t }$ using the observed dynamics encoded in $\mathbf { d } _ { t }$ . Then our decoder places $\mathbf { f } _ { t }$ back into the original pixel space by
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\begin{array} { r } { \hat { \mathbf { x } } _ { t + 1 } = g ^ { \mathrm { d e c } } \left( \mathbf { f } _ { t } , \mathbf { r } _ { t } \right) , } \end{array}
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
where $\mathbf { r } _ { t }$ is a list containing the residual connections from every layer of the motion and content encoders before pooling sent to every layer of the decoder after unpooling. We employ the deconvolution network (Zeiler et al., 2011) for our decoder network $g ^ { \mathrm { d e c } }$ , which is composed of multiple successive operations of deconvolution, rectification and unpooling with the addition of the motioncontent residual connections after each unpooling operation. The output layer is passed through a tanh (.) activation function. Unpooling with fixed switches are used to upsample the intermediate activation maps.
|
| 106 |
+
|
| 107 |
+
# 5 INFERENCE AND TRAINING
|
| 108 |
+
|
| 109 |
+
Section 4 describes the procedures for single frame prediction, while this section presents the extension of our algorithm for the prediction of multiple time steps.
|
| 110 |
+
|
| 111 |
+
# 5.1 MULTI-STEP PREDICTION
|
| 112 |
+
|
| 113 |
+
Given an input video, our network observes the first $n$ frames as image difference between frame $\mathbf { x } _ { t }$ and $\mathbf { x } _ { t - 1 }$ , starting from $t = 2$ up to $t = n$ , to encode initial temporal dynamics through the motion encoder. The last frame ${ \bf x } _ { n }$ is given to the content encoder to be transformed into the first prediction $\hat { \mathbf { x } } _ { t + 1 }$ by the identified motion features.
|
| 114 |
+
|
| 115 |
+
For each time step $t \in [ n + 1 , n + T ]$ , where $T$ is the desired number of prediction steps, our network takes the difference image between the first prediction $\hat { \mathbf { x } } _ { t + 1 }$ and the previous image $\mathbf { x } _ { t }$ , and the first prediction $\hat { \mathbf { x } } _ { t + 1 }$ itself to predict the next frame $\hat { \mathbf { x } } _ { t + 2 }$ , and so forth.
|
| 116 |
+
|
| 117 |
+
# 5.2 TRAINING OBJECTIVE
|
| 118 |
+
|
| 119 |
+
To train our network, we use an objective fMathieu et al. (2015). Given the training data $D = \{ \mathbf { x } _ { 1 , . . . , T } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ of different sub-losses similar to, our model is trained to minimize
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { \mathcal { L } = \alpha \mathcal { L } _ { \mathrm { i m g } } + \beta \mathcal { L } _ { \mathrm { G A N } } , } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\alpha$ and $\beta$ are hyper-parameters that control the effect of each sub-loss during optimization. $\mathcal { L } _ { \mathrm { i m g } }$ is the loss in image space from Mathieu et al. (2015) defined by
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\begin{array} { r } { \mathcal { L } _ { \mathrm { i m g } } = \mathcal { L } _ { p } \left( \mathbf { x } _ { t + k } , \hat { \mathbf { x } } _ { t + k } \right) + \mathcal { L } _ { g d l } \left( \mathbf { x } _ { t + k } , \hat { \mathbf { x } } _ { t + k } \right) , } \end{array}
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
$$
|
| 132 |
+
\begin{array} { l } { { \displaystyle \mathcal { L } _ { p } \left( { \bf y } , { \bf z } \right) = \sum _ { k = 1 } ^ { T } \left| \left| { \bf y } - { \bf z } \right| \right| _ { p } ^ { p } } , \ ~ } \\ { { \displaystyle \mathcal { L } _ { g d l } \left( { \bf y } , { \bf z } \right) = \sum _ { i , j } ^ { h , w } \left| \left( \left| { \bf y } _ { i , j } - { \bf y } _ { i - 1 , j } \right| - \left| { \bf z } _ { i , j } - { \bf z } _ { i - 1 , j } \right| \right) \right| ^ { \lambda } } } \\ { { \displaystyle ~ + \left| \left( \left| { \bf y } _ { i , j - 1 } - { \bf y } _ { i , j } \right| - \left| { \bf z } _ { i , j - 1 } - { \bf z } _ { i , j } \right| \right) \right| ^ { \lambda } } . } \end{array}
|
| 133 |
+
$$
|
| 134 |
+
|
| 135 |
+
Here, $\mathbf { x } _ { t + k }$ and $\hat { \mathbf { x } } _ { t + k }$ are the target and predicted frames, respectively, and $p$ and $\lambda$ are hyperparameters for ${ \mathcal { L } } _ { p }$ and $\mathcal { L } _ { g d l }$ , respectively. Intuitively, ${ \mathcal { L } } _ { p }$ guides our network to match the average pixel values directly, while $\mathcal { L } _ { g d l }$ guides our network to match the gradients of such pixel values. Overall, $\mathcal { L } _ { \mathrm { i m g } }$ guides our network to learn parameters towards generating the correct average sequence given the input. Training to generate average sequences, however, results in somewhat blurry generations which is the reason we use an additional sub-loss. ${ \mathcal { L } } _ { \mathrm { G A N } }$ is the generator loss in adversarial training to allow our model to predict realistic looking frames and it is defined by
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
\mathcal { L } _ { \mathrm { G A N } } = - \log D \left( \left[ \mathbf { x } _ { 1 : t } , G \left( \mathbf { x } _ { 1 : t } \right) \right] \right) ,
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
where $\mathbf { x } _ { 1 : t }$ is the concatenation of the input images, $\mathbf { x } _ { t + 1 : t + T }$ is the concatenation of the ground-truth future images, $G \left( \mathbf { x } _ { 1 : t } \right) = \hat { \mathbf { x } } _ { t + 1 : t + T }$ is the concatenation of all predicted images along the depth dimension, and $D \left( . \right)$ is the discriminator in adversarial training. The discriminative loss in adversarial training is defined by
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\begin{array} { r } { \mathcal { L } _ { \mathrm { d i s c } } = - \log D \left( \left[ \mathbf { x } _ { 1 : t } , \mathbf { x } _ { t + 1 : t + T } \right] \right) - \log \left( 1 - D \left( \left[ \mathbf { x } _ { 1 : t } , G \left( \mathbf { x } _ { 1 : t } \right) \right] \right) \right) . } \end{array}
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
${ \mathcal { L } } _ { \mathrm { G A N } }$ , in addition to $\mathcal { L } _ { \mathrm { i m g } }$ , allows our network to not only generate the target sequence, but also simultaneously enforce realism in the images through visual sharpness that fools the human eye. Note that our model uses its predictions as input for the next time-step during the training, which enables the gradients to flow through time and makes the network robust for error propagation during prediction. For more a detailed description about adversarial training, please refer to Appendix D.
|
| 148 |
+
|
| 149 |
+
# 6 EXPERIMENTS
|
| 150 |
+
|
| 151 |
+
In this section, we present experiments using our network for video generation. We first evaluate our network, MCnet, on the KTH (Schuldt et al., 2004) and Weizmann action (Gorelick et al., 2007) datasets, and compare against a baseline convolutional LSTM (ConvLSTM) (Shi et al., 2015). We then proceed to evaluate on the more challenging UCF-101 (Soomro et al., 2012) dataset, in which we compare against the same ConvLSTM baseline and also the current state-of-the-art method by Mathieu et al. (2015). For all our experiments, we use $\alpha = 1$ , $\lambda = 1$ , and $p = 2$ in the loss functions.
|
| 152 |
+
|
| 153 |
+
In addition to the results in this section, we also provide more qualitative comparisons in the supplementary material and in the videos on the project website: https://sites.google. com/a/umich.edu/rubenevillegas/iclr2017.
|
| 154 |
+
|
| 155 |
+
Architectures. The content encoder of MCnet is built with the same architecture as VGG16 (Simonyan and Zisserman, 2015) up to the third pooling layer. The motion encoder of MCnet is also similar to VGG16 up to the third pooling layer, except that we replace its consecutive 3x3 convolutions with single 5x5, 5x5, and $7 \mathrm { x } 7 $ convolutions in each layer. The combination layers are composed of 3 consecutive 3x3 convolutions (256, 128, and 256 channels in each layer). The multi-scale residuals are composed of 2 consecutive 3x3 convolutions. The decoder is the mirrored architecture of the content encoder where we perform unpooling followed by deconvolution. For the baseline ConvLSTM, we use the same architecture as the motion encoder, residual connections, and decoder, except we increase the number of channels in the encoder in order to have an overall comparable number of parameters with MCnet.
|
| 156 |
+
|
| 157 |
+
# 6.1 KTH AND WEIZMANN ACTION DATASETS
|
| 158 |
+
|
| 159 |
+
Experimental settings. The KTH human action dataset (Schuldt et al., 2004) contains 6 categories of periodic motions on a simple background: running, jogging, walking, boxing, hand-clapping and hand-waiving. We use person 1-16 for training and 17-25 for testing, and also resize frames to $1 2 8 \mathrm { x } 1 2 8$ pixels. We train our network and baseline by observing 10 frames and predicting 10 frames into the future on the KTH dataset. We set $\beta = 0 . 0 2$ for training. We also select the walking, running, one-hand waving, and two-hands waving sequences from the Weizmann action dataset (Gorelick et al., 2007) for testing the networks’ generalizability.
|
| 160 |
+
|
| 161 |
+
For all the experiments, we test the networks on predicting 20 time steps into the future. As for evaluation, we use the same SSIM and PSNR metrics as in Mathieu et al. (2015). The evaluation on KTH was performed on sub-clips within each video in the testset. We sample sub-clips every 3 frames for running and jogging, and sample sub-clips every 20 frames (skipping the frames we have already predicted) for walking, boxing, hand-clapping, and hand-waving. Sub-clips for running, jogging, and walking were manually trimmed to ensure humans are always present in the frames. The evaluation on Weizmann was performed on all sub-clips in the selected sequences.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 2: Quantitative comparison between MCnet and ConvLSTM baseline with and without multiscale residual connections (indicated by $" +$ RES"). Given 10 input frames, the models predict 20 frames recursively, one by one. Left column: evaluation on KTH dataset (Schuldt et al., 2004). Right colum: evaluation on Weizmann (Gorelick et al., 2007) dataset.
|
| 165 |
+
|
| 166 |
+
Results. Figure 2 summarizes the quantitative comparisons among our MCnet, ConvLSTM baseline and their residual variations. In the KTH test set, our network outperforms the ConvLSTM baseline by a small margin. However, when we test the residual versions of MCnet and ConvLSTM on the dataset (Gorelick et al., 2007) with similar motions, we can see that our network can generalize well to the unseen contents by showing clear improvements, especially in long-term prediction. One reason for this result is that the test and training partitions of the KTH dataset have simple and similar image contents so that ConvLSTM can memorize the average background and human appearance to make reasonable predictions. However, when tested on unseen data, ConvLSTM has to internally take care of both scene dynamics and image contents in a mingled representation, which gives it a hard time for generalization. In contrast, the reason our network outperforms the ConvLSTM baseline on unseen data is that our network focuses on identifying general motion features and applying them to a learned content representation.
|
| 167 |
+
|
| 168 |
+
Figure 3 presents qualitative results of multi-step prediction by our network and ConvLSTM. As expected, prediction results by our full architecture preserves human shapes more accurately than the baseline. It is worth noticing that our network produces very sharp prediction over long-term time steps; it shows that MCnet is able to capture periodic motion cycles, which reduces the uncertainty of future prediction significantly. More qualitative comparisons are shown in the supplementary material and the project website.
|
| 169 |
+
|
| 170 |
+
# 6.2 UCF-101 DATASET
|
| 171 |
+
|
| 172 |
+
Experimental settings. This section presents results on the challenging real-world videos in the UCF-101 (Soomro et al., 2012) dataset. Having collected from YouTube, the dataset contains 101 realistic human actions taken in a wild and exhibits various challenges, such as background clutter, occlusion, and complicated motion. We employed the same network architecture as in the KTH dataset, but resized frames to $2 4 0 \mathrm { x } 3 2 0$ pixels, and trained the network to observe 4 frames and predict a single frame. We set $\beta = 0 . 0 0 1$ for training. We also trained our convolutional LSTM baseline in the same way. Following the same protocol as Mathieu et al. (2015) for data pre-processing and evaluation metrics on full images, all networks were trained on Sports-1M (Karpathy et al., 2014) dataset and tested on UCF-101 unless otherwise stated.1
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 3: Qualitative comparison between our MCNet model and ConvLSTM. We display predictions starting from the $1 2 ^ { \mathrm { t h } }$ frame, in every 3 timesteps. The first 3 rows correspond to KTH dataset for the action of jogging and the last 3 rows correspond to Weizmann dataset for the action of walking.
|
| 176 |
+
|
| 177 |
+
Results. Figure 4 shows the quantitative comparisons between our network trained for single-stepprediction and Mathieu et al. (2015). We can clearly see the advantage of our network over the baseline. The separation of motion and contents in two encoder pathways allows our network to identify key motion and content features, which are then fed into the decoder to yield predictions of higher quality compared to the baseline.2 In other words, our network only moves what shows motion in the past, and leaves the rest untouched. We also trained a residual version of MCnet on UCF-101, indicated by “MCnet $^ +$ RES UCF101", to compare how well our model generalizes when trained and tested on the same or different dataset(s). To our surprise, when tested with UCF-101, the MCnet trained on Sports-1M (MCnet $^ +$ RES) roughly matches the performance of the MCnet trained on UCF-101 (MCnet $^ +$ RES UCF101), which suggests that our model learns effective representations which can generalize to new datasets. Figure 5 presents qualitative comparisons between frames generated by our network and Mathieu et al. (2015). Since the ConvLSTM and Mathieu et al. (2015) lack explicit motion and content modules, they lose sense of the dynamics in the video and therefore the contents become distorted quickly. More qualitative comparisons are shown in the supplementary material and the project website.
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
Figure 4: Quantitative comparison between our model, convolutional LSTM Shi et al. (2015), and Mathieu et al. (2015). Given 4 input frames, the models predict 8 frames recursively, one by one.
|
| 181 |
+
|
| 182 |
+
# 7 CONCLUSION
|
| 183 |
+
|
| 184 |
+
We proposed a motion-content network for pixel-level prediction of future frames in natural video sequences. The proposed model employs two separate encoding pathways, and learns to decompose motion and content without explicit constraints or separate training. Experimental results suggest that separate modeling of motion and content improves the quality of the pixel-level future prediction, and our model overall achieves state-of-the-art performance in predicting future frames in challenging real-world video datasets.
|
| 185 |
+
|
| 186 |
+
# 8 ACKNOWLEDGEMENTS
|
| 187 |
+
|
| 188 |
+
This work was supported in part by ONR N00014-13-1-0762, NSF CAREER IIS-1453651, gifts from the Bosch Research and Technology Center, and Sloan Research Fellowship. We also thank NVIDIA for donating K40c and TITAN X GPUs. We thank Ye Liu, Junhyuk Oh, Xinchen Yan, Lajanugen Logeswaran, Yuting Zhang, Sungryull Sohn, Kibok Lee, Rui Zhang, and other collaborators for helpful discussions. R. Villegas was partly supported by the Rackham Merit Fellowship.
|
| 189 |
+
|
| 190 |
+
# REFERENCES
|
| 191 |
+
|
| 192 |
+
C. Finn, I. J. Goodfellow, and S. Levine. Unsupervised learning for physical interaction through video prediction. In NIPS, 2016.
|
| 193 |
+
I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In NIPS. 2014.
|
| 194 |
+
L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri. Actions as space-time shapes. Transactions on Pattern Analysis and Machine Intelligence, 29(12):2247–2253, December 2007.
|
| 195 |
+
R. Goroshin, M. Mathieu, and Y. LeCun. Learning to linearize under uncertainty. In NIPS. 2015.
|
| 196 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015.
|
| 197 |
+
G. Hinton and R. Salakhutdinov. Reducing the dimensionality of data with neural networks. Science, 2006.
|
| 198 |
+
M. Hoai and F. Torre. Max-margin early event detectors. IJCV, 2013.
|
| 199 |
+
A. Karpathy, G. Toderici, S. Shetty, T. Leung, R. Sukthankar, and L. Fei-Fei. Large-scale video classification with convolutional neural networks. In CVPR, 2014.
|
| 200 |
+
T. Lan, T. Chen, and S. Savarese. A hierarchical representation for future action prediction. In ECCV, 2014.
|
| 201 |
+
W. Lotter, G. Kreiman, and D. Cox. Unsupervised learning of visual structure using predictive generative networks. arXiv preprint arXiv:1504.08023, 2015.
|
| 202 |
+
M. Mathieu, C. Couprie, and Y. LeCun. Deep multi-scale video prediction beyond mean square error. arXiv preprint arXiv:1511.05440, 2015.
|
| 203 |
+
J. Oh, X. Guo, H. Lee, R. L. Lewis, and S. Singh. Action-conditional video prediction using deep networks in atari games. In NIPS. 2015.
|
| 204 |
+
V. Patraucean, A. Handa, and R. Cipolla. Spatio-temporal video autoencoder with differentiable memory. CoRR, abs/1511.06309, 2015.
|
| 205 |
+
L. C. Pickup, Z. Pan, D. Wei, Y. Shih, C. Zhang, A. Zisserman, B. Scholkopf, and W. T. Freeman. Seeing the arrow of time. In CVPR, 2014.
|
| 206 |
+
S. L. Pintea, J. C. van Gemert, and A. W. M. Smeulders. Dejavu: Motion prediction in static images. In European Conference on Computer Vision, 2014.
|
| 207 |
+
M. Ranzato, A. Szlam, J. Bruna, M. Mathieu, R. Collobert, and S. Chopra. Video (language) modeling: a baseline for generative models of natural videos. arXiv preprint arXiv:1412.6604, 2014.
|
| 208 |
+
M. S. Ryoo. Human activity prediction: Early recognition of ongoing activities from streaming videos. In ICCV, 2011.
|
| 209 |
+
C. Schuldt, I. Laptev, and B. Caputo. Recognizing human actions: A local svm approach. In ICPR, 2004.
|
| 210 |
+
X. Shi, Z. Chen, H. Wang, D.-Y. Yeung, W.-k. Wong, and W.-c. WOO. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In Advances in Neural Information Processing Systems 28. 2015.
|
| 211 |
+
K. Simonyan and A. Zisserman. Two-stream convolutional networks for action recognition in videos. In NIPS. 2014.
|
| 212 |
+
K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
|
| 213 |
+
K. Soomro, A. R. Zamir, and M. Shah. UCF101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
|
| 214 |
+
N. Srivastava, E. Mansimov, and R. Salakhudinov. Unsupervised learning of video representations using lstms. In ICML, 2015.
|
| 215 |
+
C. Vondrick, H. Pirsiavash, and A. Torralba. Anticipating the future by watching unlabeled video. arXiv preprint arXiv:1504.08023, 2015.
|
| 216 |
+
C. Vondrick, H. Pirsiavash, and A. Torralba. Generating videos with scene dynamics. In NIPS. 2016.
|
| 217 |
+
J. Walker, A. Gupta , and M. Hebert . Patch to the future: Unsupervised visual prediction. In CVPR, 2014.
|
| 218 |
+
J. Walker, C. Doersch, A. Gupta, and M. Hebert. An uncertain future: Forecasting from static images using variational autoencoders. CoRR, abs/1606.07873, 2016.
|
| 219 |
+
P. Weinzaepfel, J. Revaud, Z. Harchaoui, and C. Schmid. DeepFlow: Large displacement optical flow with deep matching. In ICCV, 2013.
|
| 220 |
+
T. Xue, J. Wu, K. L. Bouman, and W. T. Freeman. Visual dynamics: Probabilistic future frame synthesis via cross convolutional networks. NIPS, 2016.
|
| 221 |
+
J. Yuen and A. Torralba. A data-driven approach for event prediction. In ECCV, 2010.
|
| 222 |
+
M. D. Zeiler, G. W. Taylor, and R. Fergus. Adaptive deconvolutional networks for mid and high level feature learning. In ICCV, 2011.
|
| 223 |
+
|
| 224 |
+

|
| 225 |
+
Figure 5: Qualitative comparisons among MCnet and ConvLSTM and Mathieu et al. (2015). We display predicted frames (in every other frame) starting from the $5 ^ { \mathrm { t h } }$ frame. The green arrows denote the top-30 closest optical flow vectors within image patches between MCnet and ground-truth. More clear motion prediction can be seen in the project website.
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
Figure 6: Qualitative comparisons on KTH testset. We display predictions starting from the $1 2 ^ { \mathrm { t h } }$ frame, for every 3 timesteps. More clear motion prediction can be seen in the project website.
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
Figure 7: Qualitative comparisons on KTH testset. We display predictions starting from the $1 2 ^ { \mathrm { t h } }$ frame, for every 3 timesteps. More clear motion prediction can be seen in the project website.
|
| 232 |
+
|
| 233 |
+

|
| 234 |
+
Figure 8: Qualitative comparisons on UCF-101. We display predictions (in every other frame) starting from the $5 ^ { \mathrm { t h } }$ frame. The green arrows denote the top-30 closest optical flow vectors within image patches between MCnet and ground-truth. More clear motion prediction can be seen in the project website.
|
| 235 |
+
|
| 236 |
+
# A QUALITATIVE AND QUANTITATIVE COMPARISON WITH CONSIDERABLE CAMERA MOTION AND ANALYSIS
|
| 237 |
+
|
| 238 |
+
In this section, we show frame prediction examples in which considerable camera motion occurs. We analyze the effects of camera motion on our best network and the corresponding baselines. First, we analyze qualitative examples on UCF101 (more complicated camera motion) and then on KTH (zoom-in and zoom-out camera effect).
|
| 239 |
+
|
| 240 |
+
UCF101 Results. As seen in Figure 9 and Figure 10, our model handles foreground and camera motion for a few steps. We hypothesize that for the first few steps, motion signals from images are clear. However, as images are predicted, motion signals start to deteriorate due to prediction errors. When a considerable amount of camera motion is present in image sequences, the motion signals are very dense. As predictions evolve into the future, our motion encoder has to handle large motion deterioration due to prediction errors, which cause motion signals to get easily confused and lost quickly.
|
| 241 |
+
|
| 242 |
+

|
| 243 |
+
Figure 9: Qualitative comparisons on UCF-101. We display predictions (in every other frame) starting from the $5 ^ { \mathrm { { \bar { t h } } } }$ frame. The green arrows denote the top-30 closest optical flow vectors within image patches between MCnet and ground-truth. More clear motion prediction can be seen in the project website.
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
Figure 10: Qualitative comparisons on UCF-101. We display predictions (in every other frame) starting from the $5 ^ { \mathrm { t h } }$ frame. The green arrows denote the top-30 closest optical flow vectors within image patches between MCnet and ground-truth. More clear motion prediction can be seen in the project website.
|
| 247 |
+
|
| 248 |
+
KTH Results. We were unable to find videos with background motion in the KTH dataset, but we found videos where the camera is zooming in or out for the actions of boxing, handclapping, and handwaving. In Figure 11, we display qualitative for such videos. Our model is able to predict the zoom change in the cameras, while continuing the action motion. In comparison to the performance observed in UCF101, the background does not change much. Thus, the motion signals are well localized in the foreground motion (human), and do not get confused with the background and lost as quickly.
|
| 249 |
+
|
| 250 |
+

|
| 251 |
+
Figure 11: Qualitative comparisons on KTH testset. We display predictions starting from the $1 2 ^ { \mathrm { t h } }$ frame, in every 3 timesteps. More clear motion prediction can be seen in the project website.
|
| 252 |
+
|
| 253 |
+
# B EXTENDED QUANTITATIVE EVALUATION
|
| 254 |
+
|
| 255 |
+
In this section, we show additional quantitative comparison with a baseline based on copying the last observed frame through time for KTH and UCF101 datasets. Copying the last observed frame through time ensures perfect background prediction in videos where most of the motion comes from foreground (i.e. person performing an action). However, if such foreground composes a small part of the video, it will result in high prediction quality score regardless of the simple copying action.
|
| 256 |
+
|
| 257 |
+
In Figure 12 below, we can see the quantitative comparison in the datasets. Copying the last observed frame through time does a reasonable job in both datasets, however, the impact is larger in UCF101. Videos in the KTH dataset comprise simple background with minimal camera motion, which allows our network to easily predict both foreground and background motion, resulting in better image quality scores. However, videos in UCF101 contain more complicated and diverse background which in combination with camera motion present a much greater challenge to video prediction networks. From the qualitative results in Section A and Figures 5, 8, 9, and 10, we can see that our network performs better in videos that contain isolated areas of motion compared to videos with dense motion. A simple copy/paste operation of the last observed frame, ensures very high prediction scores in videos where very small motion occur. The considerable score boost by videos with small motion causes the simple copy/paste baseline to outperform MCnet in the overall performance on UCF101.
|
| 258 |
+
|
| 259 |
+

|
| 260 |
+
Figure 12: Extended quantitative comparison including a baseline based on copying the last observed frame through time.
|
| 261 |
+
|
| 262 |
+
# C UCF101 MOTION DISAMBIGUATION EXPERIMENTS
|
| 263 |
+
|
| 264 |
+
Due to the observed bias from videos with small motion, we perform experiments by measuring the image quality scores on areas of motion. These experiments are similar to the ones performed in Mathieu et al. (2015). We compute DeepFlow optical flow (Weinzaepfel et al., 2013) between the previous and the current groundtruth image of interest, compute the magnitude, and normalize it to $[ 0 , 1 ]$ . The computed optical flow magnitude is used to mask the pixels where motion was observed. We set the pixels where the optical flow magnitude is less than 0.2, and leave all other pixels untouched in both the groundtruth and predicted images. Additionally, we separate the test videos by the average $\ell _ { 2 }$ -norm of time difference between target frames. We separate the test videos into deciles based of the computed average $\ell _ { 2 }$ -norms, and compute image quality on each decile. Intuitively, the $1 ^ { s t }$ decile contains videos with the least overall of motion (i.e. frames that show the smallest change over time), and the $1 0 ^ { t h }$ decile contains videos with the most overall motion (i.e. frames that show the largest change over time).
|
| 265 |
+
|
| 266 |
+
As shown in Figure 13, when we only evaluate on pixels where rough motion is observed, MCnet reflects higher PSNR and SSIM, and clearly outperforms all the baselines in terms of SSIM. The SSIM results show that our network is able to predict a structure (i.e. textures, edges, etc) similar to the grountruth images within the areas of motion. The PSNR results, however, show that our method outperforms the simple copy/paste baseline for the first few steps, but then our method performs slightly worse. The discrepancies observed between PSNR and SSIM scores could be due to the fact that some of the predicted images may not reflect the exact pixel values of the groundtruth regardless of the structures being similar. SSIM scores are known to take into consideration features in the image that go beyond directly matching pixel values, reflecting more accurately how humans perceived image quality.
|
| 267 |
+
|
| 268 |
+

|
| 269 |
+
Figure 13: Extended quantitative comparison on UCF101 including a baseline based on copying the last observed frame through time using motion based pixel mask.
|
| 270 |
+
|
| 271 |
+
Figures 15 and 14 show the evaluation by separating the test videos into deciles based on the average $\ell _ { 2 }$ -norm of time difference between target frames. From this evaluation, it is proven that the copy last frame baseline scores higher in videos where motion is the smallest. The first few deciles (videos with small motion) show that our network is not just copying the last observed frame through time, otherwise it would perform similarly to the copy last frame baseline. The last deciles (videos with large motion) show our network outperforming all the baselines, including the copy last frame baseline, effectively confirming that our network does predict motion similar to the motion observed in the video.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure 14: Quantitative comparison on UCF101 using motion based pixel mask, and separating dataset by average $\ell _ { 2 }$ -norm of time difference between target frames.
|
| 275 |
+
|
| 276 |
+

|
| 277 |
+
Figure 15: Quantitative comparison on UCF101 using motion based pixel mask, and separating dataset by average $\ell _ { 2 }$ -norm of time difference between target frames.
|
| 278 |
+
|
| 279 |
+
# D ADVERSARIAL TRAINING
|
| 280 |
+
|
| 281 |
+
Mathieu et al. (2015) proposed an adversarial training for frame prediction. Inspired by Goodfellow et al. (2014), they proposed a training procedure that involves a generative model $G$ and a discriminative model $D$ . The two models compete in a two-player minimax game. The discriminator $D$ is optimized to correctly classify its inputs as either coming from the training data (real frame sequence) or from the generator $G$ (synthetic frame sequence). The generator $G$ is optimized to generate frames that fool the discriminator into believing that they come from the training data. At training time, $D$ takes the concatenation of the input frames that go into $G$ and the images produced by $G$ . The adversarial training objective is defined as follows:
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
\underset { G } { \operatorname* { m i n } } \underset { D } { \operatorname* { m a x } } ~ \log D \left( \left[ { \bf x } _ { 1 : t } , { \bf x } _ { t + 1 : t + T } \right] \right) + \log \left( 1 - D \left( \left[ { \bf x } _ { 1 : t } , G \left( { \bf x } _ { 1 : t } \right) \right] \right) \right) ,
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
where $[ . , . ]$ denotes concatenation in the depth dimension, $\mathbf { x } _ { 1 : t }$ denotes the input frames to $G$ , $\mathbf { x } _ { t + 1 : t + T }$ are the target frames, and $G \left( \mathbf { x } _ { 1 : t } \right) = \hat { \mathbf { x } } _ { t + 1 : t + T }$ are the frames predicted by $G$ . In practice, we split the minimax objective into two separate, but equivalent, objectives: ${ \mathcal { L } } _ { \mathrm { G A N } }$ and ${ \mathcal { L } } _ { \mathrm { d i s c } }$ . During optimization, we minimize the adversarial objective alternating between ${ \mathcal { L } } _ { \mathrm { G A N } }$ and ${ \mathcal { L } } _ { \mathrm { d i s c } }$ . $\mathcal { L } _ { \mathrm { G A N } }$ is defined by
|
| 288 |
+
|
| 289 |
+
$$
|
| 290 |
+
\mathcal { L } _ { \mathrm { G A N } } = - \log D \left( \left[ \mathbf { x } _ { 1 : t } , G \left( \mathbf { x } _ { 1 : t } \right) \right] \right) ,
|
| 291 |
+
$$
|
| 292 |
+
|
| 293 |
+
where we optimize the parameters of $G$ to minimize ${ \mathcal { L } } _ { \mathrm { G A N } }$ while the parameters of $D$ stay untouched. As a result, $G$ is optimized to generate images that make $D$ believe that they come from the training data. Thus, the generated images look sharper, and more realistic. ${ \mathcal { L } } _ { \mathrm { d i s c } }$ is defined by
|
| 294 |
+
|
| 295 |
+
$$
|
| 296 |
+
\mathcal { L } _ { \mathrm { d i s c } } = - \log D \left( \left[ \mathbf { x } _ { 1 : t } , \mathbf { x } _ { t + 1 : t + T } \right] \right) - \log \left( 1 - D \left( \left[ \mathbf { x } _ { 1 : t } , G \left( \mathbf { x } _ { 1 : t } \right) \right] \right) \right) ,
|
| 297 |
+
$$
|
| 298 |
+
|
| 299 |
+
where we optimize the parameters of $D$ to minimize ${ \mathcal { L } } _ { \mathrm { d i s c } }$ , while the parameters of $G$ stay untouched. $D$ tells us whether its input came from the training data or the generator $G$ . Alternating between the two objectives, causes $G$ to generate very realistic images, and $D$ not being able to distinguish between generated frames and frames from the training data.
|
md/train/rkEfPeZRb/rkEfPeZRb.md
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VARIANCE-BASED GRADIENT COMPRESSION FOR EF-FICIENT DISTRIBUTED DEEP LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Due to the substantial computational cost, training state-of-the-art deep neural networks for large-scale datasets often requires distributed training using multiple computation workers. However, by nature, workers need to frequently communicate gradients, causing severe bottlenecks, especially on lower bandwidth connections. A few methods have been proposed to compress gradient for efficient communication, but they either suffer a low compression ratio or significantly harm the resulting model accuracy, particularly when applied to convolutional neural networks. To address these issues, we propose a method to reduce the communication overhead of distributed deep learning. Our key observation is that gradient updates can be delayed until an unambiguous (high amplitude, low variance) gradient has been calculated. We also present an efficient algorithm to compute the variance and prove that it can be obtained with negligible additional cost. We experimentally show that our method can achieve very high compression ratio while maintaining the result model accuracy. We also analyze the efficiency using computation and communication cost models and provide the evidence that this method enables distributed deep learning for many scenarios with commodity environments.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep neural networks are attracting attention because of their outstanding prediction power in many application fields such as image recognition, natural language processing, and speech recognition. In addition, software frameworks are publicly available, making it easier to apply deep learning. However, their crucial drawback is the substantial computational cost on training. For example, it takes over a week to train ResNet-50 on the ImageNet dataset if using a single GPU. Such long training time limits the number of trials possible when creating models.
|
| 12 |
+
|
| 13 |
+
Therefore, we must conduct distributed training using multiple computation workers (e.g., multiple GPUs in different nodes). However, by nature, workers need to frequently communicate gradients, which yields a severe bottleneck for scalability, especially when using lower bandwidth connections. For example, when using 1000BASE-T Ethernet, communication takes at least ten times longer than forward and backward computation for ResNet-50, making multiple nodes impractical. High performance interconnections such as InfiniBand and Omni-Path are an order of magnitude more expensive than commodity interconnections, which limits research and development of deep learning using large-scale datasets to a small number of researchers.
|
| 14 |
+
|
| 15 |
+
Although several methods have been proposed to compress gradient for efficient communication, they either suffer a low compression ratio or significantly harm the resulting model accuracy, particularly when applied to convolutional neural networks. There are mainly two lines of research: quantization and sparsification. Quantization-based methods include 1-bit SGD (Seide et al., 2014) and TernGrad (Wen et al., 2017). Though they achieve small loss of accuracy by using at least one bit for each parameter, the compression ratio is limited. Sparsification-based methods include Strom (2015) and QSGD (Alistarh et al., 2017). While they can achieve high compression ratio, as we will see in our experiments, they harm the resulting model accuracy or suffer a low compression ratio, particularly when applied to convolutional neural networks.
|
| 16 |
+
|
| 17 |
+
To address these issues, we propose a new gradient compression algorithm to reduce the communication overhead of distributed deep learning. The proposed method belongs to the sparsification approaches. Our key observation is that the variance of the gradient for each parameter point over iterations is a useful signal for compression. As almost all previous approaches of both sparsification and quantization only look at the magnitude of gradient, we believe that we are opening a new door for this field. In addition, we also show that our method can be combined with previous compression methods to further boost performance. We also present an efficient algorithm to compute the variance and prove that it can be obtained with negligible additional cost.
|
| 18 |
+
|
| 19 |
+
We experimentally demonstrate that our method can achieve a high compression ratio while maintaining result model accuracy. We also analyze the efficiency using computation and communication cost models and provide evidence that our method enables distributed deep learning for many scenarios with commodity environments.
|
| 20 |
+
|
| 21 |
+
Organization. The remainder of this paper is organized as follows: Section 2 provides the definitions and notations used in this paper. Section 3 reviews related work in this field. Section 4 presents the proposed method. Section 5 analyzes performance. Section 6 shows our experimental results, and we conclude in Section 7.
|
| 22 |
+
|
| 23 |
+
# 2 PRELIMINARIES
|
| 24 |
+
|
| 25 |
+
In this section, we describe an overview of distributed deep learning and parameter updates with compressed gradients.
|
| 26 |
+
|
| 27 |
+
# 2.1 CHALLENGES IN DATA PARALLEL STOCHASTIC GRADIENT DESCENT
|
| 28 |
+
|
| 29 |
+
In data parallel distributed Stochastic Gradient Descent (SGD), all workers have identical copies of the same model and calculate gradients using different subsets of training data. Gradients are shared across all workers, and each worker updates its local model using the shared gradients.
|
| 30 |
+
|
| 31 |
+
There are two well-known approaches to communication of gradients: synchronous and asynchronous. Even though our method can be applied to both of them, we focus on the synchronous approach in this paper. Each worker computes gradients and shares them with other workers using a synchronized group communication routine in every single training iteration, typically using a communication routine known as allreduce.
|
| 32 |
+
|
| 33 |
+
The challenge is that the communication is possibly a severe bottleneck in a training process. Gradients typically consist of tens of millions of floating point values so the total size of exchanged data can be large. For example, the model size of ResNet-50 (He et al. (2016)) is over $1 1 0 \mathrm { M B }$ , and the size of gradients becomes large accordingly. Thus, the communication time has a significant effect on the total training time in environments equipped with a commodity interconnect hardware, such as 1Gb Ethernet. Also, in the synchronous approach, workers have to wait for completion of communication and their computing resources including GPUs are idle, which is a significant performance loss.
|
| 34 |
+
|
| 35 |
+
# 2.2 PROBLEM FORMULATION
|
| 36 |
+
|
| 37 |
+
In basic procedures of SGD, model parameters are updated as
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\boldsymbol x _ { t + 1 } = \boldsymbol x _ { t } - \gamma \nabla f _ { t } ( \boldsymbol x _ { t } ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $x _ { t }$ and $\nabla f _ { t } ( x _ { t } )$ are model parameters and calculated gradients in time step $t$ , respectively. $f _ { t }$
|
| 44 |
+
is a loss function and it differs between samples used in a mini-batch. $\gamma$ is a step size.
|
| 45 |
+
|
| 46 |
+
To reduce an amount of data to be exchanged over a network, either quantization or sparsification or both are used as explained in Sec. 3.
|
| 47 |
+
|
| 48 |
+
# 3 RELATED WORK
|
| 49 |
+
|
| 50 |
+
There are two main approaches to gradient compression: quantization-based approaches and sparsification-based approaches. Quantization-based approaches reduce communication cost by expressing each gradient with fewer bits. If a baseline uses 32-bit floating points in communication, then it can reduce the amount of communication by up to 32 times. Seide et al. (2014) showed that neural networks can be trained using only one sign bit per parameter. There are two key techniques in their algorithm. First, they use different threshold to encode and decode gradient elements for each column of weight matrix. Second, quantization errors are added to the gradients calculated in the next step. Its effectiveness has been experimentally verified through speech models. Wen et al. (2017) proposed TernGrad to encode gradients with 2 bits per parameter. The algorithm is characterized by its theoretically-guaranteed convergence and reported that it can successfully train GoogLeNet (Szegedy et al., 2015) on ImageNet with an average loss of accuracy of less than $2 \%$ .
|
| 51 |
+
|
| 52 |
+
As a second approach, sparsification-based approaches reduce communication cost by sending only a small fraction of gradients. Even though they require sending not only the values of gradients but also parameters’ indexes, their strong sparsification reduces transmission requirements significantly. Strom (2015) proposed sending only gradients whose absolute values are greater than a user-defined threshold. The algorithm sends only sign bits and encoded indexes of parameters. Gradients are decoded up to the threshold and quantization errors are added to the gradients calculated in the next step as 1-bit stochastic gradients. Its effectiveness has also been experimentally verified on speech applications. Dryden et al. (2016) extended Strom’s method. They proposed to use an adaptive threshold instead of using a user-defined threshold. They also introduced repeated sparsification of gradients in order to combine the algorithm with an efficient communication algorithm. Alistarh et al. (2017) proposed QSGD. QSGD stochastically rounds gradients to linearly quantized values, which are calculated in the algorithm. Their work enjoys strong theoretical properties in convex optimizations. Furthermore, they can control the trade-off between accuracy and compression. On the other hand, Strom’s method does not work with small or large thresholds.
|
| 53 |
+
|
| 54 |
+
# 4 PROPOSED METHODS
|
| 55 |
+
|
| 56 |
+
In this section, we describe the proposed method. An efficient implementation and combination with other compression methods are also explained.
|
| 57 |
+
|
| 58 |
+
Our work belongs to the sparsification-based approaches. In this section, we explicitly denote a gradient vector $( \nabla \bar { f } ( x ) )$ and a gradient element $( \nabla _ { i } f ( x ) )$ for clarity. Previous works in this direction have focused on gradient elements with small magnitudes, and they rounded them to zero to sparsify. Our work diverges at this point. We propose using approximated variances of gradient elements instead of magnitudes. Our method do not transmit ambiguous elements until additional data reduce their ambiguity and significantly reduces communication while maintaining accuracy. This method enables shifting the balance between accuracy and compression, as necessary. Furthermore, we can combine our work with sparsity-promoting quantization like QSGD and Strom’s method. We show the way of combination with the Strom’s method later.
|
| 59 |
+
|
| 60 |
+
# 4.1 KEY CONCEPTS
|
| 61 |
+
|
| 62 |
+
The key idea of our method is delaying sending ambiguously estimated gradient elements. We consider a gradient element to be ambiguous when its amplitude is small compared to its variance over the data points. We extend the standard updating method to the following:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
x _ { t + 1 } - \gamma r _ { t + 1 } = x _ { t } - \gamma ( \nabla f _ { t } ( x _ { t } ) + r _ { t } ) .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
This extension follows Seide et al. (2014) and Strom (2015).
|
| 69 |
+
|
| 70 |
+
In previous works, the approximation errors are accumulated in $r _ { t }$ and used in future updates. In each step, parameters are updated only with approximated gradient elements represented by less number of bits. In our work, we interpret $r _ { t }$ as a delayed update, not approximation errors.
|
| 71 |
+
|
| 72 |
+
We send the gradient element corresponding to the $i$ -th parameter only when it satisfies the following criterion,
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\frac { \alpha ^ { \prime } } { | B | } V _ { B } [ \nabla _ { i } f _ { z } ( x ) ] < ( \nabla _ { i } f _ { B } ( x ) ) ^ { 2 } ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $| B |$ is a size of the mini-batch and $\alpha ^ { \prime }$ is a hyper parameter representing required estimation accuracy. $z$ is a each sample and $B$ is a mini-batch, respectively and $f _ { z }$ and $f _ { B }$ are corresponding loss functions. $V _ { B } [ \nabla _ { i } f _ { z } ( x ) ]$ is the sample variance of the gradient element corresponding to the $i$ -th parameter over a mini-batch $B$ .
|
| 79 |
+
|
| 80 |
+
If we do not send some gradient elements, we add them to the next batch and recalculate (1) with increased batch size. For example, if we postpone sending a gradient element nine times consecutively, the criterion (1) is calculated as if ten times larger batch than usual mini-batch in the next step. Note that even though the criterion (1) is calculated as if we used a larger batch, what is used for an update is not the mean of the mini-batches across steps but the sum of them.
|
| 81 |
+
|
| 82 |
+
Following lemma supports our formulation.
|
| 83 |
+
|
| 84 |
+
Lemma 4.1. (De et al., 2017) A sufficient condition that a vector $- g$ is a descent direction is
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array} { r } { \| g - \nabla f ( x ) \| _ { 2 } ^ { 2 } < \| g \| _ { 2 } ^ { 2 } . } \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
We are interested in the case of $g = \nabla f _ { B } ( x )$ , the gradient vector of the loss function over $B$ . By the weak law of large numbers, when $| B | > 1$ , the left hand side of Eq. 2 with $g = \nabla f _ { B } ( x )$ can be estimated as follows:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
E [ \| \nabla f _ { B } ( x ) - \nabla f ( x ) \| _ { 2 } ^ { 2 } ] \sim \frac { 1 } { | B | } V _ { B } [ \nabla f _ { z } ( x ) ] .
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Thus our formulation with $\alpha ^ { \prime } \geq 1$ corresponds to an elementwise estimation of the sufficient condition (2) that a gradient vector decreases the loss function. Gradient elements become more likely to be sent as sample size increases. However, if once gradient elements are estimated with too high variances, it takes too long for the elements to be sent. Thus, we decay variance at every step. Details are described in subsection 4.4. In the combination with optimization methods like Momentum SGD, gradient elements not sent are assumed to be equal to zero.
|
| 97 |
+
|
| 98 |
+
# 4.2 QUANTIZATION AND PARAMETER ENCODING
|
| 99 |
+
|
| 100 |
+
To allow for comparison with other compression methods, we propose a basic quantization process. In this section, we refer to a gradient as an accumulated gradient. After deciding which gradient elements to send, each worker sends pairs of a value of a gradient element and its parameter index as Strom (2015) and Alistarh et al. (2017). We quantize each element to 4-bit so that we can represent each pair in 32-bit as per Strom (2015). The 4-bit consists of one sign bit and three exponent bits.
|
| 101 |
+
|
| 102 |
+
Our quantization except for the sign bit is as follows. For a weight matrix $W _ { k }$ (or a weight tensor in CNN), there is a group of gradient elements corresponding to the matrix. Let $M _ { k }$ be the maximum absolute value in the group. First, for each element $g _ { i }$ in the $k$ -th group, if $| g _ { i } |$ is larger than $2 ^ { \lfloor \log _ { 2 } M _ { k } \rfloor }$ truncate it to $2 ^ { \lfloor \log _ { 2 } { M _ { k } } \rfloor }$ , otherwise, round to the closer value of $2 ^ { \lfloor \log _ { 2 } \left. \dot { g } _ { i } \right. \rfloor }$ or $2 ^ { \lceil \bar { \log } _ { 2 } \lvert g _ { i } \rvert \rceil }$ . Let $g _ { i } ^ { \prime }$ be the preprocessed gradient element. Next, calculate a integer $d _ { i } : = \lfloor \log _ { 2 } M _ { k } \rfloor - \log _ { 2 } g _ { i } ^ { \prime }$ . If $d \sb i > 7$ then we do not send the value, otherwise, encode the integer from 0 to 7 using 3 bits. $\lfloor \log _ { 2 } M _ { k } \rfloor$ is also sent for every weight matrix. An efficient implementation is presented in subsection 4.4. We do not adopt stochastic rounding like Alistarh et al. (2017) nor accumulate rounding error $g _ { i } - g _ { i } ^ { \prime }$ for the next batch because this simple rounding does not harm accuracy empirically. Appendix B has a running example of this quantization.
|
| 103 |
+
|
| 104 |
+
Because the variance-based sparsification method described in subsection 4.1 is orthogonal to the quantization shown above, we can reduce communication cost further using sparsity promoting quantization methods such as QSGD instead. However, we used the quantization to show that enough level of sparsity is gained solely by our variance-based sparsification because the quantization rounds only a small fraction of gradient elements to zero. We show how to combine our method with a method in Strom (2015) later in this paper because the way of the combination is less obvious. We use a naive encoding for parameter indexes because the rest 28-bits are enough. We can further reduce the number of bits by compressing parameter indexes (Strom, 2015; Alistarh et al., 2017).
|
| 105 |
+
|
| 106 |
+
# 4.3 COMMUNICATION BETWEEN WORKERS
|
| 107 |
+
|
| 108 |
+
In distributed deep learning, the most important operation is to take the global mean of the gradient elements calculated in each worker. The operation is referred to as “allreduce.” It consists of three steps: (1) collects all local arrays in each worker, (2) reduce them using a given arithmetic operator, which is summation in this case, and (3) broadcast the result back to all workers so that all workers obtain the identical copies of the array.
|
| 109 |
+
|
| 110 |
+
Conventional data parallel deep learning applications can enjoy the benefit of highly optimized allreduce implementations thanks to the fact that only the sum of the values has to be kept during the communication. However, after applying the proposed method to the local gradient elements, they are converted to a sparse data structure so the allreduce operation can no longer apply.
|
| 111 |
+
|
| 112 |
+
Dryden et al. (2016) and Aji & Heafield (2017) proposed sparsifying gradient elements multiple times to utilize a kind of allreduce for sparsification-based compressions. However, the accuracy is possibly degraded when the elements are highly compressed through repetitive compressions. Instead, we adopt allgatherv for communication, where each worker just sends the calculated elements to other workers. We avoid to encode and decode elements multiple times by allgatherv. In allgatherv communication cost hardly increase from a kind of allreduce because index overlap, which is needed for summation, rarely occur if the compression ratio is sufficiently higher than the number of workers. Thanks to the high compression ratio possible with this algorithm and its combination with other compression methods, even large numbers of workers can be supported. Some optimization methods, such as ADAM (Ba & Kingma, 2015), require parameter updates and postprocessing. They are calculated locally after the communication.
|
| 113 |
+
|
| 114 |
+
# 4.4 EFFICIENT IMPLEMENTATION
|
| 115 |
+
|
| 116 |
+
We first describe the efficient computation of the criterion (1) and second how to quantize gradient elements without additional floating points operations. We can efficiently compare squared mean and variance in the criterion (1) by just comparing squared mean of gradient elements and sum of squared gradient elements. That is,
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\left( \sum _ { z \in B } \frac { 1 } { | B | } \nabla _ { i } f _ { z } ( x ) \right) ^ { 2 } > \alpha \sum _ { z \in B } \left( \frac { 1 } { | B | } \nabla _ { i } f _ { z } ( x ) \right) ^ { 2 }
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
achieves our goal. Thus, we have to maintain only the sum of gradient elements and sum of squared gradient elements. Details are described in Appendix A. Decay of variance, described in subsection 4.1, is accomplished by multiplying hyperparameter $\zeta ( < 1 )$ to the sum of squared gradient elements at every step. Alpha in Eq. 3 controls how much unambiguity the algorithm require. The algorithm compress more aggressively with larger alpha. A range from one to two is good for alpha from its derivation. Fig. 1 shows the final algorithm.
|
| 123 |
+
|
| 124 |
+
The quantization of parameters described in subsection 4.2 can also be efficiently implemented with the standard binary floating point representation using only binary operations and integer arithmetic as follows. We can calculate $2 ^ { \lfloor \log _ { 2 } x \rfloor }$ by truncating the mantissa. We can also round values by adding one to the most significant bit of mantissa as if $x$ is an unsigned integer and then masking mantissa to 0.
|
| 125 |
+
|
| 126 |
+
# 4.5 HYBRID ALGORITHM
|
| 127 |
+
|
| 128 |
+
We describe the way to combine our method with Strom’s method. It becomes problematic how to modify variance when only parts of gradient elements are exchanged. We solve the issue simply by modifying $a ^ { 2 }$ to $( a - b ) ^ { 2 }$ . Let S be the value sent in a step (i.e. threshold, -threshold or 0). We correct squared gradient elements $\textstyle \sum ( \nabla _ { i } f ) ^ { 2 }$ to $\sum ( \nabla _ { i } f ) ^ { 2 } - 2 \bar { S } \sum ( \nabla _ { i } f ) + S ^ { 2 }$ . Fig. 2 shows the algorithm. We show the effictiveness of this combined algorithm by experiments in Sec. 6. Combinations with other works like QSGD and TernGrad are rather straightforward and we do not explore further in this paper.
|
| 129 |
+
|
| 130 |
+
# 5 PERFORMANCE ANALYSIS
|
| 131 |
+
|
| 132 |
+
Because common deep learning libraries do not currently support access to gradients of each sample, it is difficult to contrast practical performance of an efficient implementation in the commonly used software environment. In light of this, we estimate speedup of each iteration by gradient compression with a performance model of communication and computation. The total speed up of the whole training process is just the summation of each iteration because we adopt a synchronized approach.
|
| 133 |
+
|
| 134 |
+
Figure 1: Basic algorithm of our variancebased compression. $\zeta$ and $\alpha$ are hyperparameters. Recommended value for $\zeta$ is 0.999. $\alpha$ controls compression and accuracy. $\nabla _ { i } f _ { z }$ denotes a gradient element of parameter $i$ for each sample $z$ in mini-batch. CalcGrad() is backward and forward computaion. Encode() includes quantization and encoding of indexes. CommunicateAndUpdate() requires sharing gradient elements and decode, then update parameters.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Algorithm1:Basic</td></tr><tr><td>hyperparam:B = batch size, S,α</td></tr><tr><td>foreach parameters:</td></tr><tr><td>ri=0;</td></tr><tr><td>Ui = 0;</td></tr><tr><td>while not converged:</td></tr><tr><td>CalcGrad(;</td></tr><tr><td>foreach parameters: Vif; ri+=∑</td></tr><tr><td>Df)²; B</td></tr><tr><td>Ui+=∑( B</td></tr><tr><td>if r² >αui:</td></tr><tr><td>Encode(ri);</td></tr><tr><td>ri=0;</td></tr><tr><td>Ui=0;</td></tr><tr><td>else:</td></tr><tr><td>Ui *=;</td></tr><tr><td>CommunicateAndUpdate();</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Figure 2: Hybrid algorithm of our variancebased compression and Strom’s method. $\tau$ is a user-defined threshold required in Strom’s method. Other parameters and notations are the same with Fig. 1.
|
| 139 |
+
|
| 140 |
+
<table><tr><td>Algorithm 2: Hybrid</td><td colspan="2"></td></tr><tr><td>hyperparam:B = batch size, S,α,T</td><td rowspan="3">if |ri| >T and r² > αvi: Encode(Sign(ri)); ri -= Sign(ri) T; max(Ui - 2|rilT + T²,0);</td></tr><tr><td>foreach parameters:</td></tr><tr><td>ri=0; Ui=0;</td></tr></table>
|
| 141 |
+
|
| 142 |
+
In the communication part, the pairs of the quantized values and the parameter indexes in each node are broadcast to all nodes. The $i$ -th node’s input data size $n _ { i } ( i = 1 , . . . , p )$ may be different among nodes, where $p$ denotes the number of nodes. An MPI function called allgatherv realizes such an operation. Because recent successful image recognition neural network models like VGG (Simonyan & Zisserman, 2015) or ResNet (He et al., 2016) have a large number of parameters, the latency term in communication cost can be ignored even if we achieve very high compression ratio such as $c > 1 , 0 0 0$ . In such cases, a type of collective communication algorithms called the ring algorithm is efficient (Thakur et al., 2005). Its bandwidth term is relatively small even though its latency term is proportional to $p$ . Although the naive ring allgatherv algorithm costs unacceptable $O ( \operatorname* { m a x } _ { i } n _ { i } \cdot p )$ time, Traff et al. ¨ (2008) proposed a method to mitigate it by dividing large input data, which is called pipelined ring algorithm. For example, an allgatherv implementation in MVAPICH adopts a pipelined ring algorithm for large input data.
|
| 143 |
+
|
| 144 |
+
The calculation of variance of gradients dominates in the additional cost for the computation part of the proposed method. The leading term of the number of multiply-add operations in it is $2 N | B |$ , where $N$ and $| B |$ are the number of parameters and the local batch size, respectively. Other terms such as determination of sent indexes and application of decay are at most $\bar { O } ( N )$ . Therefore hereafter we ignore the additional cost for the computation part and concentrate to the communication part.
|
| 145 |
+
|
| 146 |
+
We discuss the relationship between the compression ratio and the speedup of the communication part. As stated above, we ignore the latency term. The baseline is ring allreduce for uncompressed gradients. Its elapsed time is $T _ { r } = 2 ( p - \mathrm { i } ) N s \beta / p$ , where $s$ and $\beta$ are the bit size of each parameter and the transfer time per bit, respectively. On the other hand, elapsed time of pipelined ring allgatherv is $T _ { v } = \sum [ ( { n } _ { i } / m ) - 1 ) \bar { m \beta } ]$ , where $m$ is the block size of pipelining. Defining $c$ as the averaged compression ratio including change of the number of bits per parameter, $T _ { v }$ is evaluated as $\begin{array} { r } { T _ { v } \leq ( \sum n _ { i } + ( p - 1 ) m ) \beta = ( N s p / c + ( p - 1 ) m ) \beta . } \end{array}$ . If we set $m$ small enough, relative speedup is $T _ { r } / \overline { { T _ { v } } } \geq 2 ( p - 1 ) c / p ^ { 2 }$ . Therefore we expect linear speedup in $c > p / 2$ range.
|
| 147 |
+
|
| 148 |
+
# 6 EXPERIMENTS
|
| 149 |
+
|
| 150 |
+
In this section, we experimentally evaluate the proposed method. Specifically, we demonstrate that our method can significantly reduce the communication cost while maintaining test accuracy. We also show that it can reduce communication cost further when combined with other sparsification methods, and even improves test accuracy in some settings.
|
| 151 |
+
|
| 152 |
+
We used CIFAR-10 (Krizhevsky, 2009) and ImageNet (Russakovsky et al., 2015), the two most popular benchmark datasets of image classification. We fixed the hyperparameter $\zeta$ in Fig. 1 and Fig. 2 to 0.999 in all experiments. We evaluated gradient compression algorithms from the following two viewpoints: accuracy and compression ratio. The accuracy is defined as the test accuracy at the last epoch, and the compression ratio is defined as the number of the total parameters of networks divided by the average number of parameters sent. We do not consider the size of other non-essential information required for the communication, because they are negligible. In addition, we can ignore the number of bits to express each gradient because we assume that both a gradient and a parameter index are enclosed in a 32 bit word as Strom (2015) in all algorithms. Please note that, as all methods use allgatherv for communication, communication cost increases in proportion to the number of workers. Thus, high compression ratio is required to achieve sufficient speed up when using tens or hundreds of workers. We have visualization of results in Appendix C.
|
| 153 |
+
|
| 154 |
+
# 6.1 CIFAR-10
|
| 155 |
+
|
| 156 |
+
For experiments on CIFAR-10, we used a convolutional neural network similar to VGG (Simonyan & Zisserman, 2015). The details of the network architecture are described in Appendix D. We trained the network for 300 epochs with weight decay of 0.0005. A total number of workers was 8 and batch size was 64 for each worker. We applied no data augmentation to training images and center-cropped both training and test images into 32x32. We used two different optimization methods: Adam (Ba & Kingma, 2015) and momentum SGD (Sutskever et al., 2013). For Adam, we used Adam’s default parameter described in Ba & Kingma (2015). For momentum SGD, we set the initial learning rate to $0 . 0 5 \times 8$ and halved it at every 25 epochs. We used two’s complement in implementation of QSGD and ”bit” represents the number of bits used to represent each element of gradients. ”d” represents a bucket size. For each configuration, we report the median of the accuracy from five independent runs. Compression ratios are calculated based on the execution that achieved the reported accuracy.
|
| 157 |
+
|
| 158 |
+
Table 1 summarizes the results. Our method successfully trained the network with slight accuracy gain for the Adam setting and 2 to $3 \%$ of accuracy degradation for the Momentum SGD setting. Compression ratios were also sufficiently high, and our method reduced communication cost beyond quantization-based approaches described in section 3. The hybrid algorithm’s compression ratio is several orders higher than existing compression methods with a low reduction in accuracy. This indicates the algorithm can make computation with a large number of nodes feasible on commodity level infrastructure that would have previously required high-end interconnections. Even though QSGD achieved higher accuracy than our method, its compression power is limited and our algorithm can reduce communication cost more aggressively. On the other hand, Strom’s method caused significant accuracy degradation. Counter-intuitively, the hybrid algorithm improved its accuracy, in addition to the further reduction of communication.
|
| 159 |
+
|
| 160 |
+
Our hypothesis for this phenomena is as follows. In Strom’s algorithm, when a large positive gradient appears, it has no choice but send positive values for consequent steps even if calculated gradients in following mini-batches have negative values. On the other hand, in the hybrid algorithm, if following gradients have a different sign with a residual, the residual is not likely to be sent. We assume that this effect helped the training procedure and led to better accuracy. We also would like to mention the difficulty of hyperparameter tuning in Strom’s method. As Table 1 shows, using lower threshold does not necessarily always lead to higher accuracy. This is because the hyperparameter controls both its sparsification and quantization. Thus, users do not know whether to use a larger or smaller value as a threshold to maintain accuracy. We note that we observed unstable behaviors with other thresholds around 0.01. On the other hand, our algorithm are free from such problem. Moreover, when we know good threshold for Strom’s algorithm, we can just combine it with ours to get further compression.
|
| 161 |
+
|
| 162 |
+
Table 1: Training of a VGG-like network on CIFAR-10. $\tau$ denotes the threshold in Strom’s method. $\alpha$ is the hyperparameter of our method described in the criterion (3). The number of bits of QSGD refers the number of bits to express gradients except for the sign bits. For each configuration, the median of the accuracy from five independent runs is reported. The compression column lists the compression ratio defined at the beginning of Sec. 6.
|
| 163 |
+
|
| 164 |
+
<table><tr><td colspan="3">Adam</td><td colspan="2">Momentum SGD</td></tr><tr><td>Method</td><td>Accuracy</td><td>Compression</td><td>Accuracy</td><td>Compression</td></tr><tr><td>no compression</td><td>88.1</td><td>1</td><td>91.7</td><td>1</td></tr><tr><td>Strom, T = 0.001</td><td>62.8</td><td>88.5</td><td>84.8</td><td>6.5</td></tr><tr><td>Strom, T = :0.01</td><td>85.0</td><td>230.1</td><td>10.6</td><td>990.7</td></tr><tr><td>Strom, T = 0.1</td><td>88.0</td><td>6,942.8</td><td>71.6</td><td>8,485.0</td></tr><tr><td>our method,α = 1</td><td>88.9</td><td>120.7</td><td>90.3</td><td>52.4</td></tr><tr><td>our method,α = 1.5</td><td>88.9</td><td>453.3</td><td>89.6</td><td>169.2</td></tr><tr><td>our method,α = 2.0</td><td>88.9</td><td>913.4</td><td>88.4</td><td>383.6</td></tr><tr><td>hybrid, τ = 0.01,α = 2.0</td><td>85.0</td><td>1,942.2</td><td>87.6</td><td>983.9</td></tr><tr><td>hybrid, τ = 0.1,α = 2.0</td><td>88.2</td><td>12,822.4</td><td>87.1</td><td>12,396.8</td></tr><tr><td>QSGD (2bit, d = 128)</td><td>88.8</td><td>12.3</td><td>90.8</td><td>6.6</td></tr><tr><td>QSGD (3bit, d = 512)</td><td>87.4</td><td>14.4</td><td>91.4</td><td>7.0</td></tr><tr><td>QSGD (4bit, d = 512)</td><td>88.2</td><td>11.0</td><td>91.7</td><td>4.0</td></tr></table>
|
| 165 |
+
|
| 166 |
+
Table 2: Training ResNet50 on ImageNet. $\tau$ denotes a threshold in Strom’s method. $\alpha$ is the hyperparameter of our method described in the criterion (3). Accuracy is the test accuracy at the last epoch. Compression refers compression ratio defined in the beginning of Sec. 6.
|
| 167 |
+
|
| 168 |
+
<table><tr><td colspan="3">Adam</td><td colspan="2">Momentum SGD</td></tr><tr><td>Method</td><td>Accuracy</td><td>Compression</td><td> Accuracy</td><td>Compression</td></tr><tr><td>no compression</td><td>56.2</td><td>1</td><td>76.0</td><td>1</td></tr><tr><td>Strom, T = 0.001</td><td>28.6</td><td>38.6</td><td>75.2</td><td>2.1</td></tr><tr><td>Strom, T = 0.01</td><td>50.0</td><td>156.2</td><td>75.5</td><td>35.2</td></tr><tr><td>Strom, T = 0.1</td><td>48.1</td><td>6,969.0</td><td>75.5</td><td>2.002.2</td></tr><tr><td>our method,α = 1</td><td>55.3</td><td>1,542.8</td><td>74.7</td><td>103.8</td></tr><tr><td>our method, α = 1.5</td><td>57.4</td><td>2,953.1</td><td>75.5</td><td>400.7</td></tr><tr><td>our method,α = 2.0</td><td>57.8</td><td>5,173.8</td><td>75.1</td><td>990.7</td></tr><tr><td>hybrid, τ = 0.01,α = 2.0</td><td>52.2</td><td>2,374.2</td><td>75.0</td><td>470.9</td></tr><tr><td>hybrid, T = 0.1,α = 2.0</td><td>43.1</td><td>28,954.2</td><td>75.1</td><td>4,345.0</td></tr></table>
|
| 169 |
+
|
| 170 |
+
# 6.2 IMAGENET
|
| 171 |
+
|
| 172 |
+
As larger scale experiments, we trained ResNet-50 (He et al., 2016) on ImageNet. We followed training procedure of Goyal et al. (2017) including optimizer, hyperparameters and data augmentation. We also evaluated algorithms with replacing MomentumSGD and its learning rate scheduling to Adam with its default hyperparameter. We used batch size 32 for each worker and used 16 workers.
|
| 173 |
+
|
| 174 |
+
Table 2 summarizes the results. In this example as well as the previous CIFAR10 example, Variancebased Gradient Compression shows a significantly high compression ratio, with comparable accuracy. While in this case, Strom’s method’s accuracy was comparable with no compression, given the significant accuracy degradation with Strom’s method on CIFAR10, it appears Variance-based Gradient Compression provides a more robust solution. Note that the training configuration with MomentumSGD is highly optimized to training without any compression. For reference, the original paper of ResNet-50 reports its accuracy as $7 5 . 3 \%$ (He et al., 2016). Wen et al. (2017) reports that it caused up to $2 \%$ accuracy degradation in training with GoogLeNet (Szegedy et al., 2015) on ImageNet and our method causes no more degradation compared to quantization-based approaches.
|
| 175 |
+
|
| 176 |
+
# 7 CONCLUSION
|
| 177 |
+
|
| 178 |
+
We proposed a novel method for gradient compression. Our method can reduce communication cost significantly with no or only slight accuracy degradation. Contributions of our work can be summarized in the following three points. First, we proposed a novel measurement of ambiguity (high variance, low amplitude) to determine when a gradient update is required. Second, we showed the application of this measurement as a threshold for updates significantly reduces update requirements, while providing comparable accuracy. Third, we demonstrated this method can be combined with other efficient gradient compression approaches to further reduce communication cost.
|
| 179 |
+
|
| 180 |
+
# REFERENCES
|
| 181 |
+
|
| 182 |
+
A. F. Aji and K. Heafield. Sparse communication for distributed gradient descent. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 440–445, 2017.
|
| 183 |
+
D. Alistarh, D. Grubic, J. Li, R. Tomioka, and M. Vojnovic. Communication-efficient stochastic gradient descent, with applications to neural networks. In Advances in Neural Information Processing Systems 31 (NIPS), 2017. to appear.
|
| 184 |
+
J. Ba and D. Kingma. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations (ICLR), 2015.
|
| 185 |
+
S. De, A. Yadav, D. Jacobs, and T. Goldstein. Automated inference with adaptive batches. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics (AISTATS), pp. 1504–1513, 2017.
|
| 186 |
+
N. Dryden, S. A. Jacobs, T. Moon, and B. Van Essen. Communication quantization for data-parallel training of deep neural networks. In Proceedings of the Workshop on Machine Learning in High Performance Computing Environments (MLHPC ’16), pp. 1–8, 2016.
|
| 187 |
+
P. Goyal, P. Dollar, R. B. Girshick, P. Noordhuis, L. Wesolowski, A. Kyrola, A. Tulloch, Y. Jia, and ´ K. He. Accurate, large minibatch SGD: training imagenet in 1 hour. arXiv:1706.02677, 2017.
|
| 188 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.
|
| 189 |
+
A. Krizhevsky. Learning multiple layers of features from tiny images. 2009.
|
| 190 |
+
O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
|
| 191 |
+
F. Seide, H. Fu, J. Droppo, G. Li, and D. Yu. 1-bit stochastic gradient descent and application to data-parallel distributed training of speech DNNs. In INTERSPEECH, pp. 1058–1062, 2014.
|
| 192 |
+
K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In 3rd International Conference on Learning Representations (ICLR), 2015.
|
| 193 |
+
N. Strom. Scalable distributed DNN training using commodity GPU cloud computing. In INTERSPEECH, pp. 1488–1492, 2015.
|
| 194 |
+
I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In Proceedings of the 30th International Conference on International Conference on Machine Learning (ICML), pp. 1139–1147, 2013.
|
| 195 |
+
C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–9, 2015.
|
| 196 |
+
R. Thakur, R. Rabenseifner, and W. Gropp. Optimization of collective communication operations in MPICH. The International Journal of High Performance Computing Applications, 19(1):49–66, 2005.
|
| 197 |
+
S. Tokui, K. Oono, S. Hido, and J. 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), 2015.
|
| 198 |
+
J. L. Traff, A. Ripke, C. Siebert, P. Balaji, R. Thakur, and W. Gropp. A simple, pipelined algorithm ¨ for large, irregular all-gather problems. In Recent Advances in Parallel Virtual Machine and Message Passing Interface: 15th European PVM/MPI Users’ Group Meeting, pp. 84–93, 2008.
|
| 199 |
+
W. Wen, C. Xu, F. Yan, C. Wu, Y. Wang, Y. Chen, and H. Li. TernGrad: Ternary gradients to reduce communication in distributed deep learning. In Advances in Neural Information Processing Systems 31 (NIPS), 2017. to appear.
|
| 200 |
+
|
| 201 |
+
# A A SIMPLIFIED VIEW OF THE VARIANCE-BASED CRITERION
|
| 202 |
+
|
| 203 |
+
We derive that the criterion (3) corresponds to the criterion (1).
|
| 204 |
+
|
| 205 |
+
$$
|
| 206 |
+
\begin{array} { r l } & { \quad ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \big | \nabla \gamma _ { s } f _ { s } ( z ) \big | ) ^ { \frac { 1 } { \gamma } } > \alpha \sum _ { \kappa \in \boldsymbol { \kappa } } ( \frac { 1 } { | B | } \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { \theta ^ { \prime } } } \\ { \Leftrightarrow } & { \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { 2 } > \alpha \frac { 1 } { | B | } ( \frac { 1 } { | B | } \underset { s \in \boldsymbol { \kappa } } { \sum } ( \nabla _ { s } f _ { s } ( z ) ) - \underset { s \neq n } { \sum } ( \frac { 1 } { | B | } \nabla _ { s } f _ { s } ( z ) ) ^ { 2 } ) } \\ { \Leftrightarrow } & { \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } | \nabla \gamma _ { s } f _ { s } ( z ) | ) ^ { 2 } > \alpha _ { | B | } \underset { s \in \boldsymbol { \kappa } } { \sum } | \nabla \gamma _ { s } f _ { s } ( z ) - \frac { 1 } { | B | } \sum _ { s \in \boldsymbol { \kappa } } ( \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { 2 } | } \\ { \Leftrightarrow } & { \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \nabla \gamma _ { s } f _ { s } ( z ) ) ^ { 2 } > \alpha \frac { | B | - \frac { 1 } { | B | } } { | B | ^ { 2 } \cdot | B | } \sum _ { s = \boldsymbol { \kappa } } ( \nabla \gamma _ { s } f _ { s } ( z ) - \frac { 1 } { | B | } \sum _ { s = \boldsymbol { \kappa } } \gamma _ { s } ( z ) ) ^ { 2 } } \\ { \Leftrightarrow } & \frac { | B | - \alpha } { | B | } ( \underset { s \in \boldsymbol { \kappa } _ { 1 } } { \sum } \frac { 1 } { B } \gamma _ { s } f _ s \end{array}
|
| 207 |
+
$$
|
| 208 |
+
|
| 209 |
+
$V _ { B } [ \nabla _ { i } f _ { z } ( x ) ] / | B |$ is an estimated variance of the means of gradients in mini-batches with size $| B |$ . For $\alpha = 1$ , the above criterion reduces to
|
| 210 |
+
|
| 211 |
+
$$
|
| 212 |
+
\nabla f _ { B } ( x ) ^ { 2 } > \frac { 1 } { | B | } V _ { B } [ \nabla f _ { z } ( x ) ] ,
|
| 213 |
+
$$
|
| 214 |
+
|
| 215 |
+
which is an estimated version of the sufficient condition (2). The term $( | B | - 1 ) / ( | B | - \alpha )$ is approximately 1 in most settings.
|
| 216 |
+
|
| 217 |
+
# B RUNNING EXAMPLE OF QUANTIZATION
|
| 218 |
+
|
| 219 |
+
Let $( 0 . 0 4 , 0 . 3 1 , - 6 . 2 5 , 2 2 . 2 5 , - 3 5 . 7 5 )$ be a part of gradient elements corresponding to a matrix. Sign bits are separately processed and we consider their absolute values here: $( 0 . 0 4 , 0 . 3 1 , 6 . 2 5 , 2 2 . 2 5 , 3 5 . 7 5 )$ . Now, $M _ { k }$ is the max of the elements: 35.75. $2 ^ { \lfloor \log _ { 2 } M _ { k } \rfloor }$ is 32. After rounding, $g _ { i ^ { \prime } }$ of each element become $0 . 0 3 1 2 5 , 0 . 2 5 , 8 , 1 6 , 3 2$ and $d _ { i }$ for each element become $1 0 , 7 , 2 , 1 , 0$ . Note that higher $d _ { i }$ corresponds to smaller $g _ { i } ^ { \prime }$ . We can use only 3 bits and thus we cannot represent 10 and it will not be sent, which means it will not be sent. Finally, we send them with $\lfloor \log _ { 2 } M _ { k } \rfloor$ , sign bits and index: $\left\{ \left\lfloor \log _ { 2 } M _ { k } \right\rfloor : 5 \right.$ , ( $( + 7$ , index : 1), (−2, index $: 2$ ), ( $+ 1$ , index : 2), $( - 0 , \mathrm { i n d e x : 3 } ) ) \}$ .
|
| 220 |
+
|
| 221 |
+
# C VISUAL REPRESENTATION OF EXPERIMENTAL RESULTS
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 3 are scatter plots of Table 1 and 2. The upper right corner is desirable. The figures suggests superiority of our variance-based compression and hybrid algorithm.
|
| 225 |
+
Figure 3: Scatter plots of relation between accuracy and compression ratio. The four plots correspond to the configurations on datasets and optimization methods as follows: (a) CIFAR-10 and Adam, (b) CIFAR-10 and MomentumSGD, (c) ImageNet and Adam, (d) ImageNet and MomentumSGD. No compression denotes the case where we do not use any compression methods. Variance is a method described in Sec. 4.1 and 4.2. Hybrid is a combination of variance based compression and Strom’s algorithm. Some outliers are not plotted. Upper right of these figures is desirable for all compression algorithms.
|
| 226 |
+
|
| 227 |
+
# D ARCHITECTURE OF VGG-LIKE NETWORK USED ON CIFAR-10
|
| 228 |
+
|
| 229 |
+
Table 3 shows the network architecture used for experiments on CIFAR-10. All convolutional layers are followed by batch normalization and ReLU activation. The code is available in examples of Chainer (Tokui et al., 2015) on GitHub.
|
| 230 |
+
|
| 231 |
+
Table 3: The network architecture for the CIFAR-10 classification task
|
| 232 |
+
|
| 233 |
+
<table><tr><td>input (3x32x32)</td></tr><tr><td>conv3-64 dropout(0.3) conv3-64</td></tr><tr><td>maxpool</td></tr><tr><td>conv3-128 dropout(0.4) conv3-128</td></tr><tr><td>maxpool</td></tr><tr><td>conv3-256 dropout(0.4) conv3-256 dropout(0.4)</td></tr><tr><td>conv3-256 maxpool</td></tr><tr><td>conv3-512 dropout(0.4) conv3-512 dropout(0.4)</td></tr><tr><td>conv3-512 maxpool</td></tr><tr><td>conv3-512 dropout(0.4) conv3-512 dropout(0.4)</td></tr><tr><td>conv3-512 maxpool</td></tr><tr><td>dropout(0.5) fully connected 512 bn relu</td></tr><tr><td>dropout(0.5) fully connected 10</td></tr><tr><td>softmax</td></tr></table>
|
md/train/rkFBJv9gg/rkFBJv9gg.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING FEATURES OF MUSIC FROM SCRATCH
|
| 2 |
+
|
| 3 |
+
John Thickstun1, Zaid Harchaoui2 & Sham M. Kakade1,2
|
| 4 |
+
1 Department of Computer Science and Engineering, 2 Department of Statistics
|
| 5 |
+
University of Washington
|
| 6 |
+
Seattle, WA 98195, USA
|
| 7 |
+
{thickstn,sham}@cs.washington.edu, name@uw.edu
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
This paper introduces a new large-scale music dataset, MusicNet, to serve as a source of supervision and evaluation of machine learning methods for music research. MusicNet consists of hundreds of freely-licensed classical music recordings by 10 composers, written for 11 instruments, together with instrument/note annotations resulting in over 1 million temporal labels on 34 hours of chamber music performances under various studio and microphone conditions.
|
| 12 |
+
|
| 13 |
+
The paper defines a multi-label classification task to predict notes in musical recordings, along with an evaluation protocol, and benchmarks several machine learning architectures for this task: i) learning from spectrogram features; ii) endto-end learning with a neural net; iii) end-to-end learning with a convolutional neural net. These experiments show that end-to-end models trained for note prediction learn frequency selective filters as a low-level representation of audio.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Music research has benefited recently from the effectiveness of machine learning methods on a wide range of problems from music recommendation (van den Oord et al., 2013; McFee & Lanckriet, 2011) to music generation (Hadjeres & Pachet, 2016); see also the recent demos of the Google Magenta project1. As of today, there is no large publicly available labeled dataset for the simple yet challenging task of note prediction for classical music. The MIREX MultiF0 Development Set (Benetos & Dixon, 2011) and the Bach10 dataset (Duan et al., 2011) together contain less than 7 minutes of labeled music. These datasets were designed for method evaluation, not for training supervised learning methods.
|
| 18 |
+
|
| 19 |
+
This situation stands in contrast to other application domains of machine learning. For instance, in computer vision large labeled datasets such as ImageNet (Russakovsky et al., 2015) are fruitfully used to train end-to-end learning architectures. Learned feature representations have outperformed traditional hand-crafted low-level visual features and lead to tremendous progress for image classification. In (Humphrey et al., 2012), Humphrey, Bello, and LeCun issued a call to action: “Deep architectures often require a large amount of labeled data for supervised training, a luxury music informatics has never really enjoyed. Given the proven success of supervised methods, MIR would likely benefit a good deal from a concentrated effort in the curation of sharable data in a sustainable manner.”
|
| 20 |
+
|
| 21 |
+
This paper introduces a new large labeled dataset, MusicNet, which is publicly available2 as a resource for learning feature representations of music. MusicNet is a corpus of aligned labels on freely-licensed classical music recordings, made possible by licensing initiatives of the European Archive, the Isabella Stewart Gardner Museum, Musopen, and various individual artists. The dataset consists of 34 hours of human-verified aligned recordings, containing a total of 1, 299, 329 individual labels on segments of these recordings. Table 1 summarizes statistics of MusicNet.
|
| 22 |
+
|
| 23 |
+
The focus of this paper’s experiments is to learn low-level features of music from raw audio data. In Sect. 4, we will construct a multi-label classification task to predict notes in musical recordings, along with an evaluation protocol. We will consider a variety of machine learning architectures for this task: i) learning from spectrogram features; ii) end-to-end learning with a neural net; iii) endto-end learning with a convolutional neural net. Each of the proposed end-to-end models learns a set of frequency selective filters as low-level features of musical audio, which are similar in spirit to a spectrogram. The learned low-level features are visualized in Figure 1. The learned features modestly outperform spectrogram features; we will explore possible reasons for this in Sect. 5.
|
| 24 |
+
|
| 25 |
+
MusicNet
|
| 26 |
+
Table 1: Summary statistics of the MusicNet dataset. See Sect. 2 for further discussion of MusicNet and Sect. 3 for a description of the labelling process. Appendix A discusses the methodology for computing error rate of this process.
|
| 27 |
+
|
| 28 |
+
<table><tr><td> Minutes</td><td>Labels</td><td>Recordings</td><td>Error Rate</td><td></td><td>Composer</td><td> Minutes</td><td>Labels</td></tr><tr><td>2,048</td><td>1,299,329</td><td>330</td><td colspan="2">4.0%</td><td>Beethoven Schubert</td><td>1,085 253</td><td>736,072</td></tr><tr><td colspan="6">Labels</td><td>192</td><td>133,109</td><td>146,648</td></tr><tr><td colspan="6">Ensemble Minutes Solo Piano 917</td><td>Brahms Mozart Bach</td><td>156</td><td>99,641</td></tr><tr><td colspan="6"> String Quartet</td><td>Dvorak</td><td>184</td><td>62,782</td></tr><tr><td colspan="6"> Accompanied Violin</td><td></td><td>56</td><td>46,261</td></tr><tr><td colspan="6"> Piano Quartet</td><td>Cambini</td><td>43</td><td>24,820</td></tr><tr><td colspan="6"> Accompanied Cello</td><td>Faure</td><td></td><td>22,349</td></tr><tr><td colspan="6"> String Sextet</td><td>Ravel</td><td>27</td><td>21,243</td></tr><tr><td colspan="6">Piano Trio</td><td>Haydn</td><td></td><td>6,404</td></tr><tr><td colspan="6">Piano Quintet</td><td></td><td></td><td></td></tr><tr><td colspan="6">25 Wind Quintet 43</td><td> Instrument</td><td> Minutes</td><td>Labels</td></tr><tr><td colspan="6">Horn Piano Trio 30</td><td>Piano</td><td>1346</td><td>794,532</td></tr><tr><td colspan="6">Wind Octet 23</td><td>Violin</td><td>874</td><td>230,484</td></tr><tr><td colspan="6">Clarinet-Cello-Piano Trio</td><td>Viola</td><td>621</td><td>99,407</td></tr><tr><td colspan="6">2524 Pairs Clarinet-Horn-Bassoon</td><td>Cello</td><td>800</td><td>99,132</td></tr><tr><td colspan="6">Clarinet Quintet 26</td><td>Clarinet</td><td>173</td><td>24,426</td></tr><tr><td colspan="6">Solo Cello 49</td><td>Bassoon</td><td>102</td><td>14,954</td></tr><tr><td colspan="6">Accompanied Clarinet 20</td><td>Horn</td><td>132</td><td>11,468</td></tr><tr><td colspan="6">10,049 Solo Violin 30</td><td>Oboe</td><td>66</td><td></td></tr><tr><td colspan="6">Violin and Harpsichord 16</td><td>Flute</td><td>69</td><td>8,696</td></tr><tr><td colspan="6">Viola Quintet 15</td><td></td><td></td><td>8,310</td></tr><tr><td colspan="6"> Solo Flute</td><td>Harpsichord</td><td>16</td><td>4,914</td></tr><tr><td colspan="6"></td><td> String Bass</td><td>38</td><td>3,006</td></tr><tr><td>Piano</td><td>Violin</td><td>Cello</td><td>Viola</td><td>Clarinet Bassoon</td><td>Horn</td><td>Oboe</td><td></td><td></td><td></td></tr><tr><td colspan="6"></td><td></td><td>Flute</td><td>Bass Harpsichord</td><td></td></tr><tr><td>Notes</td><td>83</td><td>51</td><td>51 51</td><td>41</td><td>36</td><td>41 28</td><td>37</td><td>43</td><td>51</td></tr></table>
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 1: (Left) Bottom-level weights learned by a two-layer ReLU network trained on 16,384- samples windows $( \approx 1 / 3$ seconds) of raw audio with $\ell _ { 2 }$ regularized $\lambda = 1$ ) square loss for multilabel note classification on raw audio recordings. (Middle) Magnified view of the center of each set of weights. (Right) The truncated frequency spectrum of each set of weights.
|
| 32 |
+
|
| 33 |
+
# 2 MUSICNET
|
| 34 |
+
|
| 35 |
+
Related Works. The experiments in this paper suggest that large amounts of data are necessary to recovering useful features from music; see Sect. 4.5 for details. The Lakh dataset, released this summer based on the work of Raffel & Ellis (2015), offers note-level annotations for many 30- second clips of pop music in the Million Song Dataset (McFee et al., 2012). The syncRWC dataset is a subset of the RWC dataset (Goto et al., 2003) consisting of 61 recordings aligned to scores using the protocol described in Ewert et al. (2009). The MAPS dataset (Emiya et al., 2010) is a mixture of acoustic and synthesized data, which expressive models could overfit. The Mazurka project3 consists of commercial music. Access to the RWC and Mazurka datasets comes at both a cost and inconvenience. Both the MAPS and Mazurka datasets are comprised entirely of piano music.
|
| 36 |
+
|
| 37 |
+
The MusicNet Dataset. MusicNet is a public collection of labels (exemplified in Table 2) for 330 freely-licensed classical music recordings of a variety of instruments arranged in small chamber ensembles under various studio and microphone conditions. The recordings average 6 minutes in length. The shortest recording in the dataset is 55 seconds and the longest is almost 18 minutes. Table 1 summarizes the statistics of MusicNet with breakdowns into various types of labels. Table 2 demonstrates examples of labels from the MusicNet dataset.
|
| 38 |
+
|
| 39 |
+
<table><tr><td>Start</td><td>End</td><td>Instrument</td><td>Note</td><td>Measure</td><td>Beat</td><td>Note Value</td></tr><tr><td>45.29</td><td>45.49</td><td>Violin</td><td>G5</td><td>21</td><td>3</td><td>Eighth</td></tr><tr><td>48.99</td><td>50.13</td><td>Cello</td><td>A#3</td><td>24</td><td>2</td><td>Dotted Half</td></tr><tr><td>82.91</td><td>83.12</td><td>Viola</td><td>C5</td><td>51</td><td>2.5</td><td>Eighth</td></tr></table>
|
| 40 |
+
|
| 41 |
+
Table 2: MusicNet labels on the Pascal String Quartet’s recording of Beethoven’s Opus 127, String Quartet No. 12 in E-flat major, I - Maestoso - Allegro. Creative commons use of this recording is made possible by the work of the European Archive.
|
| 42 |
+
|
| 43 |
+
MusicNet labels come from 513 label classes using the most naive definition of a class: distinct instrument/note combinations. The breakdowns reported in Table 1 indicate the number of distinct notes that appear for each instrument in our dataset. For example, while a piano has 88 keys only 83 of them are performed in MusicNet. For many tasks a note’s value will be a part of its label, in which case the number of classes will expand by approximately an order of magnitude after taking the cartesian product of the set of classes with the set of values: quarter-note, eighth-note, triplet, etc. Labels regularly overlap in the time series, creating polyphonic multi-labels.
|
| 44 |
+
|
| 45 |
+
MusicNet is skewed towards Beethoven, thanks to the composer’s popularity among performing ensembles. The dataset is also skewed towards Solo Piano due to an abundance of digital scores available for piano works. For training purposes, researchers may want to augment this dataset to increase coverage of instruments such as Flute and Oboe that are under-represented in MusicNet. Commercial recordings could be used for this purpose and labeled using the alignment protocol described in Sect. 3.
|
| 46 |
+
|
| 47 |
+
# 3 DATASET CONSTRUCTION
|
| 48 |
+
|
| 49 |
+
MusicNet recordings are freely-licensed classical music collected from the European Archive, the Isabella Stewart Gardner Museum, Musopen, and various artists’ collections. The MusicNet labels are retrieved from digital MIDI scores, collected from various archives including the Classical Archives (classicalarchives.com) Suzuchan’s Classic MIDI (suzumidi.com) and HarfeSoft (harfesoft.de). The methods in this section produce an alignment between a digital score and a corresponding freely-licensed recording. A recording is labeled with events in the score, associated to times in the performance via the alignment. Scores containing 6, 550, 760 additional labels are available on request to researchers who wish to augment MusicNet with commercial recordings.
|
| 50 |
+
|
| 51 |
+
Music-to-score alignment is a long-standing problem in the music research and signal processing communities (Raphael, 1999). Dynamic time warping (DTW) is a classical approach to this problem. An early use of DTW for music alignment is Orio & Schwarz (2001) where a recording is aligned to a crude synthesis of its score, designed to capture some of the structure of an overtone series. The method described in this paper aligns recordings to synthesized performances of scores, using side information from a commercial synthesizer. To the best of our knowledge, commercial synthesis was first used for the purpose of alignment in Turetsky & Ellis (2003).
|
| 52 |
+
|
| 53 |
+
The majority of previous work on alignment focuses on pop music. This is more challenging than aligning classical music because commercial synthesizers do a poor job reproducing the wide variety of vocal and instrumental timbers that appear in modern pop. Furthermore, pop features inharmonic instruments such as drums for which natural metrics on frequency representations–including $\ell ^ { 2 }$ –are not meaningful. For classical music to score alignment, a variant of the techniques described in Turetsky & Ellis (2003) works robustly. This method is described below; we discuss the evaluation of this procedure and its error rate on MusicNet in the appendix.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 2: (Left) Heatmap visualization of local alignment costs between the synthesized and recorded spectrograms, with the optimal alignment path in red. The block from $x = 0$ to $x = 1 0 0$ frames corresponds to silence at the beginning of the recorded performance. The slope of the alignment can be interpreted as an instantaneous tempo ratio between the recorded and synthesized performances. The curvature in the alignment between $x \ = \ 1 0 0$ and $x \ = \ 1 7 5$ corresponds to an extension of the first notes by the performer. (Right) Annotation of note onsets on the spectrogram of the recorded performance, determined by the alignment shown on the left.
|
| 57 |
+
|
| 58 |
+
In order to align the performance with a score, we need to define a metric that compares short segments of the score with segments of a performance. Musical scores can be expressed as binary vectors in $E \times K$ where $E = \{ 1 , \ldots , n \}$ and $K$ is a dictionary of notes. Performances reside in $\mathbb { R } ^ { T \times p }$ , where $T \in \{ 1 , \dots , m \}$ is a sequence of time steps and $p$ is the dimensionality of the spectrogram at time $T$ . Given some local cost function $C : ( \mathbb { R } ^ { p } , K ) \to \mathbb { R }$ , a score $\mathbf { Y } \in E \times K$ , and a performance $\mathbf { X } \in \mathbb { R } ^ { T \times p }$ , the alignment problem is to
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\begin{array} { r l r } & { \underset { t \in \mathbb { Z } ^ { n } } { \mathrm { m i n i m i z e } } } & { \displaystyle \sum _ { i = 1 } ^ { n } C ( \mathbf { X } _ { t _ { i } } , \mathbf { Y } _ { i } ) } \\ & { \mathrm { s u b j e c t ~ t o } } & { t _ { 0 } = 0 , } \\ & { t _ { n } = m , } \\ & { t _ { i } \leq t _ { j } } & { \mathrm { i f } i < j . } \end{array}
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
Dynamic time warping gives an exact solution to the problem in $\mathcal { O } ( m n )$ time and space.
|
| 65 |
+
|
| 66 |
+
The success of dynamic time warping depends on the metric used to compare the score and the performance. Previous works can be broadly categorized into three groups that define an alignment cost $C$ between segments of music $\mathbf { X }$ and score $\mathbf { y }$ by injecting them into a common normed space via maps $\Psi$ and $\Phi$ :
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
C ( \mathbf { x } , \mathbf { y } ) = \| \Psi ( \mathbf { x } ) - \Phi ( \mathbf { y } ) \|
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
The most popular approach–and the one adopted by this paper–maps the score into the space of the performance (Orio & Schwarz, 2001; Turetsky $\&$ Ellis, 2003; Soulez et al., 2003). An alternative approach maps both the score and performance into some third space, commonly a chromogram space (Hu et al., 2003; Izmirli $\&$ Dannenberg, 2010; Joder et al., 2013). Finally, some recent methods consider alignment in score space, taking $\Phi = \mathrm { I d }$ and learning $\Psi$ (Garreau et al., 2014; Lajugie et al., 2016).
|
| 73 |
+
|
| 74 |
+
With reference to the general cost (2), we must specify the maps $\Psi , \Phi$ , and the norm $\| \cdot \|$ . We compute the cost in the performance feature space $\mathbb { R } ^ { p }$ , hence we take $\Psi = \mathrm { I d }$ . For the features, we use the log-spectrogram with a window size of 2048 samples. We use a stride of 512 samples between features. Hence adjacent feature frames are computed with $7 5 \%$ overlap. For audio sampled at $4 4 . 1 \mathrm { k H z }$ , this results in a feature representation with 4 $\mathrm { \Delta } 4 , 1 0 0 / 5 1 2 \approx 8 6 $ frames per second. A discussion of these parameter choices can be found in the appendix. The map $\Phi$ is computed by a synthetizer: we used Plogue’s Sforzando sampler together with Garritan’s Personal Orchestra 4 sample library.
|
| 75 |
+
|
| 76 |
+
For a (pseudo)-metric on $\mathbb { R } ^ { p }$ , we take the $\ell ^ { 2 }$ norm $\| \cdot \| _ { 2 }$ on the low 50 dimensions of $\mathbb { R } ^ { p }$ . Recall that $\mathbb { R } ^ { p }$ represents Fourier components, so we can roughly interpret the $k$ ’th coordinate of $\mathbb { R } ^ { p }$ as the energy associated with the frequency $k \times ( 2 2 , 0 5 0 / \mathrm { 1 0 2 4 } ) \approx \bar { k } \times 2 2 . 5 \mathrm { H z }$ , where $2 2 , 0 5 0 \mathrm { H z }$ is the Nyquist frequency of a signal sampled at $4 4 . 1 \mathrm { k H z }$ . The 50 dimension cutoff is chosen empirically: we observe that the resulting alignments are more accurate using a small number of low-frequency bins rather than the full space $\mathbb { R } ^ { p }$ . Synthesizers do not accurately reproduce the high-frequency features of a musical instrument; by ignoring the high frequencies, we align on a part of the spectrum where the synthesis is most accurate. The proposed choice of cutoff is aggressive compared to usual settings; for instance, Turetsky & Ellis (2003) propose cutoffs in the $2 . 5 \mathrm { k H z }$ range. The fundamental frequencies of many notes in MusicNet are higher than the $5 0 \times 2 2 . 5 \mathrm { H z } \approx 1 \mathrm { k H z }$ cutoff. Nevertheless, we find that all notes align well using only the low-frequency information.
|
| 77 |
+
|
| 78 |
+
# 4 METHODS
|
| 79 |
+
|
| 80 |
+
We consider identification of notes in a segment of audio $\textbf { x } \in \ \mathcal { X }$ as a multi-label classification problem, modeled as follows. Assign each audio segment a binary label vector $\mathbf { y } \in \{ 0 , 1 \} ^ { 1 2 8 }$ . The 128 dimensions correspond to frequency codes for notes, and ${ \bf y } _ { n } = 1$ if note $n$ is present at the midpoint of $\mathbf { x }$ . Let $f : \mathcal { X } \to \mathcal { H }$ indicate a feature map. We train a multivariate linear regression to predict $\hat { \mathbf { y } }$ given $f ( \mathbf { x } )$ , which we optimize for square loss. The vector $\hat { \mathbf { y } }$ can be interpreted as a multi-label estimate of notes in $\mathbf { x }$ by choosing a threshold $c$ and predicting label $n$ iff ${ \hat { \mathbf { y } } } _ { n } > c$ . We search for the value $c$ that maximizes $F _ { 1 }$ -score on a sampled subset of MusicNet.
|
| 81 |
+
|
| 82 |
+
# 4.1 RELATED WORK
|
| 83 |
+
|
| 84 |
+
Learning on raw audio is studied in both the music and speech communities. Supervised learning on music has been driven by access to labeled datasets. Pop music labeled with chords (Harte, 2010) has lead to a long line of work on chord recognition, most recently Korzeniowsk & Widmer (2016). Genre labels and other metadata has also attracted work on representation learning, for example Dieleman & Schrauwen (2014). There is also substantial work modeling raw audio representations of speech; a current example is Tokuda & Zen (2016). Recent work from Google DeepMind explores generative models of raw audio, applied to both speech and music (van den Oord et al., 2016).
|
| 85 |
+
|
| 86 |
+
The music community has worked extensively on a closely related problem to note prediction: fundamental frequency estimation. This is the analysis of fundamental (in contrast to overtone) frequencies in short audio segments; these frequencies are typically considered as proxies for notes. Because access to large labeled datasets was historically limited, most of these works are unsupervised. A good overview of this literature can be found in Benetos et al. (2013). Variants of non-negative matrix factorization are popular for this task; a recent example is Khlif & Sethu (2015). A different line of work models audio probabilistically, for example Berg-Kirkpatrick et al. (2014). Recent work by Kelz et al. (2016) explores supervised models, trained using the MAPS piano dataset.
|
| 87 |
+
|
| 88 |
+
# 4.2 MULTI-LAYER PERCEPTRONS
|
| 89 |
+
|
| 90 |
+
We build a two-layer network with features $f _ { i } ( \mathbf { x } ) = \log \left( 1 + \operatorname* { m a x } ( 0 , \mathbf { w } _ { i } ^ { T } \mathbf { x } ) \right)$ . We find that compression introduced by a logarithm improves performance versus a standard ReLU network (see Table 3). Figure 1 illustrates a selection of weights $w _ { i }$ learned by the bottom layer of this network. The weights learned by the network are modulated sinusoids. This explains the effectiveness of spectrograms as a low-level representation of musical audio. The weights decay at the boundaries, analogous to Gabor filters in vision. This behavior is explained by the labeling methodology: the audio segments used here are approximately $1 / 3$ of a second long, and a segment is given a note label if that note is on in the center of the segment. Therefore information at the boundaries of the segment is less useful for prediction than information nearer to the center.
|
| 91 |
+
|
| 92 |
+
# 4.3 (LOG-)SPECTROGRAMS
|
| 93 |
+
|
| 94 |
+
Spectrograms are an engineered feature representation for musical audio signals, available in popular software packages such as librosa (McFee et al., 2015). Spectrograms (resp. log-spectrograms) are closely related to a two-layer ReLU network (resp. the log-ReLU network described above). If $\mathbf { x } = ( x _ { 1 } , \dots , x _ { t } )$ denotes a segment of an audio signal of length $t$ then we can define
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathrm { S p e c } _ { k } ( \mathbf { x } ) \equiv \left| \sum _ { s = 0 } ^ { t - 1 } e ^ { - 2 \pi i k s / t } x _ { s } \right| ^ { 2 } = \left( \sum _ { s = 0 } ^ { t - 1 } \cos ( 2 \pi k s / t ) x _ { s } \right) ^ { 2 } + \left( \sum _ { s = 0 } ^ { t - 1 } \sin ( 2 \pi k s / t ) x _ { s } \right) ^ { 2 } .
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
These features are not precisely learnable by a two-layer ReLU network. But recall that $| x | =$ $\operatorname* { m a x } ( 0 , x ) + \operatorname* { m a x } ( 0 , - \bar { x } )$ and if we take weight vectors ${ \bf u } , { \bf v } \in \mathbb { R } ^ { T }$ with $u _ { s } = \cos ( 2 \pi k s / t )$ and $v _ { s } = \sin ( 2 \pi k s / t )$ then the ReLU network can learn
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
f _ { k , \mathrm { c o s } } ( \mathbf { x } ) + f _ { k , \mathrm { s i n } } ( \mathbf { x } ) \equiv | \mathbf { u } ^ { T } \mathbf { x } | + | \mathbf { v } ^ { T } \mathbf { x } | = \left| \sum _ { s = 0 } ^ { t - 1 } \mathrm { c o s } ( 2 \pi k s / t ) x _ { s } \right| + \left| \sum _ { s = 0 } ^ { t - 1 } \mathrm { s i n } ( 2 \pi k s / t ) x _ { s } \right| .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
We call this family of features a ReLUgram and observe that it has a similar form to the spectrogram; we merely replace the $x \mapsto x ^ { 2 }$ non-linearity of the spectrogram with $x \mapsto | x |$ . These features achieve similar performance to spectrograms on the classification task (see Table 3).
|
| 107 |
+
|
| 108 |
+
# 4.4 WINDOW SIZE
|
| 109 |
+
|
| 110 |
+
When we parameterize a network, we must choose the width of the set of weights in the bottom layer. This width is called the receptive field in the vision community; in the music community it is called the window size. Traditional frequency analyses, including spectrograms, are highly sensitive to the window size. Windows must be long enough to capture relevant information, but not so long that they lose temporal resolution; this is the classical time-frequency tradeoff. Furthermore, windowed frequency analysis is subject to boundary effects, known as spectral leakage. Classical signal processing attempts to dampen these effects with predefined window functions, which apply a mask that attenuates the signal at the boundaries (Rabiner & Schafer, 2007).
|
| 111 |
+
|
| 112 |
+
The proposed end-to-end models learn window functions. If we parameterize these models with a large window size then the model will learn that distant information is irrelevant to local prediction, so the magnitude of the learned weights will attenuate at the boundaries. We therefore focus on two window sizes: 2048 samples, which captures the local content of the signal, and 16,384 samples, which is sufficient to capture almost all relevant context (again see Figure 1).
|
| 113 |
+
|
| 114 |
+
# 4.5 REGULARIZATION
|
| 115 |
+
|
| 116 |
+
The size of MusicNet is essential to achieving the results in Figure 1. In Figure 3 (Left) we optimize a two-layer ReLU network on a small subset of MusicNet consisting of 65, 000 monophonic data points. While these features do exhibit dominant frequencies, the signal is quite noisy. Comparable noisy frequency selective features were recovered by Dieleman & Schrauwen (2014); see their Figure 3. We can recover clean features on a small dataset using heavy regularization, but this destroys classification performance; regularizing with dropout poses a similar tradeoff. By contrast, Figure 3 (Right) shows weights learned by an unregularized two-layer network trained on the full MusicNet dataset. The models described in this paper do not overfit to MusicNet and optimal performance (reported in Table 3) is achieved without regularization.
|
| 117 |
+
|
| 118 |
+
# 4.6 CONVOLUTIONAL NETWORKS
|
| 119 |
+
|
| 120 |
+
Previously, we estimated $\hat { \mathbf { y } }$ by regressing against $f ( \mathbf { x } )$ . We now consider a convolutional model that regresses against features of a collection of shifted segments $\mathbf { x } _ { \ell }$ near to the original segment x. The learned features of this network are visually comparable to those learned by the fully connected network (Figure 1). The parameters of this network are the receptive field, stride, and pooling regions.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 3: (Left) Features learned by a 2-layer ReLU network trained on small monophonic subset of MusicNet. (Right) Features learned by the same network, trained on the full MusicNet dataset.
|
| 124 |
+
|
| 125 |
+
The results reported in Table 3 are achieved with 500 hidden units using a receptive field of 2, 048 samples with an 8-sample stride across a window of 16, 384 samples. These features are grouped into average pools of width 16, with a stride of 8 features between pools. A max-pooling operation yields similar results. The learned features are consistent across different parameterizations. In all cases the learned features are comparable to those of a fully connected network.
|
| 126 |
+
|
| 127 |
+
# 5 RESULTS
|
| 128 |
+
|
| 129 |
+
We hold out a test set of 3 recordings for all the results reported in this section:
|
| 130 |
+
|
| 131 |
+
• Bach’s Prelude in D major for Solo Piano. WTK Book 1, No 5. Performed by Kimiko Ishizaka. MusicNet recording id 2303.
|
| 132 |
+
• Mozart’s Serenade in E-flat major. K375, Movement 4 - Menuetto. Performed by the Soni Ventorum Wind Quintet. MusicNet recording id 1819.
|
| 133 |
+
• Beethoven’s String Quartet No. 13 in B-flat major. Opus 130, Movement 2 - Presto. Released by the European Archive. MusicNet recording id 2382.
|
| 134 |
+
|
| 135 |
+
The test set is a representative sampling of MusicNet: it covers most of the instruments in the dataset in small, medium, and large ensembles. The test data points are evenly spaced segments separated by 512 samples, between the 1st and 91st seconds of each recording. For the wider features, there is substantial overlap between adjacent segments. Each segment is labeled with the notes that are on in the middle of the segment.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 4: Precision-recall curves for the convolutional network on the test set. Curves are evaluated on subsets of the test set consisting of all data points (blue); points with exactly one label (monophonic; green); and points with exactly three labels (red).
|
| 139 |
+
|
| 140 |
+
We evaluate our models on three scores: precision, recall, and average precision. The precision score is the count of correct predictions by the model (across all data points) divided by the total number of predictions by the model. The recall score is the count of correct predictions by the model divided by the total number of (ground truth) labels in the test set. Precision and recall are parameterized by the note prediction threshold $c$ (see Sect. 4). By varying $c$ , we construct precision-recall curves (see Figure 4). The average precision score is the area under the precision-recall curve.
|
| 141 |
+
|
| 142 |
+
<table><tr><td>Representation</td><td>Window Size</td><td>Precision</td><td>Recall</td><td>Average Precision</td></tr><tr><td>log-spectrograms</td><td>1,024</td><td>49.0%</td><td>40.5%</td><td>39.8%</td></tr><tr><td>spectrograms</td><td>2,048</td><td>28.9%</td><td>52.5 %</td><td>32.9%</td></tr><tr><td>log-spectrograms</td><td>2,048</td><td>61.9%</td><td>42.0%</td><td>48.8%</td></tr><tr><td>log-ReLUgrams</td><td>2.048</td><td>58.9%</td><td>47.9%</td><td>49.3%</td></tr><tr><td>MLP,500 nodes</td><td>2.048</td><td>50.1%</td><td>58.0%</td><td>52.1%</td></tr><tr><td>MLP, 2500 nodes</td><td>2.048</td><td>53.6%</td><td>62.3%</td><td>56.2%</td></tr><tr><td>AvgPool,2 stride</td><td>2,148</td><td>53.4%</td><td>62.5%</td><td>56.4%</td></tr><tr><td>log-spectrograms</td><td>8,192</td><td>64.2%</td><td>28.6%</td><td>52.1%</td></tr><tr><td>log-spectrograms</td><td>16,384</td><td>58.4%</td><td>18.1%</td><td>45.5%</td></tr><tr><td>MLP, 500 nodes</td><td>16,384</td><td>54.4%</td><td>64.8%</td><td>60.0%</td></tr><tr><td>CNN, 64 stride</td><td>16,384</td><td>60.5%</td><td>71.9%</td><td>67.8%</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Table 3: Benchmark results on MusicNet for models discussed in this paper. The learned representations are optimized for square loss with SGD using the Tensorflow library (Abadi et al.). We report the precision and recall corresponding to the best $F _ { 1 }$ -score on validation data.
|
| 145 |
+
|
| 146 |
+
A spectrogram of length $n$ is computed from $2 n$ samples, so the linear 1024-point spectrogram model is directly comparable to the MLP runs with 2048 raw samples. Learned features4 modestly outperform spectrograms for comparable window sizes. The discussion of windowing in Sect. 4.4 partially explains this. Figure 5 suggests a second reason. Recall (Sect. 4.3) that the spectrogram features can be interpreted as the magnitude of the signal’s inner product with sine waves of linearly spaced frequencies. In contrast, the proposed networks learn weights with frequencies distributed similarly to the distribution of notes in MusicNet (Figure 5). This gives the network higher resolution in the most critical frequency regions.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 5: (Left) The frequency distribution of notes in MusicNet. (Right) The frequency distribution of learned nodes in a 500-node, two-layer ReLU network.
|
| 150 |
+
|
| 151 |
+
# ACKNOWLEDGMENTS
|
| 152 |
+
|
| 153 |
+
We thank Bob L. Sturm for his detailed feedback on an earlier version of the paper. We also thank Brian McFee and Colin Raffel for fruitful discussions. Sham Kakade acknowledges funding from the Washington Research Foundation for innovation in Data-intensive Discovery. Zaid Harchaoui acknowledges funding from the program ”Learning in Machines and Brains” of CIFAR.
|
| 154 |
+
|
| 155 |
+
REFERENCES
|
| 156 |
+
M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. 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. Mane, 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. Viegas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. TensorFlow: Largescale machine learning on heterogeneous systems. URL http://tensorflow.org/.
|
| 157 |
+
E. Benetos and S. Dixon. Joint multi-pitch detection using harmonic envelope estimation for polyphonic music transcription. IEEE Selected Topics in Signal Processing, 2011.
|
| 158 |
+
E. Benetos, S. Dixon, D. Giannoulis, H. Kirchoff, and A. Klapuri. Automatic music transcription: challenges and future directions. Journal of Intelligent Information Systems, 2013.
|
| 159 |
+
T. Berg-Kirkpatrick, J. Andreas, and D. Klein. Unsupervised transcription of piano music. NIPS, 2014.
|
| 160 |
+
S. Dieleman and B. Schrauwen. End-to-end learning for music audio. ICASSP, 2014.
|
| 161 |
+
Z. Duan, B. Pardo, and C. Zhang. Multiple fundamental frequency estimation by modeling spectral peaks and non-peak regions. TASLP, 2011.
|
| 162 |
+
V. Emiya, R. Badeau, and B. David. Multipitch estimation of piano sounds using a new probabilistic spectral smoothness principle. TASLP, 2010.
|
| 163 |
+
S. Ewert, M. Muller, and P. Grosche. High resolution audio synchronization using chroma features. ¨ ICASSP, 2009.
|
| 164 |
+
D. Garreau, R. Lajugie, S. Arlot, and F. Bach. Metric learning for temporal sequence alignment. NIPS, 2014.
|
| 165 |
+
M. Goto, H. Hashiguchi, T. Nishimura, and R. Oka. RWC music database: Music genre database and musical instrument sound database. ISMIR, 2003.
|
| 166 |
+
Gaetan Hadjeres and Franc¸ois Pachet. Deepbach: a steerable model for bach chorales generation. ¨ arXiv preprint, 2016.
|
| 167 |
+
C. Harte. Towards Automatic Extraction of Harmony Information from Music Signals. PhD thesis, Department of Electrical Engineering, Queen Mary, University of London, 2010.
|
| 168 |
+
N. Hu, R. B. Dannenberg, and G. Tzanetakis. Polyphonic audio matching and alignment for music retrieval. IEEE Workshop on Applications of Signal Processing to Audio and Acoustics, 2003.
|
| 169 |
+
E. J. Humphrey, J. P. Bello, and Y. LeCun. Moving beyond feature design: Deep architectures and automatic feature learning in music informatics. ISMIR, 2012.
|
| 170 |
+
O. Izmirli and R. B. Dannenberg. Understanding features and distance functions for music sequence alignment. ISMIR, 2010.
|
| 171 |
+
C. Joder, S. Essid, and G. Richard. Learning optimal features for polyphonic audio-to-score alignment. TASLP, 2013.
|
| 172 |
+
R. Kelz, M. Dorfer, F. Korzeniowski, S. Bock, A. Arzt, and G. Widmer. On the potential of simple ¨ framewise approaches to piano transcription. ISMIR, 2016.
|
| 173 |
+
A. Khlif and V. Sethu. An iterative multi range non-negative matrix factorization algorithm for polyphonic music transcription. ISMIR, 2015.
|
| 174 |
+
F. Korzeniowsk and G. Widmer. Feature learning for chord recognition: the deep chroma extractor. ISMIR, 2016.
|
| 175 |
+
R. Lajugie, P. Bojanowski, P. Cuvillier, S. Arlot, and F. Bach. A weakly-supervised discriminative model for audio-to-score alignment. ICASSP, 2016.
|
| 176 |
+
B. McFee and G. Lanckriet. Learning multi-modal similarity. JMLR, 2011.
|
| 177 |
+
B. McFee, T. Bertin-Mahieux, D. P. W. Ellis, and G. Lanckriet. The million song dataset challenge. Proceedings of the 21st International Conference on World Wide Web, 2012.
|
| 178 |
+
B. McFee, C. Raffel, D. Liang, D. P. W. Ellis, M. McVicar, E. Battenberg, and O. Nieto. librosa: Audio and music signal analysis in python. SCIPY, 2015.
|
| 179 |
+
N. Orio and D. Schwarz. Alignment of monophonic and polyphonic music to a score. International Computer Music Conference, 2001.
|
| 180 |
+
G. Poliner and D. P. W. Ellis. A discriminative model for polyphonic piano transcription. EURASIP Journal on Applied Signal Processing, 2007.
|
| 181 |
+
L. Rabiner and R. Schafer. Introduction to digital speech processing. Foundations and trends in signal processing, 2007.
|
| 182 |
+
C. Raffel and D. P. W. Ellis. Large-scale content-based matching of MIDI and audio files. ISMIR, 2015.
|
| 183 |
+
C. Raffel, B. McFee, E. J. Humphrey, J. Salamon, O. Nieto, D. Liang, and D. P. W. Ellis. mir eval: A transparent implementation of common mir metrics. ISMIR, 2014.
|
| 184 |
+
C. Raphael. Automatic segmentation of acoustic musical signals using hidden markov models. IEEE Transactions on Pattern Analysis and Machine Intelligence, 1999.
|
| 185 |
+
O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. Fei-Fei. Imagenet large scale visual recognition challenge. IJCV, 2015.
|
| 186 |
+
F. Soulez, X. Rodet, and D. Schwarz. Improving polyphonic and poly-instrumental music to score alignment. ISMIR, 2003.
|
| 187 |
+
K. Tokuda and H. Zen. Directly modeling voiced and unvoiced components in speech waveforms by neural networks. ICASSP, 2016.
|
| 188 |
+
R. J. Turetsky and D. P. W. Ellis. Ground-truth transcriptions of real music from force-aligned midi syntheses. ISMIR, 2003.
|
| 189 |
+
A. van den Oord, S. Dieleman, and B. Schrauwen. Deep content-based music recommendation. NIPS, 2013.
|
| 190 |
+
A. van den Oord, S. Dieleman, H. Zen, K. Simonyan, O. Vinyals, A. Graves, N. Kalchbrenner, A. Senior, and K. Kavukcuoglu. WaveNet: A generative model for raw audio. arXiv preprint, 2016.
|
| 191 |
+
|
| 192 |
+
# A VALIDATING THE MUSICNET LABELS
|
| 193 |
+
|
| 194 |
+
We validate the aligned MusicNet labels with a listening test. We create an aural representation of an aligned score-performance pair by mixing a short sine wave into the performance with the frequency indicated by the score at the time indicated by the alignment. We can listen to this mix and, if the alignment is correct, the sine tones will exactly overlay the original performance; if the alignment is incorrect, the mix will sound dissonant.
|
| 195 |
+
|
| 196 |
+
We have listened to sections of each recording in the aligned dataset: the beginning, several random samples of middle, and the end. Mixes with substantially incorrect alignments were rejected from the dataset. Failed alignments are mostly attributable to mismatches between the midi and the recording. The most common reason for rejection is musical repeats. Classical music often contains sections with indications that they be repeated a second time; in classical music performance culture, it is often acceptable to ignore these directions. If the score and performance make different choices regarding repeats, a mismatch arises. When the score omits a repeat that occurs in the performance, the alignment typically warps over the entire repeated section, with correct alignments before and after. When the score includes an extra repeat, the alignment typically compresses it into very short segment, with correct alignments on either side. We rejected alignments exhibiting either of these issues from the dataset.
|
| 197 |
+
|
| 198 |
+
From the aligned performances that we deemed sufficiently accurate to admit to the dataset, we randomly sampled 30 clips for more careful annotation and analysis. We weighted the sample to cover a wide coverage of recordings with various instruments, ensemble sizes, and durations. For each sampled performance, we randomly selected a 30 second clip. Using software transforms, it is possible to slow a recording down to approximately 1/4 speed. Two of the clips were too richly structured and fast to precisely analyze (slowing the signal down any further introduces artifacts that make the signal difficult to interpret). Even in these two rejected samples, the alignments sound substantially correct.
|
| 199 |
+
|
| 200 |
+
For the other 28 clips, we carefully analyzed the aligned performance mix and annotated every alignment error. Two of the authors are classically trained musicians: we independently checked for errors and we our analyses were nearly identical. Where there was disagreement, we used the more pessimistic author’s analysis. Over our entire set of clips we averaged a $4 . 0 \%$ error rate.
|
| 201 |
+
|
| 202 |
+
Note that we do not catch every type of error. Mistaken note onsets are more easily identified than mistaken offsets. Typically the release of one note coincides with the onset of a new note, which implicitly verifies the release. However, release times at the ends of phrases may be less accurate; these inaccuracies would not be covered by our error analysis. We were also likely to miss performance mistakes that maintain the meter of the performance, but for professional recordings such mistakes are rare.
|
| 203 |
+
|
| 204 |
+
For stringed instruments, chords consisting of more than two notes are “rolled”; i.e. they are performed serially from the lowest to the highest note. Our alignment protocol cannot separate notes that are notated simultaneously in the score; a rolled chord is labeled with a single starting time, usually the beginning of the first note in the roll. Therefore, there is some time period at the beginning of a roll where the top notes of the chord are labeled but have not yet occurred in the performance. There are reasonable interpretations of labeling under which these labels would be judged incorrect. On the other hand, if the labels are used to supervise transcription then ours is likely the desired labeling.
|
| 205 |
+
|
| 206 |
+
We can also qualitatively characterize the types of errors we observed. The most common types of errors are anticipations and delays: a single, or small sequence of labels is aligned to a slightly early or late location in the time series. Another common source of error is missing ornaments and trills: these are short flourishes in a performance are sometimes not annotated in our score data, which results in a missing annotation in the alignment. Finally, there are rare performance errors in the recordings and transcription errors in the score.
|
| 207 |
+
|
| 208 |
+
# B ALIGNMENT PARAMETER ROBUSTNESS
|
| 209 |
+
|
| 210 |
+
The definitions of audio featurization and the alignment cost function were contingent on several parameter choices. These choices were optimized by systematic exploration of the parameter space. We investigated what happens as we vary each parameter and made the choices that gave the best results in our listening tests. Fine-tuning of the parameters yields marginal gains.
|
| 211 |
+
|
| 212 |
+
The quality of alignments improves uniformly with the quality of synthesis. The time-resolution of labels improves uniformly as the stride parameter decreases; minimization of stride is limited by system memory constraints. We find that the precise phase-invariant feature specification has little effect on alignment quality. We experimented with spectrograms and log-spectrograms using windowed and un-windowed signals. Alignment quality seemed to be largely unaffected.
|
| 213 |
+
|
| 214 |
+
The other parameters are governed by a tradeoff curve; the optimal choice is determined by balancing desirable outcomes. The Fourier window size is a classic tradeoff between time and frequency resolution. The $\ell ^ { 2 }$ norm can be understood as a tradeoff between the extremes of $\ell ^ { 1 }$ and $\ell ^ { \infty }$ . The $\bar { \ell ^ { 1 } }$ norm is too egalitarian: the preponderance of errors due to synthesis quality add up and overwhelm the signal. On the other hand, the $\ell ^ { \infty }$ norm ignores too much of the signal in the spectrogram. The spectrogram cutoff, discussed in Sec. 3, is also a tradeoff between synthesis quality and maximal use of information
|
| 215 |
+
|
| 216 |
+
# C ADDITIONAL ERROR ANALYSIS
|
| 217 |
+
|
| 218 |
+
For each model, using the test set described in Sect. 5, we report accuracy and error scores used by the MIR community to evaluate the Multi-F0 systems. Definitions and a discussion of these metrics are presented in Poliner & Ellis (2007).
|
| 219 |
+
|
| 220 |
+
<table><tr><td>Representation</td><td>Acc</td><td>Etot</td><td>Esub</td><td>Emiss</td><td>Efa</td></tr><tr><td>512-point log-spectrogram</td><td>28.5%</td><td>.819</td><td>.198</td><td>.397</td><td>.224</td></tr><tr><td>1024-point log-spectrogram</td><td>33.4%</td><td>.715</td><td>.123</td><td>.457</td><td>.135</td></tr><tr><td>1024-point log-ReLUgram</td><td>35.9%</td><td>.711</td><td>.144</td><td>.377</td><td>.190</td></tr><tr><td>4096-point log-spectrogram</td><td>24.7%</td><td>.788</td><td>.085</td><td>.628</td><td>.074</td></tr><tr><td>8192-point log-spectrogram</td><td>16.1%</td><td>.866</td><td>.082</td><td>.737</td><td>.047</td></tr><tr><td>MLP,500 nodes,2048 raw samples</td><td>36.8%</td><td>.790</td><td>.206</td><td>.214</td><td>.370</td></tr><tr><td>MLP,2500 nodes.2048 samples</td><td>40.4%</td><td>.740</td><td>.177</td><td>.200</td><td>.363</td></tr><tr><td>AvgPool, 5 stride,2048 samples</td><td>40.5%</td><td>.744</td><td>.176</td><td>.200</td><td>.369</td></tr><tr><td>MLP, 500 nodes,16384 samples</td><td>42.0%</td><td>.735</td><td>.160</td><td>.191</td><td>.383</td></tr><tr><td>CNN, 64 stride,16384 samples</td><td>48.9%</td><td>.634</td><td>.117</td><td>.164</td><td>.352</td></tr></table>
|
| 221 |
+
|
| 222 |
+
Table 4: MIREX-style statistics, evaluated using the mir eval library (Raffel et al., 2014).
|
| 223 |
+
|
| 224 |
+
# D PRECISION & RECALL CURVES
|
| 225 |
+
|
| 226 |
+

|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 7: The 500 node, 2048 raw sample MLP.
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
Figure 6: The linear spectrogram model.
|
| 233 |
+
|
| 234 |
+

|
| 235 |
+
Figure 9: The average pooling model.
|
| 236 |
+
|
| 237 |
+

|
| 238 |
+
Figure 8: The 2500 node, 2048 raw sample MLP.
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 10: The 500 node, 16384 raw sample MLP.
|
| 242 |
+
Figure 11: The convolutional model.
|
| 243 |
+
|
| 244 |
+
# E ADDITIONAL RESULTS
|
| 245 |
+
|
| 246 |
+
We report additional results on splits of the test set described in Sect. 5.
|
| 247 |
+
|
| 248 |
+
<table><tr><td>Model</td><td>Features</td><td>Precision</td><td>Recall</td><td>Average Precision</td></tr><tr><td>MLP, 500 nodes</td><td>2048 raw samples</td><td>56.1%</td><td>62.7%</td><td>59.2%</td></tr><tr><td>MLP,2500 nodes</td><td>2048 raw samples</td><td>59.1%</td><td>67.8%</td><td>63.1%</td></tr><tr><td>AvgPool, 5 stride</td><td>2048 raw samples</td><td>59.1%</td><td>68.2%</td><td>64.5%</td></tr><tr><td>MLP, 500 nodes</td><td>16384 raw samples</td><td>60.2%</td><td>65.2%</td><td>65.8%</td></tr><tr><td>CNN, 64 stride</td><td>16384 raw samples</td><td>65.9%</td><td>75.2%</td><td>74.4%</td></tr></table>
|
| 249 |
+
|
| 250 |
+
Table 5: The Soni Ventorum recording of Mozart’s Wind Quintet K375 (MusicNet id 1819).
|
| 251 |
+
|
| 252 |
+
<table><tr><td>Model</td><td>Features</td><td>Precision</td><td>Recall</td><td>Average Precision</td></tr><tr><td>MLP, 500 nodes</td><td>2048 raw samples</td><td>35.4%</td><td>40.7%</td><td>28.0%</td></tr><tr><td>MLP,2500 nodes</td><td>2048 raw samples</td><td>38.3%</td><td>44.3%</td><td>30.9%</td></tr><tr><td>AvgPool, 5 stride</td><td>2048 raw samples</td><td>38.6%</td><td>45.2%</td><td>31.7%</td></tr><tr><td>MLP, 500 nodes</td><td>16384 raw samples</td><td>43.4%</td><td>51.3%</td><td>41.0%</td></tr><tr><td>CNN, 64 stride</td><td>16384 raw samples</td><td>51.0%</td><td>57.9%</td><td>49.3%</td></tr></table>
|
| 253 |
+
|
| 254 |
+
Table 6: The European Archive recording of Beethoven’s String Quartet No. 13 (MusicNet id 2382).
|
| 255 |
+
|
| 256 |
+
<table><tr><td>Model</td><td>Features</td><td>Precision</td><td>Recall</td><td>Average Precision</td></tr><tr><td>MLP, 500 nodes</td><td>2048 raw samples</td><td>55.6%</td><td>67.4%</td><td>64.1%</td></tr><tr><td>MLP,2500 nodes</td><td>2048 raw samples</td><td>60.1%</td><td>71.3%</td><td>68.6%</td></tr><tr><td>AvgPool, 5 stride</td><td>2048 raw samples</td><td>59.6%</td><td>70.7%</td><td>68.1%</td></tr><tr><td>MLP, 500 nodes</td><td>16384 raw samples</td><td>57.1%</td><td>76.3%</td><td>68.4%</td></tr><tr><td>CNN, 64 stride</td><td>16384 raw samples</td><td>61.9%</td><td>80.1%</td><td>73.9%</td></tr></table>
|
| 257 |
+
|
| 258 |
+
Table 7: The Kimiko Ishizaka recording of Bach’s Prelude in D major (MusicNet id 2303).
|
md/train/rkGG6s0qKQ/rkGG6s0qKQ.md
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# THE GAN LANDSCAPE: LOSSES, ARCHITECTURES, REGULARIZATION, AND NORMALIZATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Generative adversarial networks (GANs) are a class of deep generative models which aim to learn a target distribution in an unsupervised fashion. While they were successfully applied to many problems, training a GAN is a notoriously challenging task and requires a significant amount of hyperparameter tuning, neural architecture engineering, and a non-trivial amount of “tricks”. The success in many practical applications coupled with the lack of a measure to quantify the failure modes of GANs resulted in a plethora of proposed losses, regularization and normalization schemes, and neural architectures. In this work we take a sober view of the current state of GANs from a practical perspective. We reproduce the current state of the art and go beyond fairly exploring the GAN landscape. We discuss common pitfalls and reproducibility issues, open-source our code on Github, and provide pre-trained models on TensorFlow Hub.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep generative models are a powerful class of unsupervised machine learning models. The power of these models was recently harnessed in a variety of applications, including image generation, learned compression, and domain transfer (Isola et al., 2017; Radford et al., 2016; Agustsson et al., 2018; Tschannen et al., 2018). Generative adversarial networks (Goodfellow et al., 2014) are one of the main approaches to learning such models in a fully unsupervised fashion. The GAN framework can be viewed as a two-player game where the first player, the generator, is learning to transform some simple input distribution (usually a standard multivariate Normal or uniform) to a distribution on the space of images, such that the second player, the discriminator, cannot tell whether the samples belong to the true distribution or were synthesized. Both players aim to minimize their own loss and the solution to the game is the Nash equilibrium where neither player can improve their loss unilaterally. This powerful framework can also be derived by minimizing a divergence between the model distribution and the true distribution (Nowozin et al., 2016; Arjovsky et al., 2017).
|
| 12 |
+
|
| 13 |
+
Training GANs involves solving a minimax problem over the parameters of the generator and the discriminator which are usually parameterized as deep convolutional neural networks. Consequently, this minimax problem is notoriously hard to solve in practice. As a result, a plethora of loss functions, regularization and normalization schemes, coupled with neural architecture choices, have been proposed (Goodfellow et al., 2014; Salimans et al., 2016; Miyato et al., 2018; Gulrajani et al., 2017; Arjovsky et al., 2017; Mao et al., 2016).
|
| 14 |
+
|
| 15 |
+
Our contributions. In this work we provide a thorough empirical analysis of these competing approaches, and help the researchers and practitioners navigate this space. We first define the GAN landscape – the set of loss functions, normalization and regularization schemes, and the most commonly used architectures. We explore this search space on several modern large-scale data sets by means of hyperparameter optimization, considering both “good” sets of hyperparameters reported in the literature, as well as ones obtained by Gaussian Process regression. By analyzing the impact of the loss function, we conclude that the non-saturating loss is sufficiently stable across data sets, architectures and hyperparameters. We then proceed to decompose the effect of various normalization and regularization schemes, as well as varying architectures. We show that both gradient penalty (Gulrajani et al., 2017) as well as spectral normalization (Miyato et al., 2018) are useful in the context of high-capacity architectures. Finally, we discuss some common pitfalls, reproducibility issues, and practical considerations. We provide reference implementations, including training and evaluation code on Github1 and provide pre-trained models on TensorFlow Hub.2
|
| 16 |
+
|
| 17 |
+
# 2 THE GAN LANDSCAPE
|
| 18 |
+
|
| 19 |
+
# 2.1 LOSS FUNCTIONS
|
| 20 |
+
|
| 21 |
+
Let $P$ denote the target (true) distribution and $Q$ the model distribution. Goodfellow et al. (2014) suggest two loss functions: the minimax GAN and the non-saturating (NS) GAN. In the former the discriminator minimizes the negative log-likelihood for the binary classification task. In the latter the generator maximizes the probability of generated samples being real. In this work we consider the non-saturating loss as it is known to outperform the minimax variant. The corresponding loss functions are $\mathcal { L } _ { \mathrm { { D } } } = - \mathbb { E } _ { \boldsymbol { x } \sim P } [ \log ( D ( \boldsymbol { x } ) ) ] - \mathbb { E } _ { \hat { \boldsymbol { x } } \sim Q } [ \log ( 1 - D ( \boldsymbol { \hat { x } } ) ) ]$ and $\mathcal { L } _ { \mathrm { G } } = - \mathbb { E } _ { \hat { x } \sim Q } [ \bar { \log ( D ( \hat { x } ) ) } ]$ .
|
| 22 |
+
|
| 23 |
+
In Wasserstein GAN (WGAN) (Arjovsky et al., 2017) the authors propose to consider the Wasserstein divergence instead of the original Jensen-Shannon (JS). In particular, under the optimal discriminator, minimizing the proposed value function with respect to the generator minimizes the Wasserstein distance between $P$ and $Q$ . The drawback is that one has to ensure a 1-Lipschitz discriminator due to exploited Kantorovich-Rubenstein duality. The corresponding loss functions are $\mathcal { L } _ { \mathrm { D } } ~ =$ $- \mathbb { E } _ { x \sim P } [ D ( x ) ] + \mathbb { E } _ { \hat { x } \sim Q } [ D ( \hat { x } ) ]$ and $\mathcal { L } _ { \mathrm { G } } = - \mathbb { E } _ { \hat { x } \sim Q } [ D ( \hat { x } ) ]$ .
|
| 24 |
+
|
| 25 |
+
Finally, we consider the least-squares loss (LS) which corresponds to minimizing the Pearson $\chi ^ { 2 }$ divergence between $P$ and $Q$ (Mao et al., 2016). The intuition is that this loss function is smooth and saturates slower than the sigmoid cross-entropy loss of the JS formulation. The corresponding loss functions are $\mathcal { L } _ { \mathrm { D } } = - \mathbb { E } _ { x \sim P } \overline { { [ ( D ( x ) - 1 ) ^ { 2 } ] } } + \tilde { \mathbb { E } } _ { \hat { x } \sim Q } [ D ( \hat { x } ) ^ { 2 } ]$ and $\mathcal { L } _ { \mathrm { G } } = - \mathbb { E } _ { \hat { x } \sim Q } [ ( D ( \hat { x } ) { \bar { - } } 1 ) ^ { 2 } ]$ ].
|
| 26 |
+
|
| 27 |
+
# 2.2 REGULARIZATION AND NORMALIZATION OF THE DISCRIMINATOR
|
| 28 |
+
|
| 29 |
+
Gradient norm penalty. In the context of Wasserstein GANs this penalty can be interpreted as a soft penalty for the violation of 1-Lipschitzness (WGAN GP) (Gulrajani et al., 2017). Hereby, the gradient is evaluated on a linear interpolation between training points and generated samples as a proxy to the optimal coupling. The gradient penalty can also be evaluated around the data manifold which encourages the discriminator to be piece-wise linear in that region (Dragan) (Kodali et al., 2017). However, the gradient norm penalty can be considered purely as a regularizer for the discriminator and it was shown that it can improve the performance for other losses (Fedus et al., 2018). Furthermore, the penalty can be scaled by the “confidence” of the discriminator in the context of f-divergences (Roth et al., 2017). A drawback of gradient penalty (GP) regularization scheme is that it can depend on the model distribution $Q$ which changes during training. One drawback of Dragan is that it is unclear to which extent the Gaussian assumption for the manifold holds. Finally, computing the gradient norms implies a non-trivial running time penalty – essentially doubling the running time. We also investigate the impact of a regularizer ubiquitous in supervised learning – the $L _ { 2 }$ penalty on all the weights of the network.
|
| 30 |
+
|
| 31 |
+
Discriminator normalization. Normalizing the discriminator can be useful from both the optimization perspective (more efficient gradient flow, a more stable optimization), as well as from the representation perspective – the representation richness of the layers in a neural network depends on the spectral structure of the corresponding weight matrices (Miyato et al., 2018).
|
| 32 |
+
|
| 33 |
+
From the optimization point of view, several techniques have found their way into the GAN literature, namely batch normalization (BN) (Ioffe and Szegedy, 2015) and layer normalization (LN) (Ba et al., 2016). Batch normalization in the context of GANs was suggested by Denton et al. (2015) and further popularized by Radford et al. (2016). It normalizes the pre-activations of nodes in a layer to mean $\beta$ and standard deviation $\gamma$ , where both $\beta$ and $\gamma$ are parameters learned for each node in the layer. The normalization is done on the batch level and for each node separately. In contrast, with Layer normalization, all the hidden units in a layer share the same normalization terms $\beta$ and $\gamma$ , but different samples are normalized differently (Ba et al., 2016). Layer normalization was first applied in the context of GANs in Gulrajani et al. (2017).
|
| 34 |
+
|
| 35 |
+
From the representation point of view, one has to consider the neural network as a composition of (possibly non-linear) mappings and analyze their spectral properties. In particular, for the discriminator to be a bounded linear operator it suffices to control the maximum singular value. This approach is followed in Miyato et al. (2018) where the authors suggest dividing each weight matrix, including the matrices representing convolutional kernels, by their spectral norm. Furthermore, the authors argue that a key advantage of spectral normalization over competing approaches is that it results in discriminators of higher rank.
|
| 36 |
+
|
| 37 |
+
# 2.3 GENERATOR AND DISCRIMINATOR ARCHITECTURE
|
| 38 |
+
|
| 39 |
+
We explore two classes of architectures in this study: deep convolutional generative adversarial networks (DCGAN) (Radford et al., 2016) and residual networks (ResNet) (He et al., 2016), both of which are ubiquitous in GAN research. Recently, Miyato et al. (2018) defined a variation of DCGAN, so called SNDCGAN. Apart from minor updates (cf. Section 4) the main difference to DCGAN is the use of an eight-layer discriminator network. The details of both networks are summarized in Table 3. The other architecture, ResNet19, is an architecture with five ResNet blocks in the generator and six ResNet blocks in the discriminator, that can operate on $1 2 8 \times 1 2 8$ images. We follow the ResNet setup from Miyato et al. (2018), with the small difference that we simplified the design of the discriminator. The detailed parameters of discriminator and generator are summarized in Table 4a and Table 4b. With this setup we were able to reproduce the current state of the art results. An ablation study on various ResNet modifications is available in the Appendix.
|
| 40 |
+
|
| 41 |
+
# 2.4 EVALUATION METRICS
|
| 42 |
+
|
| 43 |
+
We focus on several recently proposed metrics well suited to the image domain. For an in-depth overview of quantitative metrics we refer the reader to (Borji, 2018).
|
| 44 |
+
|
| 45 |
+
Inception Score (IS). Proposed by Salimans et al. (2016), IS offers a way to quantitatively evaluate the quality of generated samples. Intuitively, the conditional label distribution of samples containing meaningful objects should have low entropy, and the variability of the samples should be high. which can be expressed as $\scriptstyle \mathtt { I S } = \exp ( \mathbb { E } _ { x \sim Q } [ d _ { K L } ^ { \sim } ( p ( y \mid x ) , p ( y ) ) ] )$ . The authors found that this score is well-correlated with scores from human annotators. Drawbacks include insensitivity to the prior distribution over labels and not being a proper distance.
|
| 46 |
+
|
| 47 |
+
As an alternative Heusel et al. (2017) proposed the Frechet Inception Distance (FID). Samples from $P$ and $Q$ are first embedded into a feature space (a specific layer of InceptionNet). Then, assuming that the embedded data follows a multivariate Gaussian distribution, the mean and covariance are estimated. Finally, the Frechet distance between these two Gaussians is computed, i.e. ´
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\begin{array} { r } { \mathtt { F I D } = | | \mu _ { x } - \mu _ { y } | | _ { 2 } ^ { 2 } + \operatorname { T r } \big ( \Sigma _ { x } + \Sigma _ { y } - 2 \big ( \Sigma _ { x } \Sigma _ { y } \big ) ^ { \frac { 1 } { 2 } } \big ) , } \end{array}
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\left( \mu _ { x } , \Sigma _ { x } \right)$ , and $( \mu _ { y } , \Sigma _ { y } )$ are the mean and covariance of the embedded samples from $P$ and $Q$ , respectively. The authors argue that FID is consistent with human judgment and more robust to noise than IS. Furthermore, the score is sensitive to the visual quality of generated samples – introducing noise or artifacts in the generated samples will reduce the FID. In contrast to IS, FID can detect intra-class mode dropping, i.e. a model that generates only one image per class can score a perfect IS, but will suffer from have a high FID (Lucic et al., 2018). Binkowski et al. ´ (2018) argued that FID has no unbiased estimator and suggest Kernel Inception distance (KID) instead. In Appendix B we empirically compare KID to FID and observe that both metrics are very strongly correlated (Spearman rank-order correlation coefficient of 0.994 for LSUN-BEDROOM and 0.995 for CELEBA-HQ-128 datasets). As a result we focus on FID as it is likely to result in the same ranking.
|
| 54 |
+
|
| 55 |
+
Multi-scale Structural Similarity for Image Quality (MS-SSIM) and Diversity. A critical issue in GANs are mode collapse and mode-dropping – failing to capture a mode, or low-diversity of generated samples from a given mode. The MS-SSIM score (Wang et al., 2003) is used for measuring the similarity of two images where higher MS-SSIM score indicates more similar images. Several recent works suggest using the average pairwise MS-SSIM score within a given class as a proxy for the diversity of generated samples (Odena et al., 2017; Fedus et al., 2018). The drawback of this approach is that we do not know the class corresponding to the generated sample, so it is usually applied on one-class data sets, such as CELEBA-HQ-128. In this work we use the same setup as in Fedus et al. (2018). In particular, given a batch size $b$ , we compute the average pairwise MS-SSIM score on 5 batches, of $5 \times b \times ( b - 1 ) / 2$ image pairs in total. We stress that the diversity should only be taken into account together with the FID and $I S$ metrics.
|
| 56 |
+
|
| 57 |
+
Table 1: Hyperparameter ranges used in this study. The Cartesian product of the fixed values suffices to uncover the existing results. Gaussian Process optimization in the bandit setting (Srinivas et al., 2010) is used to select good hyperparameter settings from the specified ranges.
|
| 58 |
+
(a) Fixed values
|
| 59 |
+
|
| 60 |
+
<table><tr><td>PARAMETER</td><td>DISCRETE VALUE</td></tr><tr><td>Learning rate α</td><td>{0.0002,0.0001,0.001}</td></tr><tr><td>Reg. strength 入</td><td>{1,10}</td></tr><tr><td>(β1,β2,ndis)</td><td>{(0.5,0.900,5), (0.5,0.999,1), (0.5,0.999,5), (0.9,0.999,5)}</td></tr></table>
|
| 61 |
+
|
| 62 |
+
(b) Gaussian Process regression ranges
|
| 63 |
+
|
| 64 |
+
<table><tr><td>PARAMETER</td><td>RANGE</td><td>LOG</td></tr><tr><td>Learning rate α</td><td>[10-5,10-2]</td><td>Yes</td></tr><tr><td>入 for L2</td><td>[10-4,101]</td><td>Yes</td></tr><tr><td>入 for non-L2</td><td>[10-1,102]</td><td>Yes</td></tr><tr><td>β1×β</td><td>[0,1] × [0,1]</td><td>No</td></tr></table>
|
| 65 |
+
|
| 66 |
+
# 2.5 DATA SETS
|
| 67 |
+
|
| 68 |
+
We consider three data sets, namely CIFAR10, CELEBA-HQ-128, and LSUN-BEDROOM. The LSUN-BEDROOM data set (Yu et al., 2015) contains slightly more than 3 million images3. We randomly partition the images into a train and test set whereby we use 30588 images as the test set. Secondly, we use the CELEBA-HQ data set of 30k images (Karras et al., 2018). We use the $1 2 8 \times 1 2 8 \times 3$ version obtained by running the code provided by the authors.4 We use 3000 examples as the test set and the remaining examples as the training set. Finally, we also include the CIFAR10 data set which contains 70K images $\left( 3 2 \mathbf { x } 3 2 \mathbf { x } 3 \right)$ , partitioned into 60000 training instances and 10000 testing instances. The baseline FID scores are 12.6 for CELEBA-HQ-128, 3.8 for LSUN-BEDROOM, and 5.19 for CIFAR10. Details on FID computation are presented in Section 4.
|
| 69 |
+
|
| 70 |
+
# 2.6 EXPLORING THE GAN LANDSCAPE
|
| 71 |
+
|
| 72 |
+
The search space for GANs is prohibitively expensive: exploring all combinations of all losses, normalization and regularization schemes, and architectures is outside of the practical realm. Instead, in this study we analyze several slices of this tensor for each data set. In particular, to ensure that we can reproduce existing results, we perform a study over the subset of this tensor on CIFAR10. We then proceed to analyze the performance of these models across CELEBA-HQ-128 and LSUN-BEDROOM. In Section 3.1 we fix everything but the loss. In Section 3.2 we fix everything but the regularization and normalization scheme. Finally, in Section 3.3 we fix everything but the architecture. This allows us to decouple some of these design choices and provide some insight on what matters most.
|
| 73 |
+
|
| 74 |
+
As noted in Lucic et al. (2018), one major issue preventing further progress is the hyperparameter tuning – currently, the community has converged to a small set of parameter values which work on some data sets, and may completely fail on others. In this study we combine the best hyperparameter settings found in the literature (Miyato et al., 2018), and perform Gaussian Process regression in the bandit setting (Srinivas et al., 2010) to possibly uncover better hyperparameter settings. We then consider the top performing models and discuss the impact of the computational budget.
|
| 75 |
+
|
| 76 |
+
We summarize the fixed hyperparameter settings in Table 1a which contains the “good” parameters reported in recent publications (Fedus et al., 2018; Miyato et al., 2018; Gulrajani et al., 2017). In particular, we consider the cross product of these parameters to obtain 24 hyperparameter settings to reduce the bias. Finally, to provide a fair comparison, we perform Gaussian Process optimization in the bandit setting (Srinivas et al., 2010) on the parameter ranges provided in Table 1b. We run 12 rounds (i.e. we communicate with the oracle 12 times) of the optimization, each with a batch of 10 hyperparameter sets selected based on the FID scores from the results of the previous iterations.
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 1: Impact of the loss function: FID distribution for top $5 \%$ models. The non-saturating (NS) loss is stable over both data sets. Gradient penalty and spectral normalization improve the sample quality. From the computational budget perspective (i.e. how many models one needs to train to reach a certain FID), both spectral normalization and gradient penalty perform better than the baseline, but the former is more efficient.
|
| 80 |
+
|
| 81 |
+
As we explore the number of discriminator updates per generator update (1 or 5), this leads to an additional 240 hyperparameter settings which in some cases outperform the previously known hyperparameter settings. Batch size is set to 64 for all the experiments. We use a fixed the number of discriminator update steps of 100K for LSUN-BEDROOM data set and CELEBA-HQ-128 data set, and 200K for CIFAR10 data set. We apply the Adam optimizer (Kingma and Ba, 2015).
|
| 82 |
+
|
| 83 |
+
# 3 RESULTS AND DISCUSSION
|
| 84 |
+
|
| 85 |
+
Given that there are 4 major components (loss, architecture, regularization, normalization) to analyze for each data set, it is infeasible to explore the whole landscape. Hence, we opt for a more pragmatic solution – we keep some dimensions fixed, and vary the others. For each experiment we highlight three aspects: (1) FID distribution of the top $5 \%$ of the trained models, (2) the corresponding sample diversity score, and (3) the tradeoff between the computational budget (i.e. number of models to train) and model quality in terms of FID. Each model was retrained 5 times with a different random seed and we report the median score. The variance for models obtained by Gaussian Process regression is handled implicitly so we train each model once.
|
| 86 |
+
|
| 87 |
+
# 3.1 IMPACT OF THE LOSS FUNCTION
|
| 88 |
+
|
| 89 |
+
Here the loss is either the non-saturating loss (NS) (Goodfellow et al., 2014), the least-squares loss (LS) (Mao et al., 2016), or the Wasserstein loss (WGAN) (Arjovsky et al., 2017). We use the ResNet19 with generator and discriminator architectures detailed in Table 4a. We consider the most prominent normalization and regularization approaches: gradient penalty (Gulrajani et al., 2017), and spectral normalization (Miyato et al., 2018). Both studies were performed on CELEBA-HQ-128 and LSUN-BEDROOM with hyperparameter settings shown in Table 1a.
|
| 90 |
+
|
| 91 |
+
The results are presented in Figure 1. We observe that the non-saturating loss is stable over both data sets. Spectral normalization improves the quality of the model on both data sets. Similarly, the gradient penalty can help improve the quality of the model, but finding a good regularization tradeoff is non-trivial and requires a high computational budget. Models using the GP penalty benefit from 5:1 ratio of discriminator to generator updates as suggested by (Gulrajani et al., 2017). We also performed a study on hinge loss (Miyato et al., 2018) and present it in the Appendix.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 2: Impact of regularization and normalization: FID distribution for top $5 \%$ models. Both gradient penalty (GP) and spectral normalization (SN) outperform the baseline and should be considered, while former being more computationally expensive. Unfortunately none fully address the stability issues.
|
| 95 |
+
|
| 96 |
+
# 3.2 IMPACT OF REGULARIZATION AND NORMALIZATION
|
| 97 |
+
|
| 98 |
+
The goal of this study is to compare the relative performance of various regularization and normalization methods presented in the literature. To this end, and based on the loss study, we fix the loss to non-saturating loss (Goodfellow et al., 2014). We use the ResNet19 with generator and discriminator architectures described in Table 4a. Finally, we consider batch normalization (BN) (Ioffe and Szegedy, 2015), layer normalization (LN) (Ba et al., 2016), spectral normalization (SN), gradient penalty (GP) (Gulrajani et al., 2017), dragan penalty (DR) (Kodali et al., 2017), or $L _ { 2 }$ regularization. We consider both CELEBA-HQ-128 and LSUN-BEDROOM with the hyperparameter settings shown in Table 1a and Table 1b.
|
| 99 |
+
|
| 100 |
+
The results are presented in Figure 2. We observe that adding batch norm to the discriminator hurts the performance. Secondly, gradient penalty can help, but it doesn’t stabilize the training. In fact, it is non-trivial to strike a balance of the loss and regularization strength. Spectral normalization helps improve the model quality and is more computationally efficient than gradient penalty. This is consistent with recent results in Zhang et al. (2018). Similarly to the loss study, models using GP penalty benefit from 5:1 ratio of discriminator to generator updates. Furthermore, in a separate ablation study we observed that running the optimization procedure for an additional 100K steps is likely to increase the performance of the models with GP penalty.
|
| 101 |
+
|
| 102 |
+
Impact of Simultaneous Regularization and Normalization. Given the folklore that the Lipschitz constant of the discriminator is critical for the performance, one may expect simultaneous regularization and normalization could improve model quality. To quantify this effect, we fix the loss to non-saturating loss (Goodfellow et al., 2014), use the Resnet19 architecture (as above), and combine several normalization and regularization schemes, with hyperparameter settings shown in Table 1a coupled with 24 randomly selected parameters. The results are presented in Figure 3. We observe that one may benefit from additional regularization and normalization. However, a lot of computational effort has to be invested for somewhat marginal gains in FID. Nevertheless, given enough computational budget we advocate simultaneous regularization and normalization – spectral normalization and layer normalization seem to perform well in practice.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 3: Impact of simultaneous normalization and regularization: FID distribution for top $5 \%$ models. Gradient penalty coupled with spectral normalization (SN) or layer normalization (LN) strongly improves the performance over the baseline.
|
| 106 |
+
|
| 107 |
+
# 3.3 IMPACT OF GENERATOR AND DISCRIMINATOR ARCHITECTURES
|
| 108 |
+
|
| 109 |
+
An interesting practical question is whether our findings also hold for a different model capacity. To this end, we also perform a study on SNDCGAN from Miyato et al. (2018). We consider the non-saturating GAN loss, gradient penalty and spectral normalization. While for smaller architectures regularization is not essential (Lucic et al., 2018), the regularization and normalization effects might become more relevant due to deeper architectures and optimization considerations.
|
| 110 |
+
|
| 111 |
+

|
| 112 |
+
Figure 4: Impact of the neural architectures: FID distribution for top $5 \%$ models. Both spectral normalization and gradient penalty can help improve upon the non-regularized baseline.
|
| 113 |
+
|
| 114 |
+
The results are presented in Figure 4. We observe that both architectures achieve comparable results and benefit from regularization and normalization. Spectral normalization strongly outperforms the baseline for both architectures.
|
| 115 |
+
|
| 116 |
+
# 4 COMMON PITFALLS
|
| 117 |
+
|
| 118 |
+
In this section we focus on several pitfalls we encountered while trying to reproduce existing results and provide a fairly and accurate comparison.
|
| 119 |
+
|
| 120 |
+
Metrics. There already seems to be a divergence in how the FID score is computed: (1) Some authors report the score on training data, yielding a FID between 50k training and $5 0 \mathrm { k }$ generated samples (Unterthiner et al., 2018). Some opt to report the FID based on 10k test samples and $5 \mathrm { k }$ generated samples and use a custom implementation (Miyato et al., 2018). Finally, Lucic et al. (2018) report the score with respect to the test data, in particular FID between 10k test samples, and 10k generated samples. The subtle differences will result in a mismatch between the reported FIDs, in some cases of more than $1 0 \%$ . We argue that FID should be computed with respect to the test data set as and use 10k test samples and 10k generated samples on CIFAR10 and LSUN-BEDROOM, and 3k vs 3k on CELEBA-HQ-128 as in in Lucic et al. (2018). Similarly, there are several ways to compute a diversity score using MS-SSIM and we follow the approach from Fedus et al. (2018). We provide the implementation details in Section G of the Appendix.
|
| 121 |
+
|
| 122 |
+
Details of neural architectures. Even in popular architectures, like ResNet, there is still a number of design decision one needs to make, that are often omitted from the reported results. Those include the exact design of the ResNet cell (order of layers, when is ReLu applied, when to upsample and downsample, how many filters to use). Some of these differences might lead to potentially unfair comparison. As a result, we suggest to use the architectures presented within this work as a solid baseline. An ablation study on various ResNet modifications is available in the Appendix.
|
| 123 |
+
|
| 124 |
+
Data sets. A common issue is related to data set processing – does LSUN-BEDROOM always correspond to the same data set? In most cases the precise algorithm for upscaling or cropping is not clear which introduces inconsistencies between results on the “same” data set.
|
| 125 |
+
|
| 126 |
+
Implementation details and non-determinism. One major issue is the mismatch between the algorithm presented in a paper and the code provided online. We are aware that there is an embarrassingly large gap between a good implementation and a bad implementation of a given model. Hence, when no code is available, one is forced to guess which modifications were done. Another particularly tricky issue is removing randomness from the training process. After one fixes the data ordering and the initial weights, obtaining the same score by training the same model twice is non-trivial due to randomness present in certain GPU operations (Chetlur et al., 2014). Disabling the optimizations causing the non-determinism often results in an order of magnitude running time penalty.
|
| 127 |
+
|
| 128 |
+
While each of these issues taken in isolation seems minor, they compound to create a mist which introduces friction in practical applications and the research process (Sculley et al., 2018).
|
| 129 |
+
|
| 130 |
+
# 5 RELATED WORK
|
| 131 |
+
|
| 132 |
+
A recent large-scale study on GANs and Variational Autoencoders was presented in Lucic et al. (2018). The authors consider several loss functions and regularizers, and study the effect of the loss function on the FID score, with low-to-medium complexity data sets (MNIST, CIFAR10, CELEBA), and a single (InfoGAN style) architecture. In this limited setting, the authors found that there is no statistically significant difference between recently introduced models and the original non-saturating GAN. A study of the effects of gradient-norm regularization in GANs was recently presented in Fedus et al. (2018). The authors posit that the gradient penalty can also be applied to the non-saturating GAN, and that, to a limited extent, it reduces the sensitivity to hyperparameter selection. In a recent work on spectral normalization, the authors perform a small study of the competing regularization and normalization approaches (Miyato et al., 2018). We are happy to report that we could reproduce these results and we present them in the Appendix.
|
| 133 |
+
|
| 134 |
+
Inspired by these works and building on the available open-source code from Lucic et al. (2018), we take one additional step in all dimensions considered therein: more complex neural architectures, more complex data sets, and more involved regularization and normalization schemes.
|
| 135 |
+
|
| 136 |
+
# 6 CONCLUSION
|
| 137 |
+
|
| 138 |
+
In this work we study the GAN landscape: losses, regularization and normalization schemes, and neural architectures, and their impact on the on the quality of generated samples which we assess by recently introduced quantitative metrics. Our fair and thorough empirical evaluation suggests that one should consider non-saturating GAN loss and spectral normalization as default choices when applying GANs to a new data set. Given additional computational budget, we suggest adding the gradient penalty from Gulrajani et al. (2017) and train the model until convergence. Furthermore, additional marginal gains can be obtained by combining normalization and regularization empirically confirming the importance of the Lipschitz constant of the discriminator. Furthermore, both types of architectures proposed up-to this point perform reasonably well. A separate ablation study uncovered that most of the tricks applied in the ResNet style architectures lead to marginal changes in the quality and should be avoided due to the high computational cost. As a result of this large-scale study we identify the common pitfalls standing in the way of accurate and fair comparison and propose concrete actions to demystify the future results – issues with metrics, data set preprocessing, non-determinism, and missing implementation details are particularly striking. We hope that this work, together with the open-sourced reference implementations and trained models, will serve as a solid baseline for future GAN research.
|
| 139 |
+
|
| 140 |
+
# REFERENCES
|
| 141 |
+
|
| 142 |
+
Eirikur Agustsson, Michael Tschannen, Fabian Mentzer, Radu Timofte, and Luc Van Gool. Generative adversarial networks for extreme learned image compression. CoRR, abs/1804.02958, 2018.
|
| 143 |
+
|
| 144 |
+
Mart´ın Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. In ´ International Conference on Machine Learning (ICML), 2017.
|
| 145 |
+
|
| 146 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 147 |
+
|
| 148 |
+
Mikołaj Binkowski, Dougal J. Sutherland, Michael Arbel, and Arthur Gretton. Demystifying MMD GANs. In ´ International Conference on Learning Representations (ICLR), 2018.
|
| 149 |
+
|
| 150 |
+
Ali Borji. Pros and cons of GAN evaluation measures. arXiv preprint arXiv:1802.03446, 2018.
|
| 151 |
+
|
| 152 |
+
Sharan Chetlur, Cliff Woolley, Philippe Vandermersch, Jonathan Cohen, John Tran, Bryan Catanzaro, and Evan Shelhamer. cudnn: Efficient primitives for deep learning. arXiv preprint arXiv:1410.0759, 2014.
|
| 153 |
+
|
| 154 |
+
Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in Neural Information Processing Systems (NIPS), 2015.
|
| 155 |
+
|
| 156 |
+
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. In International Conference on Learning Representations (ICLR), 2018.
|
| 157 |
+
|
| 158 |
+
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 (NIPS), 2014.
|
| 159 |
+
|
| 160 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of Wasserstein GANs. Advances in Neural Information Processing Systems (NIPS), 2017.
|
| 161 |
+
|
| 162 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 163 |
+
|
| 164 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Gunter Klambauer, and Sepp Hochre-¨ iter. GANs trained by a two time-scale update rule converge to a Nash equilibrium. Advances in Neural Information Processing Systems (NIPS), 2017.
|
| 165 |
+
|
| 166 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
|
| 167 |
+
|
| 168 |
+
Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 169 |
+
|
| 170 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. International Conference on Learning Representations (ICLR), 2018.
|
| 171 |
+
|
| 172 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference on Learning Representations (ICLR), 2015.
|
| 173 |
+
|
| 174 |
+
Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of GANs. arXiv preprint arXiv:1705.07215, 2017.
|
| 175 |
+
|
| 176 |
+
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 (NIPS), 2018.
|
| 177 |
+
|
| 178 |
+
Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. arXiv preprint ArXiv:1611.04076, 2016.
|
| 179 |
+
|
| 180 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. International Conference on Learning Representations (ICLR), 2018.
|
| 181 |
+
|
| 182 |
+
Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems (NIPS), 2016.
|
| 183 |
+
|
| 184 |
+
Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In International Conference on Machine Learning (ICML), 2017.
|
| 185 |
+
|
| 186 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. International Conference on Learning Representations (ICLR), 2016.
|
| 187 |
+
|
| 188 |
+
Kevin Roth, Aurelien Lucchi, Sebastian Nowozin, and Thomas Hofmann. Stabilizing training of generative adversarial networks through regularization. In Advances in Neural Information Processing Systems, 2017.
|
| 189 |
+
|
| 190 |
+
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 (NIPS), 2016.
|
| 191 |
+
|
| 192 |
+
D. Sculley, Jasper Snoek, Alex Wiltschko, and Ali Rahimi. Winner’s curse? On pace, progress, and empirical rigor, 2018.
|
| 193 |
+
|
| 194 |
+
Niranjan Srinivas, Andreas Krause, Sham Kakade, and Matthias W. Seeger. Gaussian process optimization in the bandit setting: No regret and experimental design. In International Conference on Machine Learning (ICML), 2010.
|
| 195 |
+
|
| 196 |
+
Michael Tschannen, Eirikur Agustsson, and Mario Lucic. Deep generative models for distribution-preserving lossy compression. Advances in Neural Information Processing Systems (NIPS), 2018.
|
| 197 |
+
|
| 198 |
+
Thomas Unterthiner, Bernhard Nessler, Calvin Seward, Gnter Klambauer, Martin Heusel, Hubert Ramsauer, and Sepp Hochreiter. Coulomb GANs: Provably optimal nash equilibria via potential fields. In International Conference on Learning Representations (ICLR), 2018.
|
| 199 |
+
|
| 200 |
+
Zhou Wang, Eero P Simoncelli, and Alan C Bovik. Multiscale structural similarity for image quality assessment. In Asilomar Conference on Signals, Systems and Computers, 2003.
|
| 201 |
+
|
| 202 |
+
Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
| 203 |
+
|
| 204 |
+
Han Zhang, Ian Goodfellow, Dimitris Metaxas, and Augustus Odena. Self-attention generative adversarial networks. arXiv preprint arXiv:1805.08318, 2018.
|
| 205 |
+
|
| 206 |
+
# A FID AND INCEPTION SCORES ON CIFAR10
|
| 207 |
+
|
| 208 |
+
We present an empirical study with SNDCGAN and ResNet CIFAR architectures on CIFAR10 in figure 5 and figure 6. In addition to Section 3.1, we evaluate one more kind of loss on CIFAR10. Here HG, NS and WGAN stand for hinge loss, non saturating loss and Wasserstein loss respectively. We observe that hinge loss performs very similar to non-saturating loss.
|
| 209 |
+
|
| 210 |
+

|
| 211 |
+
Figure 5: An empirical study with SNDCGAN and ResNet cifar architectures on CIFAR10. We recover the state of the art results recently reported in Miyato et al. (2018).
|
| 212 |
+
|
| 213 |
+

|
| 214 |
+
Figure 6: We show the Inception Score for each model within our study which corresponds to recently reported results (Miyato et al., 2018).
|
| 215 |
+
|
| 216 |
+
# B COMPARISON OF FID AND KID METRICS
|
| 217 |
+
|
| 218 |
+
The KID metric introduced by Binkowski et al. ´ (2018) is an alternative to FID. We use models from our Regularization and Normalization study (see Section 3.2) to compare both metrics. Here, by model we denote everything that needs to be specified for the training – including all hyper-parameters, like learning rate, $\lambda$ , Adam’s $\beta$ , etc. The Spearman rank-order correlation coefficient between KID and FID scores is approximately 0.994 for LSUN-BEDROOM and 0.995 for CELEBA-HQ-128 datasets.
|
| 219 |
+
|
| 220 |
+
To evaluate a practical setting of selecting several best models, we compare the intersection between the set of “best $K$ models by FID” and the set of “best $K$ models by KID” for $\bar { K } \in { 5 , 1 0 , 2 0 , 5 0 , 1 0 0 }$ . The results are summarized in Table 2.
|
| 221 |
+
|
| 222 |
+
This experiment suggests that FID and KID metrics are very strongly correlated, and for the practical applications one can choose either of them. Also, the conclusions from our studies based on FID should transfer to studies based on KID.
|
| 223 |
+
|
| 224 |
+
Table 2: Intersection between set of top $K$ experiments selected by FID and KID metrics.
|
| 225 |
+
|
| 226 |
+
<table><tr><td></td><td>LSUN-BEDROOM CELEBA-HQ-128</td></tr><tr><td>K=5 4/5</td><td>2/5</td></tr><tr><td>K=10</td><td>9/10 8/10</td></tr><tr><td>K=20</td><td>18/20 15/20</td></tr><tr><td>K=50 49/50</td><td>46/50</td></tr><tr><td>K=100</td><td>95/100 98/100</td></tr></table>
|
| 227 |
+
|
| 228 |
+
# C ARCHITECTURES
|
| 229 |
+
|
| 230 |
+
# C.1 SNDCGAN
|
| 231 |
+
|
| 232 |
+
We used the same architecture as Miyato et al. (2018), with the parameters copied from the GitHub page5. In Table 3a and Table 3b, we describe the operations in layer column with order. Kernel size is described in format [f ilter h, f ilter $_ - w$ , stride], input shape is $h \times w$ and output shape is $h \times w \times c h a n n e l s$ . The slopes of all lReLU functions are set to 0.1. The input shape $h \times w$ is $1 2 8 \times 1 2 8$ for CELEBA-HQ-128 and LSUN-BEDROOM, $3 2 \times 3 2$ for CIFAR10.
|
| 233 |
+
|
| 234 |
+
Table 3: SNDCGAN architecture.
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
<table><tr><td colspan="2">(a) SNDCGANdiscriminator</td></tr><tr><td>LAYER KERNEL</td><td>OUTPUT</td></tr><tr><td>Conv, IReLU [3,3,1]</td><td>h×w×64</td></tr><tr><td>Conv, IReLU [4,4,2]</td><td>h/2 × w/2 × 128</td></tr><tr><td>Conv, IReLU [3,3,1]</td><td>h/2 × w/2 × 128</td></tr><tr><td>Conv, lReLU [4,4,2]</td><td>h/4 × w/4× 256</td></tr><tr><td>Conv, IReLU [3,3,1]</td><td>h/4 × w/4 × 256</td></tr><tr><td>Conv, IReLU [4,4,2]</td><td>h/8×w/8× 512</td></tr><tr><td>Conv, IReLU [3,3,1]</td><td>h/8×w/8× 512</td></tr><tr><td>Linear 1</td><td>1</td></tr></table>
|
| 238 |
+
|
| 239 |
+
(b) SNDCGAN generator
|
| 240 |
+
|
| 241 |
+
<table><tr><td>LAYER</td><td>KERNEL OUTPUT</td></tr><tr><td>2 1</td><td>128</td></tr><tr><td>Linear, BN, ReLU</td><td>h/8×w/8× 512 1</td></tr><tr><td>Deconv, BN, ReLU [4,4,2]</td><td>h/4 ×w/4 × 256</td></tr><tr><td>Deconv,BN,ReLU</td><td>[4,4,2] h/2 × w/2 × 128</td></tr><tr><td>Deconv, BN, ReLU</td><td>[4,4,2] h×w×64</td></tr><tr><td>Deconv, Tanh [3,3,1]</td><td>h×w×3</td></tr></table>
|
| 242 |
+
|
| 243 |
+
# C.2 RESNET ARCHITECTURE
|
| 244 |
+
|
| 245 |
+
The ResNet19 architecture is described in Table 4. RS column stands for the resample of the residual block, with downscale(D)/upscale(U)/none(-) setting. MP stands for mean pooling and BN for batch normalization. ResBlock is defined in Table 5. The addition layer merges two paths by adding them. The first path is a shortcut layer with exactly one convolution operation, while the second path consists of two convolution operations. The downscale layer and upscale layer are marked in Table 5. We used average pool with kernel [2, 2, 2] for downscale, after the convolution operation. We used unpool from https://github.com/tensorflow/ tensorflow/issues/2169 for upscale, before convolution operation. $h$ and $w$ are the input shape to the ResNet block, output shape depends on the RS parameter. $c _ { i }$ and $c _ { o }$ are the input channels and output channels for a ResNet block. Table 6 described the ResNet CIFAR architecture we used in Figure 5 for reproducing the existing results. Note that RS is set to none for third ResBlock and fourth ResBlock in discriminator. In this case, we used the same ResNet block defined in Table 5 without resampling.
|
| 246 |
+
|
| 247 |
+
Table 4: ResNet 19 architecture corresponding to “resnet small” in https://github.com/ pfnet-research/sngan_projection.
|
| 248 |
+
(a) ResNet19 discriminator
|
| 249 |
+
|
| 250 |
+
<table><tr><td>LAYER</td><td>KERNEL</td><td>RS OUTPUT</td></tr><tr><td>ResBlock</td><td>[3,3,1] D</td><td>64 × 64× 64</td></tr><tr><td>ResBlock</td><td>[3,3,1] D</td><td>32 × 32 ×128</td></tr><tr><td>ResBlock</td><td>[3,3,1] D</td><td>16 ×16× 256</td></tr><tr><td>ResBlock</td><td>[3,3,1] D</td><td>8×8× 256</td></tr><tr><td>ResBlock</td><td>[3,3,1] D</td><td>4 ×4 × 512</td></tr><tr><td>ResBlock</td><td>[3,3,1] D</td><td>2 ×2× 512</td></tr><tr><td>ReLU, MP</td><td>-</td><td>512</td></tr><tr><td>Linear</td><td>- -</td><td>1</td></tr></table>
|
| 251 |
+
|
| 252 |
+
(b) ResNet19 generator
|
| 253 |
+
Table 5: ResNet block definition.
|
| 254 |
+
|
| 255 |
+
<table><tr><td>LAYER</td><td>KERNEL</td><td>RS</td><td>OUTPUT</td></tr><tr><td>2</td><td></td><td>1</td><td>128</td></tr><tr><td>Linear</td><td>-</td><td>1</td><td>4×4× 512</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>8×8×512</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>16 × 16× 256</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>32 × 32 × 256</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>64 × 64 × 128</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>128 × 128 × 64</td></tr><tr><td>BN,ReLU</td><td>1</td><td>1</td><td>128 × 128 × 64</td></tr><tr><td>Conv</td><td>[3,3,1]</td><td>1</td><td>128 × 128× 3</td></tr><tr><td>Sigmoid</td><td>-</td><td>-</td><td>128 × 128 × 3</td></tr></table>
|
| 256 |
+
|
| 257 |
+
(a) ResBlock discriminator
|
| 258 |
+
Table 6: ResNet CIFAR architecture.
|
| 259 |
+
|
| 260 |
+
<table><tr><td>LAYER</td><td>KERNEL</td><td>RS</td><td>OUTPUT</td></tr><tr><td>Shortcut</td><td>[3,3,1]</td><td>D</td><td>h/2 × w/2 × Co</td></tr><tr><td>BN,ReLU</td><td>1</td><td>1</td><td>hxwXCi</td></tr><tr><td>Conv</td><td>[3,3,1]</td><td>-</td><td>h×w×co</td></tr><tr><td>BN,ReLU</td><td>=</td><td>=</td><td>h×w×co</td></tr><tr><td>Conv</td><td>[3,3,1]</td><td>D</td><td>h/2 × w/2 ×Co</td></tr><tr><td>Addition</td><td>-</td><td>-</td><td>h/2 × w/2 × Co</td></tr></table>
|
| 261 |
+
|
| 262 |
+
(b) ResBlock generator
|
| 263 |
+
|
| 264 |
+
<table><tr><td>LAYER</td><td>KERNEL</td><td>RS</td><td>OUTPUT</td></tr><tr><td>Shortcut</td><td>[3,3,1]</td><td>U</td><td>2h× 2w XCo</td></tr><tr><td>BN, ReLU</td><td>1</td><td>-</td><td>h×wXCi</td></tr><tr><td rowspan="3">Conv BN, ReLU</td><td>[3,3,1]</td><td>U</td><td>2h ×2w×Co</td></tr><tr><td>-</td><td>1</td><td>2h × 2w ×Co</td></tr><tr><td>[3,3,1]</td><td>1</td><td>2h ×2w×Co</td></tr><tr><td>Conv Addition</td><td>-</td><td>-</td><td>2h × 2w X Co</td></tr></table>
|
| 265 |
+
|
| 266 |
+
(a) ResNet CIFAR discriminator
|
| 267 |
+
|
| 268 |
+
<table><tr><td>LAYER</td><td>KERNEL</td><td>RS OUTPUT</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>D 16 × 16 × 128</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>D 8×8×128</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>8×8×128 -</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>- 8×8×128</td></tr><tr><td>ReLU, MP</td><td></td><td>128 -</td></tr><tr><td>Linear</td><td>-</td><td>- 1</td></tr></table>
|
| 269 |
+
|
| 270 |
+
(b) ResNet CIFAR generator
|
| 271 |
+
|
| 272 |
+
<table><tr><td>LAYER</td><td>KERNEL</td><td>RS</td><td>OUTPUT</td></tr><tr><td>2</td><td></td><td>-</td><td>128</td></tr><tr><td>Linear</td><td>-</td><td>-</td><td>4×4×256</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>8×8× 256</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>16 × 16 × 256</td></tr><tr><td>ResBlock</td><td>[3,3,1]</td><td>U</td><td>32 × 32 × 256</td></tr><tr><td>BN, ReLU</td><td>1</td><td>1</td><td>32 × 32× 256</td></tr><tr><td>Conv</td><td>[3,3,1]</td><td>-</td><td>32 × 32 × 3</td></tr><tr><td>Sigmoid</td><td>1</td><td>-</td><td>32 × 32 × 3</td></tr></table>
|
| 273 |
+
|
| 274 |
+
# D RESNET ARCHITECTURE ABLATION STUDY
|
| 275 |
+
|
| 276 |
+
We have noticed six minor differences on Resnet architecture comparing to implementation from https: //github.com/pfnet-research/chainer-gan-lib/blob/master/common/net.py (Miyato et al., 2018). We did ablation study to verify the impact of these differences. Figure 7 shows the impact of the ablation study, with details described as following.
|
| 277 |
+
|
| 278 |
+
• DEFAULT: ResNet CIFAR architecture with spectral normalization and non-saturating GAN loss.
|
| 279 |
+
• SKIP: Use input as output for the shortcut connection in the discriminator ResBlock. By default it was a conv layer with 3x3 kernel.
|
| 280 |
+
CIN: Use $c _ { i }$ for the discriminator ResBlock hidden layer output channels. By default it was $c _ { o }$ in our setup, while Miyato et al. (2018) used $c _ { o }$ for first ResBlock and $c _ { i }$ for the rest. OPT: Use an optimized setup for the first discriminator ResBlock, which includes: (1) no ReLU, (2) a conv layer for the shortcut connections, (3) use $c _ { o }$ instead of $c _ { i }$ in ResBlock.
|
| 281 |
+
CIN OPT: Use CIN and OPT together. It means the first ResBlock is optimized while the remaining ResBlocks use $c _ { i }$ for the hidden output channels.
|
| 282 |
+
• SUM: Use reduce sum for the discriminator output. By default it was reduce mean.
|
| 283 |
+
• TAN: Use tanh for the generator output, as well as range [-1, 1] for discriminator input. By default it was sigmoid and discriminator input range [0, 1].
|
| 284 |
+
EPS: Use a bigger epsilon $\mathrm { 2 e - 5 }$ for generator batch normalization. By default it was 1e − 5 in TensorFlow.
|
| 285 |
+
• ALL: Apply all the above differences together.
|
| 286 |
+
|
| 287 |
+
In the ablation study, the CIN experiment obtained the worst FID score. Combining with OPT, the CIN results were improved to the same level as the others which is reasonable because the first block has three input channels, which becomes a bottleneck for the optimization. Hence, using OPT and CIN together performs as well as the others. Overall, the impact of these differences are minor according to the study on CIFAR10.
|
| 288 |
+
|
| 289 |
+

|
| 290 |
+
Figure 7: Ablation study of ResNet architecture differences. The experiment codes are described in Section D.
|
| 291 |
+
|
| 292 |
+
# E RECOMMENDED HYPERPARAMETER SETTINGS
|
| 293 |
+
|
| 294 |
+
To make the future GAN training simpler, we propose a set of best parameters for three setups: (1) Best parameters without any regularizer. (2) Best parameters with only one regularizer. (3) Best parameters with at most two regularizers. Table 7, Table 8 and Table 9 summarize the top 2 parameters for SNDCGAN architecture, ResNet19 architecture and ResNet CIFAR architecture, respectively. Models are ranked according to the median FID score of five different random seeds with fixed hyper-parameters in Table 1a. Note that ranking models according to the best FID score of different seeds will achieve better but unstable result. Gaussian Process optimization hyper-parameters are not included in this table. For ResNet19 architecture with at most two regularizers, we have run it only once due to computational overhead. To show the model stability, we listed the best FID score out of five seeds from the same parameters in column best. Spectral normalization is clearly outperforms the other normalizers on SNDCGAN and ResNet CIFAR architectures, while on ResNet19 both layer normalization and spectral normalization work well.
|
| 295 |
+
|
| 296 |
+
To visualize the FID score on each data set, Figure 8, Figure 9 and Figure 10 show the generated examples by GANs. We select the examples from the best FID run, and then increase the FID score for two more plots.
|
| 297 |
+
|
| 298 |
+
Table 7: SNDCGAN parameters
|
| 299 |
+
|
| 300 |
+
<table><tr><td>DATA SET</td><td>MEDIAN</td><td>BEST</td><td>LR(×10-3)</td><td>β1</td><td>β</td><td>ndisc</td><td>入</td><td>NORM</td></tr><tr><td>CIFAR10</td><td>29.75</td><td>28.66</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td>1</td><td>1</td></tr><tr><td>CIFAR10</td><td>36.12</td><td>33.23</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>=</td><td>=</td></tr><tr><td>CELEBA-HQ-128</td><td>66.42</td><td>63.13</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>1</td></tr><tr><td>CELEBA-HQ-128</td><td>67.39</td><td>64.59</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>=</td><td>=</td></tr><tr><td>LSUN-BEDROOM</td><td>180.36</td><td>160.12</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>1</td></tr><tr><td>LSUN-BEDROOM</td><td>188.99</td><td>162.00</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>1</td></tr><tr><td>CIFAR10</td><td>26.66</td><td>25.27</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>SN</td></tr><tr><td>CIFAR10</td><td>27.32</td><td>26.97</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>SN</td></tr><tr><td>CELEBA-HQ-128</td><td>31.14</td><td>29.05</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>=</td><td>SN</td></tr><tr><td>CELEBA-HQ-128</td><td>33.52</td><td>31.92</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>SN</td></tr><tr><td>LSUN-BEDROOM</td><td>63.46</td><td>58.13</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>SN</td></tr><tr><td>LSUN-BEDROOM</td><td>74.66</td><td>59.94</td><td>1.000</td><td>0.500</td><td>0.999</td><td>1</td><td>-</td><td>SN</td></tr><tr><td>CIFAR10</td><td>26.23</td><td>26.01</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>1</td><td>SN+GP</td></tr><tr><td>CIFAR10</td><td>26.66</td><td>25.27</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>1</td><td>SN</td></tr><tr><td>CELEBA-HQ-128</td><td>31.13</td><td>30.80</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td>10</td><td>GP</td></tr><tr><td>CELEBA-HQ-128</td><td>31.14</td><td>29.05</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>1</td><td>SN</td></tr><tr><td>LSUN-BEDROOM</td><td>63.46</td><td>58.13</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>=</td><td>SN</td></tr><tr><td>LSUN-BEDROOM</td><td>66.58</td><td>65.75</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>10</td><td>GP</td></tr></table>
|
| 301 |
+
|
| 302 |
+
Table 8: ResNet19 parameters
|
| 303 |
+
|
| 304 |
+
<table><tr><td>DATA SET</td><td>MEDIAN</td><td>BEST</td><td>LR(×10-3)</td><td>β</td><td>阳</td><td>ndisc</td><td>入</td><td>NORM</td></tr><tr><td>CELEBA-HQ-128</td><td>43.73</td><td>39.10</td><td>0.100</td><td>0.500</td><td>0.999</td><td>5</td><td></td><td></td></tr><tr><td>CELEBA-HQ-128</td><td>43.77</td><td>39.60</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td>=</td><td>-</td></tr><tr><td>LSUN-BEDROOM</td><td>160.97</td><td>119.58</td><td>0.100</td><td>0.500</td><td>0.900</td><td>5</td><td></td><td></td></tr><tr><td>LSUN-BEDROOM</td><td>161.70</td><td>125.55</td><td>0.100</td><td>0.500</td><td>0.900</td><td>5</td><td>=</td><td>1</td></tr><tr><td>CELEBA-HQ-128</td><td>32.46</td><td>28.52</td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td>=</td><td>LN</td></tr><tr><td>CELEBA-HQ-128</td><td>40.58</td><td>36.37</td><td>0.200</td><td>0.500</td><td>0.900</td><td>1</td><td></td><td>LN</td></tr><tr><td>LSUN-BEDROOM</td><td>70.30</td><td>48.88</td><td>1.000</td><td>0.500</td><td>0.999</td><td>1</td><td></td><td>SN</td></tr><tr><td>LSUN-BEDROOM</td><td>73.84</td><td>60.54</td><td>0.100</td><td>0.500</td><td>0.900</td><td>5</td><td>-</td><td>SN</td></tr><tr><td>CELEBA-HQ-128</td><td>29.13</td><td>=</td><td>0.100</td><td>0.500</td><td>0.900</td><td>5</td><td>1</td><td>LN+DR</td></tr><tr><td>CELEBA-HQ-128</td><td>29.65</td><td></td><td>0.200</td><td>0.500</td><td>0.900</td><td>5</td><td>1</td><td>GP</td></tr><tr><td>LSUN-BEDROOM</td><td>55.72</td><td></td><td>0.200</td><td>0.500</td><td>0.900</td><td>5</td><td>1</td><td>LN+GP</td></tr><tr><td>LSUN-BEDROOM</td><td>57.81</td><td></td><td>0.100</td><td>0.500</td><td>0.999</td><td>1</td><td>10</td><td>SN+GP</td></tr></table>
|
| 305 |
+
|
| 306 |
+
# F WHICH PARAMETERS REALLY MATTER?
|
| 307 |
+
|
| 308 |
+
For each architecture and hyper-parameter we estimate its impact on the final FID. Figure 11 presents heatmaps for hyperparameters, namely the learning rate, $\beta _ { 1 }$ , $\beta _ { 2 }$ , $n _ { d i s c }$ , and $\lambda$ for each combination of neural architecture and data set.
|
| 309 |
+
|
| 310 |
+
# G VARIATIONS OF MS-SSIM
|
| 311 |
+
|
| 312 |
+
We used the MS-SSIM scorer from TensorFlow with default power factors (Wang et al., 2003). Note that the default filter size for each scale layer is 11, the minimum image edge is $1 1 \times 2 ^ { 4 } = 1 7 6$ . To adapt it to CELEBA-HQ-128 data set with size $1 2 8 \times 1 2 8$ , we used the minimum of filter size 11 and image size in last scale layer to allow the computation followed the previous work (Fedus et al., 2018).
|
| 313 |
+
|
| 314 |
+
Table 9: ResNet CIFAR parameters
|
| 315 |
+
|
| 316 |
+
<table><tr><td>DATA SET</td><td>MEDIAN</td><td>BEST</td><td>LR(×10-3)</td><td>β1</td><td>阳</td><td>ndisc</td><td>入</td><td>NORM</td></tr><tr><td>CIFAR10</td><td>31.40</td><td>28.12</td><td>0.200</td><td>0.500</td><td>0.999</td><td>5</td><td>=</td><td>=</td></tr><tr><td>CIFAR10</td><td>33.79</td><td>30.08</td><td>0.100</td><td>0.500</td><td>0.999</td><td>5</td><td>=</td><td>1</td></tr><tr><td>CIFAR10</td><td>23.57</td><td>22.91</td><td>0.200</td><td>0.500</td><td>0.999</td><td>5</td><td>=</td><td>SN</td></tr><tr><td>CIFAR10</td><td>25.50</td><td>24.21</td><td>0.100</td><td>0.500</td><td>0.999</td><td>5</td><td>1</td><td>SN</td></tr><tr><td>CIFAR10</td><td>22.98</td><td>22.73</td><td>0.200</td><td>0.500</td><td>0.999</td><td>1</td><td>1</td><td>SN+GP</td></tr><tr><td>CIFAR10</td><td>23.57</td><td>22.91</td><td>0.200</td><td>0.500</td><td>0.999</td><td>5</td><td>-</td><td>SN</td></tr></table>
|
| 317 |
+
|
| 318 |
+

|
| 319 |
+
Figure 8: Examples generated by GANs on CELEBA-HQ-128 data set.
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
Figure 9: Examples generated by GANs on LSUN-BEDROOM data set.
|
| 323 |
+
|
| 324 |
+

|
| 325 |
+
Figure 10: Examples generated by GANs on CIFAR10 data set.
|
| 326 |
+
|
| 327 |
+

|
| 328 |
+
(a) FID score of SNDCGAN on CIFAR10
|
| 329 |
+
|
| 330 |
+

|
| 331 |
+
|
| 332 |
+

|
| 333 |
+
(b) FID score of SNDCGAN on CELEBA-HQ-128
|
| 334 |
+
|
| 335 |
+

|
| 336 |
+
(c) FID score of SNDCGAN on LSUN-BEDROOM
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
(d) FID score of ResNet CIFAR on CIFAR10
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
(e) FID score of ResNet19 on CELEBA-HQ-128
|
| 343 |
+
Figure 11: Heat plots for hyper-parameters on each architecture and dataset combination.
|
md/train/rkGZuJb0b/rkGZuJb0b.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COMPACT NEURAL NETWORKS BASED ON THE MULTISCALE ENTANGLEMENT RENORMALIZATION ANSATZ
|
| 2 |
+
|
| 3 |
+
Andrew Hallam1, Edward Grant2, Vid Stojevic $^ { 1 , 3 }$ , Simone Severin $^ { 2 , 4 }$ , Andrew G. Green5
|
| 4 |
+
|
| 5 |
+
1 Department of Physics & Astronomy, University College London
|
| 6 |
+
2 Department of Computer Science, University College London
|
| 7 |
+
3 GTN Ltd.
|
| 8 |
+
4 Institute of Natural Sciences, Shanghai Jiao Tong University
|
| 9 |
+
5 London Centre for Nanotechnology, University College London
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
This paper demonstrates a method for tensorizing neural networks based upon an efficient way of approximating scale invariant quantum states, the Multi-scale Entanglement Renormalization Ansatz (MERA). We employ MERA as a replacement for the fully connected layers in a convolutional neural network and test this implementation on the CIFAR-10 dataset. The proposed method outperforms factorization using tensor trains, providing greater compression for the same level of accuracy and greater accuracy for the same level of compression. We demonstrate MERA layers with 3900 times fewer parameters and a reduction in accuracy of less than $1 \%$ compared to the equivalent fully connected layers, scaling like $\mathcal { O } ( N ^ { \mathrm { l o g } _ { 2 } 3 } )$ .
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
The curse of dimensionality is a major bottleneck in machine learning, stemming from the exponential growth of variables with the number of modes in a data set (Cichocki et al. (2016)). Typically state-of-the-art convolutional neural networks have millions or billions of parameters. However, previous work has demonstrated that representations stored in the network parameters can be highly compressed without significant reduction in network performance (Novikov et al. (2015), Garipov et al. (2016), Hinton et al. (2015)). Determining the best network architecture for a given task remains an open problem.
|
| 18 |
+
|
| 19 |
+
Descriptions of quantum mechanical systems raise a similar challenge; representing $n d$ -dimensional particles requires a rank- $^ n$ tensor whose memory cost scales as $d ^ { n }$ . Indeed, it was the promise of harnessing this that led Richard Feynman (Feynman (1982)) to suggest the possibility of quantum computation. In the absence of a quantum computer, however, one must use compressed representations of quantum states.
|
| 20 |
+
|
| 21 |
+
A level of compression can be achieved by factorizing the tensorial description of the quantum wavefunction. Many such factorizations are possible, the optimal structure of the factorization being determined by the structure of correlations in the quantum system being studied. A revolution in quantum mechanics was made by realizing that the best way to characterize the distribution of correlations and information in a state is by a quantity known as entanglement – loosely the mutual quantum information between partitions of a quantum system (Eisert et al. (2010)).
|
| 22 |
+
|
| 23 |
+
This has led to many successful applications of tensorial approaches to problems in solid state physics and quantum chemistry over the past 25 years (Orus (2014), Kin-Lic Chan et al. (2007)). ´ Intriguing ideas have also emerged over the past few years attempting to bridge the successes of neural networks in machine learning with those of tensorial methods in quantum physics, both at a fundamental level (Lin et al. (2017), Mehta & Schwab (2014)), and as a practical tool for network design (Levine et al. (2017)). Recent work has suggested that entanglement itself is a useful quantifier of the performance of neural networks (Levine et al. (2017), Liu et al. (2017))
|
| 24 |
+
|
| 25 |
+
The simplest factorization employed in quantum systems is known as the matrix product state (Orus´ (2014)). In essence, it expresses the locality of information in certain quantum states. It has already been adopted to replace expensive linear layers in neural networks – in which context it has been independently termed tensor trains (Oseledets (2011)). This led to substantial compression of neural networks with only a small reduction in the accuracy (Novikov et al. (2015), Garipov et al. (2016)).
|
| 26 |
+
|
| 27 |
+
Here we use a different tensor factorization – known as the Multi-scale Entanglement Renormalization Ansatz (MERA) – that encodes information in a hierarchical manner (Vidal (2008)). MERA works through a process of coarse graining or renormalization. There have been a number of papers looking at the relationship between renormalization and deep learning. MERA is a concrete realization of such a renormalization procedure (Vidal (2009)) and so possesses a multi-scale structure that one might anticipate in complex data. A number of works have utilized tree tensor network models that possess a similar hierarchical structure. However, they do not include the disentangler tensors that are essential if each layer of the MERA is to capture correlations on different length scales (Liu et al. (2017)).
|
| 28 |
+
|
| 29 |
+
In this work we employ MERA as a replacement for linear layers in a neural network used to classify the CIFAR-10 dataset. Our results show that this performs better than the tensor train decomposition of the same linear layer, and gives better accuracy for the same level of compression and better compression for the same level of accuracy. In Section 2 we introduce factorizations of fully connected linear layers, starting with the tensor train factorization followed by a tree-like factorization and finally the MERA factorization. In Section 3 we discuss how this is employed as a replacement for a fully connected linear layer in deep learning networks. Section 4 gives our main results and we note connections with the existing literature in Section 5. Finally, in Section 6 we discuss some potential developments of the work.
|
| 30 |
+
|
| 31 |
+
# 2 TENSOR FACTORIZATION OF LINEAR LAYERS
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Schematic diagrams of various tensor factorizations of linear layers. a) a general linear layer, b) its tensor train factorization. The squares represent smaller tensors. Connections represent contractions as indicated in Eq.(1). c) Tree network factorization. d) MERA factorization.
|
| 35 |
+
|
| 36 |
+
In this report we have replaced the linear layers of the standard neural network with tensorial MERA layers. The first step in achieving this involves expressing a linear layer as a tensor. This can be accomplished by taking a matrix $\mathcal { W }$ and reshaping it to be a higher dimensional array. For example, suppose $\mathcal { W }$ is $d ^ { n }$ by $d ^ { n }$ dimensional with components $\mathcal { W } _ { A B }$ . It can be transformed into a rank $2 n$ tensor by mapping $A$ to $n$ elements $A \to i _ { 1 } , i _ { 2 } , . . . , i _ { n }$ and $B$ to another $n$ elements $B j _ { 1 } , j _ { 2 } , . . . , j _ { n }$ . In this case each of the elements of the new tensor will be of size $d$ .
|
| 37 |
+
|
| 38 |
+
Figure 1a gives a graphical representation of this rank $2 n$ tensor $\mathcal { W } _ { j _ { 1 } , j _ { 2 } , \dots , j _ { n } } ^ { i _ { 1 } , i _ { 2 } , \dots , i _ { n } }$ . It is important to note that in this representation, the lines represent the indices of the tensors rather than weights. Figure 1b illustrates the tensor train decomposition of $\mathcal { W }$ . This consists of writing the larger tensor as the contraction of a train of smaller tensors:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\mathcal { W } _ { j _ { 1 } , j _ { 2 } , \dots , j _ { n } } ^ { i _ { 1 } , i _ { 2 } , \dots , i _ { n } } = \sum _ { \alpha _ { 1 } , \alpha _ { 2 } , \dots , \alpha _ { n - 1 } } A _ { j _ { 1 } , \alpha _ { 1 } } ^ { i _ { 1 } } A _ { j _ { 1 } , \alpha _ { 2 } } ^ { \alpha _ { 1 } , i _ { 1 } } \dotsb A _ { j _ { n } } ^ { \alpha _ { n - 1 } , i _ { n } } .
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
In the tensor graphical notation, closed legs represent indices being summed over and free legs represent indices that aren’t being summed over. For example, in equation 1 the $\alpha _ { i }$ indices are being summed over and in Figure 1b the $\alpha _ { i }$ lines are connected to tensors at both ends.
|
| 45 |
+
|
| 46 |
+
If each index runs over values from 1 to $d$ , this represents an exponential reduction from $d ^ { 2 n }$ parameters to $n ( D d ) ^ { 2 }$ , where the indices $\alpha$ run over values from 1 to $D$ (known as the bond order or Schmidt rank in the quantum context). As noted above, this type of tensor factorization works well in physics when the information has a local structure (Eisert et al. (2010), Verstraete & Cirac (2006)); tensor trains capture correlations effectively up to length scales of order $\log D$ (Schollwock ¨ (2011)). This means that while useful for many tasks, the learned representations will be highly local. Tensors at either end of a tensor train decomposition of a linear layer will not be strongly correlated with one another.
|
| 47 |
+
|
| 48 |
+
A hierarchically structured tensor network can better represent correlations across the linear layer. The tree tensor network shown in Figure 1c represents one possible hierarchical factorization. Each element of this network is a rank 4 tensor. The two tensors on the top left would have the form $\mathcal { M } _ { i _ { 1 } , i _ { 2 } } ^ { j _ { 1 } , \alpha _ { 1 } }$ and $\mathcal { N } _ { i _ { 3 } , i _ { 4 } } ^ { j _ { 2 } , \alpha _ { 2 } }$ . The $i _ { n }$ elements being represented by the lines on the left of the figure, the $j _ { n }$ elements represented by the dotted lines on the right of the figure and the $\alpha _ { n }$ lines being those connected with the tensor immediately to the right of $\mathcal { M }$ and $\mathcal { N }$ .
|
| 49 |
+
|
| 50 |
+
Reading from left to right Figure 1c can be interpreted as follows: the tree-like connectivity imbues the network with a causal structure whereby a given linear element and its outputs are influenced by inputs in a region determined by its height in the tree.
|
| 51 |
+
|
| 52 |
+
For example, the rightmost element in Figure 1c is influenced by all of the inputs, whereas the top element in the middle column is influenced by inputs $i _ { 1 }$ to $i _ { 4 }$ . Elements other than the rightmost tensor have one dashed output (that connects directly to the overall output) and one solid output (that ties it to the branching tree structure). These dashed lines are controlled by representations occurring on a particular scale in the data.
|
| 53 |
+
|
| 54 |
+
Notice that removing these dashed lines, the network has a true tree structure and represents a coarse graining or renormalization of the network. In this case, the linear elements are the isometries of the original MERA’s definition (Vidal (2008; 2009)).
|
| 55 |
+
|
| 56 |
+
The simple tree network, which has been studied before in the context of neural networks, has a major deficiency. At each branching, it partitions the system in two, so that in extremis, the correlations between neighbouring inputs – for example $i _ { 4 }$ and $i _ { 5 }$ in Figure 1c – are only controlled by the element at the end of the network. Requiring the higher elements in the tree-structure to capture correlations between neighbouring inputs restricts their ability to describe the longer length scale correlations you would hope to capture by using a hierarchical structure.
|
| 57 |
+
|
| 58 |
+
The MERA (Vidal (2009)) factorization was introduced in order to solve this problem. As can be seen in Figure 1d it adds an additional set of rank 4 tensors called disentanglers. The MERA is constructed by taking a tree network and placing one of these rank 4 tensors $\mathcal { D } _ { \gamma _ { 1 } , \gamma _ { 2 } } ^ { \beta _ { 1 } , \beta _ { 2 } }$ such that its right-going legs $\beta _ { 1 }$ and $\beta _ { 2 }$ connect to two adjacent tensors of the tree network. For example, if we consider the top left-most disentangler in Figure 1d it has elements Dβ1,β2i ,i and connects to the tree elements M0j1,α1 and N 0j2,α2 with $\beta _ { 1 }$ and $\beta _ { 2 }$ then being summed over.
|
| 59 |
+
|
| 60 |
+
The role of the disentanglers is to cause all correlations on the same length scale to be treated similarly. For example, correlations between any two neighbouring input indices $i _ { n }$ and $i _ { n + 1 }$ will be captured by either the first row of tree elements or the disentanglers. This allows the later elements in the network to work at capturing longer range correlations.
|
| 61 |
+
|
| 62 |
+
In summary, a rank- $N$ MERA layer can be constructed in the following manner:
|
| 63 |
+
|
| 64 |
+
1. Create a tree tensor layer. For example, an $N = 2 ^ { \tau }$ tree can be constructed from $2 ^ { \tau - 1 }$ rank-4 tree tensors $\mathcal { M } _ { \gamma _ { 1 } , \gamma _ { 2 } } ^ { \beta _ { 1 } , \beta _ { 2 } }$ in the first layer, followed by $2 ^ { \tau - 2 }$ tree tensors in the second layer until after $\tau$ layers there is only a single tree tensor.
|
| 65 |
+
2. A set of disentanglers are introduced. These are rank-4 tensors $\mathcal { D } _ { \gamma _ { 1 } , \gamma _ { 2 } } ^ { \beta _ { 1 } , \beta _ { 2 } }$ which are placed such that every disentangler is contracted with two neighbouring tree tensors in an upcoming layer of the tree tensor.
|
| 66 |
+
|
| 67 |
+
# 3 EXPERIMENTS $\&$ NETWORK STRUCTURE
|
| 68 |
+
|
| 69 |
+
We have considered the performance of a neural network with the two penultimate fully connected layers of the model replaced with MERA layers, similar to the Novikov et al. (2015) study of compression of fully connected layers using tensor trains. We have quantified the performance of the MERA layer through comparisons with two other classes of networks: fully connected layers with varying numbers of nodes and tensor train layers with varying internal dimension. The three types of network are otherwise identical.
|
| 70 |
+
|
| 71 |
+
The networks consisted of three sets of two convolutional layers each followed by max pooling layers with $3 \times 3$ kernels and stride 2. The convolutional kernels were $3 \times 3$ . There were 64 channels in all of the convolutional layers except for the input, which had three channels, and the last convolutional layer, which had 256 channels. The final convolutional layer was followed by two more hidden layers, these were either fully connected, MERA layers or TT-layers depending upon the network. The first of these layers was of size $4 0 9 6 \times x$ , the second is of size $x \times 6 4$ . For all MERA and TT networks, these layers were $4 0 9 6 \times 4 0 9 6$ and $4 0 9 6 \times 6 4$ .
|
| 72 |
+
|
| 73 |
+
The final layer had 10 nodes corresponding to the 10 image classes in CIFAR-10. Leaky rectified linear units (LReLU) were used on all layers except the final layer, with $l e a k = 0 . 2$ (Maas et al. (2013)).
|
| 74 |
+
|
| 75 |
+
During training, nodes in the final convolutional layer and the two first fully connected layers were dropped with probability 0.5. The penultimate convolutional layer nodes were dropped with probability 0.2 (Srivastava et al. (2014)). Batch-normalization was used on all layers after dropout and max pooling (Ioffe & Szegedy (2015)). We did not use bias units.
|
| 76 |
+
|
| 77 |
+
Gaussian weight initialization was employed in the fully connected models with standard deviation equal to $\frac { 1 } { \sqrt { n _ { i n } } }$ , where $n _ { i n }$ was the number of inputs (He et al. (2015)).
|
| 78 |
+
|
| 79 |
+
In this report we considered networks with two varieties of fully-connected layers. The first of these networks had a $4 0 9 6 \times 4 0 9 6$ fully connected layer followed by one which was $4 0 9 6 \times 6 4$ ; this network was used as a benchmark against which the other models could be compared. The second network instead had a $4 0 9 6 \times 1 0$ fully connected layer followed by a $1 0 \times 6 4$ layer. We trained this network to compare the MERA and tensor train layers to a fully connected model with a comparable number of parameters, in order to evaluate how detrimental naive compression is to accuracy.
|
| 80 |
+
|
| 81 |
+
A schematic of the two MERA layers can be found in Figure 2. The input to the first MERA layer was reshaped in to a rank-12 tensor with each index being dimension 2, as described in Section 2. The MERA layer was then constructed from a set of rank-4 tensors using the method described in Section 2.
|
| 82 |
+
|
| 83 |
+
The first MERA layer works as follows: It contains a column of 6 rank-4 tree elements, followed by 3 tree elements and finally a single tree element. 5 disentanglers are placed before the first column of tree elements and 2 more disentanglers are placed before the second column of tree elements.
|
| 84 |
+
|
| 85 |
+
The second MERA layer has an identical structure to the first MERA layer, one of the outputs of the first set of tree elements is fixed. As a result the output of the second MERA layer is 64 nodes. The dimensions of the internal indices in the MERA layers were allowed to vary, with a MERA- $D$ being a MERA layer with internal dimension $D$ .
|
| 86 |
+
|
| 87 |
+
MERA weights were initialized using elements of randomized orthogonal matrices (Saxe et al. (2013)). The tensors themselves were constructed by reshaping these matrices, as described in Section 2. The random orthogonal matrix was constructed using the method of Stewart (Stewart (1980), Mezzadri (2007)). Starting from a random $n - 1 \times n - 1$ dimensional orthogonal matrix, a random $n \times n$ dimensional orthogonal matrix can be constructed by taking a randomly distributed $n$ -dimensional vector, constructing its Householder transformation, and then applying the $n - 1$ dimensional matrix to this vector.
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
Figure 2: A schematic of the MERA layers of the model. The small rectangles represent linear elements to factorize a general linear layer. White rectangles represent disentanglers. Red rectangles represent tree elements. Solid black lines connecting nodes represent tensor contraction and dashed lines with arrow heads represent the nonlinearities being applied. Dashed lines ending in a circle represent fixed outputs.
|
| 91 |
+
|
| 92 |
+
Finally, a network with its fully connected layers replaced with a tensor train decomposition was trained in order to provide a comparison with the MERA layers. The tensor train layers were constructed as described in Section 2 with the internal dimension being allowed to vary from $D = 3$ to $D = 5$ . In the second tensor train layer, half of the output indices were fixed to match the second MERA layer.
|
| 93 |
+
|
| 94 |
+
We tested performance on the CIFAR-10 dataset. We used 50, 000 images for training and 10, 000 for testing. Each training batch consisted of 50 images. Training data was augmented by randomly flipping and translating the input images by up to 4 pixels. Translated images were padded with zeros. All images were normalized by dividing by 255 and subtracting the mean pixels value from the training set.
|
| 95 |
+
|
| 96 |
+
Test accuracy was recorded every 500 iterations and training was stopped when test accuracy did not improve for 10 successive tests. The network was trained using backpropagation and the Adam optimizer, with initial learning rate 0.001 (Kingma & Ba (2014)) and a softmax-cross-entropy objective.
|
| 97 |
+
|
| 98 |
+
The networks were implemented in Tensorflow r1.3 and trained on NVIDIA Titan Xp and 1080ti GPUs.
|
| 99 |
+
|
| 100 |
+
# 4 EXPERIMENTAL RESULTS
|
| 101 |
+
|
| 102 |
+
In Table 1 we compare the number of parameters used, the compression rate and the accuracy obtained for each of the models described in Section 3. The compression rate stated is with respect to the number of parameters used in the fully-connected benchmark model, FC-1.
|
| 103 |
+
|
| 104 |
+
When comparing the MERA networks to the fully connected model we can see a considerable drop in the number of parameters required with only a modest drop in the accuracy. MERA-2 compressed the fully connected layers by a factor of nearly 5500 with an accuracy drop of $1 . 4 8 \%$ . Increasing the internal dimension of the MERA to 3 we found the compression rate decreased to approximately 3900 but the accuracy was $8 6 . 2 \%$ , a drop of less than $1 \%$ compared to the fully connected model. The compression rate of an entire MERA network compared to the fully connected network was approximately 57. We did not attempt to compress the convolutional layers in this work, and therefore the vast majority of parameters were focused in these layers for the MERA networks.
|
| 105 |
+
|
| 106 |
+
How significant is the MERA network structure we have chosen to the results obtained? The results of the MERA networks can be compared against the fully connected layer with only 10 nodes, see FC-2 in Table 1. This network possesses 100 times more parameters than MERA-2 but the drop in the accuracy is $6 . 0 4 \%$ , significantly more than any MERA network.
|
| 107 |
+
|
| 108 |
+
The MERA network also compares favourably to tensor train methods. TT-3 had a comparable compression rate to the MERA methods but a more significant drop in accuracy, $2 . 2 2 \%$ . For a tensor train network to achieve an accuracy drop of only $1 \%$ the internal dimension had to be increased to 7, resulting in an inferior compression rate compared to MERA-2.
|
| 109 |
+
|
| 110 |
+
In addition to the degree of compression achieved by these networks, we also address the time to optimize. There is evidently a degree of compromise required here: the number of multiplications required to apply a MERA layer scales with the input size $N$ and bond order $D$ as $N ^ { \mathrm { l o g } _ { 2 } D }$ . The equivalent scaling for a tensor train and fully connected layer are $N D ^ { 2 }$ and $N ^ { 2 }$ , respectively. This is reflected in the times taken to optimize these networks. Note however, that MERA can accommodate correlations at all scales of its input even at low bond order, whereas tensor trains require a bond order that scales exponentially with the length scale of correlation (Orus (2014)). MERA is, ´ therefore, expected to scale better for very large data sets than either tensor trains or fully connected layers.
|
| 111 |
+
|
| 112 |
+
Table 1: The experimental results for the different models. FC1 was the fully-connected model and FC2 was the fully-connected model with severely reduced number of parameters in the fullyconnected layers. MERA-2 and MERA-3 were MERA models with the MERA layers of internal bond dimension 2 and 3 respectively. Finally TT-3, TT-5, TT-7 were tensor train models with the internal dimension being 3, 5 and 7.
|
| 113 |
+
|
| 114 |
+
<table><tr><td>Network</td><td>Parameters (Fully connected)</td><td>Parameters (Total)</td><td>Compression (Fully connected)</td><td>Compression (Total)</td><td>Accuracy</td></tr><tr><td>FC-1</td><td>17041920</td><td>17338560</td><td>1</td><td>1</td><td>0.8719</td></tr><tr><td>FC-2</td><td>305664</td><td>602304</td><td>55</td><td>28.79</td><td>0.8114</td></tr><tr><td>MERA-2</td><td>3112</td><td>299752</td><td>5476</td><td>57.85</td><td>0.8579</td></tr><tr><td>MERA-3</td><td>4342</td><td>300982</td><td>3924</td><td>57.61</td><td>0.8620</td></tr><tr><td>TT-3</td><td>3168</td><td>299854</td><td>5272</td><td>57.82</td><td>0.8497</td></tr><tr><td>TT-5</td><td>4380</td><td>301020</td><td>3891</td><td>57.60</td><td>0.8532</td></tr><tr><td>TT-7</td><td>6088</td><td>302728</td><td>2799</td><td>57.27</td><td>0.8629</td></tr></table>
|
| 115 |
+
|
| 116 |
+
# 4.1 STUDY OF ABLATED NETWORKS
|
| 117 |
+
|
| 118 |
+
As can be seen in Table 1, the number of parameters in the fully convolutional layers far outweigh the parameters in the fully connected, MERA or tensor train layers of the network. In order to study the behaviour of the MERA and tensor train layers without the convolutional layers distorting the results we have created an ablated network with the number of parameters in the convolutional layers minimized.
|
| 119 |
+
|
| 120 |
+
In this case the only convolutional layer was had a $1 \times 1$ kernel with 3 channels in and 4 channels out. This was followed by $4 0 9 6 \times 6 4$ MERA or tensor train layer. The final layer was a $6 4 \times 1 0$ layer as in the previous network structure. A MERA-2 layer was used, with 232 parameters. The tensor-train layer used a mixture of TT-2 and TT-3 so it would contain 236 parameters, as close as possible to the MERA-2 layer.
|
| 121 |
+
|
| 122 |
+
For this simplified network we found that the MERA-2 network achieved an accuracy of $4 7 . 3 6 \%$ $( \sigma = 0 . 4 8 \%$ ) while the tensor train achieved an accuracy of $4 6 . 6 5 \%$ $\begin{array} { r } { \sigma = 0 . 2 5 \% , } \end{array}$ ). Evidence of a MERA layer once again outperforming a tensor train layer with a comparable number of parameters.
|
| 123 |
+
|
| 124 |
+
Given how memory intensive deep neural networks typically are, substantial effort has been made to reduce number of parameters these networks require without significantly reducing their accuracy. Some of these have taken a similar approach to the MERA network described above, using tensor decompositions of the fully connected layers.
|
| 125 |
+
|
| 126 |
+
These include the tensor train models of Novikov et al. (2015) and Garipov et al. (2016). Here we have found replacing a fully connected linear layer with a MERA factorization resulted in superior accuracy for a comparable number of parameters.
|
| 127 |
+
|
| 128 |
+
More directly related to this MERA model are a number of tree tensor network models (Liu et al. (2017), Levine et al. (2017)). As Section 2 explained, tree tensor networks inconsistently capture correlations on the same length scale, this is the reason for the introduction of disentanglers. Tree tensors do not possess these and we expect them to struggle to capture long range correlations as effectively as MERA.
|
| 129 |
+
|
| 130 |
+
A MERA works through a process of coarse graining or renormalization. There have been a number of other papers looking at the relationship between renormalization and deep learning. Lin et al. (2017) argue that the effectiveness of deep neural networks should be thought of in terms of renormalization and Mehta & Schwab (2014) demonstrate an exact mapping between the variational renormalization group and restricted Boltzmann machines. In this report we have taken a different approach: only the fully connected layers of the network were replaced with MERA layers.
|
| 131 |
+
|
| 132 |
+
# 6 DISCUSSION
|
| 133 |
+
|
| 134 |
+
We have shown that replacing the fully connected layers of a deep neural network with layers based upon the multi-scale entanglement renormalization ansatz can generate significant efficiency gains with only small reduction in accuracy. When applied to the CIFAR-10 data we found the fully connected layers can be replaced with MERA layers with 3900 times less parameters with a reduction in the accuracy of less than $1 \%$ . The model significantly outperformed compact fully connected layers with $7 0 - 1 0 0$ times as many parameters. Moreover, it outperformed a similar replacement of the fully connected layers with tensor trains, both in terms of accuracy for a given compression and compression for a given accuracy.
|
| 135 |
+
|
| 136 |
+
An added advantage — not explored here — is that a factorized layer can potentially handle much larger input data sets, thus enabling entirely new types of computation. Correlations across these large inputs can be handled much more efficiently by MERA than by tensor trains. Moreover, a compressed network may provide a convenient way to avoid over-fitting of large data sets. The compression achieved by networks with these factorized layers comes at a cost. They can take longer to train than networks containing the large fully connected layers due to the number of tensor contractions required to apply the factorized layer.
|
| 137 |
+
|
| 138 |
+
Our results suggest several immediate directions for future inquiry. Firstly, there are some questions about how to improve the existing model. For example, before the MERA layer is used the input is reshaped into a rank-12 tensor. There isn’t a well defined method for how to perform this reshaping optimally and some experimentation is necessary. The best way to initialize the MERA layers is also still an open question.
|
| 139 |
+
|
| 140 |
+
The results presented here are a promising first step for using MERA in a more fundamental way. Since MERA can be viewed as a coarse graining procedure (as explained in Section 2), and image data is often well represented in a hierarchical manner, one possibility would be to simply train a two-dimensional MERA directly on an image dataset, with no reference to a neural network. In Stoudenmire & Schwab (2016) a similar idea was explored with matrix product states being trained directly on MNIST. An alternative possibility would be the replacement of just the convolutional layers of the network with a two-dimensional MERA. Both of these approaches would be closer in spirit to the fundamental ideas about the relationships between quantum physics and machine learning proposed in Lin et al. (2017) and Mehta & Schwab (2014).
|
| 141 |
+
|
| 142 |
+
Additionally, there has been some work using entanglement measures to explore how correlations are distributed in deep neural networks, and then utilizing these in order to optimize the design of networks (Liu et al. (2017), Levine et al. (2017)). It would be intriguing to explore such ideas using MERA, for example by using the concrete MERA model explored in this paper, or one of the more ambitious possibilities mentioned above.
|
| 143 |
+
|
| 144 |
+
We end by noting two facts: any variational approximation to a quantum wavefunction can be used to construct a replacement for linear layers of a network. There are many examples and each may have its sphere of useful application. Moreover, quantum computers of the type being developed currently by several groups are precisely described by a type of tensor network (a finite-depth circuit - and one that may very soon be too large to manipulate classically) and could be used as direct replacement for linear layers in a hybrid quantum/classical neural computation scheme.
|
| 145 |
+
|
| 146 |
+
# ACKNOWLEDGMENTS
|
| 147 |
+
|
| 148 |
+
This work was supported by the Engineering and Physical Sciences Research Council [grant number EP/P510270/1]. The Titan Xp used for this research was donated by the NVIDIA Corporation. We would like to thank Miles Stoudenmire for many enlightening discussions.
|
| 149 |
+
|
| 150 |
+
# REFERENCES
|
| 151 |
+
|
| 152 |
+
A. Cichocki, N. Lee, I. V. Oseledets, A.-H. Phan, Q. Zhao, and D. Mandic. Low-Rank Tensor Networks for Dimensionality Reduction and Large-Scale Optimization Problems: Perspectives and Challenges PART 1. ArXiv e-prints arXiv:1609.00893, September 2016.
|
| 153 |
+
J. Eisert, M. Cramer, and M. B. Plenio. Colloquium: Area laws for the entanglement entropy. Reviews of Modern Physics, 82:277–306, January 2010. doi: 10.1103/RevModPhys.82.277.
|
| 154 |
+
R. P. Feynman. Simulating physics with computers. International Journal of Theoretical Physics, 21(6):467–488, 1982.
|
| 155 |
+
Timur Garipov, Dmitry Podoprikhin, Alexander Novikov, and Dmitry P. Vetrov. Ultimate tensorization: compressing convolutional and FC layers alike. CoRR, abs/1611.03214, 2016. URL http://arxiv.org/abs/1611.03214.
|
| 156 |
+
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, 2015.
|
| 157 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 158 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
|
| 159 |
+
G. Kin-Lic Chan, J. J. Dorando, D. Ghosh, J. Hachmann, E. Neuscamman, H. Wang, and T. Yanai. An Introduction to the Density Matrix Renormalization Group Ansatz in Quantum Chemistry. ArXiv e-prints arXiv:0711.1398, November 2007.
|
| 160 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 161 |
+
Yoav Levine, David Yakira, Nadav Cohen, and Amnon Shashua. Deep learning and quantum entanglement: Fundamental connections with implications to network design. CoRR, abs/1704.01552, 2017. URL http://arxiv.org/abs/1704.01552.
|
| 162 |
+
H. W. Lin, M. Tegmark, and D. Rolnick. Why Does Deep and Cheap Learning Work So Well? Journal of Statistical Physics, 168:1223–1247, September 2017. doi: 10.1007/s10955-017-1836-5.
|
| 163 |
+
D. Liu, S.-J. Ran, P. Wittek, C. Peng, R. Blazquez Garc ´ ´ıa, G. Su, and M. Lewenstein. Machine Learning by Two-Dimensional Hierarchical Tensor Networks: A Quantum Information Theoretic Perspective on Deep Architectures. ArXiv e-prints arXiv:1710.04833, October 2017.
|
| 164 |
+
Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In Proc. ICML, volume 30, 2013.
|
| 165 |
+
P. Mehta and D. J. Schwab. An exact mapping between the Variational Renormalization Group and Deep Learning. ArXiv e-prints arXiv:1410.3831, October 2014.
|
| 166 |
+
Francesco Mezzadri. How to generate random matrices from the classical compact groups. Notices of the American Mathematical Society, 54(5):592 – 604, 5 2007. ISSN 0002-9920.
|
| 167 |
+
Alexander Novikov, Dmitry Podoprikhin, Anton Osokin, and Dmitry P. Vetrov. Tensorizing neural networks. CoRR, abs/1509.06569, 2015. URL http://arxiv.org/abs/1509.06569.
|
| 168 |
+
R. Orus. A practical introduction to tensor networks: Matrix product states and projected entangled ´ pair states. Annals of Physics, 349:117–158, October 2014. doi: 10.1016/j.aop.2014.06.013.
|
| 169 |
+
I. V. Oseledets. Tensor-train decomposition. SIAM J. Sci. Comput., 33(5):2295–2317, September 2011. ISSN 1064-8275. doi: 10.1137/090752286. URL http://dx.doi.org/10.1137/ 090752286.
|
| 170 |
+
A. M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. ArXiv e-prints arXiv:1312.6120, December 2013.
|
| 171 |
+
U. Schollwock. The density-matrix renormalization group in the age of matrix product states. ¨ Annals of Physics, 326:96–192, January 2011. doi: 10.1016/j.aop.2010.09.012.
|
| 172 |
+
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.
|
| 173 |
+
G. W. Stewart. The efficient generation of random orthogonal matrices with an application to condition estimators. SIAM Journal on Numerical Analysis, 17(3):403–409, 1980. doi: 10.1137/0717034. URL https://doi.org/10.1137/0717034.
|
| 174 |
+
Miles Stoudenmire and D. J. Schwab. Supervised Learning with Quantum-Inspired Tensor Networks. ArXiv e-prints arXiv:1605.05775, May 2016.
|
| 175 |
+
F. Verstraete and J. I. Cirac. Matrix product states represent ground states faithfully. , 73(9):094423, March 2006. doi: 10.1103/PhysRevB.73.094423.
|
| 176 |
+
G. Vidal. Class of Quantum Many-Body States That Can Be Efficiently Simulated. Physical Review Letters, 101(11):110501, September 2008. doi: 10.1103/PhysRevLett.101.110501.
|
| 177 |
+
G. Vidal. Entanglement Renormalization: an introduction. ArXiv e-prints arXiv:0912.1651, December 2009.
|
md/train/rkGabzZgl/rkGabzZgl.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/rkHVZWZAZ/rkHVZWZAZ.md
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# THE REACTOR:
|
| 2 |
+
|
| 3 |
+
# A FAST AND SAMPLE-EFFICIENT ACTOR-CRITIC AGENT FOR REINFORCEMENT LEARNING
|
| 4 |
+
|
| 5 |
+
Audrunas Gruslys, ¯ DeepMind audrunas@google.com
|
| 6 |
+
|
| 7 |
+
Will Dabney,
|
| 8 |
+
DeepMind
|
| 9 |
+
wdabney@google.com
|
| 10 |
+
|
| 11 |
+
Mohammad Gheshlaghi Azar, DeepMind mazar@google.com
|
| 12 |
+
|
| 13 |
+
Bilal Piot,
|
| 14 |
+
DeepMind
|
| 15 |
+
piot@google.com
|
| 16 |
+
|
| 17 |
+
Marc G. Bellemare, Google Brain bellemare@google.com
|
| 18 |
+
|
| 19 |
+
Rémi Munos,
|
| 20 |
+
DeepMind
|
| 21 |
+
munos@google.com
|
| 22 |
+
|
| 23 |
+
# ABSTRACT
|
| 24 |
+
|
| 25 |
+
In this work, we present a new agent architecture, called Reactor, which combines multiple algorithmic and architectural contributions to produce an agent with higher sample-efficiency than Prioritized Dueling DQN (Wang et al., 2017) and Categorical DQN (Bellemare et al., 2017), while giving better run-time performance than A3C (Mnih et al., 2016). Our first contribution is a new policy evaluation algorithm called Distributional Retrace, which brings multi-step off-policy updates to the distributional reinforcement learning setting. The same approach can be used to convert several classes of multi-step policy evaluation algorithms, designed for expected value evaluation, into distributional algorithms. Next, we introduce the $\beta$ -leave-one-out policy gradient algorithm, which improves the trade-off between variance and bias by using action values as a baseline. Our final algorithmic contribution is a new prioritized replay algorithm for sequences, which exploits the temporal locality of neighboring observations for more efficient replay prioritization. Using the Atari 2600 benchmarks, we show that each of these innovations contribute to both sample efficiency and final agent performance. Finally, we demonstrate that Reactor reaches state-of-the-art performance after 200 million frames and less than a day of training.
|
| 26 |
+
|
| 27 |
+
# 1 INTRODUCTION
|
| 28 |
+
|
| 29 |
+
Model-free deep reinforcement learning has achieved several remarkable successes in domains ranging from super-human-level control in video games (Mnih et al., 2015) and the game of Go (Silver et al., 2016; 2017), to continuous motor control tasks (Lillicrap et al., 2015; Schulman et al., 2015).
|
| 30 |
+
|
| 31 |
+
Much of the recent work can be divided into two categories. First, those of which that, often building on the DQN framework, act $\epsilon$ -greedily according to an action-value function and train using minibatches of transitions sampled from an experience replay buffer (Van Hasselt et al., 2016; Wang et al., 2015; He et al., 2017; Anschel et al., 2017). These value-function agents benefit from improved sample complexity, but tend to suffer from long runtimes (e.g. DQN requires approximately a week to train on Atari). The second category are the actor-critic agents, which includes the asynchronous advantage actor-critic (A3C) algorithm, introduced by Mnih et al. (2016). These agents train on transitions collected by multiple actors running, and often training, in parallel (Schulman et al., 2017; Vezhnevets et al., 2017). The deep actor-critic agents train on each trajectory only once, and thus tend to have worse sample complexity. However, their distributed nature allows significantly faster training in terms of wall-clock time. Still, not all existing algorithms can be put in the above two categories and various hybrid approaches do exist (Zhao et al., 2016; O’Donoghue et al., 2017; Gu et al., 2017; Wang et al., 2017).
|
| 32 |
+
|
| 33 |
+
Data-efficiency and off-policy learning are essential for many real-world domains where interactions with the environment are expensive. Similarly, wall-clock time (time-efficiency) directly impacts an algorithm’s applicability through resource costs. The focus of this work is to produce an agent that is sample- and time-efficient. To this end, we introduce a new reinforcement learning agent, called Reactor (Retrace-Actor), which takes a principled approach to combining the sample-efficiency of off-policy experience replay with the time-efficiency of asynchronous algorithms. We combine recent advances in both categories of agents with novel contributions to produce an agent that inherits the benefits of both and reaches state-of-the-art performance over 57 Atari 2600 games.
|
| 34 |
+
|
| 35 |
+
Our primary contributions are (1) a novel policy gradient algorithm, $\beta$ -LOO, which makes better use of action-value estimates to improve the policy gradient; (2) the first multi-step off-policy distributional reinforcement learning algorithm, distributional Retrace $( \lambda )$ ; (3) a novel prioritized replay for off-policy sequences of transitions; and (4) an optimized network and parallel training architecture.
|
| 36 |
+
|
| 37 |
+
We begin by reviewing background material, including relevant improvements to both value-function agents and actor-critic agents. In Section 3 we introduce each of our primary contributions and present the Reactor agent. Finally, in Section 4, we present experimental results on the 57 Atari 2600 games from the Arcade Learning Environment (ALE) (Bellemare et al., 2013), as well as a series of ablation studies for the various components of Reactor.
|
| 38 |
+
|
| 39 |
+
# 2 BACKGROUND
|
| 40 |
+
|
| 41 |
+
We consider a Markov decision process (MDP) with state space $X$ and finite action space $\mathcal { A }$ . A (stochastic) policy $\pi ( \cdot | x )$ is a mapping from states $x \in X$ to a probability distribution over actions. We consider a $\gamma$ -discounted infinite-horizon criterion, with $\gamma \in [ 0 , 1 )$ the discount factor, and define for policy $\pi$ the action-value of a state-action pair $( x , a )$ as
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\begin{array} { r } { Q ^ { \pi } ( x , a ) \stackrel { \mathrm { d e f } } { = } \mathbb { E } \Bigl [ \sum _ { t \geq 0 } \gamma ^ { t } r _ { t } | x _ { 0 } = x , a _ { 0 } = a , \pi \Bigr ] , } \end{array}
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
where $( \{ x _ { t } \} _ { t \ge 0 } )$ is a trajectory generated by choosing $a$ in $x$ and following $\pi$ thereafter, i.e., $a _ { t } \sim$ $\pi ( \cdot | x _ { t } )$ (for $t \geq 1$ ), and $r _ { t }$ is the reward signal. The objective in reinforcement learning is to find an optimal policy $\pi ^ { * }$ , which maximises $Q ^ { \pi } ( x , a )$ . The optimal action-values are given by $Q ^ { * } ( x , a ) = \operatorname* { m a x } _ { \pi } Q ^ { \pi } ( x , a )$ .
|
| 48 |
+
|
| 49 |
+
# 2.1 VALUE-BASED ALGORITHMS
|
| 50 |
+
|
| 51 |
+
The Deep Q-Network (DQN) framework, introduced by Mnih et al. (2015), popularised the current line of research into deep reinforcement learning by reaching human-level, and beyond, performance across 57 Atari 2600 games in the ALE. While DQN includes many specific components, the essence of the framework, much of which is shared by Neural Fitted Q-Learning (Riedmiller, 2005), is to use of a deep convolutional neural network to approximate an action-value function, training this approximate action-value function using the Q-Learning algorithm (Watkins & Dayan, 1992) and mini-batches of one-step transitions $( x _ { t } , a _ { t } , r _ { t } , x _ { t + 1 } , \gamma _ { t } )$ drawn randomly from an experience replay buffer (Lin, 1992). Additionally, the next-state action-values are taken from a target network, which is updated to match the current network periodically. Thus, the temporal difference (TD) error for transition $t$ used by these algorithms is given by
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\delta _ { t } = r _ { t } + \gamma _ { t } \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ( x _ { t + 1 } , a ^ { \prime } ; \bar { \theta } ) - Q ( x _ { t } , a _ { t } ; \theta ) ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $\theta$ denotes the parameters of the network and $\bar { \theta }$ are the parameters of the target network.
|
| 58 |
+
|
| 59 |
+
Since this seminal work, we have seen numerous extensions and improvements that all share the same underlying framework. Double DQN (Van Hasselt et al., 2016), attempts to correct for the over-estimation bias inherent in Q-Learning by changing the second term of (1) to $\begin{array} { r } { Q ( x _ { t + 1 } , \arg \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ( x _ { t + 1 } , a ^ { \prime } ; \theta ) ; \bar { \theta } ) } \end{array}$ . The dueling architecture (Wang et al., 2015), changes the network to estimate action-values using separate network heads $V ( x ; \theta )$ and $A ( x , a ; \theta )$ with
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
Q ( x , a ; \theta ) = V ( x ; \theta ) + A ( x , a ; \theta ) - \frac { 1 } { | A | } \sum _ { a ^ { \prime } } A ( x , a ^ { \prime } ; \theta ) .
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
Recently, Hessel et al. (2017) introduced Rainbow, a value-based reinforcement learning agent combining many of these improvements into a single agent and demonstrating that they are largely complementary. Rainbow significantly out performs previous methods, but also inherits the poorer time-efficiency of the DQN framework. We include a detailed comparison between Reactor and Rainbow in the Appendix. In the remainder of the section we will describe in more depth other recent improvements to DQN.
|
| 66 |
+
|
| 67 |
+
# 2.1.1 PRIORITIZED EXPERIENCE REPLAY
|
| 68 |
+
|
| 69 |
+
The experience replay buffer was first introduced by Lin (1992) and later used in DQN (Mnih et al., 2015). Typically, the replay buffer is essentially a first-in-first-out queue with new transitions gradually replacing older transitions. The agent would then sample a mini-batch uniformly at random from the replay buffer. Drawing inspiration from prioritized sweeping (Moore & Atkeson, 1993), prioritized experience replay replaces the uniform sampling with prioritized sampling proportional to the absolute TD error (Schaul et al., 2016).
|
| 70 |
+
|
| 71 |
+
Specifically, for a replay buffer of size $N$ , prioritized experience replay samples transition $t$ with probability $P ( t )$ , and applies weighted importance-sampling with $w _ { t }$ to correct for the prioritization bias, where
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
P ( t ) = \frac { p _ { t } ^ { \alpha } } { \sum _ { k } p _ { k } ^ { \alpha } } , \quad w _ { t } = \left( \frac { 1 } { N } \cdot \frac { 1 } { P ( t ) } \right) ^ { \beta } , \quad p _ { t } = | \delta _ { t } | + \epsilon , \quad \alpha , \beta , \epsilon > 0 .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Prioritized DQN significantly increases both the sample-efficiency and final performance over DQN on the Atari 2600 benchmarks (Schaul et al., 2015).
|
| 78 |
+
|
| 79 |
+
# 2.1.2 RETRACE(λ)
|
| 80 |
+
|
| 81 |
+
Retrace $( \lambda )$ is a convergent off-policy multi-step algorithm extending the DQN agent (Munos et al., 2016). Assume that some trajectory $\left\{ x _ { 0 } , a _ { 0 } , r _ { 0 } , x _ { 1 } , a _ { 1 } , r _ { 1 } , \dots , x _ { t } , a _ { t } , r _ { t } , \dots , \right\}$ has been generated according to behaviour policy $\mu$ , i.e., $a _ { t } \sim \mu ( \cdot | x _ { t } )$ . Now, we aim to evaluate the value of a different target policy $\pi$ , i.e. we want to estimate $Q ^ { \pi }$ . The Retrace algorithm will update our current estimate $Q$ of $Q ^ { \pi }$ in the direction of
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\begin{array} { r } { \Delta Q ( x _ { t } , a _ { t } ) \stackrel { \mathrm { d e f } } { = } \sum _ { s \geq t } \gamma ^ { s - t } ( c _ { t + 1 } \ldots c _ { s } ) \delta _ { s } ^ { \pi } Q , } \end{array}
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $\delta _ { s } ^ { \pi } Q \stackrel { \mathrm { d e f } } { = } r _ { s } + \gamma \mathbb { E } _ { \pi } [ Q ( x _ { s + 1 } , \cdot ) ] - Q ( x _ { s } , a _ { s } )$ is the temporal difference at time $s$ under $\pi$ , and
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
c _ { s } = \lambda \operatorname* { m i n } \big ( 1 , \rho _ { s } \big ) , \quad \rho _ { s } = \frac { \pi ( a _ { s } | x _ { s } ) } { \mu ( a _ { s } | x _ { s } ) } .
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
The Retrace algorithm comes with the theoretical guarantee that in finite state and action spaces, repeatedly updating our current estimate $Q$ according to (3) produces a sequence of $\mathrm { Q }$ functions which converges to $Q ^ { \pi }$ for a fixed $\pi$ or to $Q ^ { * }$ if we consider a sequence of policies $\pi$ which become increasingly greedy w.r.t. the $Q$ estimates (Munos et al., 2016).
|
| 94 |
+
|
| 95 |
+
# 2.1.3 DISTRIBUTIONAL RL
|
| 96 |
+
|
| 97 |
+
Distributional reinforcement learning refers to a class of algorithms that directly estimate the distribution over returns, whose expectation gives the traditional value function (Bellemare et al., 2017). Such approaches can be made tractable with a distributional Bellman equation, and the recently proposed algorithm $C 5 1$ showed state-of-the-art performance in the Atari 2600 benchmarks. $C 5 1$ parameterizes the distribution over returns with a mixture over Diracs centered on a uniform grid,
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
Q ( x , a ; \theta ) = \sum _ { i = 0 } ^ { N - 1 } q _ { i } ( x , a ; \theta ) z _ { i } , q _ { i } = \frac { e ^ { \theta _ { i } ( x , a ) } } { \sum _ { j = 0 } ^ { N - 1 } e ^ { \theta _ { j } ( x , a ) } } , z _ { i } = v _ { \mathrm { m i n } } + i \frac { v _ { \mathrm { m a x } } - v _ { \mathrm { m i n } } } { N - 1 } ,
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
with hyperparameters $v _ { \operatorname* { m i n } } , v _ { \operatorname* { m a x } }$ that bound the distribution support of size $N$ .
|
| 104 |
+
|
| 105 |
+
# 2.2 ACTOR-CRITIC ALGORITHMS
|
| 106 |
+
|
| 107 |
+
In this section we review the actor-critic framework for reinforcement learning algorithms and then discuss recent advances in actor-critic algorithms along with their various trade-offs. The asynchronous advantage actor-critic (A3C) algorithm (Mnih et al., 2016), maintains a parameterized policy $\pi ( a | x ; \theta )$ and value function $V ( x ; \theta _ { v } )$ , which are updated with
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\begin{array} { r } { \triangle \theta = \nabla _ { \theta } \log \pi ( a _ { t } | x _ { t } ; \theta ) A ( x _ { t } , a _ { t } ; \theta _ { v } ) , \quad \triangle \theta _ { v } = A ( x _ { t } , a _ { t } ; \theta _ { v } ) \nabla _ { \theta _ { v } } V ( x _ { t } ) , } \\ { \mathrm { w h e r e , } \quad A ( x _ { t } , a _ { t } ; \theta _ { v } ) = \displaystyle \sum _ { k } ^ { n - 1 } \gamma ^ { k } r _ { t + k } + \gamma ^ { n } V ( x _ { t + n } ) - V ( x _ { t } ) . } \end{array}
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
A3C uses $M = 1 6$ parallel CPU workers, each acting independently in the environment and applying the above updates asynchronously to a shared set of parameters. In contrast to the previously discussed value-based methods, A3C is an on-policy algorithm, and does not use a GPU nor a replay buffer.
|
| 114 |
+
|
| 115 |
+
Proximal Policy Optimization (PPO) is a closely related actor-critic algorithm (Schulman et al., 2017), which replaces the advantage (7) with,
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\mathrm { m i n } ( \rho _ { t } A ( x _ { t } , a _ { t } ; \theta _ { v } ) , c l i p ( \rho _ { t } , 1 - \epsilon , 1 + \epsilon ) A ( x _ { t } , a _ { t } ; \theta _ { v } ) ) , \epsilon > 0 ,
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $\rho _ { t }$ is as defined in Section 2.1.2. Although both PPO and A3C run $M$ parallel workers collecting trajectories independently in the environment, PPO collects these experiences to perform a single, synchronous, update in contrast with the asynchronous updates of A3C.
|
| 122 |
+
|
| 123 |
+
Actor-Critic Experience Replay (ACER) extends the A3C framework with an experience replay buffer, Retrace algorithm for off-policy corrections, and the Truncated Importance Sampling Likelihood Ratio (TISLR) algorithm used for off-policy policy optimization (Wang et al., 2017).
|
| 124 |
+
|
| 125 |
+
# 3 THE REACTOR
|
| 126 |
+
|
| 127 |
+
The Reactor is a combination of four novel contributions on top of recent improvements to both deep value-based RL and policy-gradient algorithms. Each contribution moves Reactor towards our goal of achieving both sample and time efficiency.
|
| 128 |
+
|
| 129 |
+
# 3.1 $\beta$ -LOO
|
| 130 |
+
|
| 131 |
+
The Reactor architecture represents both a policy $\pi ( a | x )$ and action-value function $Q ( x , a )$ . We use a policy gradient algorithm to train the actor $\pi$ which makes use of our current estimate $Q ( x , a )$ of $Q ^ { \pi } ( x , a )$ . Let $V ^ { \pi } ( x _ { 0 } )$ be the value function at some initial state $x _ { 0 }$ , the policy gradient theorem says that $\begin{array} { r } { \nabla V ^ { \pi } ( { x } _ { 0 } ) = \mathbb { E } \big [ \sum _ { t } \gamma ^ { t } \sum _ { a } Q ^ { \pi } ( { x } _ { t } , a ) \nabla \pi ( a | { x } _ { t } ) \big ] } \end{array}$ , where $\nabla$ refers to the gradient w.r.t. policy parameters (Sutton et al., 2000). We now consider several possible ways to estimate this gradient.
|
| 132 |
+
|
| 133 |
+
To simplify notation, we drop the dependence on the state $x$ for now and consider the problem of estimating the quantity
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\begin{array} { r } { G = \sum _ { a } Q ^ { \pi } ( a ) \nabla \pi ( a ) . } \end{array}
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
In the off-policy case, we consider estimating $G$ using a single action $\hat { a }$ drawn from a (possibly different from $\pi$ ) behaviour distribution $\hat { a } \sim \mu$ . Let us assume that for the chosen action $\hat { a }$ we have access to an unbiased estimate $R ( { \hat { a } } )$ of $Q ^ { \pi } ( \hat { a } )$ . Then, we can use likelihood ratio (LR) method combined with an importance sampling (IS) ratio (which we call ISLR) to build an unbiased estimate of $G$ :
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
\hat { G } _ { \mathrm { I S L R } } = \frac { \pi ( \hat { a } ) } { \mu ( \hat { a } ) } ( R ( \hat { a } ) - V ) \nabla \log \pi ( \hat { a } ) ,
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
where $V$ is a baseline that depends on the state but not on the chosen action. However this estimate suffers from high variance. A possible way for reducing variance is to estimate $G$ directly from (8) by using the return $R ( { \hat { a } } )$ for the chosen action $\hat { a }$ and our current estimate $Q$ of $Q ^ { \pi }$ for the other actions, which leads to the so-called leave-one-out (LOO) policy-gradient estimate:
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
\begin{array} { r } { \hat { G } _ { \mathrm { L O O } } = R ( \hat { a } ) \nabla \pi ( \hat { a } ) + \sum _ { a \ne \hat { a } } Q ( a ) \nabla \pi ( a ) . } \end{array}
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 1: Single-step (left) and multi-step (right) distribution bootstrapping.
|
| 153 |
+
|
| 154 |
+
This estimate has low variance but may be biased if the estimated $Q$ values differ from $Q ^ { \pi }$ . A better bias-variance tradeoff may be obtained by the more general $\beta$ -LOO policy-gradient estimate:
|
| 155 |
+
|
| 156 |
+
$$
|
| 157 |
+
\begin{array} { r } { \hat { G } _ { \beta \mathrm { - } \mathrm { L O O } } = \beta ( R ( \hat { a } ) - Q ( \hat { a } ) ) \nabla \pi ( \hat { a } ) + \sum _ { a } Q ( a ) \nabla \pi ( a ) , } \end{array}
|
| 158 |
+
$$
|
| 159 |
+
|
| 160 |
+
where $\beta = \beta ( \mu , \pi , \hat { a } )$ can be a function of both policies, $\pi$ and $\mu$ , and the selected action $\hat { a }$ . Notice that when $\beta = 1$ , (10) reduces to (9), and when $\beta = 1 / \mu ( \hat { a } )$ , then (10) is
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
\hat { G } _ { \frac { 1 } { \mu } \cdot \mathrm { L O O } } = \frac { \pi ( \hat { a } ) } { \mu ( \hat { a } ) } ( R ( \hat { a } ) - Q ( \hat { a } ) ) \nabla \log \pi ( \hat { a } ) + \textstyle \sum _ { a } Q ( a ) \nabla \pi ( a ) .
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
This estimate is unbiased and can be seen as a generalization of $\hat { G } _ { \mathrm { I S L R } }$ where instead of using a state-only dependent baseline, we use a state-and-action-dependent baseline (our current estimate $Q$ ) and add the correction term $\begin{array} { r } { \sum _ { a } { \nabla \pi ( a ) Q ( a ) } } \end{array}$ to cancel the bias. Proposition 1 gives our analysis of the bias of $G _ { \beta - \mathrm { L O O } }$ , with a proof left to the Appendix.
|
| 167 |
+
|
| 168 |
+
Proposition 1. Assume $\hat { a } \sim \mu$ and that $\mathbb { E } [ R ( { \hat { a } } ) ] = Q ^ { \pi } ( { \hat { a } } )$ . Then, the bias of $G _ { \beta - L O O } ~ i s \mid \sum _ { a } ( 1 -$ $\mu ( a ) \beta ( a ) ) \nabla \pi ( a ) [ Q ( a ) - Q ^ { \pi } ( a ) ] \big |$ .
|
| 169 |
+
|
| 170 |
+
Thus the bias is small when $\beta ( a )$ is close to $1 / \mu ( a )$ , or when the $Q$ -estimates are close to the true $Q ^ { \pi }$ values, and unbiased regardless of the estimates if $\beta ( a ) = 1 / \mu ( a )$ . The variance is low when $\beta$ is small, therefore, in order to improve the bias-variance tradeoff we recommend using the $\beta$ -LOO estimate with $\beta$ defined as: $\begin{array} { r } { \beta ( \hat { a } ) ^ { \ast } = \operatorname* { m i n } \left( c , \frac { 1 } { \mu ( \hat { a } ) } \right) } \end{array}$ , for some constant $c \geq 1$ . This truncated $1 / \mu$ coefficient shares similarities with the truncated IS gradient estimate introduced in (Wang et al., 2017) (which we call TISLR for truncated-ISLR):
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
\hat { G } _ { \mathrm { T S L R } } = \operatorname* { m i n } \Big ( c , \frac { \pi ( \hat { a } ) } { \mu ( \hat { a } ) } \Big ) ( R ( \hat { a } ) - V ) \nabla \log \pi ( \hat { a } ) + \sum _ { a } \Big ( \frac { \pi ( a ) } { \mu ( a ) } - c \Big ) _ { + } \mu ( a ) ( Q ^ { \pi } ( a ) - V ) \nabla \log \pi ( a ) .
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
The differences are: (i) we truncate $1 / \mu ( \hat { a } ) = \pi ( \hat { a } ) / \mu ( \hat { a } ) \times 1 / \pi ( \hat { a } )$ instead of truncating $\pi ( \hat { a } ) / \mu ( \hat { a } )$ , which provides an additional variance reduction due to the variance of the LR $\begin{array} { r } { \nabla \log \pi ( \hat { a } ) = \frac { \nabla \pi ( \hat { a } ) } { \pi ( \hat { a } ) } } \end{array}$ (since this LR may be large when a low probability action is chosen), and (ii) we use our $Q$ -baseline instead of a $V$ baseline, reducing further the variance of the LR estimate.
|
| 177 |
+
|
| 178 |
+
# 3.2 DISTRIBUTIONAL RETRACE
|
| 179 |
+
|
| 180 |
+
In off-policy learning it is very difficult to produce an unbiased sample $R ( \hat { a } )$ of $Q ^ { \pi } ( \hat { a } )$ when following another policy $\mu$ . This would require using full importance sampling correction along the trajectory. Instead, we use the off-policy corrected return computed by the Retrace algorithm, which produces a (biased) estimate of $Q ^ { \pi } ( \hat { a } )$ but whose bias vanishes asymptotically (Munos et al., 2016).
|
| 181 |
+
|
| 182 |
+
In Reactor, we consider predicting an approximation of the return distribution function from any state-action pair $( x , a )$ in a similar way as in Bellemare et al. (2017). The original algorithm C51 described in that paper considered single-step Bellman updates only. Here we need to extend this idea to multi-step updates and handle the off-policy correction performed by the Retrace algorithm, as defined in (3). Next, we describe these two extensions.
|
| 183 |
+
|
| 184 |
+
Multi-step distributional Bellman operator: First, we extend C51 to multi-step Bellman backups. We consider return-distributions from $( x , a )$ of the form $\textstyle \sum _ { i } q _ { i } ( x , a ) \delta _ { z _ { i } }$ (where $\delta _ { z }$ denotes a Dirac in $z$ )
|
| 185 |
+
|
| 186 |
+
which are supported on a finite uniform grid $\{ z _ { i } \} \in [ v _ { \operatorname* { m i n } } , v _ { \operatorname* { m a x } } ]$ , $z _ { i } < z _ { i + 1 }$ , $z _ { 1 } = v _ { \mathrm { m i n } }$ , $z _ { m } = v _ { \operatorname* { m a x } }$ . The coefficients $q _ { i } ( x , a )$ (discrete distribution) corresponds to the probabilities assigned to each atom $z _ { i }$ of the grid. From an observed $n$ -step sequence $\left\{ x _ { t } , a _ { t } , r _ { t } , x _ { t + 1 } , \ldots , x _ { t + n } \right\}$ , generated by behavior policy $\mu$ (i.e, $a _ { s } \sim \mu ( \cdot | x _ { s } )$ for $t \leq s < t + n )$ ), we build the $n$ -step backed-up $\left( { { x } _ { t } } , { { a } _ { t } } \right)$ The , is gi $n$ -step distributional Bellman target, whose expectation isn by: $\textstyle \sum _ { s = t } ^ { t + n - 1 } \gamma ^ { s - t } r _ { s } + \gamma ^ { n } Q ( x _ { t + n } , a )$
|
| 187 |
+
|
| 188 |
+
$$
|
| 189 |
+
\sum _ { i } q _ { i } ( x _ { t + n } , a ) \delta _ { z _ { i } ^ { n } } , \mathrm { w i t h } z _ { i } ^ { n } = \sum _ { s = t } ^ { t + n - 1 } \gamma ^ { s - t } r _ { s } + \gamma ^ { n } z _ { i } .
|
| 190 |
+
$$
|
| 191 |
+
|
| 192 |
+
Since this distribution is supported on the set of atoms $\left\{ z _ { i } ^ { n } \right\}$ , which is not necessarily aligned with the grid $\left\{ z _ { i } \right\}$ , we do a projection step and minimize the KL-loss between the projected target and the current estimate, just as with C51 except with a different target distribution (Bellemare et al., 2017).
|
| 193 |
+
|
| 194 |
+
Distributional Retrace: Now, the Retrace algorithm defined in (3) involves an off-policy correction which is not handled by the previous $n$ -step distributional Bellman backup. The key to extending this distributional back-up to off-policy learning is to rewrite the Retrace algorithm as a linear combination of $n$ -step Bellman backups, weighted by some coefficients $\alpha _ { n , a }$ . Indeed, notice that (3) rewrites as
|
| 195 |
+
|
| 196 |
+
$$
|
| 197 |
+
\Delta Q ( x _ { t } , a _ { t } ) = \sum _ { n \geq 1 } \sum _ { a \in \cal { A } } \alpha _ { n , a } \Big [ \underbrace { \sum _ { s = t } ^ { t + n - 1 } \gamma ^ { s - t } r _ { s } + \gamma ^ { n } Q ( x _ { t + n } , a ) } _ { n \cdot \mathrm { s t e p B e l l m a r k u p } } \Big ] - Q ( x _ { t } , a _ { t } ) ,
|
| 198 |
+
$$
|
| 199 |
+
|
| 200 |
+
where $\alpha _ { n , a } = \left( c _ { t + 1 } \ldots c _ { t + n - 1 } \right) \left( \pi ( a | x _ { t + n } ) - \mathbb { I } \{ a = a _ { t + n } \} c _ { t + n } \right)$ . These coefficients depend on the degree of off-policy-ness (between $\mu$ and $\pi$ ) along the trajectory. We have that $\begin{array} { r } { \sum _ { n \geq 1 } \sum _ { a } \alpha _ { n , a } = } \end{array}$ $\begin{array} { r } { \sum _ { n \geq 1 } \big ( c _ { t + 1 } \dots c _ { t + n - 1 } \big ) ( 1 - c _ { t + n } ) = 1 } \end{array}$ , but notice some coefficients may be negative. However, in expectation (over the behavior policy) they are non-negative. Indeed,
|
| 201 |
+
|
| 202 |
+
$$
|
| 203 |
+
\begin{array} { r c l } { \mathbb { E } _ { \mu } [ \alpha _ { n , a } ] } & { = } & { \mathbb { E } \Big [ \big ( c _ { t + 1 } \cdot . . c _ { t + n - 1 } \big ) \mathbb { E } _ { a _ { t + n } \sim \mu ( \cdot \vert x _ { t + n } ) } \big [ \pi ( a \vert x _ { t + n } ) - \mathbb { I } \{ a = a _ { t + n } \} c _ { t + n } \big \vert x _ { t + n } \big ] \Big ] } \\ & { = } & { \mathbb { E } \Big [ \big ( c _ { t + 1 } . . . c _ { t + n - 1 } \big ) \Big ( \pi ( a \vert x _ { t + n } ) - \mu ( a \vert x _ { t + n } ) \lambda \operatorname* { m i n } \big ( 1 , \frac { \pi ( a \vert x _ { t + n } ) } { \mu ( a \vert x _ { t + n } ) } \big ) \Big ) \Big ] \geq 0 , } \end{array}
|
| 204 |
+
$$
|
| 205 |
+
|
| 206 |
+
by definition of the $c _ { s }$ coefficients (4). Thus in expectation (over the behavior policy), the Retrace update can be seen as a convex combination of $n$ -step Bellman updates.
|
| 207 |
+
|
| 208 |
+
Then, the distributional Retrace algorithm can be defined as backing up a mixture of $n$ -step distributions. More precisely, we define the Retrace target distribution as:
|
| 209 |
+
|
| 210 |
+
$$
|
| 211 |
+
\sum _ { i = 1 } q _ { i } ^ { * } ( x _ { t } , a _ { t } ) \delta _ { z _ { i } } , \mathrm { ~ w i t h ~ } q _ { i } ^ { * } ( x _ { t } , a _ { t } ) = \sum _ { n \geq 1 } \sum _ { a } \alpha _ { n , a } \sum _ { j } q _ { j } ( x _ { t + n } , a _ { t + n } ) h _ { z _ { i } } ( z _ { j } ^ { n } ) ,
|
| 212 |
+
$$
|
| 213 |
+
|
| 214 |
+
where $h _ { z _ { i } } ( x )$ is a linear interpolation kernel, projecting onto the support $\left\{ z _ { i } \right\}$ :
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
\iota _ { z _ { i } } ( x ) = \left\{ \begin{array} { l l } { ( x - z _ { i - 1 } ) / ( z _ { i } - z _ { i - 1 } ) , } & { \mathrm { ~ i f ~ } z _ { i - 1 } \leq x \leq z _ { i } \ \backslash } \\ { ( z _ { i + 1 } - x ) / ( z _ { i + 1 } - z _ { i } ) , } & { \mathrm { ~ i f ~ } z _ { i } \leq x \leq z _ { i + 1 } } \\ { 0 , } & { \mathrm { ~ i f ~ } x \leq z _ { i - 1 } \mathrm { ~ o r ~ } x \geq z _ { i + 1 } } \\ { 1 , } & { \mathrm { ~ i f ~ } ( x \leq v _ { \operatorname* { m i n } } \mathrm { ~ a n d ~ } z _ { i } = v _ { \operatorname* { m i n } } ) \mathrm { ~ o r ~ } ( x \geq v _ { \operatorname* { m a x } } \mathrm { ~ a n d ~ } z _ { i } = v _ { \operatorname* { m a x } } ) \enspace . } \end{array} \right.
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
We update the current probabilities $q ( x _ { t } , a _ { t } )$ by performing a gradient step on the KL-loss
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\nabla \mathrm { K L } ( q ^ { * } ( x _ { t } , a _ { t } ) , q ( x _ { t } , a _ { t } ) ) = - \sum _ { i = 1 } q _ { i } ^ { * } ( x _ { t } , a _ { t } ) \nabla \log q _ { i } ( x _ { t } , a _ { t } ) .
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
Again, notice that some target “probabilities” $q _ { i } ^ { * } ( x _ { t } , a _ { t } )$ may be negative for some sample trajectory, but in expectation they will be non-negative. Since the gradient of a KL-loss is linear w.r.t. its first argument, our update rule (12) provides an unbiased estimate of the gradient of the KL between the expected (over the behavior policy) Retrace target distribution and the current predicted distribution.1
|
| 227 |
+
|
| 228 |
+
Remark: The same method can be applied to other algorithms (such as $\mathrm { T B } ( \lambda )$ (Precup et al., 2000) and importance sampling (Precup et al., 2001)) in order to derive distributional versions of other off-policy multi-step RL algorithms.
|
| 229 |
+
|
| 230 |
+
# 3.3 PRIORITIZED SEQUENCE REPLAY
|
| 231 |
+
|
| 232 |
+
Prioritized experience replay has been shown to boost both statistical efficiency and final performance of deep RL agents (Schaul et al., 2016). However, as originally defined prioritized replay does not handle sequences of transitions and weights all unsampled transitions identically. In this section we present an alternative initialization strategy, called lazy initialization, and argue that it better encodes prior information about temporal difference errors. We then briefly describe our computationally efficient prioritized sequence sampling algorithm, with full details left to the appendix.
|
| 233 |
+
|
| 234 |
+
It is widely recognized that TD errors tend to be temporally correlated, indeed the need to break this temporal correlation has been one of the primary justifications for the use of experience replay (Mnih et al., 2015). Our proposed algorithm begins with this fundamental assumption.
|
| 235 |
+
|
| 236 |
+
Assumption 1. Temporal differences are temporally correlated, with correlation decaying on average with the time-difference between two transitions.
|
| 237 |
+
|
| 238 |
+
Prioritized experience replay adds new transitions to the replay buffer with a constant priority, but given the above assumption we can devise a better method. Specifically, we propose to add experience to the buffer with no priority, inserting a priority only after the transition has been sampled and used for training. Also, instead of sampling transitions, we assign priorities to all (overlapping) sequences of length $n$ . When sampling, sequences with an assigned priority are sampled proportionally to that priority. Sequences with no assigned priority are sampled proportionally to the average priority of assigned priority sequences within some local neighbourhood. Averages are weighted to compensate for sampling biases (i.e. more samples are made in areas of high estimated priorities, and in the absence of weighting this would lead to overestimation of unassigned priorities).
|
| 239 |
+
|
| 240 |
+
The lazy initialization scheme starts with priorities $p _ { t }$ corresponding to the sequences $\{ x _ { t } , a _ { t } , \ldots , x _ { t + n } \}$ for which a priority was already assigned. Then it extrapolates a priority of all other sequences in the following way. Let us define a partition $( I _ { i } ) _ { i }$ of the states ordered by increasing time such that each cell $I _ { i }$ contains exactly one state $s _ { i }$ with already assigned priority. We define the estimated priority $\hat { p } _ { t }$ to all other sequences as $\begin{array} { r } { \hat { p } _ { t } = \sum _ { s _ { i } \in J ( t ) } \frac { w _ { i } } { \sum _ { i ^ { \prime } \in J ( t ) } w _ { i ^ { \prime } } } p \big ( s _ { i } \big ) } \end{array}$ , where $J ( t )$ is a collection of contiguous cells $( I _ { i } )$ containing time $t$ , and $w _ { i } = | I _ { i } |$ is the length of the cell $I _ { i }$ containing $s _ { i }$ . For already defined priorities denote $\hat { p } _ { t } = p _ { t }$ . Cell sizes work as estimates of inverse local density and are used as importance weights for priority estimation. 2 For the algorithm to be unbiased, partition $( I _ { i } ) _ { i }$ must not be a function of the assigned priorities. So far we have defined a class of algorithms all free to choose the partition $( I _ { i } )$ and the collection of cells $I ( t )$ , as long that they satisfy the above constraints. Figure 4 in the Appendix illustrates the above description.
|
| 241 |
+
|
| 242 |
+
Now, with probability $\epsilon$ we sample uniformly at random, and with probability $1 - \epsilon$ we sample proportionally to $\hat { p } _ { t }$ . We implemented an algorithm satisfying the above constraints and called it Contextual Priority Tree (CPT). It is based on AVL trees (Velskii & Landis, 1976) and can execute sampling, insertion, deletion and density evaluation in $O ( \ln ( n ) )$ time. We describe CPT in detail in the Appendix in Section 6.3.
|
| 243 |
+
|
| 244 |
+
We treated prioritization as purely a variance reduction technique. Importance-sampling weights were evaluated as in prioritized experience replay, with fixed $\beta = 1$ in (2). We used simple gradient magnitude estimates as priorities, corresponding to a mean absolute TD error along a sequence for Retrace, as defined in (3) for the classical RL case, and total variation in the distributional Retrace case.3
|
| 245 |
+
|
| 246 |
+
# 3.4 AGENT ARCHITECTURE
|
| 247 |
+
|
| 248 |
+
In order to improve CPU utilization we decoupled acting from learning. This is an important aspect of our architecture: an acting thread receives observations, submits actions to the environment, and stores transitions in memory, while a learning thread re-samples sequences of experiences from memory and trains on them (Figure 2, left). We typically execute 4-6 acting steps per each learning step. We sample sequences of length $n = 3 3$ in batches of 4. A moving network is unrolled over frames 1-32 while the target network is unrolled over frames 2-33.
|
| 249 |
+
|
| 250 |
+

|
| 251 |
+
Figure 2: (Left) The model of parallelism of DQN, A3C and Reactor architectures. Each row represents a separate thread. In Reactor’s case, each worker, consiting of a learner and an actor is run on a separate worker machine. (Right) Comparison of training times and resources for various algorithms. $5 0 0 \mathrm { m }$ denotes 500 million training frames; otherwise $2 0 0 \mathrm { m }$ training frames were used.
|
| 252 |
+
|
| 253 |
+
We allow the agent to be distributed over multiple machines each containing action-learner pairs. Each worker downloads the newest network parameters before each learning step and sends delta-updates at the end of it. Both the network and target network are stored on a shared parameter server while each machine contains its own local replay memory. Training is done by downloading a shared network, evaluating local gradients and sending them to be applied on the shared network. While the agent can also be trained on a single machine, in this work we present results of training obtained with either 10 or 20 actor-learner workers and one parameter server. In Figure 2 (right) we compare resources and runtimes of Reactor with related algorithms.4
|
| 254 |
+
|
| 255 |
+
# 3.4.1 NETWORK ARCHITECTURE
|
| 256 |
+
|
| 257 |
+
In some domains, such as Atari, it is useful to base decisions on a short history of past observations. The two techniques generally used to achieve this are frame stacking and recurrent network architectures. We chose the latter over the former for reasons of implementation simplicity and computational efficiency. As the Retrace algorithm requires evaluating action-values over contiguous sequences of trajectories, using a recurrent architecture allowed each frame to be processed by the convolutional network only once, as opposed to $n$ times times if $n$ frame concatenations were used.
|
| 258 |
+
|
| 259 |
+
The Reactor architecture uses a recurrent neural network which takes an observation $x _ { t }$ as input and produces two outputs: categorical action-value distributions $q _ { i } ( x _ { t } , a )$ ( $i$ here is a bin identifier), and policy probabilities $\pi ( \boldsymbol { a } | \boldsymbol { x } _ { t } )$ . We use an architecture inspired by the duelling network architecture (Wang et al., 2015). We split action-value -distribution logits into state-value logits and advantage logits, which in turn are connected to the same LSTM network (Hochreiter & Schmidhuber, 1997). Final action-value logits are produced by summing state- and action-specific logits, as in Wang et al. (2015). Finally, a softmax layer on top for each action produces the distributions over discounted future returns.
|
| 260 |
+
|
| 261 |
+
The policy head uses a softmax layer mixed with a fixed uniform distribution over actions, where this mixing ratio is a hyperparameter (Wiering, 1999, Section 5.1.3). Policy and Q-networks have separate LSTMs. Both LSTMs are connected to a shared linear layer which is connected to a shared convolutional neural network (Krizhevsky et al., 2012). The precise network specification is given in Table 3 in the Appendix.
|
| 262 |
+
|
| 263 |
+
Gradients coming from the policy LSTM are blocked and only gradients originating from the Qnetwork LSTM are allowed to back-propagate into the convolutional neural network. We block gradients from the policy head for increased stability, as this avoids positive feedback loops between $\pi$ and $q _ { i }$ caused by shared representations. We used the Adam optimiser (Kingma & Ba, 2014), with a learning rate of $5 \times 1 0 ^ { - 5 }$ and zero momentum because asynchronous updates induce implicit momentum (Mitliagkas et al., 2016). Further discussion of hyperparameters and their optimization can be found in Appendix 6.1.
|
| 264 |
+
|
| 265 |
+

|
| 266 |
+
Figure 3: (Left) Reactor performance as various components are removed. (Right) Performance comparison as a function of training time in hours. Rainbow learning curve provided by Hessel et al. (2017).
|
| 267 |
+
|
| 268 |
+
# 4 EXPERIMENTAL RESULTS
|
| 269 |
+
|
| 270 |
+
We trained and evaluated Reactor on 57 Atari games (Bellemare et al., 2013). Figure 3 compares the performance of Reactor with different versions of Reactor each time leaving one of the algorithmic improvements out. We can see that each of the algorithmic improvements (Distributional retrace, betaLOO and prioritized replay) contributed to the final results. While prioritization was arguably the most important component, Beta-LOO clearly outperformed TISLR algorithm. Although distributional and non-distributional versions performed similarly in terms of median human normalized scores, distributional version of the algorithm generalized better when tested with random human starts (Table 1).
|
| 271 |
+
|
| 272 |
+
Table 1: Random human starts
|
| 273 |
+
|
| 274 |
+
<table><tr><td rowspan=1 colspan=1>ALGORITHM</td><td rowspan=1 colspan=1>NORMALIZEDSCORES</td><td rowspan=1 colspan=1>MEANRANK</td><td rowspan=1 colspan=1>ELO</td></tr><tr><td rowspan=12 colspan=1>RANDOMHUMANDQNDDQNDUELPRIORPRIOR.DUEL.A3CLSTMRAINBOWREACTOR ND 5REACTORREACTOR500M</td><td rowspan=1 colspan=1>0.00</td><td rowspan=1 colspan=1>11.65</td><td rowspan=1 colspan=1>-563</td></tr><tr><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>6.82</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>0.69</td><td rowspan=1 colspan=1>9.05</td><td rowspan=2 colspan=1>-172-58</td></tr><tr><td rowspan=1 colspan=1>1.11</td><td rowspan=1 colspan=1>7.63</td></tr><tr><td rowspan=1 colspan=1>1.17</td><td rowspan=1 colspan=1>6.35</td><td rowspan=1 colspan=1>32</td></tr><tr><td rowspan=1 colspan=1>1.13</td><td rowspan=1 colspan=1>6.63</td><td rowspan=1 colspan=1>13</td></tr><tr><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>6.25</td><td rowspan=1 colspan=1>40</td></tr><tr><td rowspan=1 colspan=1>1.13</td><td rowspan=1 colspan=1>6.30</td><td rowspan=1 colspan=1>37</td></tr><tr><td rowspan=1 colspan=1>1.53</td><td rowspan=1 colspan=1>4.18</td><td rowspan=1 colspan=1>186</td></tr><tr><td rowspan=1 colspan=1>1.51</td><td rowspan=1 colspan=1>4.98</td><td rowspan=1 colspan=1>126</td></tr><tr><td rowspan=1 colspan=1>1.65</td><td rowspan=1 colspan=1>4.58</td><td rowspan=1 colspan=1>156</td></tr><tr><td rowspan=1 colspan=1>1.82</td><td rowspan=1 colspan=1>3.65</td><td rowspan=1 colspan=1>227</td></tr></table>
|
| 275 |
+
|
| 276 |
+
Table 2: 30 random no-op starts.
|
| 277 |
+
|
| 278 |
+
<table><tr><td rowspan=1 colspan=1>ALGORITHM</td><td rowspan=1 colspan=1>NORMALIZEDSCORES</td><td rowspan=1 colspan=1>MEANRANK</td><td rowspan=1 colspan=1>ELO</td></tr><tr><td rowspan=12 colspan=1>RANDOMHUMANDQNDDQNDUELPRIORPRIOR.DUEL.ACER500MRAINBOWREACTOR ND 5REACTORREACTOR500M</td><td rowspan=1 colspan=1>0.00</td><td rowspan=1 colspan=1>10.93</td><td rowspan=4 colspan=1>-6730-167-27</td></tr><tr><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>6.89</td></tr><tr><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>8.65</td></tr><tr><td rowspan=1 colspan=1>1.18</td><td rowspan=1 colspan=1>7.28</td></tr><tr><td rowspan=1 colspan=1>1.51</td><td rowspan=1 colspan=1>5.19</td><td rowspan=1 colspan=1>143</td></tr><tr><td rowspan=1 colspan=1>1.24</td><td rowspan=1 colspan=1>6.11</td><td rowspan=1 colspan=1>70</td></tr><tr><td rowspan=1 colspan=1>1.72</td><td rowspan=1 colspan=1>5.44</td><td rowspan=1 colspan=1>126</td></tr><tr><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>、</td><td rowspan=1 colspan=1>=</td></tr><tr><td rowspan=1 colspan=1>2.31</td><td rowspan=1 colspan=1>3.63</td><td rowspan=1 colspan=1>270</td></tr><tr><td rowspan=1 colspan=1>1.80</td><td rowspan=1 colspan=1>4.53</td><td rowspan=1 colspan=1>195</td></tr><tr><td rowspan=1 colspan=1>1.87</td><td rowspan=1 colspan=1>4.46</td><td rowspan=1 colspan=1>196</td></tr><tr><td rowspan=1 colspan=1>2.30</td><td rowspan=1 colspan=1>3.47</td><td rowspan=1 colspan=1>280</td></tr></table>
|
| 279 |
+
|
| 280 |
+
# 4.1 COMPARING TO PRIOR WORK
|
| 281 |
+
|
| 282 |
+
We evaluated Reactor with target update frequency $T _ { u p d a t e } = 1 0 0 0$ , $\lambda = 1 . 0$ and $\beta$ -LOO with $\beta = 1$ on 57 Atari games trained on 10 machines in parallel. We averaged scores over 200 episodes using 30 random human starts and noop starts (Tables 4 and 5 in the Appendix). We calculated mean and median human normalised scores across all games. We also ranked all algorithms (including random and human scores) for each game and evaluated mean rank of each algorithm across all 57 Atari games. We also evaluated mean Rank and Elo scores for each algorithm for both human and noop start settings. Please refer to Section 6.2 in the Appendix for more details.
|
| 283 |
+
|
| 284 |
+
Tables 1 & 2 compare versions of our algorithm,5 with several other state-of-art algorithms across 57 Atari games for a fixed random seed across all games (Bellemare et al., 2013). We compare Reactor against are: DQN (Mnih et al., 2015), Double DQN (Van Hasselt et al., 2016), DQN with prioritised experience replay (Schaul et al., 2015), dueling architecture and prioritised dueling (Wang et al., 2015), ACER (Wang et al., 2017), A3C (Mnih et al., 2016), and Rainbow (Hessel et al., 2017). Each algorithm was exposed to 200 million frames of experience, or 500 million frames when followed by 500M, and the same pre-processing pipeline including 4 action repeats was used as in the original DQN paper (Mnih et al., 2015).
|
| 285 |
+
|
| 286 |
+
In Table 1, we see that Reactor exceeds the performance of all algorithms across all metrics, despite requiring under two days of training. With 500 million frames and four days training we see Reactor’s performance continue to improve significantly. The difference in time-efficiency is especially apparent when comparing Reactor and Rainbow (see Figure 3, right). Additionally, unlike Rainbow, Reactor does not use Noisy Networks (Fortunato et al., 2017), which was reported to have contributed to the performance gains. When evaluating under the no-op starts regime (Table 2), Reactor out performs all methods except for Rainbow. This suggests that Rainbow is more sample-efficient when training and evaluation regimes match exactly, but may be overfitting to particular trajectories due to the significant drop in performance when evaluated on the random human starts.
|
| 287 |
+
|
| 288 |
+
Regarding ACER, another Retrace-based actor-critic architecture, both classical and distributional versions of Reactor (Figure 3) exceeded the best reported median human normalized score of 1.9 with noop starts achieved in 500 million steps.6
|
| 289 |
+
|
| 290 |
+
# 5 CONCLUSION
|
| 291 |
+
|
| 292 |
+
In this work we presented a new off-policy agent based on Retrace actor-critic architecture and show that it achieves similar performance as the current state-of-the-art while giving significant real-time performance gains. We demonstrate the benefits of each of the suggested algorithmic improvements, including Distributional Retrace, beta-LOO policy gradient and contextual priority tree.
|
| 293 |
+
|
| 294 |
+
# REFERENCES
|
| 295 |
+
|
| 296 |
+
Oron Anschel, Nir Baram, and Nahum Shimkin. Averaged-dqn: Variance reduction and stabilization for deep reinforcement learning. In International Conference on Machine Learning, pp. 176–185, 2017.
|
| 297 |
+
|
| 298 |
+
Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
|
| 299 |
+
|
| 300 |
+
Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. arXiv preprint arXiv:1707.06887, 2017.
|
| 301 |
+
|
| 302 |
+
Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, et al. Noisy networks for exploration. arXiv preprint arXiv:1706.10295, 2017.
|
| 303 |
+
|
| 304 |
+
Shixiang Gu, Timothy Lillicrap, Zoubin Ghahramani, Richard E Turner, and Sergey Levine. Q-prop: Sample-efficient policy gradient with an off-policy critic. International Conference on Learning Representations, 2017.
|
| 305 |
+
|
| 306 |
+
Frank S He, Yang Liu, Alexander G Schwing, and Jian Peng. Learning to play in a day: Faster deep reinforcement learning by optimality tightening. In International Conference on Learning Representations, 2017.
|
| 307 |
+
|
| 308 |
+
Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. arXiv preprint arXiv:1710.02298, 2017.
|
| 309 |
+
|
| 310 |
+
Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
|
| 311 |
+
|
| 312 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 313 |
+
|
| 314 |
+
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.
|
| 315 |
+
|
| 316 |
+
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.
|
| 317 |
+
|
| 318 |
+
Long-H Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3/4):69–97, 1992.
|
| 319 |
+
|
| 320 |
+
Ioannis Mitliagkas, Ce Zhang, Stefan Hadjis, and Christopher Ré. Asynchrony begets momentum, with an application to deep learning. In Communication, Control, and Computing (Allerton), 2016 54th Annual Allerton Conference on, pp. 997–1004. IEEE, 2016.
|
| 321 |
+
|
| 322 |
+
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.
|
| 323 |
+
|
| 324 |
+
Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy P Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, 2016.
|
| 325 |
+
|
| 326 |
+
Andrew W Moore and Christopher G Atkeson. Prioritized sweeping: Reinforcement learning with less data and less time. Machine learning, 13(1):103–130, 1993.
|
| 327 |
+
|
| 328 |
+
Rémi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1046–1054, 2016.
|
| 329 |
+
|
| 330 |
+
Brendan O’Donoghue, Remi Munos, Koray Kavukcuoglu, and Volodymyr Mnih. Combining policy gradient and q-learning. International Conference on Learning Representations, 2017.
|
| 331 |
+
|
| 332 |
+
Doina Precup, Richard S Sutton, and Satinder Singh. Eligibility traces for off-policy policy evaluation. In Proceedings of the Seventeenth International Conference on Machine Learning, 2000.
|
| 333 |
+
|
| 334 |
+
Doina Precup, Richard S Sutton, and Sanjoy Dasgupta. Off-policy temporal-difference learning with function approximation. In Proceedings of the 18th International Conference on Machine Laerning, pp. 417–424, 2001.
|
| 335 |
+
|
| 336 |
+
Martin Riedmiller. Neural fitted q iteration-first experiences with a data efficient neural reinforcement learning method. In ECML, volume 3720, pp. 317–328. Springer, 2005.
|
| 337 |
+
|
| 338 |
+
Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
|
| 339 |
+
|
| 340 |
+
Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In International Conference on Learning Representations, 2016.
|
| 341 |
+
|
| 342 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015.
|
| 343 |
+
|
| 344 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 345 |
+
|
| 346 |
+
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.
|
| 347 |
+
|
| 348 |
+
David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of go without human knowledge. Nature, 550(7676):354–359, 10 2017. URL http: //dx.doi.org/10.1038/nature24270.
|
| 349 |
+
|
| 350 |
+
Richard S. Sutton, David Mcallester, Satinder Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In In Advances in Neural Information Processing Systems 12, pp. 1057–1063. MIT Press, 2000.
|
| 351 |
+
|
| 352 |
+
Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In AAAI, pp. 2094–2100, 2016.
|
| 353 |
+
|
| 354 |
+
Adel’son G Velskii and E Landis. An algorithm for the organisation of information. Dokl. Akad. Nauk SSSR, 146:263–266, 1976.
|
| 355 |
+
|
| 356 |
+
Alexander Sasha Vezhnevets, Simon Osindero, Tom Schaul, Nicolas Heess, Max Jaderberg, David Silver, and Koray Kavukcuoglu. Feudal networks for hierarchical reinforcement learning. arXiv preprint arXiv:1703.01161, 2017.
|
| 357 |
+
|
| 358 |
+
Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, and Nando de Freitas. Dueling network architectures for deep reinforcement learning. International Conference on Machine Learning, pp. 1995–2003, 2015.
|
| 359 |
+
|
| 360 |
+
Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. In International Conference on Learning Representations, 2017.
|
| 361 |
+
|
| 362 |
+
C. J. C. H. Watkins and P. Dayan. Q-learning. Machine Learning, 8(3):272–292, 1992.
|
| 363 |
+
|
| 364 |
+
Marco A Wiering. Explorations in efficient reinforcement learning. PhD thesis, University of Amsterdam, 1999.
|
| 365 |
+
|
| 366 |
+
Dongbin Zhao, Haitao Wang, Kun Shao, and Yuanheng Zhu. Deep reinforcement learning with experience replay based on sarsa. In Computational Intelligence (SSCI), 2016 IEEE Symposium Series on, pp. 1–6. IEEE, 2016.
|
| 367 |
+
|
| 368 |
+
# 6 APPENDIX
|
| 369 |
+
|
| 370 |
+
Proposition 1. Assume $\hat { a } \sim \mu$ and that $\mathbb { E } [ R ( { \hat { a } } ) ] = Q ^ { \pi } ( { \hat { a } } )$ . Then, the bias of $G _ { \beta - L O O }$ is $| \sum a ^ { ( 1 - }$ $\mu ( a ) \beta ( a ) ) \nabla \pi ( a ) [ Q ( a ) - Q ^ { \pi } ( a ) ] \big |$ .
|
| 371 |
+
|
| 372 |
+
Proof. The bias of $\hat { G } _ { \beta - \mathrm { L O O } }$ is
|
| 373 |
+
|
| 374 |
+
$$
|
| 375 |
+
\begin{array} { r c l } { \mathbb { E } [ \hat { G } _ { \beta \cdot \mathrm { L o o } } ] - G } & { = } & { \displaystyle \sum _ { a } \mu ( a ) [ \beta ( a ) ( \mathbb { E } [ R ( a ) ] - Q ( a ) ) ] \nabla \pi ( a ) + \sum _ { a } Q ( a ) \nabla \pi ( a ) - G } \\ & { = } & { \displaystyle \sum _ { a } ( 1 - \mu ( a ) \beta ( a ) ) [ Q ( a ) - Q ^ { \pi } ( a ) ] \nabla \pi ( a ) } \end{array}
|
| 376 |
+
$$
|
| 377 |
+
|
| 378 |
+
# 6.1 HYPERPARAMETER OPTIMIZATION
|
| 379 |
+
|
| 380 |
+
As we believe that algorithms should be robust with respect to the choice of hyperparameters, we spent little effort on parameter optimization. In total, we explored three distinct values of learning rates and two values of ADAM momentum (the default and zero) and two values of $T _ { u p d a t e }$ on a subset of 7 Atari games without prioritization using non-distributional version of Reactor. We later used those values for all experiments. We did not optimize for batch sizes and sequence length or any prioritization hyperparamters.
|
| 381 |
+
|
| 382 |
+
# 6.2 RANK AND ELO EVALUATION
|
| 383 |
+
|
| 384 |
+
Commonly used mean and median human normalized scores have several disadvantages. A mean human normalized score implicitly puts more weight on games that computers are good and humans are bad at. Comparing algorithm by a mean human normalized score across 57 Atari games is almost equivalent to comparing algorithms on a small subset of games close to the median and thus dominating the signal. Typically a set of ten most score-generous games, namely Assault, Asterix, Breakout, Demon Attack, Double Dunk, Gopher, Pheonix, Stargunner, Up’n Down and Video Pinball can explain more than half of inter-algorithm variance. A median human normalized score has the opposite disadvantage by effectively discarding very easy and very hard games from the comparison. As typical median human normalized scores are within the range of 1-2.5, an algorithm which scores zero points on Montezuma’s Revenge is evaluated equal to the one which scores 2500 points, as both performance levels are still below human performance making incremental improvements on hard games not being reflected in the overall evaluation. In order to address both problem, we also evaluated mean rank and Elo metrics for inter-algorithm comparison. Those metrics implicitly assign the same weight to each game, and as a result is more sensitive of relative performance on very hard and easy games: swapping scores of two algorithms on any game would result in the change of both mean rank and Elo metrics.
|
| 385 |
+
|
| 386 |
+
We calculated separate mean rank and Elo scores for each algorithm using results of test evaluations with 30 random noop-starts and 30 random human starts (Tables 5 and 4). All algorithms were ranked across each game separately, and a mean rank was evaluated across 57 Atari games. For Elo score evaluation algorithm, $A$ was considered to win over algorithm $B$ if it obtained more scores on a given Atari. We produced an empirical win-probability matrix by summing wins across all games and used this matrix to evaluate Elo scores. A ranking difference of 400 corresponds to the odds of winning of 10:1 under the Gaussian assumption.
|
| 387 |
+
|
| 388 |
+
# 6.3 CONTEXTUAL PRIORITY TREE
|
| 389 |
+
|
| 390 |
+
Contextual priority tree is one possible implementation of lazy prioritization (Figure 4). All sequence keys are put into a balanced binary search tree which maintains a temporal order. An AVL tree (Velskii & Landis (1976)) was chosen due to the ease of implementation and because it is on average more evenly balanced than a Red-Black Tree.
|
| 391 |
+
|
| 392 |
+
Each tree node has up to two children (left and right) and contains currently stored key and a priority of the key which is either set or is unknown. Some trees may only have a single child subtree while some may have none. In addition to this information, we were tracking other summary statistics at each node which was re-evaluated after each tree rotation. The summary statistics was evaluated by consuming previously evaluated summary statistics of both children and a priority of the key stored within the current node. In particular, we were tracking a total number of nodes within each subtree and mean-priority estimates updated according to rules shown in Figure 5. The total number of nodes within each subtree was always known $\dot { c }$ in Figure 5), while mean priority estimates per key ( $m$ in Figure 5) could either be known or unknown.
|
| 393 |
+
|
| 394 |
+

|
| 395 |
+
Figure 4: Illustration of Lazy prioritization, where sequences with no explicitly assigned priorities get priorities estimated by a linear combination of nearby assigned priorities. Exact boundaries of blue and red intervals are arbitrary (as long as all conditions described in Section 3.3 are satisfied) thus leading to many possible algorithms. Each square represents an individual sequence of size 32 (sequences overlap). Inverse sizes of blue regions work as local density estimates allowing to produce unbiased priority estimates.
|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
Figure 5: Rules used to evaluate summary statistics on each node of a binary search tree where all sequence keys are kept sorted by temporal order. $c _ { l }$ and $c _ { r }$ are total number of nodes within left and right subtrees. $m _ { l }$ and $m _ { l }$ are estimated mean priorities per node within the subtree. A central square node corresponds to a single key stored within the parent node with its corresponding priority of $p$ (if set) or ? if not set. Red subtrees do not have any singe child with a set priority, and a result do not have priority estimates. A red square shows that priority of the key stored within the parent node is not known. Unknown mean priorities is marked by a question mark. Empty child nodes simply behave as if $c = 0$ with $p = \mathrm { ? }$ . Rules a-f illustrate how mean values are propagated down from children to parents when priorities are only partially known (rules d and e also apply symmetrically). Sampling is done by going from the root node up the tree by selecting one of the children (or the current key) stochastically proportional to orange proportions. Sampling terminates once the current (square) key is chosen.
|
| 399 |
+
|
| 400 |
+

|
| 401 |
+
Figure 6: Example of a balanced priority tree. Dark blue nodes contain keys with known priorities, light blue nodes have at least one child with at least a single known priority, while ping nodes do not have any priority estimates. Nodes 1, 2 and 3 will obtain priority estimates equal to $\mathrm { { \dot { 2 } / 3 } }$ of the priority of key 5 and $1 / 3$ of the priority of node 4. This implies that estimated priorities of keys 1, 2 and 3 are implicitly defined by keys 4 and 6. Nodes 8, 9 and 11 are estimated to have the same priority as node 10.
|
| 402 |
+
|
| 403 |
+
If a mean priority of either one child subtree or a key stored within the current node is unknown then it can be estimated to by exploiting information coming from another sibling subtree or a priority stored within the parent node.
|
| 404 |
+
|
| 405 |
+
Sampling was done by traversing the tree from the root node up while sampling either one of the children subtrees or the currently held key proportionally to the total estimated priority masses contained within. The rules used to evaluate proportions are shown in orange in Figure 5. Similarly, probabilities of arbitrary keys can be queried by traversing the tree from the root node towards the child node of an interest while maintaining a product of probabilities at each branching point. Insertion, deletion, sampling and probability query operations can be done in $\mathrm { O } ( \mathrm { l n ( n ) } )$ time.
|
| 406 |
+
|
| 407 |
+
The suggested algorithm has the desired property that it becomes a simple proportional sampling algorithm once all the priorities are known. While some key priorities are unknown, they are estimated by using nearby known key priorities (Figure 6).
|
| 408 |
+
|
| 409 |
+
Each time when a new sequence key is added to the tree, it was set to have an unknown priority. Any priority was assigned only after the key got first sampled and the corresponding sequence got passed through the learner. When a priority of a key is set or updated, the key node is deliberately removed from and placed back to the tree in order to become a leaf-node. This helped to set priorities of nodes in the immediate vicinity more accurately by using the freshest information available.
|
| 410 |
+
|
| 411 |
+
# 6.4 NETWORK ARCHITECTURE
|
| 412 |
+
|
| 413 |
+
The value of $\epsilon = 0 . 0 1$ is the minimum probability of choosing a random action and it is hard-coded into the policy network. Figure 7 shows the overall network topology while Table 3 specifies network layer sizes.
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
Figure 7: Network architecture.
|
| 417 |
+
|
| 418 |
+
Table 3: Specification of the neural network used (illustrated in Figure 7)
|
| 419 |
+
|
| 420 |
+
<table><tr><td rowspan=1 colspan=1>LAYER</td><td rowspan=1 colspan=1>INPUTSIZE</td><td rowspan=1 colspan=3>PARAMETERS</td></tr><tr><td rowspan=1 colspan=1>CONVOLUTIONAL</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>KERNELWIDTH</td><td rowspan=1 colspan=1>OUTPUTCHANNELS</td><td rowspan=1 colspan=1>STRIDES</td></tr><tr><td rowspan=1 colspan=1>CoNV1CONCATRELUCONV 2CONCATRELUCONV 3CONCATRELU</td><td rowspan=1 colspan=1>[84,84,1][20,20,16][20,20,32][9,9,32][9,9, 64][7, 7, 32]</td><td rowspan=1 colspan=1>[8,8][4,4][3,3]</td><td rowspan=1 colspan=1>163232</td><td rowspan=1 colspan=1>421</td></tr><tr><td rowspan=1 colspan=1>FULLYCONNECTED</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LINEARCONCATRELU</td><td rowspan=1 colspan=1>[7, 7, 64][128]</td><td rowspan=1 colspan=3>128</td></tr><tr><td rowspan=1 colspan=1>RECURRENTT</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LSTMLINEARCONCATRELULINEARSOFTMAXX(1-e)+E/#ACTIONS</td><td rowspan=1 colspan=1>[256][128][32][64][#ACTIONS][#ACTIONS]</td><td rowspan=1 colspan=3>12832#ACTIONS#ACTIONS#ACTIONS</td></tr><tr><td rowspan=1 colspan=1>RECURRENTQ</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LSTM</td><td rowspan=1 colspan=1>[256]</td><td rowspan=1 colspan=3>128</td></tr><tr><td rowspan=1 colspan=1>VALUELOGITHEAD</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LINEARCONCATRELULINEAR</td><td rowspan=1 colspan=1>[128][32][64]</td><td rowspan=1 colspan=3>32#BINS</td></tr><tr><td rowspan=1 colspan=1>ADVANTAGELOGIT HEAD</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>#ACTIONS× #BINS</td></tr><tr><td rowspan=1 colspan=1>LINEARCONCATRELU</td><td rowspan=1 colspan=1>[128][32]</td><td rowspan=1 colspan=3>32</td></tr></table>
|
| 421 |
+
|
| 422 |
+
# 6.5 COMPARISONS WITH RAINBOW
|
| 423 |
+
|
| 424 |
+
In this section we compare Reactor with the recently published Rainbow agent (Hessel et al., 2017). While ACER is the most closely related algorithmically, Rainbow is most closely related in terms of performance and thus a deeper understanding of the trade-offs between Rainbow and Reactor may benefit interested readers. There are many architectural and algorithmic differences between Rainbow and Reactor. We will therefore begin by highlighting where they agree. Both use a categorical action-value distribution critic (Bellemare et al., 2017), factored into state and state-action logits (Wang et al., 2015),
|
| 425 |
+
|
| 426 |
+
$$
|
| 427 |
+
q _ { i } ( x , a ) = \frac { l _ { i } ( x , a ) } { \sum _ { j } l _ { j } ( x , a ) } , \quad l _ { i } ( x , a ) = l _ { i } ( x ) + l _ { i } ( x , a ) - \frac { 1 } { | \mathcal { A } | } \sum _ { b \in \mathcal { A } } l _ { i } ( x , b ) .
|
| 428 |
+
$$
|
| 429 |
+
|
| 430 |
+
Both use prioritized replay, and finally, both perform $n$ -step Bellman updates.
|
| 431 |
+
|
| 432 |
+
Despite these similarities, Reactor and Rainbow are fundamentally different algorithms and are based upon different lines of research. While Rainbow uses Q-Learning and is based upon DQN (Mnih et al., 2015), Reactor is an actor-critic algorithm most closely based upon A3C (Mnih et al., 2016). Each inherits some design choices from their predecessors, and we have not performed an extensive ablation comparing these various differences. Instead, we will discuss four of the differences we believe are important but less obvious.
|
| 433 |
+
|
| 434 |
+
First, the network structures are substantially different. Rainbow uses noisy linear layers and ReLU activations throughout the network, whereas Reactor uses standard linear layers and concatenated ReLU activations throughout. To overcome partial observability, Rainbow, inheriting this choice from DQN, uses frame stacking. On the other hand, Reactor, inheriting its choice from A3C, uses LSTMs after the convolutional layers of the network. It is also difficult to directly compare the number of parameters in each network because the use of noisy linear layers doubles the number of parameters, although half of these are used to control noise, while the LSTM units in Reactor require more parameters than a corresponding linear layer would.
|
| 435 |
+
|
| 436 |
+
Second, both algorithms perform $n$ -step updates, however, the Rainbow $n$ -step update does not use any form of off-policy correction. Because of this, Rainbow is restricted to using only small values of $n$ (e.g. $n = 3$ ) because larger values would make sequences more off-policy and hurt performance. By comparison, Reactor uses our proposed distributional Retrace algorithm for off-policy correction of $n$ -step updates. This allows the use of larger values of $n$ (e.g. $n = 3 3$ ) without loss of performance.
|
| 437 |
+
|
| 438 |
+
Third, while both agents use prioritized replay buffers (Schaul et al., 2016), they each store different informaction and prio, sum of ize using different algdiscounted rewards a tuple contai, product of ng the state discount fa $x _ { t - 1 }$ $a _ { t - 1 }$ $n$ $\begin{array} { r } { \sum _ { k = 0 } ^ { n - 1 } r _ { t + k } \prod _ { m = 0 } ^ { k - 1 } \gamma _ { t + m } } \end{array}$ $n$ $\textstyle \prod _ { k = 0 } ^ { n - 1 } \gamma _ { t + k }$ , and next-state $x _ { t + n - 1 }$ . Tuples are prioritized based upon the last observed TD error, and inserted into replay with a maximum priority. Reactor stores length $n$ sequences of tuples $( x _ { t - 1 } , a _ { t - 1 } , r _ { t } , \gamma _ { t } )$ and also prioritizes based upon the observed TD error. However, when inserted into the buffer the priority is instead inferred based upon the known priorities of neighboring sequences. This priority inference was made efficient using the previously introduced contextual priority tree, and anecdotally we have seen it improve performance over a simple maximum priority approach.
|
| 439 |
+
|
| 440 |
+
Finally, the two algorithms have different approaches to exploration. Rainbow, unlike DQN, does not use $\epsilon$ -greedy exploration, but instead replaces all linear layers with noisy linear layers which induce randomness throughout the network. This method, called Noisy Networks (Fortunato et al., 2017), creates an adaptive exploration integrated into the agent’s network. Reactor does not use noisy networks, but instead uses the same entropy cost method used by A3C and many others (Mnih et al., 2016), which penalizes deterministic policies thus encouraging indifference between similarly valued actions. Because Rainbow can essentially learn not to explore, it may learn to become entirely greedy in the early parts of the episode, while still exploring in states not as frequently seen. In some sense, this is precisely what we want from an exploration technique, but it may also lead to highly deterministic trajectories in the early part of the episode and an increase in overfitting to those trajectories. We hypothesize that this may be the explanation for the significant difference in Rainbow’s performance between evaluation under no-op and random human starts, and why Reactor does not show such a large difference.
|
| 441 |
+
|
| 442 |
+
# 6.6 ATARI RESULTS
|
| 443 |
+
|
| 444 |
+
Table 4: Scores for each game evaluated with 30 random human starts. Reactor was evaluated by averaging scores over 200 episodes. All scores (except for Reactor) were taken from Wang et al. (2015), Mnih et al. (2016) and Hessel et al. (2017).
|
| 445 |
+
|
| 446 |
+
<table><tr><td>GAME AGENT</td><td>RANDOM</td><td>HUMAN</td><td>DQN</td><td>DDQN</td><td>DUEL</td><td>PRIOR</td><td>PRIOR. DUEL.</td><td>A3C LSTM</td><td>RAINBOW</td><td>REACTOR ND5</td><td>REACTOR</td><td>REACTOR 500M</td></tr><tr><td>ALIEN</td><td>128.3</td><td>6371.3</td><td>634.0</td><td>1033.4</td><td>1486.5</td><td>1334.7</td><td>823.7</td><td>945.3</td><td>6022.9</td><td>924.1</td><td>2763.9</td><td>4958.6</td></tr><tr><td>AMIDAR</td><td>11.8</td><td>1540.4</td><td>178.4</td><td>169.1</td><td>172.7</td><td>129.1</td><td>238.4</td><td>173.0</td><td>202.8</td><td>174.8</td><td>423.0</td><td>503.2</td></tr><tr><td>ASSAULT</td><td>166.9</td><td>628.9</td><td>3489.3</td><td>6060.8</td><td>3994.8</td><td>6548.9</td><td>10950.6</td><td>14497.9</td><td>14491.7</td><td>15041.2</td><td>9994.2</td><td>6713.8</td></tr><tr><td>ASTERIX</td><td>164.5</td><td>7536.0</td><td>3170.5</td><td>16837.0</td><td>15840.0</td><td>22484.5</td><td>364200.0</td><td>17244.5</td><td>280114.0</td><td>7269.8</td><td>26240.8</td><td>191948.0</td></tr><tr><td>ASTEROIDS</td><td>871.3</td><td>36517.3</td><td>1458.7</td><td>1193.2</td><td>2035.4</td><td>1745.1</td><td>1021.9</td><td>5093.1</td><td>2249.4</td><td>3764.4</td><td>2771.3</td><td>4215.0</td></tr><tr><td>ATLANTIS</td><td>13463.0</td><td>26575.0</td><td>292491.0</td><td>319688.0</td><td>445360.0</td><td>330647.0</td><td>423252.0</td><td>875822.0</td><td>814684.0</td><td>897803.5</td><td>280809.5</td><td>274196.0</td></tr><tr><td>BANK HEIST</td><td>21.7</td><td>644.5</td><td>312.7</td><td>886.0</td><td>1129.3</td><td>876.6</td><td>1004.6</td><td>932.8</td><td>826.0</td><td>852.8</td><td>710.1</td><td>876.0</td></tr><tr><td>BATTLEZONE</td><td>3560.0</td><td>33030.0</td><td>23750.0</td><td>24740.0</td><td>31320.0</td><td>25520.0</td><td>30650.0</td><td>20760.0</td><td>52040.0</td><td>84985.0</td><td>52300.0</td><td>57075.0</td></tr><tr><td>BEAM RIDER</td><td>254.6</td><td>14961.0</td><td>9743.2</td><td>17417.2</td><td>14591.3</td><td>31181.3</td><td>37412.2</td><td>24622.2</td><td>21768.5</td><td>9298.9</td><td>9941.6</td><td>12877.0</td></tr><tr><td>BERZERK</td><td>196.1</td><td>2237.5</td><td>493.4</td><td>1011.1</td><td>910.6</td><td>865.9</td><td>2178.6</td><td>862.2</td><td>1793.4</td><td>1221.3</td><td>1186.0</td><td>1643.4</td></tr><tr><td>BOWLING</td><td>35.2</td><td>146.5</td><td>56.5</td><td>69.6</td><td>65.7</td><td>52.0</td><td>50.4</td><td>41.8</td><td>39.4</td><td>63.7</td><td>72.4</td><td>76.0</td></tr><tr><td>BOXING</td><td>-1.5</td><td>9.6</td><td>70.3</td><td>73.5</td><td>77.3</td><td>72.3</td><td>79.2</td><td>37.3</td><td>54.9</td><td>60.2</td><td>75.1</td><td>55.6</td></tr><tr><td>BREAKOUT</td><td>1.6</td><td>27.9</td><td>354.5</td><td>368.9</td><td>411.6</td><td>343.0</td><td>354.6</td><td>766.8</td><td>379.5</td><td>459.0</td><td>465.5</td><td>478.4</td></tr><tr><td>CENTIPEDE</td><td>1925.5</td><td>10321.9</td><td>3973.9</td><td>3853.5</td><td>4881.0</td><td>3489.1</td><td>5570.2</td><td>1997.0</td><td>7160.9</td><td>3974.5</td><td>2584.0</td><td>2674.3</td></tr><tr><td>CHOPPER COMMAND</td><td>644.0</td><td>8930.0</td><td>5017.0</td><td>3495.0</td><td>3784.0</td><td>4635.0</td><td>8058.0</td><td>10150.0</td><td>10916.0</td><td>17312.0</td><td>33150.0</td><td>71442.5</td></tr><tr><td>CRAZY CLIMBER</td><td>9337.0</td><td>32667.0</td><td>98128.0</td><td>113782.0</td><td>124566.0</td><td>127512.0</td><td>127853.0</td><td>138518.0</td><td>143962.0</td><td>151295.0</td><td>182399.0</td><td>209784.0</td></tr><tr><td>DEFENDER</td><td>1965.5</td><td>14296.0</td><td>15917.5</td><td>27510.0</td><td>33996.0</td><td>23666.5</td><td>34415.0</td><td>233021.5</td><td>47671.3</td><td>162327.5</td><td>110446.3</td><td>221671.0</td></tr><tr><td>DEMON ATTACK</td><td>208.3</td><td>3442.8</td><td>12550.7</td><td>69803.4</td><td>56322.8</td><td>61277.5</td><td>73371.3</td><td>115201.9</td><td>109670.7</td><td>120682.2</td><td>101435.4</td><td>113853.0</td></tr><tr><td>DOUBLE DUNK</td><td>-16.0</td><td>-14.4</td><td>-6.0</td><td>-0.3</td><td>-0.8</td><td>16.0</td><td>-10.7</td><td>0.1</td><td>-0.6</td><td>22.2</td><td>11.0</td><td>22.0</td></tr><tr><td>ENDURO</td><td>-81.8</td><td>740.2</td><td>626.7</td><td>1216.6</td><td>2077.4</td><td>1831.0</td><td>2223.9</td><td>-82.5</td><td>2061.1</td><td>2054.3</td><td>2127.0</td><td>2138.3</td></tr><tr><td>FISHING DERBY</td><td>-77.1</td><td>5.1</td><td>-1.6</td><td>3.2</td><td>-4.1</td><td>9.8</td><td>17.0</td><td>22.6</td><td>22.6</td><td>23.2</td><td>17.7</td><td>21.7</td></tr><tr><td>FREEWAY</td><td>0.1</td><td>25.6</td><td>26.9</td><td>28.8</td><td>0.2</td><td>28.9</td><td>28.2</td><td>0.1</td><td>29.1</td><td>19.4</td><td>26.9</td><td>26.9</td></tr><tr><td>FROSTBITE</td><td>66.4</td><td>4202.8</td><td>496.1</td><td>1448.1</td><td>2332.4</td><td>3510.0</td><td>4038.4</td><td>197.6</td><td>4141.1</td><td>3497.8</td><td>4358.7</td><td>4743.5</td></tr><tr><td>GOPHER</td><td>250.0</td><td>2311.0</td><td>8190.4</td><td>15253.0</td><td>20051.4</td><td>34858.8</td><td>105148.4</td><td>17106.8</td><td>72595.7</td><td>36286.2</td><td>60743.2</td><td>89306.8</td></tr><tr><td>GRAVITAR</td><td>245.5</td><td>3116.0</td><td>298.0</td><td>200.5</td><td>297.0</td><td>269.5</td><td>167.0</td><td>320.0</td><td>567.5</td><td>544.0</td><td>583.0</td><td>779.8</td></tr><tr><td>H.E.R.O.</td><td>1580.3</td><td>25839.4</td><td>14992.9</td><td>14892.5</td><td>15207.9</td><td>20889.9</td><td>15459.2</td><td>28889.5</td><td>50496.8</td><td>22673.3</td><td>30253.7</td><td>37833.4</td></tr><tr><td>ICE HOCKEY</td><td>-9.7</td><td>0.5</td><td>-1.6</td><td>-2.5</td><td>-1.3</td><td>-0.2</td><td>0.5</td><td>-1.7</td><td>-0.7</td><td>11.1</td><td>0.9</td><td>4.9</td></tr><tr><td>JAMES BOND 007</td><td>33.5</td><td>368.5</td><td>697.5</td><td>573.0</td><td>835.5</td><td>3961.0</td><td>585.0</td><td>613.0</td><td>18142.3</td><td>12655.3</td><td>6741.0</td><td>13987.5</td></tr><tr><td>KANGAROO</td><td>100.0</td><td>2739.0</td><td>4496.0</td><td>11204.0</td><td>10334.0</td><td>12185.0</td><td>861.0</td><td>125.0</td><td>10841.0</td><td>9111.0</td><td>5143.5</td><td>5587.5</td></tr><tr><td>KRULL</td><td>1151.9</td><td>2109.1</td><td>6206.0</td><td>6796.1</td><td>8051.6</td><td>6872.8</td><td>7658.6</td><td>5911.4</td><td>6715.5</td><td>7450.1</td><td>7815.9</td><td>7621.8</td></tr><tr><td>KUNG-FU MASTER</td><td>304.0</td><td>20786.8</td><td>20882.0</td><td>30207.0</td><td>24288.0</td><td>31676.0</td><td>37484.0</td><td>40835.0</td><td>28999.8</td><td>48781.5</td><td>49767.9</td><td>55357.7</td></tr><tr><td>MONTEZUMA'S REVENGE</td><td>25.0</td><td>4182.0 15375.0</td><td>47.0 1092.3</td><td>42.0 1241.3</td><td>22.0 2250.6</td><td>51.0 1865.9</td><td>24.0 1007.8</td><td>41.0 850.7</td><td>154.0 2570.2</td><td>45.0 1102.4</td><td>984.0 1714.6</td><td>1045.5 2540.1</td></tr><tr><td>Ms. PAC-MAN NAME THIS GAME</td><td>197.8 1747.8</td></table>
|
| 447 |
+
|
| 448 |
+
Table 5: Scores for each game evaluated with 30 random noop starts. Reactor was evaluated by averaging scores over 200 episodes. All scores (except for Reactor) were taken from Wang et al. (2015) and Hessel et al. (2017).
|
| 449 |
+
|
| 450 |
+
<table><tr><td>GAME AGENT</td><td>RANDOM</td><td>HUMAN</td><td>DQN</td><td>DDQN</td><td>DUEL</td><td>PRIOR</td><td>PRIOR. DUEL.</td><td>RAINBOW</td><td>REACTOR ND5</td><td>REACTOR</td><td>REACTOR 500M</td></tr><tr><td>ALIEN</td><td>227.8</td><td>7127.7</td><td>1620.0</td><td>3747.7</td><td>4461.4</td><td>4203.8</td><td>3941.0</td><td>9491.7</td><td>4199.4</td><td>6482.1</td><td>12689.1</td></tr><tr><td>AMIDAR</td><td>5.8</td><td>1719.5</td><td>978.0</td><td>1793.3</td><td>2354.5</td><td>1838.9</td><td>2296.8</td><td>5131.2</td><td>1546.8</td><td>833.0</td><td>1015.8</td></tr><tr><td>ASSAULT</td><td>222.4</td><td>742.0</td><td>4280.4</td><td>5393.2</td><td>4621.0</td><td>7672.1</td><td>11477.0</td><td>14198.5</td><td>17543.8</td><td>11013.5</td><td>8323.3</td></tr><tr><td>ASTERIX</td><td>210.0</td><td>8503.3</td><td>4359.0</td><td>17356.5</td><td>28188.0</td><td>31527.0</td><td>375080.0</td><td>428200.3</td><td>16121.0</td><td>36238.5</td><td>205914.0</td></tr><tr><td>ASTEROIDS</td><td>719.1</td><td>47388.7</td><td>1364.5</td><td>734.7</td><td>2837.7</td><td>2654.3</td><td>1192.7</td><td>2712.8</td><td>4467.4</td><td>2780.4</td><td>3726.1</td></tr><tr><td>ATLANTIS</td><td>12850.0</td><td>29028.1</td><td>279987.0</td><td>106056.0</td><td>382572.0</td><td>357324.0</td><td>395762.0</td><td>826659.5</td><td>968179.5</td><td>308258.0</td><td>302831.0</td></tr><tr><td>BANK HEIST</td><td>14.2</td><td>753.1</td><td>455.0</td><td>1030.6</td><td>1611.9</td><td>1054.6</td><td>1503.1</td><td>1358.0</td><td>1236.8</td><td>988.7</td><td>1259.7</td></tr><tr><td>BATTLEZONE</td><td>2360.0</td><td>37187.5</td><td>29900.0</td><td>31700.0</td><td>37150.0</td><td>31530.0</td><td>35520.0</td><td>62010.0</td><td>98235.0</td><td>61220.0</td><td></td></tr><tr><td>BEAM RIDER</td><td>363.9</td><td>16926.5</td><td>8627.5</td><td>13772.8</td><td>12164.0</td><td>23384.2</td><td>30276.5</td><td>16850.2</td><td>8811.8</td><td></td><td>64070.0</td></tr><tr><td>BERZERK</td><td>123.7</td><td>2630.4</td><td>585.6</td><td>1225.4</td><td>1472.6</td><td>1305.6</td><td>3409.0</td><td>2545.6</td><td></td><td>8566.5</td><td>11033.4</td></tr><tr><td>BOWLING</td><td>23.1</td><td>160.7</td><td>50.4</td><td>68.1</td><td>65.5</td><td>47.9</td><td>46.7</td><td>30.0</td><td>1515.7 59.3</td><td>1641.4</td><td>2303.1</td></tr><tr><td>BOXING</td><td></td><td>12.1</td><td>88.0</td><td>91.6</td><td>99.4</td><td>95.6</td><td>98.9</td><td></td><td></td><td>75.4</td><td>81.0</td></tr><tr><td>BREAKOUT</td><td>0.1</td><td>30.5</td><td>385.5</td><td>418.5</td><td>345.3</td><td>373.9</td><td>366.0</td><td>99.6</td><td>99.7</td><td>99.4</td><td>99.4</td></tr><tr><td>CENTIPEDE</td><td>1.7 2090.9</td><td>12017.0</td><td>4657.7</td><td>5409.4</td><td>7561.4</td><td>4463.2</td><td>7687.5</td><td>417.5 8167.3</td><td>509.5 7267.2</td><td>518.4</td><td>514.8</td></tr><tr><td>CHOPPER COMMAND</td><td></td><td>7387.8</td><td>6126.0</td><td>5809.0</td><td>11215.0</td><td>8600.0</td><td>13185.0</td><td>16654.0</td><td>19901.5</td><td>3402.8</td><td>3422.0</td></tr><tr><td>CRAZY CLIMBER</td><td>811.0</td><td>35829.4</td><td>110763.0</td><td>117282.0</td><td>143570.0</td><td></td><td>162224.0</td><td>168788.5</td><td>173274.0</td><td>37568.0</td><td>107779.0 236422.0</td></tr><tr><td>DEFENDER</td><td>10780.5 2874.5</td><td>18688.9</td><td>23633.0</td><td>35338.5</td><td>42214.0</td><td>141161.0 31286.5</td><td>41324.5</td><td>55105.0</td><td>181074.3</td><td>194347.0</td><td></td></tr><tr><td>DEMON ATTACK</td><td></td><td>1971.0</td><td>12149.4</td><td>58044.2</td><td>60813.3</td><td>71846.4</td><td></td><td>111185.2</td><td>122782.5</td><td>113128.0</td><td>223025.0</td></tr><tr><td>DOUBLE DUNK</td><td>152.1</td><td>-16.4</td><td>-6.6</td><td>-5.5</td><td>0.1</td><td>18.5</td><td>72878.6 -12.5</td><td>-0.3</td><td>23.0</td><td>100189.0</td><td>115154.0</td></tr><tr><td>ENDURO</td><td>-18.6</td><td>860.5</td><td>729.0</td><td>1211.8</td><td>2258.2</td><td></td><td>2306.4</td><td>2125.9</td><td></td><td>11.4</td><td>23.0</td></tr><tr><td>FISHING DERBY</td><td>0.0</td><td>-38.7</td><td>-4.9</td><td>15.5</td><td></td><td>2093.0</td><td></td><td></td><td>2211.3</td><td>2230.1</td><td>2224.2</td></tr><tr><td>FREEWAY</td><td>-91.7</td><td>29.6</td><td>30.8</td><td>33.3</td><td>46.4</td><td>39.5</td><td>41.3</td><td>31.3</td><td>33.1</td><td>23.2</td><td>30.4</td></tr><tr><td>FROSTBITE</td><td>0.0</td><td></td><td>797.4</td><td>1683.3</td><td>0.0</td><td>33.7</td><td>33.0</td><td>34.0</td><td>22.3</td><td>31.4</td><td>31.5</td></tr><tr><td>GOPHER</td><td>65.2</td><td>4334.7 2412.5</td><td>8777.4</td><td>14840.8</td><td>4672.8</td><td>4380.1</td><td>7413.0</td><td>9590.5</td><td>7136.7</td><td>8042.1</td><td>7932.2</td></tr><tr><td>GRAVITAR</td><td>257.6</td><td>3351.4</td><td>473.0</td><td>412.0</td><td>15718.4</td><td>32487.2</td><td>104368.2</td><td>70354.6</td><td>36279.1</td><td>69135.1</td><td>89851.0</td></tr><tr><td>H.E.R.O.</td><td>173.0</td><td>30826.4</td><td>20437.8</td><td>20130.2</td><td>588.0</td><td>548.5</td><td>238.0</td><td>1419.3</td><td>1804.8</td><td>1073.8</td><td>2041.8</td></tr><tr><td>ICE HOCKEY</td><td>1027.0</td><td>0.9</td><td>-1.9</td><td>-2.7</td><td>20818.2</td><td>23037.7</td><td>21036.5</td><td>55887.4</td><td>27833.0</td><td>35542.2</td><td>43360.4</td></tr><tr><td>JAMES BOND 007</td><td>-11.2</td><td>302.8</td><td>768.5</td><td>1358.0</td><td>0.5 1312.5</td><td>1.3</td><td>-0.4</td><td>1.1</td><td>15.7</td><td>3.4</td><td>10.7</td></tr><tr><td>KANGAROO</td><td>29.0 52.0</td><td>3035.0</td><td>7259.0</td><td>12992.0</td><td>14854.0</td><td>5148.0</td><td>812.0</td><td>19809.0</td><td>14524.0</td><td>7869.2</td><td>16056.2</td></tr><tr><td>KRULL</td><td>1598.0</td><td>2665.5</td><td>8422.3</td><td>7920.5</td><td>11451.9</td><td>16200.0 9728.0</td><td>1792.0 10374.4</td><td>14637.5 8741.5</td><td>13349.0</td><td>10484.5</td><td>11266.5</td></tr><tr><td>KUNG-FU MASTER</td><td>258.5</td><td>22736.3</td><td>26059.0</td><td>29710.0</td><td>34294.0</td><td>39581.0</td><td>48375.0</td><td></td><td>10237.8</td><td>9930.8</td><td>9896.0</td></tr><tr><td>MONTEZUMA'S REVENGE</td><td>0.0</td><td>4753.3</td><td>0.0</td><td>0.0</td><td>0.0</td><td></td><td></td><td>52181.0</td><td>61621.5</td><td>59799.5</td><td>65836.5</td></tr><tr><td>MS.PAC-MAN</td><td>307.3</td><td>6951.6</td><td>3085.6</td><td>2711.4</td><td>6283.5</td><td>0.0 6518.7</td><td>0.0 3327.3</td><td>384.0</td><td>0.0</td><td>2643.5</td><td>2643.5</td></tr><tr><td>NAME THIS GAME</td><td></td><td>8049.0</td><td>8207.8</td><td>10616.0</td><td>11971.1</td><td></td><td>15572.5</td><td>5380.4 13136.0</td><td>4416.9 12636.5</td><td>2724.3 9907.2</td><td>3749.2 9543.8</td></tr><tr><td>PHOENIX</td><td>2292.3 761.4</td><td>7242.6</td><td>8485.2</td><td>12252.5</td><td>23092.2</td><td>12270.5 18992.7</td></table>
|
md/train/rkKCdAdgx/rkKCdAdgx.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COMPACT EMBEDDING OF BINARY-CODED INPUTS AND OUTPUTS USING BLOOM FILTERS
|
| 2 |
+
|
| 3 |
+
Joan Serra & Alexandros Karatzoglou\`
|
| 4 |
+
Telefonica Research´
|
| 5 |
+
Pl. Ernest Lluch i Mart´ın, 5
|
| 6 |
+
Barcelona, 08019, Spain
|
| 7 |
+
firstname.lastname@telefonica.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
The size of neural network models that deal with sparse inputs and outputs is often dominated by the dimensionality of those inputs and outputs. Large models with high-dimensional inputs and outputs are difficult to train due to the limited memory of graphical processing units, and difficult to deploy on mobile devices with limited hardware. To address these difficulties, we propose Bloom embeddings, a compression technique that can be applied to the input and output of neural network models dealing with sparse high-dimensional binary-coded instances. Bloom embeddings are computationally efficient, and do not seriously compromise the accuracy of the model up to 1/5 compression ratios. In some cases, they even improve over the original accuracy, with relative increases up to $12 \%$ . We evaluate Bloom embeddings on 7 data sets and compare it against 4 alternative methods, obtaining favorable results. We also discuss a number of further advantages of Bloom embeddings, such as ‘on-the-fly’ constant-time operation, zero or marginal space requirements, training time speedups, or the fact that they do not require any change to the core model architecture or training configuration.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
The size of neural network models that deal with sparse inputs and outputs is often dominated by the dimensionality of such inputs and outputs. This is the case, for instance, with recommender systems, where high-dimensional sparse vectors, typically in the order from tens of thousands to hundreds of millions, constitute both the input and the output of the model (e.g., Wu et al., 2016; Hidasi et al., 2016; Cheng et al., 2016; Strub et al., 2016). This results in large models that present a number of difficulties, both at training and prediction stages. Apart from training and prediction times, an obvious bottleneck of such models is space: their size (and even performance) is hampered by the physical memory of graphical processing units (GPUs), and they are difficult to deploy on mobile devices with limited hardware (cf. Han et al., 2016).
|
| 16 |
+
|
| 17 |
+
One option to reduce the size of sparse inputs and outputs is to embed them into a lower-dimensional space. Embedding sparse high-dimensional inputs is commonplace (e.g., Bengio et al., 2000; Turian et al., 2010; Mikolov et al., 2013). However, embedding sparse high-dimensional outputs, or even inputs and outputs at the same time, is much less common (cf. Weston et al., 2002; Bengio et al., 2010; Akata et al., 2015). Importantly, typical embeddings still require the storage and processing of large matrices with the same dimensionality as the input/output (like the original neural network model would do). Thus, the gains in terms of space are limited. As mentioned, the size of such models is dominated by the input/output dimensionality, with input and output layers representing about $9 9 . 9 4 \%$ of the total amount of weights of the model1.
|
| 18 |
+
|
| 19 |
+
In general, an ideal embedding procedure for sparse high-dimensional inputs/outputs should produce compact embeddings, of much lower dimensionality than the original input/output. In addition, it should consume little space, both in terms of storage and memory space. Smaller sizes imply less parameters, thus training the model on embedded vectors would also be faster than with the original instances. The embedding of the output should also lead to a formulation for which the appropriate loss should be clear. Embeddings should not compromise the accuracy of the model nor the required number of training epochs to obtain that accuracy. In addition, no changes to the original core architecture of the model should be required to achieve good performance (obviously, input/output dimensions must change). The embedding should also be fast; if not to be done directly ‘on-the-fly’, at least fast enough so that speed improvements made during training are not lost in the embedding operation. Last, but not least, output embeddings should be easily reversible, so that the output of the model could be mapped to the original items at prediction time.
|
| 20 |
+
|
| 21 |
+
In this paper, we propose an unsupervised embedding technique that fulfills all the previous requirements. It can be applied to both input and output layers of neural network models that deal with binary (one-hot encoded) inputs and/or outputs. In addition, it produces lower-dimensionality binary embeddings that can be easily mapped to the original instances. Provided that the embedding dimension is not too low, the accuracy is not compromised. Furthermore, in some cases, we show that training with embedded vectors can even increase prediction accuracy. The embedding requires no changes to the core network structure nor to the model configuration, and works with a softmax output, the most common output activation for binary-coded instances. As it is unsupervised, the embedding does not require any preliminary training. Moreover, it is a constant-time operation that can be either performed on-the-fly, requiring no disk or memory space, or can be cached in memory, occupying orders of magnitude less space than a typical embedding matrix. Lower dimensionality of input/output vectors result in faster training, and the mapping from the embedded space to the original one does not add an overwhelming amount of time to the prediction stage. The proposed embedding is based on the idea of Bloom filters (Bloom, 1970), and therefore it inherits part of the theory developed around that idea (Blustein & El-Maazawi, 2002; Dillinger & Manolios, 2004; Mitzenmacher & Upfal, 2005; Bonomi et al., 2006).
|
| 22 |
+
|
| 23 |
+
# 2 RELATED WORK
|
| 24 |
+
|
| 25 |
+
A common approach to embed high-dimensional inputs is the hashing trick (Langford et al., 2007; Shi et al., 2009; Weinberger et al., 2009). However, the hashing trick approach does not deal with outputs, as it offers no explicit way to map back from the (dense) embedding space to the original space. A more elementary version of the hashing trick (Ganchev & Dredze, 2008) can be used at the outputs by considering it as a special case of the Bloom-based methodology proposed here. A framework providing both encoding and decoding strategies is the error-correcting output codes (ECOC) framework (Dietterich & Bakiri, 1995). Originally designed for single-class outputs, it can be also applied to class sets (Armano et al., 2012). The compressed sensing approach of Hsu et al. (2009) builds on top of ECOC to reduce multi-label regression to binary regression problems. Similarly, Cisse et al. (2013) use Bloom filters to reduce multi-label classification to binary classification ´ problems and improve the robustness of individual binary classifiers’ errors. Another example of a framework offering recovery capabilities is kernel dependency estimation (Weston et al., 2002).
|
| 26 |
+
|
| 27 |
+
Data-dependent embeddings that require some form of learning also exist. A typical approach is to rely on variants of latent semantic analysis or singular value decomposition (SVD), exploiting similarities or correlations that may be present in the data. Again, the issue of mapping from the embedding space to the original space is left unresolved. Nonetheless, recently, Chollet (2016) has successfully applied a K-nearest neighbors (KNN) algorithm to perform such a mapping and to derive a ranking of the elements in the original space. An SVD decomposition of the pairwise mutual information matrix (PMI) is used to perform the embedding, and cosine similarity is used as loss function and to retrieve neighbors. Using the KNN trick offers the possibility to exploit different types of factorization of similarity-based matrices. Canonical correlation analysis is an example that considers both inputs and outputs at the same time (Hotelling, 1936). Other examples considering output embeddings are nuclear norm regularized learning (Amit et al., 2007), label embedding trees (Bengio et al., 2010), or the WSABIE algorithm (Weston et al., 2010). In the presence of side information, like text descriptions, element or class taxonomies, or manually-collected data, a range of approaches are applicable. Akata et al. (2015) provide a comprehensive list. In our study, we assume no side information is available and focus on input/output-based embeddings.
|
| 28 |
+
|
| 29 |
+
From a more general perspective, reducing the space of (or compressing) neural network models is an active research topic, driven by the need to deploy such models in systems with limited hardware resources. A common approach is to reduce the size of already trained models by some quantization and/or pruning of the connections in dense layers (Courbariaux et al., 2015; Han et al., 2016; Kim et al., 2016). A less frequently used approach is to reduce the model size before training (Chen et al., 2015). These methods typically do not focus on input layers and, to the best of our knowledge, none of them deals with high-dimensional outputs. It is also worth noting that a number of techniques have been proposed to efficiently deal with high-dimensional outputs, specially in the natural language processing domain. The hierarchical softmax approach (Morin & Bengio, 2005) or the more recent adaptive softmax (Grave et al., 2016) are two examples of those. Yet, as mentioned, the focus of these works is on speed, not on space. The work of Vincent et al. (2015) focuses on both aspects of very large sparse outputs but, to the best of our knowledge, cannot be applied to traditional softmax outputs.
|
| 30 |
+
|
| 31 |
+
# 3 BLOOM EMBEDDINGS
|
| 32 |
+
|
| 33 |
+
# 3.1 BLOOM FILTERS
|
| 34 |
+
|
| 35 |
+
Bloom filters (Bloom, 1970) are a compact probabilistic data structure that is used to represent sets of elements, and to efficiently check whether an element is a member of a set (Mitzenmacher & Upfal, 2005). Since the instances we deal with represent sets of one-hot encoded elements, Bloom filters are an interesting option to embed those in a compact space with good recovery (or checking) guarantees.
|
| 36 |
+
|
| 37 |
+
In essence, Bloom filters project every element of a set to $k$ different positions of a binary array $\mathbf { u }$ of size $m$ . Projections are done using a set of $k$ independent hash functions $\mathsf { H } = \left\{ H _ { i } \right\} _ { i = 1 } ^ { k }$ , each of which with a range from 1 to $m$ , ideally distributing the projected elements uniformly at random (Mitzenmacher & Upfal, 2005). Proper independent hash functions can be derived using enhanced double hashing or triple hashing (Dillinger & Manolios, 2004). The number of hash functions $k$ is usually a constant, $k \ll m$ , proportional to the expected number of elements to be projected.
|
| 38 |
+
|
| 39 |
+
To check if an element is in $\mathbf { u }$ , one feeds it to the $k$ hash functions $H$ to get $k$ array positions. If any of the bits at these positions is 0, then the element is definitely not in the set. Thus, element checks return no false negatives, meaning that the structure gives an answer with $100 \%$ recall (Mitzenmacher & Upfal, 2005). However, if all $k$ bits at the projected positions are 1, then either the element is in the set, or the bits have by chance been set to 1 during the insertion of other set elements. This implies that false positives are possible, due to collisions between projections of different elements (Blustein & El-Maazawi, 2002). The values of $m$ and $k$ can be adjusted to control the probability of such collisions. However, in practice, $m$ is usually constrained by space requirements, and $k \leq 1 0$ is employed, independent of the number of elements to be projected, and giving less than $1 \%$ false positive probability (Bonomi et al., 2006).
|
| 40 |
+
|
| 41 |
+
# 3.2 EMBEDDING AND RECOVERY
|
| 42 |
+
|
| 43 |
+
In the following, we describe the use of Bloom filter techniques in embedding binary highdimensional instances, and the recovery or mapping to such instances from these embeddings. We denote our approach as Bloom embedding (BE). The idea we pursue is to embed both inputs and outputs and to perform training in the embedding space. To do so, only a probability-based output activation is required, together with a loss function that is appropriate for such activations.
|
| 44 |
+
|
| 45 |
+
Let $\mathbf { X }$ be an input or output instance with dimensionality $d$ , such that $\mathbf { x } = [ x _ { 1 } , \dots x _ { d } ]$ , $x _ { i } \in \{ 0 , 1 \}$ . Instances $\mathbf { X }$ are assumed to be sparse, that is, $\textstyle \sum _ { i = 1 } ^ { d } x _ { i } \ll d$ . Because of that, we can more conveniently (and compactly) represent $\mathbf { X }$ as set $\boldsymbol { z } = \left\{ \boldsymbol { z } _ { i } \right\} _ { i = 1 } ^ { c }$ , $z _ { i } \in \mathbb { N } _ { \leq d }$ , where $c$ is the number of non-zero elements and $z _ { i }$ is the position of such elements in $\mathbf { X }$ . For every set $\textsf { Z }$ , we generate an embedded instance $\mathbf { u }$ of dimensionality $m < d$ , such that $\mathbf { u } = [ u _ { 1 } , \dots u _ { m } ]$ , $u _ { i } \in \{ 0 , 1 \}$ . To do so, we first set all $m$ components of $\mathbf { u }$ to 0. Then, iteratively, for every element $z _ { i }$ , $i = 1 , \dots c$ , and every projection $H _ { j }$ , $j = 1 , \dots k$ , we assign
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
u _ { H _ { j } ( z _ { i } ) } = 1 .
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
Notice that, since $H _ { j }$ has a range between 1 and $m$ , $k \geq 1$ , and $m < d$ , a number of $z _ { i }$ elements may map to the same index of $\mathbf { u }$ . Bloom filters mitigate this by properly choosing $k$ independent hash functions $H$ (see above). Notice furthermore that the process has no space requirements, as $H$ is computed on-the-fly. Finally, notice that the embedding of a set $\textsf { Z }$ is constant time: the process is $O ( c k )$ , with $c$ bounded by the maximum number of non-sparse elements in x, $c \ll d$ , and $k$ being a constant that is set beforehand, $k \ll m < d$ . In practice, this constant time is dominated by the time spent on $H$ to generate a hash. If we want to be faster than that, and at the same time ensure an optimal (uniform) distribution of the outputs of $H$ , we can decide to compromise part of the available memory to pre-compute a hash matrix storing the projections or hash indices for allthe potential elements in $\textsf { Z }$ . We can do it by generating vectors $\mathbf { h } \overset { \cdot } { = } \left[ h _ { 1 } , \ldots h _ { k } \right]$ for each $z _ { i }$ , where $h _ { j }$ is a uniformly randomly chosen integer between 1 and $m$ (without replacement). This way, by pregenerating all projections for all $d$ elements, we end up with a $d \times k$ matrix $\mathbf { H }$ of integers between 1 and $m$ , which we can easily store in random-access memory (RAM), not in the GPU memory.
|
| 52 |
+
|
| 53 |
+
We now explain how to recover a probability-based ranking of the $d$ elements of $\mathbf { X }$ at the output of the model. Assuming a softmax activation is used, we have a probability vector $\mathbf { v } = [ v _ { 1 } , \dots v _ { m } ]$ that, at training time, is compared to the binary embedding $\mathbf { u }$ of some ground truth set $\textsf { Z }$ (or vector $\mathbf { x } )$ . We can think of $v _ { i }$ as the probability of being the projection of some element $z _ { l }$ , that is, $v _ { i } \sim$ $P ( u _ { i } = 1 ) \sim P ( H _ { j } ( z _ { l } ) = i )$ (see Eq. 1). To unravel the embedding $\mathbf { v }$ and map to the $d$ original elements of $\mathbf { X }$ , we can understand $\mathbf { v }$ as a $k$ -way factorization of every element $x _ { i }$ . Following the idea of Bloom filters, if an element maps to $u _ { i }$ and $v _ { i } = 0$ , then the element is definitely not in the output of the model. Otherwise, if an element maps to $u _ { i }$ and $v _ { i }$ is relatively large, we want the likelihood of that element to reflect that. Specifically, given an element position $z _ { i }$ from $\mathbf { X }$ , we can compute the likelihood of $z _ { i }$ as
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
{ \cal L } ( z _ { i } ) = \prod _ { j = 1 } ^ { k } v _ { H _ { j } ( z _ { i } ) } ,
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
and assign outputs $x _ { i } = L ( z _ { i } )$ . Alternatively, if a more numerically-stable output is desired, we can compute the negative log-likelihood
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
L ( z _ { i } ) = - \sum _ { j = 1 } ^ { k } \log \left( v _ { H _ { j } ( z _ { i } ) } \right) .
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
Both operations, when iterated for $i = 1 , \ldots d$ , define a ranking over the elements in $\mathbf { X }$ , which is the most common way to define (and evaluate) sparse high-dimensional outputs. One could potentially also recover a probability distribution by re-normalization, but the problems we consider are information retrieval-type of problems (Manning et al., 2008), which are typically seen as ranking problems, such as ranking recommendations based on user preferences (Weimer et al., 2008).
|
| 66 |
+
|
| 67 |
+
Note that BE, by construction, already offers a number of the aforementioned desired qualities for sparse high-dimensional embeddings (Sec. 1). Specifically, BE is designed for both inputs and outputs, offering a rank-based mapping between the original instances and the embedded vectors. BE yields a more compact representation of the original instance and requires no disk or memory space (at most some marginal RAM space, not GPU memory). In addition, BE can be performed on-the-fly, without training, and in constant time. In the following, we demonstrate the remaining desirable qualities using a comprehensive experimental setup: we show that the accuracy of the model is not compromised given a reasonable embedding dimension (sometimes it even improves), that no changes in the model architecture nor configuration are required, that training times are faster thanks to the reduction of the number of parameters of the model, that evaluation times do not carry much overhead, and that performance is generally better than a number of alternative approaches.
|
| 68 |
+
|
| 69 |
+
# 4 EXPERIMENTAL SETUP
|
| 70 |
+
|
| 71 |
+
# 4.1 GENERAL CONSIDERATIONS
|
| 72 |
+
|
| 73 |
+
We demonstrate that BE works under several settings and that it can be applied to multiple tasks. We consider a number of data sets, network architectures, configurations, and evaluation measures. In total, we define 7 different setups, which we summarize in Sec. 4.2 and detail in Appendix A. We also demonstrate that BE is competitive with respect to the available alternatives. To this end, we consider 4 different state-of-the-art approaches, which we overview in Sec. 4.3.
|
| 74 |
+
|
| 75 |
+
Table 1: Data set statistics after data cleaning and splitting. From left to right: data set name, type of modeled interaction, number of instances $n$ , test split size, instance dimensionality $d$ , median number of non-zero components $c$ , and median density $c / d$ .
|
| 76 |
+
|
| 77 |
+
<table><tr><td>Data set</td><td>Interaction</td><td>n</td><td>Split</td><td>d</td><td>C</td><td>c/d</td></tr><tr><td>ML</td><td>User-Movies</td><td>138,224</td><td>10,000</td><td>15,405</td><td>18</td><td>1.2·10-3</td></tr><tr><td>PTB</td><td>Sequence-Words</td><td>929,589</td><td>82,430</td><td>10,001</td><td>1</td><td>1.0 · 10-4</td></tr><tr><td>CADE</td><td>Words-Category</td><td>40,983</td><td>13,661</td><td>193,998</td><td>17</td><td>8.8.10-5</td></tr><tr><td>MSD</td><td>User-Songs</td><td>597,155</td><td>50,000</td><td>69,989</td><td>5</td><td>7.1 · 10-5</td></tr><tr><td>AMZ</td><td>User-Books</td><td>916,484</td><td>50,000</td><td>22,561</td><td>1</td><td>4.4 · 10-5</td></tr><tr><td>BC</td><td>User-Books</td><td>25,816</td><td>2,500</td><td>54,069</td><td>2</td><td>3.7 ·10-5</td></tr><tr><td>YC</td><td>Session-Clicks</td><td>1,865,997</td><td>50,000</td><td>35,732</td><td>1</td><td>2.8.10-5</td></tr></table>
|
| 78 |
+
|
| 79 |
+
Table 2: Experimental setup and baseline scores. From left to right: data set name, network architecture and optimizer, evaluation measure name, random score $S _ { \mathrm { R } }$ , and baseline score $S _ { 0 }$ .
|
| 80 |
+
|
| 81 |
+
<table><tr><td>Data set</td><td>Architecture+Optimizer</td><td>Evaluation measure</td><td>SR</td><td>S</td></tr><tr><td>ML</td><td>Feed-forward+Adam</td><td>Mean average precision</td><td>0.003</td><td>0.160</td></tr><tr><td>PTB</td><td>LSTM + SGD</td><td>Reciprocal rank</td><td>0.001</td><td>0.342</td></tr><tr><td>CADE</td><td>Feed-forward +RMSprop</td><td>Accuracy (%)</td><td>8.5</td><td>58.0</td></tr><tr><td>MSD</td><td>Feed-forward + Adam</td><td>Mean average precision</td><td><0.001</td><td>0.066</td></tr><tr><td>AMZ</td><td>Feed-forward + Adam</td><td>Mean average precision</td><td><0.001</td><td>0.049</td></tr><tr><td>BC</td><td>Feed-forward+ Adam</td><td>Mean average precision</td><td><0.001</td><td>0.010</td></tr><tr><td>YC</td><td>GRU + Adagrad</td><td>Reciprocal rank</td><td><0.001</td><td>0.368</td></tr></table>
|
| 82 |
+
|
| 83 |
+
Data sets are formed by inputs with $n$ instances, corresponding to either individual instances (or onehot encoded user profiles) or to sequences of instances (or profile lists). Outputs, also of $n$ instances, correspond to individual instances or to class labels. Instances have an original dimensionality $d$ , corresponding to the cardinality of all possible profile items. Given the nature of the considered problems, instances are very sparse, with all but $c$ elements being different from 0, $c \ll d$ , typically with $c / d$ in the order of $1 0 ^ { - 5 }$ (Table 1).
|
| 84 |
+
|
| 85 |
+
For each data set, and based on the literature, we select an appropriate baseline neural network architecture. We experiment with both feed-forward (autoencoder-like) and recurrent networks, carefully selecting their parameters and configuration to match (or even improve) the state-of-theart results. For the sake of comparison, we also choose appropriate and well-known evaluation measures. Depending on the data set, we work with mean average precision, reciprocal ranks, or accuracy (Manning et al., 2008).
|
| 86 |
+
|
| 87 |
+
Each combination of data set, network architecture, configuration, and evaluation measure defines a task. For every task, we compute a baseline score $S _ { 0 }$ , corresponding to running the plain neural network model without any embedding. We then report the performance of the $i \cdot$ -th combination of training with a particular embedding on a particular task with respect to the baseline score using $S _ { i } / S _ { 0 }$ . This way, we can compare the performance across different tasks using different evaluation measures, reporting relative improvement/loss with respect to the baseline. Similarly, to compare across different dimensionalities, we report the ratio of embedding dimensionality with respect to the original dimensionality, $m / d$ , and to compare across different training and evaluation times, we report time ratios with respect to the baseline, $T _ { i } / T _ { 0 }$ .
|
| 88 |
+
|
| 89 |
+
# 4.2 TASKS
|
| 90 |
+
|
| 91 |
+
We now give a brief summary of the 7 considered tasks (Tables 1 and 2). For a more detailed explanation related to data, network architecture, configuration, or evaluation methodology, we refer the reader to Appendix A. Further references can be also found there. All data sets are publiclyavailable, and for all tasks we use categorical cross-entropy as loss function.
|
| 92 |
+
|
| 93 |
+
1. Movielens (ML): movie recommendation with the Movielens data set (Harper & Konstan, 2015). We employ a 3-layer feed-forward neural network model and optimize its parameters with Adam. We evaluate the accuracy of the model with mean average precision.
|
| 94 |
+
2. Penn treebank (PTB): next word prediction with the Penn treebank data set (Mikolov, 2012). We employ a long short-term memory (LSTM) network and optimize its parameters with stochastic gradient descent (SGD). We evaluate the accuracy of the model with the reciprocal rank of the correct prediction.
|
| 95 |
+
3. CADE web directory (CADE): text categorization with the CADE web directory data set (Cardoso-Cachopo, 2007). We employ a 4-layer feed-forward neural network model and optimize its parameters with RMSprop. This is the only considered task where output embeddings are not required (classification into 12 text categories). We use accuracy as evaluation measure.
|
| 96 |
+
4. Million song data set (MSD): song recommendation with the Million song data set (BertinMahieux et al., 2011). We employ a 3-layer feed-forward neural network model and optimize its parameters with Adam. We evaluate the accuracy of the model with mean average precision.
|
| 97 |
+
5. Amazon book reviews (AMZ): book recommendation with the Amazon book reviews data set (McAuley et al., 2015). We employ a 4-layer feed-forward neural network and optimize its parameters with Adam. We evaluate the accuracy of the model with mean average precision.
|
| 98 |
+
6. Book crossing (BC): book recommendation with the book crossing data set (Ziegler et al., 2005). We employ a 4-layer feed-forward neural network and optimize its parameters with Adam. We evaluate the accuracy of the model with mean average precision.
|
| 99 |
+
7. YooChoose (YC): session-based recommendation with the YooChoose RecSys15 challenge data set2. We employ a gated recurrent unit (GRU) model and optimize its parameters with Adagrad. We evaluate the accuracy of the model with the reciprocal rank.
|
| 100 |
+
|
| 101 |
+
# 4.3 ALTERNATIVE APPROACHES
|
| 102 |
+
|
| 103 |
+
To compare the performance of BE with the state-of-the-art, we consider 4 different embedding alternatives. We base our evaluation on performance, measured at a given input/output compression ratio. It is important to note that, in general, besides performance, alternative approaches do not present some of the other desired qualities (Sec. 1) that BE offers, such as on-the-fly operation, constant-time, no supervision, or no network/configuration changes.
|
| 104 |
+
|
| 105 |
+
1. Hashing trick (HT). We first consider the popular hashing trick for classifier inputs (Langford et al., 2007; Weinberger et al., 2009). In general, these methodologies only focus on inputs and are not designed to deal with any type of output. Nonetheless, in the case of binary outputs, variants like the one used by Ganchev & Dredze (2008) can be adapted to map to the original items using Eqs. 2 or 3. In fact, considering this adaptation for recovery, the approach can be seen as a special case of BE with $k = 1$ .
|
| 106 |
+
2. Error-correcting output codes (ECOC). Originally designed for single-class targets (Dietterich & Bakiri, 1995), ECOC can be applied to class sets (inputs and outputs), with its corresponding encoding and decoding strategies (Armano et al., 2012). Yet, in the case of training neural networks, it is not clear which loss function should be used. The obvious choice would be to use the Hamming distance. However, in pre-analysis, a Hamming loss turned out to be significantly inferior than cross-entropy. Therefore, we use the latter in our experiments. We construct the ECOC matrix with the randomized hill-climbing method of Dietterich & Bakiri (1995).
|
| 107 |
+
3. Pairwise mutual information (PMI). Recently, Chollet (2016) has proposed a PMI approach for embedding sets of image labels into a dense space of real-valued vectors. The approach
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 1: Score ratios $S _ { i } / S _ { 0 }$ as a function of dimensionality ratio $m / d$ using $k = 4$ . Qualitatively similar plots are observed for other values of $k$ .
|
| 111 |
+
|
| 112 |
+
is based on the SVD of a PMI matrix computed from counting pairwise co-occurrences. It uses cosine similarity as the loss function and, at prediction time, it performs KNN (again using cosine similarity) with the projection of individual labels to obtain a ranking.
|
| 113 |
+
|
| 114 |
+
4. Canonical correlation analysis (CCA). CCA is a common way to learn a joint dense, realvalued embedding for both inputs and outputs at the same time (Hotelling, 1936). CCA can be computed using SVD on a correlation matrix (Hsu et al., 2012) and, similarly to PMI, we can use the KNN trick to rank elements or labels at prediction time. Correlation is now the metric of choice, both for the loss function and for determining the neighbors.
|
| 115 |
+
|
| 116 |
+
# 5 RESULTS
|
| 117 |
+
|
| 118 |
+
We start by reporting on the performance of BE. First of all, we focus on performance as a function of the embedding dimension. As mentioned, to facilitate comparisons, we report in relative terms, using score ratios $S _ { i } / S _ { 0 }$ and dimensionality ratios $m / d$ . When plotting the former as a function of the latter, we see several things that are worth noting (Fig. 1). Firstly, we observe that, for most of the tasks, score ratios approach 1 as $m$ approaches $d$ . This indicates that the introduction of BE does not degrade the original score of the Baseline when the embedding dimension $m$ is comparable to the original dimension $d$ . Secondly, we observe that the lower the dimensionality ratio, the lower the score ratio. This is to be expected, as one cannot embed sets of elements with their intrinsic dimensionality to an infinitesimally small $m$ . Importantly, the reduction of $S _ { i } / S _ { 0 }$ should not be linear with $m / d$ , but should maximize $S _ { i }$ for low $m$ (thus getting curves close to the top left corner of Fig. 1). We see that BE fulfills this requirement. In general, we can reduce the size of inputs and outputs 5 times $( m / d = 0 . 2 )$ and still maintain more than $92 \%$ of the value of the original score. The ML task is the only exception, which we think is due to the abnormally high density of the data (Table 1), inhibiting the embedding to low dimensions3. CADE is the task for which BE achieves the highest $S _ { i }$ for low $m$ . Presumably, the CADE task is the easiest one we consider, as only input embeddings are required.
|
| 119 |
+
|
| 120 |
+
An additional observation is worth noting (Fig. 1). Interestingly, we find that BE can improve the scores over the Baseline for a number of tasks. That is the case for 3 out of the 7 considered tasks: MSD with $m / d \geq 0 . 3$ , AMZ with $m / d \geq 0 . 2$ , and BC with $0 . 3 \leq m / d \leq 0 . 6$ . The fact that an embedding performs better than the original Baseline has been also observed in some other methods for specific data sets (Weston et al., 2002; Langford et al., 2007; Chollet, 2016). For instance, Chollet (2016) has reported increases up to $7 \%$ using the PMI approach on the so-called JFT data set. Here, depending on the task and the embedding dimension, relative increases go from 1 to $12 \%$ . Given that the data sets where we observe these increases are some of the less dense ones (Table 1), we hypothesize that, in the case of BE, such increases come from having $k$ times more active elements in the ground truth output (recall that one output element is projected $k$ times using $k$ independent hash functions, Sec. 3.2). With $k$ more times elements set to 1 in the output, a better estimation of the gradient may be computed (larger errors that propagate back to the rest of the network).
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 2: Score ratios $S _ { i } / S _ { 0 }$ as a function of the number of hash functions $k$ : using $m / d = 0 . 3$ (left) and $m / d = 1$ (right).
|
| 124 |
+
|
| 125 |
+
We now focus on performance as a function of the number of projections $k$ , reporting score ratios $S _ { i } / S _ { 0 }$ as above (Fig. 2). From repeating the plots for different values of $m / d$ , we observe that $S _ { i } / S _ { 0 }$ is always low for $k = 1$ (Fig. 2, left), except when $m$ approaches $d$ , where we have an almost flat behavior (Fig. 2, right). In general, $S _ { i } / S _ { 0 }$ jumps up for $k \geq 2$ and remains stable until $k \approx 1 0$ , where the decrease of $S _ { i } / S _ { 0 }$ becomes more apparent (Fig. 2, left). The best operating range typically corresponds to $2 \leq k \leq 4$ . The ML task is again an exception, with a best operating range around $7 \leq k \leq 1 0$ .
|
| 126 |
+
|
| 127 |
+
Besides performance scores, it is interesting to assess whether the reduction of input and output dimensions has an effect to training and evaluation times. To this end, we plot the time ratios $T _ { i } / T _ { 0 }$ as a function of the dimensionality ratio $m / d$ (Fig. 3). Regarding training times, we basically observe a linear decrease with $m / d$ (Fig. 3, left). ML is an exception to the trend, and CADE and AMZ experiment almost no decrease for very low dimensionality ratios $m / d < 0 . 2$ . In general, we confirm faster training times thanks to the reduction of the number of parameters of the model, dominated by input/output matrices (output dimension also affecting the time to compute the loss function). We obtain a 2 times speedup for a 2 times input/output compression and, roughly, a little bit over 3 times speedup for a 5 times input/output compression. Regarding evaluation times, we also observe a linear trend (Fig. 3, right). However, this time, $T _ { i } / T _ { 0 }$ is not as low, with values slightly above 1 but always below 1.5 (with the exception of CADE for $m / d > 0 . 6 )$ . Overall, this indicates that, compared to the Baseline evaluation time, the mapping used by BE when reconstructing the output does not introduce an overwhelming amount of extra computation time. With the exception of ML, extra computation time is below $20 \%$ for $m / d < 0 . 5$ .
|
| 128 |
+
|
| 129 |
+
Finally, we compare the performance of BE to the one of the considered alternative methods. We do so by establishing a dimensionality ratio $m / d$ and computing the corresponding score ratio $S _ { i } / S _ { 0 }$ for a given task (Table 3). We see that BE is better than the alternative methods in 5 out of the 7 tasks (10 out of the 14 considered test points). PMI is better in one of the tasks (CADE) and CCA is better also in one of the tasks (AMZ). It is relevant to note that, when BE wins, it always does so by a relatively large margin (see, for instance, the ML or YC tasks). Otherwise, when an alternative approach wins, generally it does so by a smaller margin (see, for instance, the AMZ task). These results become more relevant if we realize that PMI and CCA are both SVD-based approaches, introducing a separate degree of supervised learning to the task by exploiting pairwise element co-occurrences and correlations, respectively (Sec. 4.3). In contrast, BE does not require any learning. We formulate a co-occurrence-based version of BE in Appendix B, which achieves moderate performance increments over BE and more closely approaches the performance of PMI and CCA on the two tasks where BE was not already performing best. To conclude, a further interesting thing to note is that we confirm the small variation in the score ratios obtained for $2 \leq$ $k \leq 1 0$ (Fig. 2). Here, score ratios for $3 \le k \le 5$ are often comparable in a statistical significance sense (Table 3).
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 3: Time ratios $T _ { i } / T _ { 0 }$ as a function of dimensionality ratios $m / d$ with $k = 4$ : training time (left) and evaluation time (right). Qualitatively similar plots are observed for other values of $k$ . Bl. denotes baseline.
|
| 133 |
+
|
| 134 |
+
Table 3: Comparison of BE with the considered alternatives. Score ratios $S _ { i } / S _ { 0 }$ for different combinations of data set and compression ratio $m / d$ . Best results are highlighted in bold, up to statistical significance (Mann-Whitney U, $p { > } 0 . 0 5 ) ,$ ).
|
| 135 |
+
|
| 136 |
+
<table><tr><td colspan="2">Test point</td><td colspan="4">Alternativemethods</td><td colspan="3">BE</td></tr><tr><td>Data set</td><td>m/d</td><td>HT</td><td>ECOC</td><td>PMI</td><td>CCA</td><td>k=3</td><td>k=4</td><td>k=5</td></tr><tr><td>ML</td><td>0.2</td><td>0.234</td><td>0.342</td><td>0.043</td><td>0.209</td><td>0.750</td><td>0.770</td><td>0.722</td></tr><tr><td>ML</td><td>0.3</td><td>0.285</td><td>0.208</td><td>0.045</td><td>0.200</td><td>0.796</td><td>0.813</td><td>0.815</td></tr><tr><td>PTB</td><td>0.2</td><td>0.357</td><td>0.453</td><td>0.837</td><td>0.638</td><td>0.919</td><td>0.908</td><td>0.881</td></tr><tr><td>PTB</td><td>0.4</td><td>0.528</td><td>0.454</td><td>0.836</td><td>0.695</td><td>0.942</td><td>0.920</td><td>0.902</td></tr><tr><td>CADE</td><td>0.01</td><td>0.857</td><td>0.359</td><td>0.984</td><td>0.928</td><td>0.862</td><td>0.853</td><td>0.855</td></tr><tr><td>CADE</td><td>0.03</td><td>0.914</td><td>0.363</td><td>1.002</td><td>0.950</td><td>0.914</td><td>0.925</td><td>0.926</td></tr><tr><td>MSD</td><td>0.05</td><td>0.078</td><td>0.268</td><td>0.216</td><td>0.679</td><td>0.695</td><td>0.738</td><td>0.738</td></tr><tr><td>MSD</td><td>0.1</td><td>0.151</td><td>0.310</td><td>0.321</td><td>0.740</td><td>0.835</td><td>0.841</td><td>0.832</td></tr><tr><td>AMZ</td><td>0.1</td><td>0.166</td><td>0.182</td><td>0.851</td><td>1.030</td><td>0.864</td><td>0.881</td><td>0.861</td></tr><tr><td>AMZ</td><td>0.2</td><td>0.289</td><td>0.185</td><td>0.995</td><td>1.048</td><td>1.016</td><td>1.029</td><td>1.008</td></tr><tr><td>BC</td><td>0.05</td><td>0.189</td><td>0.817</td><td>0.022</td><td>0.313</td><td>0.777</td><td>0.750</td><td>0.837</td></tr><tr><td>BC</td><td>0.1</td><td>0.199</td><td>0.886</td><td>0.025</td><td>0.465</td><td>0.965</td><td>0.919</td><td>0.831</td></tr><tr><td>YC</td><td>0.03</td><td>0.150</td><td>0.076</td><td>0.776</td><td>0.466</td><td>0.841</td><td>0.858</td><td>0.858</td></tr><tr><td>YC</td><td>0.05</td><td>0.240</td><td>0.083</td><td>0.777</td><td>0.517</td><td>0.919</td><td>0.910</td><td>0.928</td></tr></table>
|
| 137 |
+
|
| 138 |
+
# 6 CONCLUSION
|
| 139 |
+
|
| 140 |
+
We have proposed the use of Bloom embeddings to represent sparse high-dimensional binary-coded inputs and outputs. We have shown that a compact representation can be obtained without compromising the performance of the original neural network model or, in some cases, even increasing it by a substantial factor. Due to the compact representation, the loss function and the input and output layers deal with less parameters, which results in faster training times. The approach compares favorably with respect to the considered alternatives, and offers a number of further advantages such as on-the-fly operation or zero space requirements, all this without introducing changes to the core network architecture, task configuration, or loss function.
|
| 141 |
+
|
| 142 |
+
In the future, besides continuing to exploit co-occurrences (Appendix B), one could extend the proposed approach by considering further extensions of Bloom filters such as counting Bloom filters (Bonomi et al., 2006). In theory, those extensions could provide a more compact representation by breaking the binary nature of the embedding. However, they could require the modification of the loss function or the mapping process (Eqs. 2 and 3). A faster mapping process using the sorted probabilities of v could also be studied.
|
| 143 |
+
|
| 144 |
+
# ACKNOWLEDGMENTS
|
| 145 |
+
|
| 146 |
+
We thank the curators of the data sets used in this study for making them publicly-available. We also thank Santi Pascual for his comments on a previous version of the paper.
|
| 147 |
+
|
| 148 |
+
# REFERENCES
|
| 149 |
+
|
| 150 |
+
Z. Akata, F. Perronnin, Z. Harchaoui, and C. Schmid. Label-embedding for image classification. IEEE Trans. on Pattern Analysis and Machine Intelligence, 38(7):1425–1438, 2015.
|
| 151 |
+
Y. Amit, M. Fink, N. Srebro, and S. Ullman. Uncovering shared structures in multiclass classification. In Proc. of the Int. Conf. on Machine Learning (ICML), pp. 17–24, 2007.
|
| 152 |
+
G. Armano, C. Chira, and N. Hatami. Error-correcting output codes for multi-label text categorization. In Proc. of the Italian Information Retrieval Conf. (IIR), pp. 26–37, 2012.
|
| 153 |
+
S. Bengio, J. Weston, and D. Grangier. Label embedding trees for large multi-class tasks. In Advances in Neural Information Processing Systems (NIPS), volume 23, pp. 163–171. 2010.
|
| 154 |
+
Y. Bengio, R. Ducharme, and P. Vincent. A neural probabilistic language model. In T. K. Leen, T. G. Dietterich, and V. Tresp (eds.), Advances in Neural Information Processing Systems (NIPS), volume 13, pp. 932–938. 2000.
|
| 155 |
+
T. Bertin-Mahieux, D. P. W. Ellis, B. Whitman, and P. Lamere. The million song dataset. In Proc. of the Int. Soc. for Music Information Retrieval Conf. (ISMIR), pp. 591–596, 2011.
|
| 156 |
+
B. H. Bloom. Space/time trade-offs in hash coding with allowable errors. Communications of the ACM, 13(7):422–426, 1970.
|
| 157 |
+
J. Blustein and A. El-Maazawi. Bloom filters – a tutorial, analysis, and survey. Technical report, Faculty of Computer Science, Dalhousie University, Halifax, Canada, 2002. URL https:// www.cs.dal.ca/research/techreports/cs-2002-10.
|
| 158 |
+
F. Bonomi, M. Mitzenmacher, R. Panigrahy, S. Singh, and G. Varghese. An improved construction for counting Bloom filters. In Y. Azar and T. Erlebach (eds.), European Symposium on Algorithms (ESA), volume 4168 of Lecture Notes in Computer Science, pp. 684–695. Springer-Verlag, Berlin, Germany, 2006.
|
| 159 |
+
A. Cardoso-Cachopo. Improving methods for single-label text categorization. PhD thesis, Instituto Superior Tecnico, Universidade Tecnica de Lisboa, 2007.
|
| 160 |
+
W. Chen, J. Wilson, S. Tyree, K. Weinberger, and Y. Chen. Compressing neural networks with the hashing trick. In Proc. of the Int. Conf. on Machine Learning (ICML), pp. 2285–2294, 2015.
|
| 161 |
+
H.-T. Cheng, L. Koc, J. Harmsen, T. Shaked, T. Chandra, H. Aradhye, G. Anderson, G. Corrado, W. Chai, M. Ispir, R. Anil, Z. Haque, L. Hong, V. Jain, X. Liu, and H. Shah. Wide & deep learning for recommender systems. In Proc. of the Workshop on Deep Learning for Recommender Systems (DLRS), pp. 7–10, 2016.
|
| 162 |
+
K. Cho, B. Van Merrienboer, D. Bahdanau, and Y. Bengio. On the properties of neural machine ¨ translation: encoder-decoder approaches. In Proc. of the Workshop on Syntax, Semantics and Structure in Statistical Translation (SSST), pp. 103–111, 2014.
|
| 163 |
+
F. Chollet. Information-theoretic label embeddings for large-scale image classification. ArXiv: 1607.05691, 2016.
|
| 164 |
+
M. Cisse, N. Usunier, T. Arti ´ eres, and P. Gallinari. Robust Bloom filters for large multilabel clas- \` sification tasks. In Advances in Neural Information Processing Systems (NIPS), pp. 1851–1859. 2013.
|
| 165 |
+
M. Courbariaux, Y. Bengio, and J.-P. David. BinaryConnect: training deep neural networks with binary weights during propagations. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems (NIPS), pp. 3123–3131. 2015.
|
| 166 |
+
T. G. Dietterich and G. Bakiri. Solving multiclass learning problems via error-correcting output codes. Journal of Artificial Intelligence Research, 2:263–286, 1995.
|
| 167 |
+
P. C. Dillinger and P. Manolios. Bloom filters in probabilistic verification. In Proc. of the Int. Conf. on Formal Methods in Computer-Aided Design (FMCAD), pp. 367–381, 2004.
|
| 168 |
+
J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12:2121–2159, 2011.
|
| 169 |
+
K. Ganchev and M. Dredze. Small statistical models by random feature mixing. In ACL Workshop on Mobile Language Processing (MLP), pp. 19–20, 2008.
|
| 170 |
+
X. Glorot and Y. Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proc. of the Int. Conf. on Artificial Intelligence and Statistics (AISTATS), pp. 249–256, 2010.
|
| 171 |
+
X. Glorot, A. Bordes, and Y. Bengio. Deep sparse rectifier neural networks. In Proc. of the Int. Conf. on Artificial Intelligence and Statistics (AISTATS), pp. 315–323, 2011.
|
| 172 |
+
E. Grave, A. Joulin, M. Cisse, D. Grangier, and H. J ´ egou. Efficient softmax approximation for ´ GPUs. ArXiv: 1609.04309, 2016.
|
| 173 |
+
A. Graves. Generating sequences with recurrent neural networks. ArXiv: 1308.0850, 2013.
|
| 174 |
+
S. Han, H. Mao, and W. J. Dally. Deep compression: compressing deep neural networks with pruning, trained quantization and Huffman coding. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2016.
|
| 175 |
+
F. M. Harper and J. K. Konstan. The MovieLens datasets: history and context. ACM Trans. on Interactive Intelligent Systems, 5(4):19, 2015.
|
| 176 |
+
B. Hidasi, A. Karatzoglou, L. Baltrunas, and D. Tikk. Session-based recommendations with recurrent neural networks. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2016. URL https://arxiv.org/abs/1511.06939.
|
| 177 |
+
S. Hochreiter and J. Schmidhuber. Long short-term memory networks. Neural Computation, 9(8): 1735–1780, 1997.
|
| 178 |
+
H. Hotelling. Relations between two sets of variates. Biometrika, 28(3-4):321–377, 1936.
|
| 179 |
+
D. Hsu, S. M. Kakade, and T. Zhang. A spectral algorithm for learning hidden Markov models. Journal of Computer and System Sciences, 78(5):1460–1470, 2012.
|
| 180 |
+
D. J. Hsu, S. M. Kakade, J. Langford, and T. Zhang. Multi-label prediction via compressed sensing. In Y. Bengio, D. Schuurmans, J. D. Lafferty, C. K. I. Williams, and A. Culotta (eds.), Advances in Neural Information Processing Systems (NIPS), volume 22, pp. 772–780. 2009.
|
| 181 |
+
Y.-D. Kim, E. Park, S. Yoo, T. Choi, L. Yang, and D. Shin. Compression of deep convolutional neural networks for fast and low power mobile applications. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2016. URL https://arxiv.org/abs/1511.06530.
|
| 182 |
+
D. P. Kingma and J. L. Ba. Adam: a method for stochastic optimization. In Proc. of the Int. Conf. on Learning Representations (ICLR), 2015. URL https://arxiv.org/abs/1412.6980.
|
| 183 |
+
J. Langford, L. Li, and A. Strehl. Vowpal wabbit online learning project. Technical report, 2007. URL http://hunch.net/ $? { \mathrm { p } } = 3 0 9$ .
|
| 184 |
+
C. D. Manning, P. Raghavan, and H. Schutze. ¨ Introduction to information retrieval. Cambridge University Press, Cambridge, UK, 2008.
|
| 185 |
+
M. P. Marcus, B. Santorini, and M. A. Marcinkiewich. Building a large annotated corpus of English: the Penn treebank. Computational Linguisitcs, 19(2):313–330, 1993.
|
| 186 |
+
J. McAuley, R. Pandey, and J. Leskovec. Inferring networks of substitutable and complementary products. In Proc. of the ACM SIGKDD Int. Conf. on Knowledge Discovery and Data Mining (KDD), pp. 785–794, 2015.
|
| 187 |
+
T. Mikolov. Statistical language models based on neural networks. PhD thesis, Brno University of Technology, 2012.
|
| 188 |
+
T. Mikolov, K. Chen, G. S. Corrado, and J. Dean. Efficient estimation of word representations in vector space. ArXiv: 1301.3781, 2013.
|
| 189 |
+
M. Mitzenmacher and E. Upfal. Probability and computing: randomized algorithms and probabilistic analysis. Cambridge University Press, Cambridge, UK, 2005.
|
| 190 |
+
F. Morin and Y. Bengio. Hierarchical probabilistic neural network language model. In Proc. of the Int. Workshop on Artificial Intelligence and Statistics (AISTATS), pp. 246–252, 2005.
|
| 191 |
+
Q. Shi, J. Petterson, G. Dror, J. Langford, A. Smola, and S. V. N. Vishwanathan. Hash kernels for structured data. Journal of Machine Learning Research, 10:2615–2637, 2009.
|
| 192 |
+
F. Strub, R. Gaudel, and J. Mary. Hybrid recommender system based on autoencoders. In Proc. of the Workshop on Deep Learning for Recommender Systems (DLRS), pp. 11–16, 2016.
|
| 193 |
+
T. Tieleman and G. Hinton. Lecture 6.5-RMSprop: divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning 4, 2, 2012.
|
| 194 |
+
J. Turian, L. Ratinov, and Y. Bengio. Word representations: a simple and general method for semisupervised learning. In Proc. of the Annual Meeting of the Association for Computational Linguistics (ACL), pp. 384–394, 2010.
|
| 195 |
+
P. Vincent, A. Brebisson, and X. Bouthilier. Efficient exact gradient update for training deep net- ´ works with very large sparse targets. In Advances in Neural Information Processing Systems (NIPS), pp. 1108–1116. 2015.
|
| 196 |
+
M. Weimer, A. Karatzoglou, Q. V. Le, and A. J. Smola. COFI RANK - maximum margin matrix factorization for collaborative ranking. In J. C. Platt, D. Koller, Y. Singer, and S. T. Roweis (eds.), Advances in Neural Information Processing Systems (NIPS), volume 20, pp. 1593–1600. 2008.
|
| 197 |
+
K. Weinberger, A. Dasgupta, J. Attenberg, J. Langford, and A. Smola. Feature hashing for large scale multitask learning. In Proc. of the Int. Conf. on Machine Learning (ICML), pp. 1113–1120, 2009.
|
| 198 |
+
J. Weston, O. Chapelle, A. Elisseeff, B. Scholkopf, and V. Vapnik. Kernel dependency estimation. ¨ In S. Becker, S. Thrun, and K. Obermayer (eds.), Advances in Neural Information Processing Systems (NIPS), volume 15, pp. 873–880. 2002.
|
| 199 |
+
|
| 200 |
+
J. Weston, S. Bengio, and N. Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine Learning, 81(1):21–35, 2010.
|
| 201 |
+
|
| 202 |
+
Y. Wu, C. DuBois, A. X. Zheng, and M. Ester. Collaborative denoising auto-encoders for top-n recommender systems. In Proc. of the ACM Int. Conf. on Web Search and Data Mining (WSDM), pp. 153–162, 2016.
|
| 203 |
+
|
| 204 |
+
C.-N. Ziegler, S. M. McNee, J. A. Konstan, and G. Lausen. Improving recommendation lists through topic diversification. In Proc. of the Int. World Wide Web Conf. (WWW), pp. 22–32, 2005.
|
| 205 |
+
|
| 206 |
+
# APPENDIX A TASKS DETAIL
|
| 207 |
+
|
| 208 |
+
# A.1 MOVIELENS (ML)
|
| 209 |
+
|
| 210 |
+
We first consider the task of movie recommendation with the Movielens 20M data set4 (Harper & Konstan, 2015). This data set comprises 20 million ratings applied to roughly 27,000 movies by over 138,000 users. To recommend movies that users would like, ratings, originally between 0.5 and 5 stars, were discretized with a threshold of 3.5. Then, movies with less than 5 ratings were removed, resulting in a total of 15,405 movies. User profiles were next built using a chronologically-ordered list of liked movies. We removed users with less than 2 movies and limited profiles to a maximum of 2,000 movies (less than $0 . 1 \%$ fulfilled this condition). Inputs and outputs were built by splitting user profiles uniformly at random, ensuring a minimum of one movie in both input and output. Finally, 10,000 random users were taken out for validation and another 10,000 for testing. The ML data set is the most dense data set we consider, with a median of 18 movies in input/output profiles (Table 1).
|
| 211 |
+
|
| 212 |
+
To perform recommendations with the ML data set, we build on top of $\mathrm { W u }$ et al. (2016) and consider a 3-layer feed-forward neural network with a softmax output and 150 rectified linear units (Glorot et al., 2011) in the hidden layers. We initialize the weights with uniform random numbers, weighted by the input and output dimensionality of the layer (Glorot & Bengio, 2010). We optimize the weights of the network using cross-entropy and Adam (Kingma & Ba, 2015), with a learning rate of 0.001 and parameters $\beta _ { 1 } ~ = ~ 0 . 9$ and $\beta _ { 2 } ~ = ~ 0 . 9 9 9$ . Training is performed for 15 epochs and with batches of 32 instances. If no improvement is seen on the validation set after one epoch, the learning rate is divided by 5. As done with all the other tasks, we make sure that the network architecture and the number of epochs is sufficient to achieve a state-of-the-art result. As the output probabilities define a ranking of movies that the user may like, the accuracy of the result is measured with mean average precision (Manning et al., 2008). The obtained baseline score $S _ { 0 } = 0 . 1 6 0$ can be considered a state-of-the-art result (Wu et al., 2016). Performing movie rankings at random yields a score $S _ { \mathrm { R } } = 0 . 0 0 3$ .
|
| 213 |
+
|
| 214 |
+
# A.2 PENN TREEBANK (PTB)
|
| 215 |
+
|
| 216 |
+
Another task we consider is next-word prediction with the Penn treebank data set (Marcus et al., 1993). We employ the data made available by Mikolov (2012), which contains close to 1 million words and defines validation and test splits of roughly 74,000 and 82,000 words, respectively. The vocabulary is limited to 10,000 words, with all other words mapped to an ‘unknown’ token (Table 1). We consider the end of the sentence as an additional token and form input sequences of length 10.
|
| 217 |
+
|
| 218 |
+
Inspired by Graves (2013), we perform next word prediction with an LSTM network (Hochreiter & Schmidhuber, 1997). We set the inner dimensionality to 250 and train the network with SGD. We use a learning rate of 0.25, a momentum of 0.99, and clip gradients to have a maximum norm of 1 (Graves, 2013). We use batches of 128 instances and train the model for 10 epochs. As for the rest, we proceed as with the ML task. We evaluate the result using the reciprocal rank of the correct prediction (Manning et al., 2008). We achieve a performance of $S _ { 0 } = 0 . 3 4 2$ , which indicates that, on average, the correct word is ranked on the third position. Predicting words at random yields a score $S _ { \mathrm { R } } = 0 . 0 0 1$ .
|
| 219 |
+
|
| 220 |
+
# A.3 CADE WEB DIRECTORY (CADE)
|
| 221 |
+
|
| 222 |
+
We perform single-label text categorization using web pages classified by human experts from the CADE web directory of Brazilian web pages5 (Cardoso-Cachopo, 2007). The data set contains around 40,000 documents assigned to one of 12 categories such as services, education, health, or culture. We use the train and test splits provided by Cardoso-Cachopo (2007), further splitting the train set randomly to obtain a validation set from it. Validation and test splits comprise 5,000 and 13,661 documents, respectively. The size of the vocabulary is close to 200,000 words with a median number of 17 words per document (Table 1).
|
| 223 |
+
|
| 224 |
+
To perform classification we use a 4-layer feed-forward neural network with a softmax output. The number of units is, from input to output, 400, 200, 100, and 12, and we use rectified linear units as activations for the hidden layers. We train the network for 10 epochs, using batches of 32 instances and RMSprop (Tieleman & Hinton, 2012) with a learning rate of 0.0002 and exponential decay of 0.9. As for the rest, we proceed as with the ML task. We obtain a baseline accuracy of $S _ { 0 } = 5 8 . 0 \%$ , slightly superior than the best baseline reported by Cardoso-Cachopo (2007), and a random accuracy of $S _ { \mathrm { R } } = 8 . 5 \%$ (Table 2). Notice that this is the only data set that does not have a sparse instance or user profile as output.
|
| 225 |
+
|
| 226 |
+
# A.4 MILLION SONG DATA SET (MSD)
|
| 227 |
+
|
| 228 |
+
The next task we consider is song recommendation with the million song data set (Bertin-Mahieux et al., 2011). We take the Echo Nest taste profile subset6, which includes over 48 million play counts of around 384,000 songs for roughly 1 million users. We assume that a user likes a song when this has listened to it a minimum of 3 times. We then remove the songs that appear less than 20 times and build user profiles with a minimum of 5 songs. We split the data set as with the ML task, keeping 50,000 user profiles for validation and another 50,000 for testing. The MSD data set has a median of 5 songs in input/output profiles (Table 1).
|
| 229 |
+
|
| 230 |
+
To recommend future listens to the user we use a 3-layer feed-forward neural network with a softmax output and 300 rectified linear units in the hidden layers. We fit the model for 10 epochs with batches of 64 instances. As for the rest, we proceed as with the ML task. We obtain a baseline mean average precision of $S _ { 0 } = 0 . 0 6 6$ and a random score of $S _ { \mathrm { R } }$ below 0.001.
|
| 231 |
+
|
| 232 |
+
# A.5 AMAZON BOOK REVIEWS (AMZ)
|
| 233 |
+
|
| 234 |
+
We also consider book recommendations with the Amazon book reviews data $\mathrm { s e t } ^ { 7 }$ (McAuley et al., 2015). The data set originally contains 22 million ratings of over 2 million books by approximately 3 million users. We proceed as with the ML data set, but this time setting the minimum number of ratings per book to 100 and splitting the data with 50,000 instances for validation and another 50,000 instances for testing.
|
| 235 |
+
|
| 236 |
+
We here use a 4-layer feed-forward neural network with a softmax output and 300 rectified linear units in the hidden layers. We fit the model for 10 epochs with batches of 64 instances and, as for the rest, we proceed as with the ML task. We obtain a baseline mean average precision of $S _ { 0 } = 0 . 0 4 9$ and a random score of $S _ { \mathrm { R } }$ below 0.001.
|
| 237 |
+
|
| 238 |
+
# A.6 BOOK CROSSING (BC)
|
| 239 |
+
|
| 240 |
+
Continuing with book recommendations, we consider the book crossing data set8 (Ziegler et al., 2005). It contains 278,000 users providing over 1 million ratings about a little more than 271,000 books. We remove books with less than 2 ratings, discretize those by a threshold of 4, and proceed as with the ML data set, but keeping 2,500 users for validation and another 2,500 for testing. The BC data set is known to be a very sparse data set, specially after removing users with less than 2 book reviews (Table 1).
|
| 241 |
+
|
| 242 |
+
To perform recommendations we use the same architecture and configuration as with the MSD task, but this time we use 250 units in the hidden layers. We obtain a baseline mean average precision of $S _ { 0 } = 0 . 0 1 0$ and a random score of $S _ { \mathrm { R } }$ below 0.001.
|
| 243 |
+
|
| 244 |
+
# A.7 YOOCHOOSE (YC)
|
| 245 |
+
|
| 246 |
+
We finally study session-based recommendations using the YooChoose RecSys15 challenge9 data. Here, the task is to predict the next click given a sequence of click events for a given session in an e-commerce site (Hidasi et al., 2016). We work with the training set of the challenge and keep only the click events. We take the first 2 million sessions of the data set which have a minimum of 2 clicks, and keep apart 50,000 for validation and another 50,000 for testing. We form sequences of, at most, 13 clicks to the 35,000 possible links (Table 1). Note that this is a sequential data set with one-hot encoded instances of only one event each.
|
| 247 |
+
|
| 248 |
+
To predict the next click we proceed as in Hidasi et al. (2016) and consider a GRU model (Cho et al., 2014). We set the inner dimensionality to 100 and train the network with Adagrad (Duchi et al., 2011), using a learning rate of 0.01. We use batches of 64 instances and train the model for 10 epochs. As for the rest, we proceed as with the ML task. As with PTB, we evaluate the result using the reciprocal rank of the correct prediction. We achieve a performance of $S _ { 0 } = 0 . 3 6 8$ , which can be assumed to be as good as state-of-the-art models on this data (Hidasi et al., 2016). Predicting clicks at random yields a score $S _ { \mathrm { R } }$ below 0.001.
|
| 249 |
+
|
| 250 |
+
# APPENDIX B GOING ONE STEP FURTHER WITH CO-OCCURRENCE-BASED COLLISIONS
|
| 251 |
+
|
| 252 |
+
B.1 CO-OCCURRENCE-BASED BLOOM EMBEDDING (CBE)
|
| 253 |
+
|
| 254 |
+
In Bloom filters and BE, collisions are unavoidable due to the lower embedding dimensionality and the use of multiple projections (Sec. 3). In addition we have seen that alternative approaches produce embeddings by exploiting co-occurrence information (Secs. 2 and 4.3). Here, we study a variant of BE that takes advantage of co-occurrence information to adjust the collisions that will inevitably take place when performing the embedding. We denote this approach by co-occurrencebased Bloom embedding (CBE).
|
| 255 |
+
|
| 256 |
+
What we propose is a quite straightforward approach to CBE, which does not add much extra precomputation time. Training and testing times remain the same, as CBE uses a pre-computed hashing matrix H (Sec. 3.2). The general idea of the proposed approach is to ‘re-direct’ the collisions of the co-occurring elements to the same bits or positions of u. Our implementation of this idea is detailed in Algorithm 1, and briefly explained below.
|
| 257 |
+
|
| 258 |
+
Algorithm 1 Pseudocode for CBE.
|
| 259 |
+
|
| 260 |
+
Input: Input and/or output instances $\mathbf { X }$ $\cdot n \times d$ sparse binary matrix), embedding dimensionality $m$ , number of projections $k$ , and pre-computed hashing matrix $\mathbf { H }$ ( $d \times k$ integers matrix).
|
| 261 |
+
|
| 262 |
+
Output: Co-occurrence-based hashing matrix $\mathbf { H } ^ { \prime }$
|
| 263 |
+
|
| 264 |
+
1: $\mathbf { C } \gets \mathbf { X } ^ { \mathrm { { T } } } \mathbf { X }$
|
| 265 |
+
2: $\mathbf { C } \mathbf { C }$ $\odot$ $\operatorname { S G N } ( \mathbf { C } - \operatorname { A V G F R E Q } ( \mathbf { X } ) )$
|
| 266 |
+
3: cVAL , $\mathbf { c } ^ { \mathrm { R O W } }$ , $\mathbf { c } ^ { \mathrm { { c o L } } } \gets \mathrm { { C O O R D } } \big ( \mathrm { { L O W T R I } } ( \mathbf { C } ) \big )$
|
| 267 |
+
4: for $i$ in ARGSORT(cVAL)
|
| 268 |
+
5: a, b ← cROW, cCOL
|
| 269 |
+
6: $r \gets \mathrm { U R N D } \big ( 1 , m , \mathsf { h } _ { a } \cup \mathsf { h } _ { b } \big )$
|
| 270 |
+
7: $j _ { a } \gets \mathrm { U R N D } ( 1 , k , \emptyset )$
|
| 271 |
+
8: $j _ { b } \gets \mathrm { U R N D } ( 1 , k , \emptyset )$
|
| 272 |
+
9: $h _ { a , j _ { a } } , h _ { b , j _ { b } } \gets r$
|
| 273 |
+
|
| 274 |
+
Table 4: Co-occurrence statistics and average score increase of CBE over BE. From left to right: data set name, input percent of co-occurrent pairs, input average co-occurrence ratio of co-occurrent pairs, output percent of co-occurrent pairs, output average co-occurrence ratio of co-occurrent pairs, and average score increases of CBE over BE ( $\%$ , calculated using $1 0 0 ( S _ { j } - S _ { i } ) / S _ { 0 }$ and averaging over all $m / d$ points). Co-occurrence values for PTB and YC inputs correspond to considering training sequences, not isolated sequence elements.
|
| 275 |
+
|
| 276 |
+
<table><tr><td rowspan="2">Data set</td><td colspan="4">Co-occurrence statistics</td><td colspan="2">Score increase (%)</td></tr><tr><td>Input (%)</td><td>Input (p)</td><td>Output (%)</td><td>Ouput (p)</td><td>k=3</td><td>k=4</td></tr><tr><td>ML</td><td>25.2</td><td>1.3:10-4</td><td>32.9</td><td>1.0.10-4</td><td>+0.9</td><td>+1.7</td></tr><tr><td>PTB</td><td>3.3</td><td>2.4· 10-5</td><td>0</td><td>0</td><td>+0.1</td><td>+0.9</td></tr><tr><td>CADE</td><td>1.3</td><td>8.8.10-5</td><td>N/A</td><td>N/A</td><td>-0.4</td><td>-0.1</td></tr><tr><td>MSD</td><td>1.3</td><td>3.0·10-6</td><td>1.3</td><td>3.1·10-6</td><td>+0.5</td><td>+1.5</td></tr><tr><td>AMZ</td><td>3.0</td><td>1.8. 10-6</td><td>3.0</td><td>1.8.10-6</td><td>+6.6</td><td>+8.4</td></tr><tr><td>BC</td><td>0.8</td><td>4.9.10-5</td><td>0.4</td><td>4.9 · 10-5</td><td>-3.4</td><td>-1.0</td></tr><tr><td>YC</td><td>0.2</td><td>1.5 · 10-6</td><td>0</td><td>0</td><td>+0.4</td><td>+0.3</td></tr></table>
|
| 277 |
+
|
| 278 |
+
First, we count pairwise co-occurrences and store them in a sparse matrix C (line 1). Next, we threshold C by the average element frequency in $\mathbf { X }$ using the Hadamard product $\odot$ and a componentwise sign function (line 2). We then get the lower triangular part of C and return it in coordinates format, that is, using a tuple of values, row indices, and column indices (line 3). We will use the order in $\mathbf { c } ^ { \mathrm { { V A L } } }$ to update the hash matrix H. To do so, we first loop over the indices of the sorted values of $\mathbf { c } ^ { \mathrm { { V A L } } }$ in increasing order (line 4). After selecting the corresponding elements $a$ and $b$ (line 5), we then draw integers from URND (lines 6–8). The function $\mathrm { U R N D } \left( x , y , z \right)$ is a uniform random integer generator between $x$ and $y$ (both included) such that the output integer is not included in the set $\textsf { Z }$ , that is, $\mathrm { U R N D } ( x , y , z ) \not \in { z }$ . Rows $a$ and $b$ of $\mathbf { H }$ are transformed to sets $\mathsf { h } _ { a }$ and $\mathsf { h } _ { b }$ and its union is computed (line 6). Finally, we use the integers generated by URND to pick projections $j _ { a }$ and $j _ { b }$ from $\mathbf { H }$ , and assign them the same bit $r$ (line 9). By updating the projections in $\mathbf { H }$ in increasing order of co-occurrence (line 4), we give priority to the pairs with largest co-occurrence, setting them to collide to the same bit $r$ (line 9).
|
| 279 |
+
|
| 280 |
+
# B.2 CBE RESULTS
|
| 281 |
+
|
| 282 |
+
Overall, the performance of CBE only provides moderate increments over the original BE approach (Fig. 4). With the exception of the BC task, the performance of CBE is always higher than the one of BE. However, with the exception of the AMZ task, we do not observe dramatic increases of CBE over BE. On average, such increases are between $0 . 4 \%$ and $8 . 4 \%$ (Table 4, right). One possible explanation for these moderate performance increases is the low co-occurrence in the considered data (Table 4, left). As it can be seen, typically less than $3 \%$ of all possible pairs show a cooccurrence. Moreover, the average co-occurrence count of such co-occurring pairs is very low, with ratios $\rho$ to the total number of instances $n$ in the order of $1 0 ^ { - 5 }$ or $1 0 ^ { - 6 }$ .
|
| 283 |
+
|
| 284 |
+
Despite being moderate on average, we observed that the increments provided by CBE were more prominent for low dimensionality ratios $m / d$ . By relating CBE with the best approaches resulting from the comparison of BE with the alternatives, we see that CBE is generally better than BE, sometimes with a statistically significant difference (Table 5). Furthermore, we see that CBE, being based on co-occurrences, more closely approaches PMI and CCA in the tasks where those were performing best, and even outperforms them in one test point (AMZ, $m / d = 0 . 2$ ; compare also with Table 3). Being closer to those co-occurrence-based approaches is an indication that CBE leverages co-occurrence information to some extent.
|
| 285 |
+
|
| 286 |
+

|
| 287 |
+
Figure 4: Comparison of score ratios $S _ { i } / S _ { 0 }$ as a function of dimensionality ratio $m / d$ for BE (dashed lines) and CBE (solid lines) using $k \ = \ 4$ . Qualitatively similar plots are observed for other values of $k$ .
|
| 288 |
+
|
| 289 |
+
Table 5: Comparison of CBE versus the results in Table 3. Score ratios $S _ { i } / S _ { 0 }$ for different combinations of data set and compression ratio $m / d$ . Best results are highlighted in bold, up to statistical significance (Mann-Whitney-U, $p { > } 0 . 0 5 )$ .
|
| 290 |
+
|
| 291 |
+
<table><tr><td colspan="2">Test point</td><td colspan="2">Best so far</td><td colspan="2">CBE</td></tr><tr><td>Data set</td><td>m/d</td><td>Method</td><td>Si/So</td><td>k=3</td><td>k=4</td></tr><tr><td>ML</td><td>0.2</td><td>BE</td><td>0.770</td><td>0.760</td><td>0.781</td></tr><tr><td>ML</td><td>0.3</td><td>BE</td><td>0.815</td><td>0.812</td><td>0.867</td></tr><tr><td>PTB</td><td>0.2</td><td>BE</td><td>0.919</td><td>0.915</td><td>0.907</td></tr><tr><td>PTB</td><td>0.4</td><td>BE</td><td>0.942</td><td>0.937</td><td>0.922</td></tr><tr><td>CADE</td><td>0.01</td><td>PMI</td><td>0.984</td><td>0.854</td><td>0.853</td></tr><tr><td>CADE</td><td>0.03</td><td>PMI</td><td>1.002</td><td>0.921</td><td>0.922</td></tr><tr><td>MSD</td><td>0.05</td><td>BE</td><td>0.738</td><td>0.759</td><td>0.756</td></tr><tr><td>MSD</td><td>0.1</td><td>BE</td><td>0.841</td><td>0.856</td><td>0.873</td></tr><tr><td>AMZ</td><td>0.1</td><td>CCA</td><td>1.030</td><td>0.994</td><td>0.991</td></tr><tr><td>AMZ</td><td>0.2</td><td>CCA</td><td>1.048</td><td>1.109</td><td>1.117</td></tr><tr><td>BC</td><td>0.05</td><td>BE</td><td>0.837</td><td>0.774</td><td>0.808</td></tr><tr><td>BC</td><td>0.1</td><td>BE</td><td>0.965</td><td>0.880</td><td>0.878</td></tr><tr><td>YC</td><td>0.03</td><td>BE</td><td>0.858</td><td>0.871</td><td>0.880</td></tr><tr><td>YC</td><td>0.05</td><td>BE</td><td>0.928</td><td>0.933</td><td>0.936</td></tr></table>
|
md/train/rkMW1hRqKX/rkMW1hRqKX.md
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OPTIMAL COMPLETION DISTILLATIONFOR SEQUENCE LEARNING
|
| 2 |
+
|
| 3 |
+
Sara Sabour, William Chan, Mohammad Norouzi
|
| 4 |
+
|
| 5 |
+
{sasabour, williamchan, mnorouzi}@google.com Google Brain
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
We present Optimal Completion Distillation (OCD), a training procedure for optimizing sequence to sequence models based on edit distance. OCD is efficient, has no hyper-parameters of its own, and does not require pretraining or joint optimization with conditional log-likelihood. Given a partial sequence generated by the model, we first identify the set of optimal suffixes that minimize the total edit distance, using an efficient dynamic programming algorithm. Then, for each position of the generated sequence, we define a target distribution that puts an equal probability on the first token of each optimal suffix. OCD achieves the state-of-theart performance on end-to-end speech recognition, on both Wall Street Journal and Librispeech datasets, achieving ${ \mathrm { { \bar { 9 } . 3 \% } } }$ and $\bar { 4 } . 5 \%$ word error rates, respectively.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Recent advances in natural language processing and speech recognition hinge on the development of expressive neural network architectures for sequence to sequence (seq2seq) learning (Sutskever et al., 2014; Bahdanau et al., 2015). Such encoder-decoder architectures are adopted in both machine translation (Bahdanau et al., 2015; Wu et al., 2016; Hassan et al., 2018) and speech recognition systems (Chan et al., 2016; Bahdanau et al., 2016a; Chiu et al., 2017) achieving impressive performance above traditional multi-stage pipelines (Koehn et al., 2007; Povey et al., 2011). Improving the building blocks of seq2seq models can fundamentally advance machine translation and speech recognition, and positively impact other domains such as image captioning (Xu et al., 2015), parsing (Vinyals et al., 2015), summarization (Rush et al., 2015), and program synthesis (Zhong et al., 2017).
|
| 14 |
+
|
| 15 |
+
To improve the key components of seq2seq models, one can either design better architectures, or develop better learning algorithms. Recent architectures using convolution (Gehring et al., 2017) and self attention (Vaswani et al., 2017) have proved to be useful, especially to facilitate efficient training. On the other hand, despite many attempts to mitigate the limitations of Maximum Likelihood Estimation (MLE) (Ranzato et al., 2016; Wiseman and Rush, 2016; Norouzi et al., 2016; Bahdanau et al., 2017; Leblond et al., 2018), MLE is still considered the dominant approach for training seq2seq models. Current alternative approaches require pre-training or joint optimization with conditional log-likelihood. They are difficult to implement and require careful tuning of new hyper-parameters (e.g. mixing ratios). In addition, alternative approaches typically do not offer a substantial performance improvement over a well tuned MLE baseline, especially when label smoothing (Pereyra et al., 2017; Edunov et al., 2018) and scheduled sampling (Bengio et al., 2015) are used.
|
| 16 |
+
|
| 17 |
+
In this paper, we borrow ideas from search-based structured prediction (Daumé et al., 2009; Ross et al., 2011) and policy distillation (Rusu et al., 2016) and develop an efficient algorithm for optimizing seq2seq models based on edit distance1. Our key observation is that given an arbitrary prefix (e.g. a partial sequence generated by sampling from the model), we can exactly and efficiently identify all of the suffixes that result in a minimum total edit distance (v.s. the ground truth target). Our training procedure, called Optimal Completion Distillation (OCD), is summarized as follows:
|
| 18 |
+
|
| 19 |
+
1. We always train on prefixes generated by sampling from the model that is being optimized.
|
| 20 |
+
2. For each generated prefix, we identify all of the optimal suffixes that result in a minimum total edit distance v.s. the ground truth target using an efficient dynamic programming algorithm.
|
| 21 |
+
3. We teach the model to optimally extend each generated prefix by maximizing the average log probability of the first token of each optimal suffix identified in step 2.
|
| 22 |
+
|
| 23 |
+
The proposed OCD algorithm is efficient, straightforward to implement, and has no tunable hyperparameters of its own. Our key contributions include:
|
| 24 |
+
|
| 25 |
+
• We propose OCD, a stand-alone algorithm for optimizing seq2seq models based on edit distance. OCD is scalable to real-world datasets with long sequences and large vocabularies, and consistently outperforms Maximum Likelihood Estimation (MLE) by a large margin. • Given a target sequence of length $m$ and a generated sequence of length $n$ , we present an $O ( n m )$ algorithm that identifies all of the optimal extensions for each prefix of the generated sequence. We demonstrate the effectiveness of OCD on end-to-end speech recognition using attentionbased seq2seq models. On the Wall Street Journal dataset, OCD achieves a Character Error Rate (CER) of $3 . 1 \%$ and a Word Error Rate (WER) of $9 . 3 \%$ without language model rescoring, outperforming all prior work (Table 4). On Librispeech, OCD achieves state-of-the-art WER of $4 . 5 \%$ on “test-clean” and $1 3 . 3 \%$ on “test-other” sets (Table 5).
|
| 26 |
+
|
| 27 |
+
# 2 BACKGROUND: SEQUENCE LEARNING WITH MLE
|
| 28 |
+
|
| 29 |
+
Given a dataset of input output pairs $\mathcal { D } \equiv \{ ( \mathbf { x } , \mathbf { y } ^ { * } ) _ { i } \} _ { i = 1 } ^ { N }$ , we are interested in learning a mapping $\mathbf x \to \mathbf y$ from an input $\mathbf { x }$ to a target output sequence $\mathbf { y } ^ { \ast } \in \mathcal { V }$ . Let $\mathcal { V }$ denote the set of all sequences of tokens from a finite vocabulary $\nu$ with variable but finite lengths. Often learning a mapping $\mathbf x \to \mathbf y$ is formulated as optimizing the parameters of a conditional distribution $p _ { \theta } ( \mathbf { y } \mid \mathbf { x } )$ . Then, the final sequence prediction under the probabilistic model $p _ { \theta }$ is performed by exact or approximate inference (e.g. via beam search) as:
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
{ \hat { \mathbf { y } } } \approx \operatorname { a r g m a x } _ { \mathbf { y } \in \mathcal { Y } } p _ { \theta } ( \mathbf { y } \mid \mathbf { x } ) ~ .
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
Similar to the use of log loss for supervised classification, the standard approach to optimize the parameters $\theta$ of the conditional probabilistic model entails maximizing a conditional log-likelihood objective, $\mathcal { O } _ { \mathrm { M L E } } ( \theta ) = \mathbb { E } _ { ( \mathbf { x } , \mathbf { y } ^ { * } ) \sim p _ { \mathcal { D } } } \log p _ { \theta } ( \mathbf { y } ^ { * } \mid \mathbf { x } )$ . This approach to learning the parameters is called Maximum Likelihood Estimation (MLE) and is commonly used in sequence to sequence learning.
|
| 36 |
+
|
| 37 |
+
Sutskever et al. (2014) propose the use of recurrent neural networks (RNNs) for autoregressive seq2seq modeling to tractably optimize ${ \mathcal { O } } _ { \mathrm { M L E } } ( \theta )$ . An autoregressive model estimates the conditional probability of the target sequence given the source one token at a time, often from left-to-right. A special end-of-sequence token is appended at the end of all of target sequences to handle variable length. The conditional probability of $\mathbf { y } ^ { * }$ given $\mathbf { x }$ is decomposed via the chain rule as,
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
p _ { \boldsymbol \theta } ( \mathbf { y } ^ { * } \mid \mathbf { x } ) \equiv \prod _ { t = 1 } ^ { | \mathbf { y } ^ { * } | } p _ { \boldsymbol \theta , t } ( y _ { t } ^ { * } \mid \mathbf { y } _ { < t } ^ { * } , \mathbf { x } ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\mathbf { y } _ { < t } ^ { * } \equiv ( y _ { 1 } ^ { * } , \dots , y _ { t - 1 } ^ { * } )$ denotes a prefix of the sequence $\mathbf { y } ^ { * }$ . To estimate the probability of a token $a$ given a prefix $\mathbf { y } _ { < t } ^ { * }$ and an input $\mathbf { x }$ , denoted $p _ { \theta , t } ( a \mid \mathbf { y } _ { < t } ^ { * } , \mathbf { x } )$ , different architectures have been proposed. Some papers (e.g. Britz et al. (2017)) have investigated the use of LSTM (Hochreiter and Schmidhuber, 1997) and GRU (Cho et al., 2014) cells, while others proposed new architecturs based on soft attention (Bahdanau et al., 2015), convolution (Gehring et al., 2017), and self-attention (Vaswani et al., 2017). Nonetheless, all of these techniques rely on MLE for learning,
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\mathcal { O } _ { \mathrm { M L E } } ( \theta ) = \mathbb { E } _ { ( \mathbf { x } , \mathbf { y } ^ { * } ) \sim p _ { D } } \sum _ { t = 1 } ^ { | \mathbf { y } ^ { * } | } \log p _ { \theta , t } ( y _ { t } ^ { * } \mid \mathbf { y } _ { < t } ^ { * } , \mathbf { x } ) ,
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
where $p _ { \mathcal { D } }$ denotes the empirical data distribution, uniform across the dataset $\mathcal { D }$ . We present a new objective function for optimizing autoregressive seq2seq models applicable to any neural architecture.
|
| 50 |
+
|
| 51 |
+
# 2.1 LIMITATIONS OF MLE FOR AUTOREGRESSIVE MODELS
|
| 52 |
+
|
| 53 |
+
In order to maximize the conditional log-likelihood (3) of an autoregressive seq2seq model (2), one provides the model with a prefix of $t - 1$ tokens from the ground truth target sequence, denoted $\mathbf { y } _ { < t } ^ { * }$ and maximizes the log-probability of $y _ { t } ^ { * }$ as the next token. This resembles a teacher walking a student through a sequence of perfect decisions, where the student learns as a passive observer. However, during inference one uses beam search (1), wherein the student needs to generate each token $\hat { \mathbf { y } } _ { t }$ by conditioning on its own previous outputs, i.e. $\hat { \mathbf { y } } _ { < t }$ instead of $\mathbf { y } _ { < t } ^ { * }$ . This creates a discrepancy between training and test known as exposure bias (Ranzato et al., 2016). Appendix B expands this further.
|
| 54 |
+
|
| 55 |
+
Concretely, we highlight two limitations with the use of MLE for autoregressive seq2seq modeling:
|
| 56 |
+
|
| 57 |
+
1. There is a mismatch between the prefixes seen by the model during training and inference. When the distribution of $\hat { \mathbf { y } } _ { < t }$ is different from the distribution of $\mathbf { y } _ { < t } ^ { * }$ , then the student will find themselves in a novel situation that they have not been trained for. This can result in poor generalization, especially when the training set is small or the model size is large. 2. There is a mismatch between the training loss and the task evaluation metric. During training, one optimizes the log-probability of the ground truth output sequence, which is often different from the task evaluation metric (e.g. edit distance for speech recognition).
|
| 58 |
+
|
| 59 |
+
There has been a recent surge of interest in understanding and mitigating the limitations of MLE for autoregressive seq2seq modeling. In Section 4 we discuss prior work in detail after presenting our approach below.
|
| 60 |
+
|
| 61 |
+
# 3 OPTIMAL COMPLETION DISTILLATION
|
| 62 |
+
|
| 63 |
+
To alleviate the mismatch between inference and training, we never train on ground truth target sequences. Instead, we always train on sequences generated by sampling from the current model that is being optimized. Let $\widetilde { \mathbf { y } }$ denote a sequence generated by sampling from the current model, and $\mathbf { y } ^ { * }$ edenote the ground truth target. Applying MLE to autoregressive models casts the problem of sequence learning as optimizing a mapping $( \mathbf { x } , \mathbf { y } _ { < t } ^ { * } ) \to y _ { t } ^ { * }$ from ground truth prefixes to correct next tokens. By contrast, the key question that arises when training on model samples is the choice of targets for learning a similar mapping $( { \bf x } , \widetilde { { \bf y } } _ { < t } ) \ ? \ ?$ from generated prefixes to next tokens. Instead eof using a set of pre-specified targets, OCD solves a prefix-specific problem to find optimal extensions that lead to the best completions according to the task evaluation metric. Then, OCD encourages the model to extend each prefix with the set of optimal choices for the next token.
|
| 64 |
+
|
| 65 |
+
Our notion of optimal completion depends on the task evaluation metric denoted $R ( \cdot , \cdot )$ , which measures the similarity between two complete sequences, e.g. the ground truth target v.s. a generated sequence. Edit distance is a common task metric. Our goal in sequence learning is to train a model, which achieves high scores of $R ( \mathbf { y } ^ { * } , \widetilde { \mathbf { y } } )$ . Drawing connection with the goal of reinforcement elearning (Sutton and Barto, 1998), let us recall the notion of optimal $\mathbf { Q }$ -values. Optimal Q-values for a state-action pair $( s , a )$ , denoted $Q ^ { * } ( s , a )$ , represent the maximum future reward that an agent can accumulate after taking an action $a$ at a state $s$ by following with optimal subsequent actions. Similarly, we define Q-values for a prefix $\widetilde { \mathbf { y } } _ { < t }$ and the extending token $a$ , as the maximum score attainable by concatenating $[ \widetilde { \mathbf { y } } _ { < t } , a ]$ ewith an optimal suffix $\mathbf { y }$ to create a full sequence $[ \widetilde { \mathbf { y } } _ { < t } , a , \mathbf { y } ]$ Formally,
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\forall a \in \mathcal { V } , \qquad Q ^ { * } ( \widetilde { \mathbf { y } } _ { < t } , a ) = \operatorname* { m a x } _ { \mathbf { y } \in \mathcal { V } } R ( \mathbf { y } ^ { * } , [ \widetilde { \mathbf { y } } _ { < t } , a , \mathbf { y } ] ) .
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Then, the optimal extension for a prefix $\widetilde { \mathbf { y } } _ { < t }$ can be defined as tokens that attain the maximal Q-values, i.e. argmax $a ^ { Q ^ { * } } ( \widetilde { \mathbf { y } } _ { < t } , a )$ e. This formulation allows for a prefix $\widetilde { \mathbf { y } } _ { < t }$ to be sampled on-policy from the model $p _ { \theta }$ e e, or drawn off-policy in any way. Table 1 includes an example ground truth target from the Wall Street Journal dataset and the corresponding generated sample from a model. We illustrate that for some prefixes there exist more than a single optimal extension leading to the same edit distance.
|
| 72 |
+
|
| 73 |
+
Given $Q$ -values for our prefix-token pairs, we use an exponential transform followed by normalization to convert $\mathbf { Q }$ -values to a soft optimal policy over the next token extension,
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\pi ^ { * } ( a \mid \widetilde { \mathbf { y } } _ { < t } ) = \frac { \exp ( Q ^ { * } ( \widetilde { \mathbf { y } } _ { < t } , a ) / \tau ) } { \sum _ { a ^ { \prime } } \exp \left( Q ^ { * } ( \widetilde { \mathbf { y } } _ { < t } , a ^ { \prime } ) / \tau \right) } ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $\tau \geq 0$ is a temperature parameter. Note the similarity of $\tau$ and the label smoothing parameter helpful within MLE. In our experiments, we used the limit of $\tau 0$ resulting in hard targets and no hyper-parameter tuning.
|
| 80 |
+
|
| 81 |
+
Given a training example $\left( \mathbf { x } , \mathbf { y } ^ { * } \right)$ , we first draw a full sequence $\widetilde { \mathbf { y } } \sim p _ { \theta } ( \cdot \mid \mathbf { x } )$ i.i.d. from the current model, and then minimize a per-step KL divergence between the optimal policy and the model distribution over the next token extension at each time step $t$ . The OCD objective is expressed as,
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\begin{array} { r l r } { \mathcal { O } _ { \mathrm { O C D } } ( \theta ) } & { = } & { \mathbb { E } _ { ( \mathbf { x } , \mathbf { y } ^ { * } ) \sim p _ { \mathcal { D } } } \mathbb { E } _ { \widetilde { \mathbf { y } } \sim p _ { \theta } ( \cdot | \mathbf { x } ) } \sum _ { t = 1 } ^ { | \widetilde { \mathbf { y } } | } \mathrm { K L } \left( \pi ^ { * } ( \cdot | \widetilde { \mathbf { y } } _ { < t } ) \parallel p _ { \theta , t } ( \cdot | \widetilde { \mathbf { y } } _ { < t } , \mathbf { x } ) \right) . } \end{array}
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
For every prefix $\widetilde { \mathbf { y } } _ { < t }$ , we compute the optimal $Q$ -values and use (5) to construct the optimal policy distribution $\pi ^ { * }$ e. Then, we distill the knowledge of the optimal policy for each prefix $\widetilde { \mathbf { y } } _ { < t }$ into the eparametric model using a KL loss. For the important class of sequence learning problems where edit
|
| 88 |
+
|
| 89 |
+
<table><tr><td>Target sequence y*</td><td>as_he_talks_his_wife</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Generated sequence y</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>as_ee_talks_whose_wife</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Optimal extensions for</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>as_he_talks_hiis__𝑤ife</td></tr><tr><td>edit distance (OCD targets)</td><td></td><td></td><td></td><td>h</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>hiw</td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 90 |
+
|
| 91 |
+
Table 1: A sample sequence $\mathbf { y } ^ { * }$ from the Wall Street Journal dataset, where the model’s prediction $\widetilde { \mathbf { y } }$ is not perfect. The optimal next characters for each prefix of $\widetilde { \mathbf { y } }$ based on edit distance are shown in blue. For example, for the prefix “as $\mathbf { e } ^ { \prime \prime }$ e there are 3 optimal next characters of “e”, “h”, and $\underline { { { \bf \hat { \Pi } } } } ( \mathbf { \Delta } ) \mathbf { \Delta } ,$ . All of these 3 characters when combined with proper suffixes will result in a total edit distance of 1.
|
| 92 |
+
|
| 93 |
+
distance is the evaluation metric, we develop a dynamic programming algorithm to calculate optimal $Q$ -values exactly and efficiently for all prefixes of a sequence $\widetilde { \mathbf { y } }$ , discussed below.
|
| 94 |
+
|
| 95 |
+
# 3.1 OPTIMAL Q-VALUES FOR EDIT DISTANCE
|
| 96 |
+
|
| 97 |
+
We propose a dynamic programming algorithm to calculate optimal Q-values exactly and efficiently for the reward metric of negative edit distance, i.e. $R ( \mathbf { y } ^ { * } , \widetilde { \mathbf { y } } ) \overset { - } { = } - \mathrm { D } _ { \mathrm { e d i t } } ( \mathbf { y } ^ { * } , \widetilde { \mathbf { y } } )$ . Given two sequences $\mathbf { y } ^ { * }$ and $\widetilde { \mathbf { y } }$ , we compute the Q-values for every prefix $\widetilde { \mathbf { y } } _ { < t }$ e eand any extending token $a \in \nu$ with an easymptotic complexity of $O ( | \mathbf { y } ^ { * } | . | \widetilde { \mathbf { y } } | + | \mathcal { V } | . | \widetilde { \mathbf { y } } | )$ e. Assuming that $| \mathbf { y } ^ { * } | \approx | \widetilde { \mathbf { y } } | \leq | \nu |$ , our algorithm does e e enot increase the time complexity over MLE, since computing the cross-entropy losses in MLE also requires a complexity of $O ( | \mathbf { y } ^ { * } | . | \nu | )$ . When this assumption does not hold, e.g. genetic applications, OCD is less efficient than MLE. However, in practice, the wall clock time is dominated by the forward and backward passes of a neural networks, and the OCD cost is often negligible. We discuss the efficiency of OCD further in Appendix A.
|
| 98 |
+
|
| 99 |
+
Recall the Levenshtein algorithm (Levenshtein, 1966) for calculating the minimum number of edits (insertion, deletion and substitution) required to convert sequences $\widetilde { \mathbf { y } }$ and $\mathbf { y } ^ { * }$ to each other based on,
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\{ \begin{array} { l l } { \mathrm { D } _ { \mathrm { e d i f } } ( \widetilde { \mathbf { y } } _ { < - 1 } , : ) = \infty } \\ { \mathrm { D } _ { \mathrm { e d i f } } ( \cdot , \mathbf { y } _ { < - 1 } ^ { * } ) = \infty } & D _ { \mathrm { e d i f } } ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < j } ^ { * } ) = \operatorname* { m i n } \{ \begin{array} { l l } { D _ { \mathrm { e d i f } } ( \widetilde { \mathbf { y } } _ { < i - 1 } , \mathbf { y } _ { < j } ^ { * } ) + 1 } \\ { D _ { \mathrm { e d i f } } ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < j - 1 } ^ { * } ) + 1 } \\ { D _ { \mathrm { e d i f } } ( \widetilde { \mathbf { y } } _ { < i - 1 } , \mathbf { y } _ { < j - 1 } ^ { * } ) + \mathbb { 1 } [ \widetilde { y } _ { i } \neq y _ { j } ^ { * } ] . } \end{array} \end{array}
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Table 2 shows an example edit distance table for sequences “Satrapy” and “Sunday”. Our goal is to identify the set of all optimal suffixes $\mathbf { y } \in \mathcal { V }$ that result in a full sequences $[ \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } ]$ with a minimum edit distance v.s. $\mathbf { y } ^ { * }$ .
|
| 106 |
+
|
| 107 |
+
Lemma 1. The edit distance resulting from any potential suffix $\mathbf { y } \in \mathcal { V }$ is lower bounded by $m _ { i }$
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\forall \mathbf { y } \in \mathcal { V } , \ D _ { e d i t } \big ( [ \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } ] , \mathbf { y } ^ { * } \big ) \ \ge \ \operatorname* { m i n } _ { 0 \le j \le | \mathbf { y } ^ { * } | } \ D _ { e d i t } \big ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < j } ^ { * } \big ) \ = \ m _ { i } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Proof. Let’s consider the path $P$ that traces $\mathrm { D } _ { \mathrm { e d i t } } \big ( [ \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } ] , \mathbf { y } ^ { \ast } \big )$ back to $\mathrm { D } _ { \mathrm { e d i t } } \big ( \widetilde { \mathbf { y } } _ { < 0 } , \mathbf { y } _ { < 0 } ^ { * } \big )$ connecting each cell to an adjacent parent cell, which provides the minimum value among the three options in (7). Such a path for tracing edit distance between “Satrapy” and “Sunday” is shown in Table 2.
|
| 114 |
+
|
| 115 |
+
Table 2: Each row corresponds to a prefix of “SATRAPY” and shows edit distances with all prefixes of “SUNDAY”. We also show OCD targets (optimal extensions) for each prefix, and minimum value along each row, denoted $m _ { i }$ (see (8)). We highlight the trace path for $\mathrm { D } _ { \mathrm { e d i t } }$ (“Satrapy”, “Sunday”).
|
| 116 |
+
|
| 117 |
+
<table><tr><td rowspan=1 colspan=8>Edit Distance Table</td><td rowspan=1 colspan=1> OCD Targets</td><td rowspan=1 colspan=1>mi</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>Y</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>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>U,N</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>T</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>U, N, D</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>U, N, D,A</td><td rowspan=1 colspan=1>3</td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>Y</td><td rowspan=1 colspan=1>3</td></tr><tr><td rowspan=1 colspan=1>P</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>Y,</s></td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=1 colspan=1>Y</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1><s></td><td rowspan=1 colspan=1>4</td></tr></table>
|
| 118 |
+
|
| 119 |
+
Suppose the path $P$ crosses row $i$ at a cell $( i , k )$ . Since the operations in (7) are non-decreasing, the edit distance along the path cannot decrease, so $\mathrm { D } _ { \mathrm { e d i t } } \bigl ( \bigl [ \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } \bigr ] , \mathbf { y } ^ { * } \bigr ) \geq \mathrm { D } _ { \mathrm { e d i t } } \bigl ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < k } ^ { * } \bigr ) \geq m _ { i }$ . □
|
| 120 |
+
|
| 121 |
+
Then, consider any $k$ such that $\mathrm { D } _ { \mathrm { e d i t } } \big ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < k } ^ { * } \big ) = m _ { i }$ . Let $\mathbf { y } _ { \geq k } ^ { * } \equiv ( y _ { k } ^ { * } , \ldots , y _ { | \mathbf { y } ^ { * } | } ^ { * } )$ denote a suffix of $\mathbf { y } ^ { * }$ . We conclude that $\mathrm { D } _ { \mathrm { e d i t } } \big ( [ \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { > k } ^ { * } ] , \mathbf { y } ^ { * } \big ) = m _ { i }$ , because on the one hand there is a particular edit path that results in $m _ { i }$ eedits, and on the other hand $m _ { i }$ is a lower bound according to Lemma 1. Hence any such $\mathbf { y } _ { \geq k } ^ { * }$ is an optimal suffix for $\widetilde { \mathbf { y } } _ { < i }$ . Further, it is straightforward to prove by contradiction that ethe set of optimal suffixes is limited to suffixes $\mathbf { y } _ { \geq k } ^ { * }$ corresponding to $\mathrm { D } _ { \mathrm { e d i t } } ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < k } ^ { * } ) = m _ { i }$ .
|
| 122 |
+
|
| 123 |
+
Since the set of optimal completions for $\widetilde { \mathbf { y } } _ { < i }$ is limited to $\mathbf { y } _ { \geq k } ^ { * }$ , the only extensions that can lead to maximum reward are the starting token of such suffixes $( y _ { k } ^ { * } )$ . Since $\mathrm { D } _ { \mathrm { e d i t } } ( \widetilde { \mathbf { y } } _ { < i } , \mathbf { y } _ { < k } ^ { * } ) = m _ { i }$ as well, we can identify the optimal extensions by calculating the edit distances between all prefixes of $\widetilde { \mathbf { y } }$ and all prefixes of $\mathbf { y } ^ { * }$ which can be efficiently calculated by dynamic programming in $\mathcal { O } ( | \widetilde { \mathbf { y } } | . | \mathbf { y } ^ { * } | )$ . For a prefix $\widetilde { \mathbf { y } } _ { < i }$ after we calculate the minimum edit distance $m _ { i }$ among all prefixes of $\mathbf { y } ^ { * }$ e, we set the $Q ^ { * } ( \widetilde { \mathbf { y } } _ { < i } , y _ { k } ^ { * } ) = - m _ { i }$ for all $k$ where $\mathbf { y } _ { < k } ^ { * }$ has edit distance equal to $m _ { i }$ . We set the $Q ^ { * }$ for any eother token to $- m _ { i } - 1$ . We provide the details of our modified Levenshtein algorithm to efficiently compute the $Q ^ { * } ( \widetilde { \mathbf { y } } _ { < i } , a )$ for all $i$ and $a$ in Appendix A.
|
| 124 |
+
|
| 125 |
+
# 4 RELATED WORK
|
| 126 |
+
|
| 127 |
+
Our work builds upon Learning to Search (Daumé III and Marcu, 2005) and Imitation Learning techniques (Ross et al., 2011; Ross and Bagnell, 2014; Sun et al., 2018), where a student policy is optimized to imitate an expert teacher. DAgger (Ross et al., 2011) in particular is closely related, where a dataset of trajectories from an expert teacher is aggregated with samples from past student models, and a policy is optimized to mimic a given expert policy $\pi ^ { * }$ at various states. Similarly, OCD aims to mimic an optimal policy $\pi ^ { * }$ at all prefixes, but in OCD, the behavior policy is directly obtained from an online student. Further, the oracle policy is not provided during training, and we obtain the optimal policy by finding optimal $Q$ -values. AggreVaTeD (Sun et al., 2017) assumes access to an unbiased estimate of Q-values and relies on variance reduction techniques and conjugate gradients to address a policy optimization problem. OCD calculates exact Q-values and uses regular SGD for optimization. Importantly, our roll-in prefixes are drawn only from the student model, and we do not require mixing in ground truth (a.k.a. expert) samples. Cheng and Boots (2018) showed that mixing in ground truth samples is an essential regularizer for value aggregation convergence in imitation learning.
|
| 128 |
+
|
| 129 |
+
Our work is closely related to Policy Distillation (Rusu et al., 2016), where a Deep Q-Network (DQN) agent (Mnih et al., 2015) that is previously optimized is used as the expert teacher. Then, action sequences are sampled from the teacher and the learned Q-value estimates are distilled (Hinton et al., 2014) into a smaller student network using a KL loss. OCD adopts a similar loss function, but rather than estimating Q-values using bootstrapping, we estimate exact $Q$ -values using dynamic programming. Moreover, we draw samples from the student rather than the teacher.
|
| 130 |
+
|
| 131 |
+
Similar to OCD, the learning to search (L2S) techniques such as LOLS (Chang et al., 2015) and Goodman et al. (2016) also attempt to estimate the Q-values for each state-action pair. Such techniques examine multiple roll-outs of a generated prefix and aggregate the return values. SeaRNN (Leblond et al., 2018) approximates the cost-to-go for each token by computing the task loss for as many roll-outs as the vocabulary size at each time step with a per step complexity of $O ( V T )$ . It is often difficult to scale approaches based on multiple roll-outs to real world datasets, where either the sequences are long or the vocabulary is large. OCD exploits the special structure in edit distance and find exact Q-values efficiently in $O ( V + T )$ per step. Unlike L2S and SeaRNN, which require ground truth prefixes to stabilize training, we solely train on model samples.
|
| 132 |
+
|
| 133 |
+
Approaches based on Reinforcement Learning (RL) have also been applied to sequence prediction problems, including REINFORCE (Ranzato et al., 2016), Actor-Critic (Bahdanau et al., 2017) and Self-critical Sequence Training (Rennie et al., 2017). These methods sample sequences from the model’s distribution and backpropagate a sequence-level task objective (e.g. edit distance). Beam Search Optimization (Wiseman and Rush, 2016) and Edit-based Minimum Bayes Risk (EMBR) (Prabhavalkar et al., 2018) is similar, but the sampling procedure is replaced with beam search. These training methods suffer from high variances and credit assignment problems. By contrast, OCD takes advantage of the decomposition of the sequence-level objective into token level optimal completion targets. This reduces the variance of the gradient and stabilizes the model. Crucially, unlike most
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 1: Fraction of OCD training prefix tokens on WSJ which does not match ground truth.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 2: WSJ validation Character Error Rate (CER) per training CER for MLE and OCD.
|
| 140 |
+
|
| 141 |
+
RL-based approaches, we neither need MLE pretraining or joint optimization with log-likelihood. Bahdanau et al. (2016b) also noticed some of the nice structure of edit distance, but they optimize the model by regressing its outputs to edit distance values leading to suboptimal performance. Rather, we first construct the optimal policy and then use knowledge distillation for training. Independently, Karita et al. (2018) also decomposed edit distance into the contribution of individual tokens and used this decomposition within the EMBR framework. That said, Karita et al. (2018) do not theoretically justify this particular choice of decomposition and report high variance in their gradient estimates.
|
| 142 |
+
|
| 143 |
+
Reward Augmented Maximum Likelihood (RAML) (Norouzi et al., 2016) and its variants (Ma et al., 2017; Elbayad et al., 2018; Wang et al., 2018) are also similiar to RL-based approaches. Instead of sampling from the model’s distribution, RAML samples sequences from the true exponentiated reward distribution. However, sampling from the true distribution is often difficult and intractable. RAML suffers from the same problems as RL-based methods in credit assignment. SPG (Ding and Soricut, 2017) changes the policy gradient formulation to sample from a reward shaped model distribution. Therefore, its samples are closer than RAML to the model’s samples. In order to facilitate sampling from their proposed distribution SPG provides a heuristic to decompose ROUGE score. Although SPG has a lower variance due to their biased samples, it suffers from the same problems as RAML and RL-based methods in credit assignment.
|
| 144 |
+
|
| 145 |
+
Generally, OCD excels at training from scratch, which makes it an ideal substitution for MLE. Hence, OCD is orthogonal to methods which require MLE pretraining or joint optimization.
|
| 146 |
+
|
| 147 |
+
# 5 EXPERIMENTS
|
| 148 |
+
|
| 149 |
+
We conduct our experiments on speech recogntion on the Wall Street Journal (WSJ) (Paul and Baker, 1992) and Librispeech (Panayotov et al., 2015) benchmarks. We only compare end-to-end speech recognition approaches that do not incorporate language model rescoring. On both WSJ and Librispeech, our proposed OCD (Optimal Completion Distillation) algorithm significantly outperforms our own strong baselines including MLE (Maximum Likelihood Estimation with label smoothing) and SS (scheduled sampling with a well-tuned schedule). Moreover, OCD significantly outperforms all prior work, achieving a new state-of-the-art on two competitive benchmarks.
|
| 150 |
+
|
| 151 |
+
# 5.1 WALL STREET JOURNAL
|
| 152 |
+
|
| 153 |
+
The WSJ dataset is readings of three separate years of the Wall Street Journal. We use the standard configuration of si284 for training, dev93 for validation and report both test Character Error Rate (CER) and Word Error Rate (WER) on eval92. We tokenize the dataset to English characters and punctuation. Our model is an attention-based seq2seq network with a deep convolutional frontend as used in Zhang et al. (2017). During inference, we use beam search with a beam size of 16 for all of our models. We describe the architecture and hyperparameter details in Appendix C. We first analyze some key characteristics of the OCD model separately, and then compare our results with other baselines and state-of-the-art methods.
|
| 154 |
+
|
| 155 |
+
Training prefixes and generalization. We emphasize that during training, the generated prefixes sampled from the model do not match the ground truth sequence, even at the end of training. We define OCD prefix mismatch as the fraction of OCD training tokens that do not match corresponding ground truth training tokens at each position. Assuming that the generated prefix sequence is perfectly matched with the ground truth sequence, then the OCD targets would simply be the following tokens of the ground truth sequence. Hence, OCD becomes equivalent to MLE. Figure 1 shows that OCD prefixes mismatch is more than $2 5 \%$ for the most of the training. This suggests that OCD and MLE are training on very different input prefix trajectories. Further, Figure 2 depicts validation CER as a function of training CER for different model checkpoints during training, where we use beam search on both training and validation sets to obtain CER values. Even at the same training CER, we observe better validation error for OCD, which suggests that OCD improves generalization of MLE, possibly because OCD alleviates the mismatch between training and inference.
|
| 156 |
+
|
| 157 |
+
Table 3: WSJ Character Error Rate (CER) and Word Error Rate (WER) of different baselines. Schedule Sampling optimizes for Hamming distance and mixes samples from the model and ground truth with a probability schedule (start-of-training end-of-training). OCD always samples from the model and optimizes for all characters which minimize Edit distance. Optimal Completion Target optimizes for one character which minimizes edit distance and another criteria (shortest or same #words).
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Training Strategy</td><td>CER</td><td>WER</td></tr><tr><td>Schedule Sampling (1.0 →1.0)</td><td>12.1</td><td>35.6</td></tr><tr><td>Schedule Sampling (0.0 → 1.0)</td><td>3.8</td><td>11.7</td></tr><tr><td>Schedule Sampling (0.0 → 0.55)</td><td>3.6</td><td>10.2</td></tr><tr><td>Optimal Completion ' Target (Shortest)</td><td>3.8</td><td>12.7</td></tr><tr><td>Optimal Completion Target (Same #Words)</td><td>3.3</td><td>10.2</td></tr><tr><td>Optimal Completion Distillation</td><td>3.1</td><td>9.3</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Table 4: Character Error Rate (CER) and Word Error Rate (WER) results on the end-to-end speech recognition WSJ task. We report results of our Optimal Completion Distillation (OCD) model, and well-tuned implementations of maximum likelihood estimation (MLE) and Scheduled Sampling (SS).
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Model</td><td>CER</td><td>WER</td></tr><tr><td>Prior Work</td><td></td><td></td></tr><tr><td>CTC (Graves and Jaitly; 2014)</td><td>9.2</td><td>30.1</td></tr><tr><td>CTC +REINFORCE (Graves and Jaitly; 2014)</td><td>8.4</td><td>27.3</td></tr><tr><td>Gram-CTC (Liu et al.; 2017)</td><td>1</td><td>16.7</td></tr><tr><td>seq2seq (Bahdanau et al.; 2016a)</td><td>6.4</td><td>18.6</td></tr><tr><td>seq2seq + TLE (Bahdanau et al.; 2016b)</td><td>5.9</td><td>18.0</td></tr><tr><td>seq2seq + LS (Chorowski and Jaitly; 2017)</td><td>-</td><td>10.6</td></tr><tr><td>seq2seq + CNN (Zhang et al.; 2017)</td><td>-</td><td>10.5</td></tr><tr><td>seq2seq + LSD (Chan et al.; 2017)</td><td>=</td><td>9.6</td></tr><tr><td>seq2seq + CTC (Kim et al.; 2017)</td><td>7.4</td><td>-</td></tr><tr><td>seq2seq + TwinNet (Serdyuk et al.; 2018)</td><td>6.2</td><td></td></tr><tr><td>seq2seq + MLE + REINFORCE (Tjandra et al.; 2018)</td><td>6.1</td><td>=</td></tr><tr><td>Our Implementation</td><td></td><td></td></tr><tr><td>seq2seq +MLE</td><td>3.6</td><td>10.6</td></tr><tr><td>seq2seq + SS</td><td>3.6</td><td>10.2</td></tr><tr><td>seq2seq + OCD</td><td>3.1</td><td>9.3</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Impact of edit distance. We further investigate the role of the optimizer by experimenting with different losses. Table 3 compares the test CER and WER of the schedule sampling with a fixed probability schedule of $( 1 . 0 1 . 0 $ ) and OCD model. Both of the models are trained only on sampled trajectories. The main difference is their optimizers, where the S ${ \bf S } ( 1 . 0 1 . 0 $ ) model is optimizing the log likelihood of ground truth (a.k.a. Hamming distance). The significant drop in CER of $\mathrm { S S } ( 1 . 0 1 . 0 $ ) emphasizes the necessity of pretraining or joint training with MLE for models such as SS. OCD is trained from random initialization and does not require MLE pretraining, nor does it require joint optimization with MLE. We also emphasize that unlike SS, we do not need to tune an exploration schedule, OCD prefixes are simply always sampled from the model from the start of training. We note that even fine tuning a pre-trained SS model which achieves $3 . 6 \%$ CER with $1 0 0 \%$ sampling increases the CER to $3 . 8 \%$ . This emphasizes the importance of making the loss a function of the model input prefixes, as opposed to the ground truth prefixes. Appendix D covers another aspect of optimizing Edit distance rather than Hamming distance.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 3: Librispeech training and validation WER per training epoch for OCD and MLE.
|
| 169 |
+
|
| 170 |
+
Target distribution. Another baseline which is closer to MLE framework is selecting only one correct target. Table 3 compares OCD with several Optimal Completion Target (OCT) models. In OCT, we optimize the log-likelihood of one target, which at each step we pick dynamically based on the minimum edit distance completion similar to OCD. We experiment with several different strategies when there is more than one character that can lead to minimum CER. In the OCT (Shortest), we select the token that would minimize the CER and the final length of the sequence. In the OCT (Same #Words), we select the token that in addition to minimum CER, would lead to the closest number of words to the target sequence. We show that OCD achieves significantly better CER and WER over the other optimization strategies compared in Table 3. This highlights the importance of optimizing for the entire set of optimal completion targets, as opposed to a single target.
|
| 171 |
+
|
| 172 |
+
State-of-the-art. Our model trained with OCD optimizes for CER; we achieve $3 . 1 \%$ CER and $9 . 3 \%$ WER, substantially outperforming our baseline by $14 \%$ relatively on CER and $12 \%$ relatively on WER. In terms of CER, our work substantially outperforms prior work as compared in Table 4, with the closest being Tjandra et al. (2018) trained with policy gradients on CER. In terms of WER, our work is also outperforming Chan et al. (2017), which uses subword units while our model emits characters.
|
| 173 |
+
|
| 174 |
+
# 5.2 LIBRISPEECH
|
| 175 |
+
|
| 176 |
+
For the Librispeech dataset, we train on the full training set (960h audio data) and validate our results on the dev-other set. We report the results both on the “clean” and “other” test set. We use Byte Pair Encoding (BPE) (Sennrich et al., 2016) for the output token segmentation. BPE token set is an open vocabulary set since it includes the characters as well as common words and n-grams. We use 10k BPE tokens and report both CER and WER as the evaluation metric. We describe the architecture and hyperparameter details in Appendix C.
|
| 177 |
+
|
| 178 |
+
Table 5: Character Error Rate (CER) and Word Error Rate (WER) on LibriSpeech test sets.
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Model</td><td colspan="2">test-clean</td><td colspan="2">test-other</td></tr><tr><td></td><td>CER</td><td>WER</td><td>CER</td><td>WER</td></tr><tr><td>Prior Work</td><td></td><td></td><td></td><td></td></tr><tr><td>Wav2letter (Collobert et al., 2016)</td><td>6.9</td><td>7.2</td><td></td><td></td></tr><tr><td>Gated ConvNet (Liptchinsky etal., 2017)</td><td>1</td><td>6.7</td><td>1</td><td>20.8</td></tr><tr><td>Cold Fusion (Sriram et al., 2018)</td><td>3.9</td><td>7.5</td><td>9.3</td><td>17.0</td></tr><tr><td>Invariant Representation Learning (Liang et al.,2018)</td><td>3.3</td><td>1</td><td>11.0</td><td>1</td></tr><tr><td>Pretraining+seq2seq+CTC (Zeyer et al.,2018)</td><td>1</td><td>4.9</td><td>1</td><td>15.4</td></tr><tr><td>Our Implementation</td><td></td><td></td><td></td><td></td></tr><tr><td>seq2seq +MLE</td><td>2.9</td><td>5.7</td><td>8.4</td><td>15.4</td></tr><tr><td>seq2seq + OCD</td><td>1.7</td><td>4.5</td><td>6.4</td><td>13.3</td></tr></table>
|
| 181 |
+
|
| 182 |
+
Fig. 3 shows the validation and training WER curves for MLE and OCD. OCD starts outperforming MLE on training decodings after training for 13 epochs and on validation decodings after 9 epochs. Our MLE baseline achieves $5 . 7 \%$ WER, while OCD achieves $4 . 5 \%$ WER on test-clean ( $2 1 \%$ improvement) and improves the state-of-the-art results over Zeyer et al. (2018). test-other is the more challenging test split ranked by the WER of a model trained on WSJ (Panayotov et al., 2015) mainly because readers accents deviate more from US-English accents. On test-other our MLE baseline achieves $1 5 . 4 \%$ , while our OCD model achieves $1 3 . 3 \%$ WER, outperforming the $1 5 . 4 \%$ WER of Zeyer et al. (2018). Table 5 compares our results with other recent works and the MLE baseline on Librispeech.
|
| 183 |
+
|
| 184 |
+
# 6 CONCLUSION
|
| 185 |
+
|
| 186 |
+
This paper presents Optimal Completion Distillation (OCD), a training procedure for optimizing autoregressive sequence models base on edit distance. OCD is applicable to on-policy or off-policy trajectories, and in this paper, we demonstrate its effectiveness on samples drawn from the model in an online fashion. Given any prefix, OCD creates an optimal extension policy by computing the exact optimal Q-values via dynamic programming. The optimal extension policy is distilled by minimizing a KL divergence between the optimal policy and the model. OCD does not require MLE initialization or joint optimization with conditional log-likelihood. OCD achieves $3 . 1 \%$ CER and $9 . 3 \%$ WER on the competitive WSJ speech recognition task, and $4 . 5 \%$ WER on Librispeech without any language model. OCD outperforms all published work on end-to-end speech recognition, including our own well-tuned MLE and scheduled sampling baselines without introducing new hyper-parameters.
|
| 187 |
+
|
| 188 |
+
# ACKNOWLEDGEMENTS
|
| 189 |
+
|
| 190 |
+
We thank Geoffrey Hinton for his valuable feedback and reviews. We thank Samy Bengio, Navdeep Jaitly, and Jamie Kiros for their help in reviewing the manuscript as well. We thank Zhifeng Chen and Yonghui Wu for their generous technical help.
|
| 191 |
+
|
| 192 |
+
# REFERENCES
|
| 193 |
+
|
| 194 |
+
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, pages 265–283, 2016.
|
| 195 |
+
|
| 196 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2015.
|
| 197 |
+
|
| 198 |
+
Dzmitry Bahdanau, Jan Chorowski, Dmitriy Serdyuk, Philemon Brakel, and Yoshua Bengio. End-toEnd Attention-based Large Vocabulary Speech Recognition. ICASSP, 2016a.
|
| 199 |
+
|
| 200 |
+
Dzmitry Bahdanau, Dmitriy Serdyuk, Philemon Brakel, Nan Rosemary Ke, Jan Chorowski, Aaron Courville, and Yoshua Bengio. Task Loss Estimation for Sequence Prediction. ICLR Workshop, 2016b.
|
| 201 |
+
|
| 202 |
+
Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An Actor-Critic Algorithm for Sequence Prediction. ICLR, 2017.
|
| 203 |
+
|
| 204 |
+
Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam M. Shazeer. Scheduled Sampling for Sequence Prediction with Recurrent Neural Networks. NIPS, 2015.
|
| 205 |
+
|
| 206 |
+
Denny Britz, Anna Goldie, Minh-Thang Luong, and Quoc Le. Massive exploration of neural machine translation architectures. arXiv:1703.03906, 2017.
|
| 207 |
+
|
| 208 |
+
William Chan, Navdeep Jaitly, Quoc Le, and Oriol Vinyals. Listen, Attend and Spell: A Neural Network for Large Vocabulary Conversational Speech Recognition. ICASSP, 2016.
|
| 209 |
+
|
| 210 |
+
William Chan, Yu Zhang, and Navdeep Jaitly. Latent Sequence Decompositions. ICLR, 2017.
|
| 211 |
+
|
| 212 |
+
Kai-Wei Chang, Akshay Krishnamurthy, Alekh Agarwal, Hal Daumé III, and John Langford. Learning to Search Better Than Your Teacher. In ICML, 2015.
|
| 213 |
+
|
| 214 |
+
Ching-An Cheng and Byron Boots. Convergence of value aggregation for imitation learning. arXiv preprint arXiv:1801.07292, 2018.
|
| 215 |
+
|
| 216 |
+
Chung-Cheng Chiu, Tara N Sainath, Yonghui Wu, Rohit Prabhavalkar, Patrick Nguyen, Zhifeng Chen, Anjuli Kannan, Ron J Weiss, Kanishka Rao, Katya Gonina, et al. State-of-the-art speech recognition with sequence-to-sequence models. arXiv:1712.01769, 2017.
|
| 217 |
+
|
| 218 |
+
Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. EMNLP, 2014.
|
| 219 |
+
|
| 220 |
+
Jan Chorowski and Navdeep Jaitly. Towards better decoding and language model integration in sequence to sequence models. INTERSPEECH, 2017.
|
| 221 |
+
|
| 222 |
+
Ronan Collobert, Christian Puhrsch, and Gabriel Synnaeve. Wav2letter: an end-to-end convnet-based speech recognition system. arXiv preprint arXiv:1609.03193, 2016.
|
| 223 |
+
|
| 224 |
+
Hal Daumé, III, John Langford, and Daniel Marcu. Search-based structured prediction. Mach. Learn. J., 2009.
|
| 225 |
+
|
| 226 |
+
Hal Daumé III and Daniel Marcu. Learning as search optimization: Approximate large margin methods for structured prediction. ICML, 2005.
|
| 227 |
+
|
| 228 |
+
Nan Ding and Radu Soricut. Cold-Start Reinforcement Learning with Softmax Policy Gradient. In Advances in Neural Information Processing Systems, pages 2817–2826, 2017.
|
| 229 |
+
|
| 230 |
+
Sergey Edunov, Myle Ott, Michael Auli, David Grangier, and Marc’Aurelio Ranzato. Classical structured prediction losses for sequence to sequence learning. NAACL, 2018.
|
| 231 |
+
|
| 232 |
+
Maha Elbayad, Laurent Besacier, and Jakob Verbeek. Token-level and sequence-level loss smoothing for rnn language models. ACL, 2018.
|
| 233 |
+
|
| 234 |
+
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional Sequence to Sequence Learning. In arXiv:1705.03122, 2017.
|
| 235 |
+
|
| 236 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 249–256, 2010.
|
| 237 |
+
|
| 238 |
+
James Goodman, Andreas Vlachos, and Jason Naradowsky. Noise reduction and targeted exploration in imitation learning for abstract meaning representation parsing. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pages 1–11, 2016.
|
| 239 |
+
|
| 240 |
+
Alex Graves and Navdeep Jaitly. Towards End-to-End Speech Recognition with Recurrent Neural Networks. ICML, 2014.
|
| 241 |
+
|
| 242 |
+
Hany Hassan, Anthony Aue, Chang Chen, Vishal Chowdhary, Jonathan Clark, Christian Federmann, Xuedong Huang, Marcin Junczys-Dowmunt, William Lewis, Mu Li, et al. Achieving human parity on automatic chinese to english news translation. arXiv:1803.05567, 2018.
|
| 243 |
+
|
| 244 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the Knowledge in a Neural Network. In Neural Information Processing Systems: Workshop Deep Learning and Representation Learning Workshop, 2014.
|
| 245 |
+
|
| 246 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long Short-Term Memory. Neural Comput., 9, 1997.
|
| 247 |
+
|
| 248 |
+
Shigeki Karita, Atsunori Ogawa, Marc Delcroix, and Tomohiro Nakatani. Sequence Training of Encoder-decoder Model Using Policy Gradient for End- To-end Speech Recognition. In ICASSP, 2018.
|
| 249 |
+
|
| 250 |
+
Suyoun Kim, Takaaki Hori, and Shinji Watanabe. Joint CTC-Attention based End-to-End Speech Recognition using Multi-task Learning. ICASSP, 2017.
|
| 251 |
+
|
| 252 |
+
Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, et al. Moses: Open source toolkit for statistical machine translation. Proceedings of the 45th annual meeting of the ACL on interactive poster and demonstration sessions, 2007.
|
| 253 |
+
|
| 254 |
+
Rémi Leblond, Jean-Baptiste Alayrac, Anton Osokin, and Simon Lacoste-Julien. SEARNN: Training RNNs with global-local losses. ICLR, 2018.
|
| 255 |
+
|
| 256 |
+
Vladimir I Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. Soviet Physics Doklady, 10(8):707–710, 1966.
|
| 257 |
+
|
| 258 |
+
Davis Liang, Zhiheng Huang, and Zachary C Lipton. Learning noise-invariant representations for robust speech recognition. arXiv preprint arXiv:1807.06610, 2018.
|
| 259 |
+
|
| 260 |
+
Vitaliy Liptchinsky, Gabriel Synnaeve, and Ronan Collobert. Letter-Based Speech Recognition with Gated ConvNets. In arXiv:1712.09444, 2017.
|
| 261 |
+
|
| 262 |
+
Hairong Liu, Zhenyao Zhu, Xiangang Li, and Sanjeev Satheesh. Gram-CTC: Automatic Unit Selection and Target Decomposition for Sequence Labelling. ICML, 2017.
|
| 263 |
+
|
| 264 |
+
Xuezhe Ma, Pengcheng Yin, Jingzhou Liu, Graham Neubig, and Eduard Hovy. Softmax q-distribution estimation for structured prediction: A theoretical interpretation for raml. arXiv:1705.07136, 2017.
|
| 265 |
+
|
| 266 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 2015.
|
| 267 |
+
|
| 268 |
+
Mohammad Norouzi, Samy Bengio, Zhifeng Chen, Navdeep Jaitly, Mike Schuster, Yonghui Wu, and Dale Schuurmans. Reward Augmented Maximum Likelihood for Neural Structured Prediction. NIPS, 2016.
|
| 269 |
+
|
| 270 |
+
Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pages 5206–5210. IEEE, 2015.
|
| 271 |
+
|
| 272 |
+
Douglas B Paul and Janet M Baker. The design for the wall street journal-based csr corpus. In Proceedings of the workshop on Speech and Natural Language, pages 357–362. Association for Computational Linguistics, 1992.
|
| 273 |
+
|
| 274 |
+
Gabriel Pereyra, George Tucker, Jan Chorowski, Łukasz Kaiser, and Geoffrey Hinton. Regularizing Neural Networks by Penalizing Confident Output Distributions. ICLR Workshop, 2017.
|
| 275 |
+
|
| 276 |
+
Daniel Povey, Arnab Ghoshal, Gilles Boulianne, et al. The Kaldi Speech Recognition Toolkit. ASRU, 2011.
|
| 277 |
+
|
| 278 |
+
Rohit Prabhavalkar, Tara N. Sainath, Yonghui Wu, Patrick Nguyen, Zhifeng Chen, Chung-Cheng Chiu, and Anjuli Kannan. Minimum Word Error Rate Training for Attention-based Sequence-toSequence Models. In ICASSP, 2018.
|
| 279 |
+
|
| 280 |
+
Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence Level Training with Recurrent Neural Networks. ICLR, 2016.
|
| 281 |
+
|
| 282 |
+
Steven J. Rennie, Etienne Marcheret, Youssef Mroueh, Jarret Ross, and Vaibhava Goel. Self-critical Sequence Training for Image Captioning. In CVPR, 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. AISTATS, 2011.
|
| 287 |
+
|
| 288 |
+
Alexander M. Rush, Sumit Chopra, and Jason Weston. A Neural Attention Model for Abstractive Sentence Summarization. In EMNLP, 2015.
|
| 289 |
+
|
| 290 |
+
Andrei A. Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy Distillation. ICLR, 2016.
|
| 291 |
+
|
| 292 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. ACL, 2016.
|
| 293 |
+
|
| 294 |
+
Dmitriy Serdyuk, Nan Rosemary Ke, Alessandro Sordoni, Adam Trischler, Chris Pal, and Yoshua Bengio. Twin Networks: Matching the Future for Sequence Generation. ICLR, 2018.
|
| 295 |
+
|
| 296 |
+
Anuroop Sriram, Heewoo Jun, Sanjeev Satheesh, and Adam Coates. Cold fusion: Training seq2seq models together with language models. In INTERSPEECH, 2018.
|
| 297 |
+
|
| 298 |
+
Wen Sun, Arun Venkatraman, Geoffrey J Gordon, Byron Boots, and J Andrew Bagnell. Deeply aggrevated: Differentiable imitation learning for sequential prediction. arXiv preprint arXiv:1703.01030, 2017.
|
| 299 |
+
|
| 300 |
+
Wen Sun, J Andrew Bagnell, and Byron Boots. Truncated horizon policy search: Combining reinforcement learning & imitation learning. arXiv preprint arXiv:1805.11240, 2018.
|
| 301 |
+
|
| 302 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to Sequence Learning with Neural Networks. NIPS, 2014.
|
| 303 |
+
|
| 304 |
+
Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. MIT Press, 1998.
|
| 305 |
+
|
| 306 |
+
Andros Tjandra, Sakriani Sakti, and Satoshi Nakamura. Sequence-to-Sequence ASR Optimization via Reinforcement Learning. ICASSP, 2018.
|
| 307 |
+
|
| 308 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. NIPS, 2017.
|
| 309 |
+
|
| 310 |
+
Oriol Vinyals, Lukasz Kaiser, Terry Koo, Slav Petrov, Ilya Sutskever, and Geoffrey Hinton. Grammar as a Foreign Language. NIPS, 2015.
|
| 311 |
+
|
| 312 |
+
Xinyi Wang, Hieu Pham, Zihang Dai, and Graham Neubig. Switchout: an efficient data augmentation algorithm for neural machine translation. EMNLP, 2018.
|
| 313 |
+
|
| 314 |
+
Sam Wiseman and Alexander M. Rush. Sequence-to-Sequence Learning as Beam-Search Optimization. EMNLP, 2016.
|
| 315 |
+
|
| 316 |
+
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:1609.08144, 2016.
|
| 317 |
+
|
| 318 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhutdinov, Richard Zemel, and Yoshua Bengio. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. ICML, 2015.
|
| 319 |
+
|
| 320 |
+
Albert Zeyer, Kazuki Irie, Ralf Schlüter, and Hermann Ney. Improved training of end-to-end attention models for speech recognition. arXiv preprint arXiv:1805.03294, 2018.
|
| 321 |
+
|
| 322 |
+
Yu Zhang, William Chan, and Navdeep Jaitly. Very Deep Convolutional Networks for End-to-End Speech Recognition. ICASSP, 2017.
|
| 323 |
+
|
| 324 |
+
Victor Zhong, Caiming Xiong, and Richard Socher. Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning. arXiv:1709.00103, 2017.
|
| 325 |
+
|
| 326 |
+
Procedure 1 EditDistanceQ op returns Q-values of the tokens at each time step based on the minimum edit distance between a reference sequence $r$ and a hypothesis sequence $h$ of length $t$ .
|
| 327 |
+
|
| 328 |
+
<table><tr><td>1: for j in (0..t) do</td><td></td></tr><tr><td>2:</td><td>dj←j+1</td></tr><tr><td>3:</td><td>for i in (1..t) do</td></tr><tr><td>4:</td><td>minDist←i</td></tr><tr><td>5:</td><td>subCost←i-1</td></tr><tr><td>6:</td><td>insCost←i+1</td></tr><tr><td>7:</td><td>for j in (0..t -1) do</td></tr><tr><td>8:</td><td>if hi-1=rj then</td></tr><tr><td>9: 10:</td><td>repCost ←0</td></tr><tr><td>11:</td><td>else repCost ←1</td></tr><tr><td></td><td></td></tr><tr><td>12: 13:</td><td>cheapest ← min(subCost+repCost,dj +1,insCost)</td></tr><tr><td>14:</td><td>subCost ←dj</td></tr><tr><td>15:</td><td>insCost ← cheapest +1</td></tr><tr><td>16:</td><td>dj←cheapest</td></tr><tr><td>17:</td><td>if dj<minDist then minDist ← dj</td></tr><tr><td>18:</td><td></td></tr><tr><td>19:</td><td>if minDist=ithen Qi,r←1</td></tr><tr><td>20:</td><td>for j in (1..t) do</td></tr><tr><td>21:</td><td>if dj = minDist then</td></tr><tr><td>22:</td><td>Qi,rj+1←1</td></tr><tr><td>23:</td><td>for all tokens k do</td></tr><tr><td>24:</td><td>Qi,k ← Qi,k -1-minDist</td></tr></table>
|
| 329 |
+
|
| 330 |
+
# APPENDIX A OCD ALGORITHM
|
| 331 |
+
|
| 332 |
+
Complexity. The total time complexity for calculating the sequence loss using OCD is $O ( T ^ { 2 } + | V | T )$ where $V$ is the vocabulary size and $T$ is the sequence length. MLE loss has a time complexity of $O ( | V | T )$ for calculating the softmax loss at each step. Therefore, assuming that $O ( T ) \leq O ( | V | )$ OCD does not change the time complexity compared to the baseline seq2seq+MLE. The memory cost of the OCD algorithm is $O ( T + | V | T ) = O ( | V | T ) , O ( 2$ for the dynamic programming in line 4 - line 13 of Proc. 1 and $O ( | V | T )$ for storing the stepwise $Q$ values. MLE also stores the one-hot encoding of targets at each step with a cost of $O ( | V | T )$ . Therefore, the memory complexity does not change compared to the MLE baseline either.
|
| 333 |
+
|
| 334 |
+
Although the loss calculation has the same complexity as MLE, online sampling from the model to generate the input of next RNN cell (as in OCD and SS) is generally slower than reading the ground truth (as in MLE). Therefore, overall a naive implementation of OCD is $\leq 2 0 \%$ slower than our baseline MLE in terms of number of step time. However, since OCD is stand alone and can be trained off-policy, we can also train on stale samples and untie the input generation worker from the training workers. In this case it is as fast as the MLE baseline.
|
| 335 |
+
|
| 336 |
+
Run through. As an example of how this algorithm works, consider the sequence “SUNDAY” as reference and “SATURDAY” as hypothesis. Table A.1 first shows how to extract optimal targets and their respective $Q ^ { * }$ -values from the table of edit distances between all prefixes of reference and all prefixes of hypothesis. At each row highlighted cells indicate the prefixes which has minimum edit distance in the row. The next character at these indices are the Optimal targets for that row. At each step the $Q ^ { * }$ -value for the optimal targets is negative of the minimum edit distance and for the non-optimal characters it is one smaller.
|
| 337 |
+
|
| 338 |
+
Table A.1 also illustrates how appending the optimal completions for the prefix “SA” of the hypothesis can lead to the minimum total edit distance. Concatenating with both reference suffixes, “UNDAY”
|
| 339 |
+
|
| 340 |
+
and “NDAY” will result in an edit distance of 1. Therefore, predicting “U” or “N” at step 2 can lead to the maximum attainable reward of $( - 1 )$ .
|
| 341 |
+
|
| 342 |
+
Table A.1: Top: Each row corresponds to a prefix of “SATURDAY” and shows edit distances with all prefixes of “SUNDAY”, along with the optimal targets and their $Q ^ { * }$ -value at that step. The highlighted cells indicate cells with minimum edit distance at each row. Bottom: An example of appending suffixes of “SUNDAY” with minimum edit distance to the prefix “SA”.
|
| 343 |
+
|
| 344 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=7>Edit Distance</td><td rowspan=1 colspan=1>OCD Targets</td><td rowspan=1 colspan=1>Q-values</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>Y</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>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>U,N</td><td rowspan=1 colspan=1>-1</td></tr><tr><td rowspan=1 colspan=1>T</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>U,N,D</td><td rowspan=1 colspan=1>-2</td></tr><tr><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>-2</td></tr><tr><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>N,D</td><td rowspan=1 colspan=1>-3</td></tr><tr><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>-3</td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>Y</td><td rowspan=1 colspan=1>-3</td></tr><tr><td rowspan=1 colspan=1>Y</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1></s></td><td rowspan=1 colspan=1>-3</td></tr></table>
|
| 345 |
+
|
| 346 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>Y</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>+</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Y</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr></table>
|
| 347 |
+
|
| 348 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>Y</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Y</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td></tr></table>
|
| 349 |
+
|
| 350 |
+
# APPENDIX B EXPOSURE BIAS
|
| 351 |
+
|
| 352 |
+
A key limitation of teacher forcing for sequence learning stems from the discrepancy between the training and test objectives. One trains the model using conditional log-likelihood $\mathcal { O } _ { \mathrm { C L L } }$ , but evaluates the quality of the model using empirical reward $\mathcal { O } _ { \mathrm { E R } }$ .
|
| 353 |
+
|
| 354 |
+
Unlike teacher forcing and Scheduled Sampling (SS), policy gradient approaches (e.g. Ranzato et al. (2016); Bahdanau et al. (2017)) and OCD aim to optimize the empirical reward objective (4) on the training set. We illustrate four different training strategies of MLE, SS, Policy Gradient and OCD in Figure B.1. The drawback of policy gradient techniques is twofold: 1) they cannot easily incorporate ground truth sequence information except through the reward function, and 2) they have difficulty reducing the variance of the gradients to perform proper credit assignment. Accordingly, most policy gradient approaches Ranzato et al. (2016); Bahdanau et al. (2017); Wu et al. (2016) pre-train the model using teacher forcing. By contrast, the OCD method proposed in this paper defines an optimal completion policy $\pi _ { t } ^ { * }$ for any off-policy prefix by incorporating the ground truth information. Then, OCD optimizes a token level log-loss and alleviates the credit assignment problem. Finally, training is much more stable, and we do not require initialization nor joint optimization with MLE.
|
| 355 |
+
|
| 356 |
+
There is an intuitive notion of exposure bias Ranzato et al. (2016) discussed in the literature as a limitation of teacher forcing. We formalize this notion as follows. One can think of the optimization of the log loss (3) in an autoregressive models as a classification problem, where the input to the classifier is a tuple $( \mathbf { s } , \mathbf { y } _ { < t } ^ { * } )$ and the correct output is $y _ { i } ^ { * }$ , where $\mathbf { y } _ { < t } ^ { * } \equiv ( y _ { 1 } ^ { * } , \dots , y _ { t - 1 } ^ { * } )$ . Then the training dataset comprises different examples and different prefixes of the ground truth sequence. The key challenge is that once the model is trained, one should not expect the model to generalize to a new prefix $\mathbf { y } _ { < t }$ that does not come from the training distribution of $P ( \mathbf { y } _ { < t } ^ { * } )$ . This problem can become severe as $\mathbf { y } _ { < t }$ becomes more dissimilar to correct prefixes. During inference, when one conducts beam search with a large beam size then one is more likely to discover wrong generalization of $p _ { \theta } ( \hat { y } _ { t } | \hat { \mathbf { y } } _ { < t } , \mathbf { x } )$ , because the sequence is optimized globally. A natural strategy to remedy this issue is to train on arbitrary prefixes. Unlike the aforementioned techniques OCD can train on any prefix given its off-policy nature.
|
| 357 |
+
|
| 358 |
+

|
| 359 |
+
Figure B.1: Illustration of different training strategies for autoregressive sequence models. (a) Teacher Forcing: the model conditions on correct prefixes and is taught to predict the next ground truth token. (b) Scheduled Sampling: the model conditions on tokens either from ground truth or drawn from the model and is taught to predict the next ground truth token regardless. (c) Policy Gradient: the model conditions on prefixes drawn from the model and is encouraged to reinforce sequences with a large sequence reward $R ( \tilde { y } )$ . (d) Optimal Completion Distillation: the model conditions on prefixes drawn from the model and is taught to predict an optimal completion policy $\pi ^ { * }$ specific to the prefix.
|
| 360 |
+
|
| 361 |
+
Figure B.2 illustrates how increasing the beam size for MLE and SS during inference decreases their performance on WSJ datasets to above $1 1 \%$ WER. OCD suffers a degradation in the performance too but it never gets above $1 0 \%$ WER.
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure B.2: Word Error Rate (WER) of WSJ with MLE, SS and OCD for different beam sizes.
|
| 365 |
+
|
| 366 |
+
# APPENDIX C ARCHITECTURE
|
| 367 |
+
|
| 368 |
+
WSJ. The input audio signal is converted into 80-dimensional filterbank features computed every $1 0 \mathrm { m s }$ with delta and delta-delta acceleration, normalized with per-speaker mean and variance generated by Kaldi (Povey et al., 2011). Our encoder uses 2-layers of convolutions with $3 \times 3$ filters, stride $2 \times 2$ and 32 channels, followed by a convolutional LSTM with 1D-convolution of filter width 3, followed by 3 LSTM layers with 256 cell size. We also apply batch-normalization between each layer in the encoder. The attention-based decoder is a 1-layer LSTM with 256 cell size with content-based attention. We use Xavier initializer (Glorot and Bengio, 2010) and train our models for 300 epochs of batch size 8 with 8 async workers. We separately tune the learning rate for our baseline and OCD model, 0.0007 for OCD vs 0.001 for baseline. We apply a single 0.01 drop of learning rate when validation CER plateaus, the same as for our baseline. Both happen around 225 epoch. We implemented our experiments2 in TensorFlow (Abadi et al., 2016).
|
| 369 |
+
|
| 370 |
+
Librispeech. Since the dataset is larger than WSJ, we use a larger batch size of 16, smaller learning rate of 0.0005 for baseline and 0.0003 for OCD. Models are trained for 70 epochs. We remove the convolutional LSTM layers of the encoder, increase the number of LSTM layers in the encoder to 6, and increase the LSTM cell size to 384. All other configs are the same as the WSJ setup.
|
| 371 |
+
|
| 372 |
+
# APPENDIX D HAMMING DISTANCE VS EDIT DISTANCE DURING TRAINING
|
| 373 |
+
|
| 374 |
+
Figure D.3 plots the edit distance on training data of OCD and MLE for fixed hamming distances during training. The plot shows that for a fixed Hamming distance (which is the metric that MLE correlates with more), OCD achieves a lower edit distance compared to MLE. This gives evidence that OCD is indeed optimizing for edit distance as intended.
|
| 375 |
+
|
| 376 |
+

|
| 377 |
+
Figure D.3: WSJ training Character Error Rate (CER) of MLE and OCD over Character Accuracy at different checkpoints during training.
|
md/train/rkQkBnJAb/rkQkBnJAb.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IMPROVING GANS USING OPTIMAL TRANSPORT
|
| 2 |
+
|
| 3 |
+
Tim Salimans∗ OpenAI tim@openai.com
|
| 4 |
+
|
| 5 |
+
Han Zhang∗†
|
| 6 |
+
Rutgers University
|
| 7 |
+
han.zhang@cs.rutgers.edu
|
| 8 |
+
|
| 9 |
+
Alec Radford OpenAI alec@openai.com
|
| 10 |
+
|
| 11 |
+
Dimitris Metaxas Rutgers University dnm@cs.rutgers.edu
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
We present Optimal Transport GAN (OT-GAN), a variant of generative adversarial nets minimizing a new metric measuring the distance between the generator distribution and the data distribution. This metric, which we call mini-batch energy distance, combines optimal transport in primal form with an energy distance defined in an adversarially learned feature space, resulting in a highly discriminative distance function with unbiased mini-batch gradients. Experimentally we show OT-GAN to be highly stable when trained with large mini-batches, and we present state-of-the-art results on several popular benchmark problems for image generation.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Generative modeling is a major sub-field of Machine Learning that studies the problem of how to learn models that generate images, audio, video, text or other data. Applications of generative models include image compression, generating speech from text, planning in reinforcement learning, semi-supervised and unsupervised representation learning, and many others. Since generative models can be trained on unlabeled data, which is almost endlessly available, they have enormous potential in the development of artificial intelligence.
|
| 20 |
+
|
| 21 |
+
The central problem in generative modeling is how to train a generative model such that the distribution of its generated data will match the distribution of the training data. Generative adversarial nets (GANs) represent an advance in solving this problem, using a neural network discriminator or critic to distinguish between generated data and training data. The critic defines a distance between the model distribution and the data distribution which the generative model can optimize to produce data that more closely resembles the training data.
|
| 22 |
+
|
| 23 |
+
A closely related approach to measuring the distance between the distributions of generated data and training data is provided by optimal transport theory. By framing the problem as optimally transporting one set of data points to another, it represents an alternative method of specifying a metric over probability distributions and provides another objective for training generative models. The dual problem of optimal transport is closely related to GANs, as discussed in the next section. However, the primal formulation of optimal transport has the advantage that it allows for closed form solutions and can thus more easily be used to define tractable training objectives that can be evaluated in practice without making approximations. A complication in using primal form optimal transport is that it may give biased gradients when used with mini-batches (see Bellemare et al., 2017) and may therefore be inconsistent as a technique for statistical estimation.
|
| 24 |
+
|
| 25 |
+
In this paper we present OT-GAN, a variant of generative adversarial nets incorporating primal form optimal transport into its critic. We derive and justify our model by defining a new metric over probability distributions, which we call Mini-batch Energy Distance, combining optimal transport in primal form with an energy distance defined in an adversarially learned feature space. This combination results in a highly discriminative metric with unbiased mini-batch gradients.
|
| 26 |
+
|
| 27 |
+
In Section 2 we provide the preliminaries required to understand our work, and we put our contribution into context by discussing the relevant literature. Section 3 presents our main theoretical contribution: Minibatch energy distance. We apply this new distance metric to the problem of learning generative models in Section 4, and show state-of-the-art results in Section 5. Finally, Section 6 concludes by discussing the strengths and weaknesses of the proposed method, as well as directions for future work.
|
| 28 |
+
|
| 29 |
+
# 2 GANS AND OPTIMAL TRANSPORT
|
| 30 |
+
|
| 31 |
+
Generative adversarial nets (Goodfellow et al., 2014) were originally motivated using game theory: A generator $g$ and a discriminator $d$ play a zero-sum game where the generator maps noise $\mathbf { z }$ to simulated images $\mathbf { y } = g ( \mathbf { z } )$ and where the discriminator tries to distinguish the simulated images y from images $\mathbf { x }$ drawn from the distribution of training data $p$ . The discriminator takes in each image $\mathbf { x }$ and y and outputs an estimated probability that the given image is real rather than generated. The discriminator is rewarded for putting high probability on the correct classification, and the generator is rewarded for fooling the discriminator. The goal of training is then to find a pair of $( g , d )$ for which this game is at a Nash equilibrium. At such an equilibrium, the generator minimizes its loss, or negative game value, which can be defined as
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
L _ { g } = \operatorname* { s u p } _ { d } \mathbb { E } _ { \mathbf { x } \sim p } \log [ d ( \mathbf { x } ) ] + \mathbb { E } _ { \mathbf { y } \sim g } \log [ 1 - d ( \mathbf { y } ) ]
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
Arjovsky et al. (2017) re-interpret GANs in the framework of optimal transport theory. Specifically, they propose the Earth-Mover distance or Wasserstein- $^ { l }$ distance as a good objective for generative modeling:
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
D _ { \mathrm { E M D } } ( p , g ) = \operatorname* { i n f } _ { \gamma \in \Pi ( p , g ) } \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim \gamma } c ( \mathbf { x } , \mathbf { y } ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\Pi ( p , g )$ is the set of all joint distributions $\gamma ( \mathbf { x } , \mathbf { y } )$ with marginals $p ( \mathbf { x } ) , g ( \mathbf { y } )$ , and where $c ( \mathbf { x } , \mathbf { y } )$ is a cost function that Arjovsky et al. (2017) take to be the Euclidean distance. If the $p ( \mathbf { x } )$ and $g ( \mathbf { y } )$ distributions are interpreted as piles of earth, the Earth-Mover distance $D _ { \mathrm { E M D } } ( p , g )$ can be interpreted as the minimum amount of “mass” that $\gamma$ has to transport to turn the generator distribution $g ( \mathbf { y } )$ into the data distribution $p ( \mathbf { x } )$ . For the right choice of cost $c$ , this quantity is a metric in the mathematical sense, meaning that $D _ { \mathrm { E M D } } ( p , g ) \geq 0$ and $D _ { \mathrm { E M D } } ( p , g ) = 0$ if and only if $p = g$ . Minimizing the Earth-Mover distance in $g$ is thus a valid method for deriving a statistically consistent estimator of $p$ , provided $p$ is in the model class of our generator $g$ .
|
| 44 |
+
|
| 45 |
+
Unfortunately, the minimization over $\gamma$ in Equation 2 is generally intractable, so Arjovsky et al. (2017) turn to the dual formulation of this optimal transport problem:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
D _ { \mathrm { E M D } } ( p , g ) = \operatorname* { s u p } _ { \| f \| _ { L } \leq 1 } \mathbb { E } _ { \mathbf { x } \sim p } f ( \mathbf { x } ) - \mathbb { E } _ { \mathbf { y } \sim g } f ( \mathbf { y } ) ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where we have replaced the minimization over $\gamma$ with a maximization over the set of 1-Lipschitz functions. This optimization problem is generally still intractable, but Arjovsky et al. (2017) argue that it is well approximated by using the class of neural network GAN discriminators or critics described earlier in place of the class of 1-Lipschitz functions, provided we bound the norm of their gradient with respect to the image input. Making this substitution, the objective becomes quite similar to that of our original GAN formulation in Equation 1.
|
| 52 |
+
|
| 53 |
+
In followup work Gulrajani et al. (2017) propose a different method of bounding the gradients in the class of allowed critics, and provide strong empirical results supporting this interpretation of GANs. In spite of their success, however, we should note that GANs are still only able to solve this optimal transport problem approximately. The optimization with respect to the critic cannot be performed perfectly, and the class of obtainable critics only very roughly corresponds to the class of 1-Lipschitz functions. The connection between GANs and dual form optimal transport is further explored by Bousquet et al. (2017) and Genevay et al. (2017a), who extend the analysis to different optimal transport costs and to a broader model class including latent variables.
|
| 54 |
+
|
| 55 |
+
An alternative approach to generative modeling is chosen by Genevay et al. (2017b) who instead chose to approximate the primal formulation of optimal transport. They start by taking an entropically smoothed generalization of the Earth Mover distance, called the Sinkhorn distance (Cuturi,
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
D _ { \mathrm { S i n k h o r n } } ( p , g ) = \operatorname* { i n f } _ { \gamma \in \Pi _ { \beta } ( p , g ) } \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim \gamma } c ( \mathbf { x } , \mathbf { y } ) ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
where the set of allowed joint distribution $\Pi _ { \beta }$ is now restricted to distributions with entropy of at least some constant $\beta$ . Genevay et al. (2017b) then approximate this distance by evaluating it on mini-batches of data $\mathbf { X } , \mathbf { Y }$ consisting of $K$ data vectors $\mathbf x , \mathbf y$ . The cost function $c$ then gives rise to a $K \times K$ transport cost matrix $C$ , where $C _ { i , j } = c ( \mathbf { x } _ { i } , \mathbf { y } _ { j } )$ tells us how expensive it is to transport the $i$ - th data vector $\mathbf { x } _ { i }$ in mini-batch $\mathbf { X }$ to the $j$ -th data vector $\mathbf { y } _ { j }$ in mini-batch $\mathbf { Y }$ . Similarly, the coupling distribution $\gamma$ is replaced by a $K \times K$ matrix $M$ of soft matchings between these $i , j$ elements, which is restricted to the set of matrices $\mathcal { M }$ with all positive entries, with all rows and columns summing to one, and with sufficient entropy $- \operatorname { T r } [ M \log ( M ^ { \mathrm { T } } ) ] \geq \alpha$ . The resulting distance, evaluated on a minibatch, is then
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
{ \mathcal { W } } _ { c } ( X , Y ) = \operatorname* { i n f } _ { M \in { \mathcal { M } } } \mathrm { T r } [ M C ^ { \mathrm { T } } ] .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
In practice, the minimization over the soft matchings $M$ can be found efficiently on the GPU using the Sinkhorn algorithm. Consequently, Genevay et al. (2017b) call their method of using Equation 5 in generative modeling Sinkhorn AutoDiff.
|
| 68 |
+
|
| 69 |
+
The great advantage of this mini-batch Sinkhorn distance is that it is fully tractable, eliminating the instabilities often experienced with GANs due to imperfect optimization of the critic. However, a disadvantage is that the expectation of Equation 5 over mini-batches is no longer a valid metric over probability distributions. Viewed another way, the gradients of Equation 5, for fixed mini-batch size, are not unbiased estimators of the gradients of our original optimal transport problem in Equation 4. For this reason, Bellemare et al. (2017) propose to instead use the Energy Distance, also called Cramer Distance, as the basis of generative modeling:
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
D _ { \mathrm { E D } } ( p , g ) = \sqrt { 2 \mathbb { E } [ \left\| \mathbf { x } - \mathbf { y } \right\| ] - \mathbb { E } [ \left\| \mathbf { x } - \mathbf { x } ^ { \prime } \right\| ] - \mathbb { E } [ \left\| \mathbf { y } - \mathbf { y } ^ { \prime } \right\| ] } ,
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where $\mathbf { x } , \mathbf { x } ^ { \prime }$ are independent samples from data distribution $p$ and $\mathbf { y } , \mathbf { y } ^ { \prime }$ independent samples from the generator dsitribution $g$ . In Cramer $G A N$ they propose training the generator by minimizing this distance metric, evaluated in a latent space which is learned by the GAN critic.
|
| 76 |
+
|
| 77 |
+
In the next section we propose a new metric for generative modeling, combining the insights of GANs and optimal transport. Although our work was performed concurrently to that by Genevay et al. (2017b) and Bellemare et al. (2017), it can be understood most easily as forming a synthesis of the ideas used in Sinkhorn AutoDiff and Cramer GAN.
|
| 78 |
+
|
| 79 |
+
# 3 MINI-BATCH ENERGY DISTANCE
|
| 80 |
+
|
| 81 |
+
As discussed in the last section, most previous work in generative modeling can be interpreted as minimizing a distance $D ( g , p )$ between a generator distribution $g ( \mathbf { x } )$ and the data distribution $p ( \mathbf { x } )$ , where the distributions are defined over a single vector $\mathbf { x }$ which we here take to be an image. However, in practice deep learning typically works with mini-batches of images $\mathbf { X }$ rather than individual images. For example, a GAN generator is typically implemented as a high dimensional function $G ( \mathbf { Z } )$ that turns a mini-batch of random noise $\mathbf { Z }$ into a mini-batch of images $\mathbf { X }$ , which the GAN discriminator then compares to a mini-batch of images from the training data. The central insight of Mini-batch GAN (Salimans et al., 2016) is that it is strictly more powerful to work with the distributions over mini-batches $g ( \mathbf { X } ) , p ( \mathbf { X } )$ than with the distributions over individual images. Here we further pursue this insight and propose a new distance over mini-batch distributions $\bar { D [ { g ( \mathbf { X } ) , p ( \mathbf { X } ) } ] }$ which we call the Mini-batch Energy Distance. This new distance combines optimal transport in primal form with an energy distance defined in an adversarially learned feature space, resulting in a highly discriminative distance function with unbiased mini-batch gradients.
|
| 82 |
+
|
| 83 |
+
In order to derive our new distance function, we start by generalizing the energy distance given in Equation 6 to general non-Euclidean distance functions $d$ . Doing so gives us the generalized energy distance:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
D _ { \mathtt { G E D } } ( p , g ) = { \sqrt { 2 \mathbb { E } [ d ( \mathbf { X } , \mathbf { Y } ) ] - \mathbb { E } [ d ( \mathbf { X } , \mathbf { X } ^ { \prime } ) ] - \mathbb { E } [ d ( \mathbf { Y } , \mathbf { Y } ^ { \prime } ) ] } } ,
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\mathbf { X } , \mathbf { X } ^ { \prime }$ are independent samples from distribution $p$ and $\mathbf { Y } , \mathbf { Y } ^ { \prime }$ independent samples from $g$ . This distance is typically defined for individual samples, but it is valid for general random objects, including mini-batches like we assume here. The energy distance $D _ { \mathrm { G E D } } ( \bar { p } , g )$ is a metric, in the mathematical sense, as long as the distance function $d$ is a metric (Klebanov et al., 2005). Under this condition, meaning that $d$ satisfies the triangle inequality and several other conditions, we have that $D ( p , g ) \geq 0$ , and $\bar { D } ( p , g ) = 0$ if and only if $p = g$ .
|
| 90 |
+
|
| 91 |
+
Using individual samples $\mathbf x , \mathbf y$ instead of minibatches $\mathbf { X } , \mathbf { Y }$ , Sejdinovic et al. (2013) showed that such generalizations of the energy distance can equivalently be viewed as a form of maximum mean discrepancy, where the MMD kernel $k$ is related to the distance function $d$ by $d ( { \bf x } , { \bf x } ^ { \prime } ) \equiv k ( { \bf x } , { \bf x } ) +$ $k ( \mathbf { x } ^ { \prime } , \mathbf { \bar { x } } ^ { \prime } ) - 2 k ( \mathbf { x } , \mathbf { x } ^ { \prime } )$ . We find the energy distance perspective more intuitive here and follow Cramer GAN in using this perspective instead.
|
| 92 |
+
|
| 93 |
+
We are free to choose any metric $d$ for use in Equation 7, but not all choices will be equally discriminative when used for generative modeling. Here, we choose $d$ to be the entropy-regularized Wasserstein distance, or Sinkhorn distance, as defined for mini-batches in Equation 5. Although the average over mini-batch Sinkhorn distances is not a valid metric over probability distributions $p , g$ , resulting in the biased gradients problem discussed in Section 2, the Sinkhorn distance is a valid metric between individual mini-batches, which is all we require for use inside the generalized energy distance.
|
| 94 |
+
|
| 95 |
+
Putting everything together, we arrive at our final distance function over distributions, which we call the Minibatch Energy Distance. Like with the Cramer distance, we typically work with the squared distance, which we define as
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
D _ { \mathrm { M E D } } ^ { 2 } ( p , g ) = 2 \mathbb { E } [ \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { Y } ) ] - \mathbb { E } [ \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) ] - \mathbb { E } [ \mathcal { W } _ { c } ( \mathbf { Y } , \mathbf { Y } ^ { \prime } ) ] ,
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $\mathbf { X }$ , $\mathbf { X } ^ { \prime }$ are independently sampled mini-batches from distribution $p$ and $\mathbf { Y } , \mathbf { Y } ^ { \prime }$ are independent mini-batches from $g$ . We include the subscript $c$ to make explicit that this distance depends on the choice of transport cost function $c$ , which we will learn adversarially as discussed in Section 4.
|
| 102 |
+
|
| 103 |
+
In comparison with the original Sinkhorn distance (Equation 5 the loss function for training $g$ implied by this metric adds a repulsive term − $\mathbf { \nabla } \cdot \mathcal { W } _ { c } ( \mathbf { Y } , \mathbf { Y } ^ { \prime } )$ to the attractive term ${ \mathcal W } _ { c } ( { \bf X } , { \bf Y } )$ . Like with the energy distance used by Cramer GAN, this is what makes the resulting mini-batch gradients unbiased and the objective statistically consistent. However, unlike the plain energy distance, the mini-batch energy distance $D _ { \mathrm { M E D } } ^ { 2 } ( p , \bar { g } )$ still incorporates the primal form optimal transport of the Sinkhorn distance, which in Section 5 we show leads to much stronger discriminative power and more stable generative modeling.
|
| 104 |
+
|
| 105 |
+
In concurrent work, Genevay et al. (2018) independently propose a very similar loss function to (8), but using a single sample from the data and generator distributions. We obtained best results using two independently sampled minibatches from each distribution.
|
| 106 |
+
|
| 107 |
+
# 4 OPTIMAL TRANSPORT GAN (OT-GAN)
|
| 108 |
+
|
| 109 |
+
In the last section we defined the mini-batch energy distance which we propose using for training generative models. However, we left undefined the transport cost function $c ( \mathbf { x } , \mathbf { y } )$ on which it depends. One possibility would be to choose $c$ to be some fixed function over vectors, like Euclidean distance, but we found this to perform poorly in preliminary experiments. Although minimizing the mini-batch energy distance $\bar { D } _ { M E D } ^ { 2 } ( \bar { p } , g )$ guarantees statistical consistency for simple fixed cost functions $c$ like Euclidean distance, the resulting statistical efficiency is generally poor in high dimensions. This means that there typically exist many bad distributions distributions $g$ for which $D _ { M E D } ^ { 2 } ( p , g )$ is so close to zero that we cannot tell $p$ and $g$ apart without requiring an enormous sample size. To solve this we propose learning the cost function adversarially, so that it can adapt to the generator distribution $g$ and thereby become more discriminative. In practice we implement this by defining $c$ to be the cosine distance between vectors $v _ { \eta } ( \mathbf { x } )$ and $v _ { \eta } ( \mathbf { y } )$ , where $v _ { \eta }$ is a deep neural network that maps the images in our mini-batch into a learned latent space. That is we define the transport cost to be
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
c _ { \eta } ( \mathbf x , \mathbf y ) = 1 - \frac { v _ { \eta } ( \mathbf x ) \cdot v _ { \eta } ( \mathbf y ) } { \| v _ { \eta } ( \mathbf x ) \| _ { 2 } \| v _ { \eta } ( \mathbf y ) \| _ { 2 } } ,
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where we choose $\eta$ to maximize the resulting minibatch energy distance.
|
| 116 |
+
|
| 117 |
+
In practice, training our generative model $g _ { \boldsymbol { \theta } }$ and our adversarial transport cost $c _ { \eta }$ is done by alternating gradient descent as is standard practice in GANs (Goodfellow et al., 2014). Here we choose to update the generator more often than we update our critic. This is contrary to standard practice (e.g. Arjovsky et al., 2017) and ensures our cost function $c$ does not become degenerate. If $c$ were to assign zero transport cost to two non-identical regions in image space, the generator would quickly adjust to take advantage of this. Similar to how a quickly adapting critic controls the generator in standard GANs, this works the other way around in our case. Contrary to standard GANs, our generator has a well defined and statistically consistent training objective even when the critic is not updated, as long as the cost function $c$ is not degenerate. We also investigated forcing $v _ { \eta }$ to be one-to-one by parameterizing it using a RevNet Gomez et al. (2017), thereby ensuring $c$ cannot degenerate, but this proved unnecessary if the generator is updated often enough.
|
| 118 |
+
|
| 119 |
+
Our full training procedure is described in Algorithm 1, and is visually depicted in Figure 1. Here we compute the matching matrix $M$ in ${ \mathcal { W } } _ { c }$ using the Sinkhorn algorithm. Unlike Genevay et al. (2017b) we do not backpropagate through this algorithm. Ignoring the gradient flow through the matchings $M$ is justified by the envelope theorem (see e.g. Carter, 2001): Since $M$ is chosen to minimize ${ \mathcal { W } } _ { c }$ , the gradient of ${ \mathcal { W } } _ { c }$ with respect to this variable is zero (when projected into the allowed space $\mathcal { M }$ ). Algorithm 1 assumes we use standard SGD for optimization, but we are free to use other optimizers. In our experiments we use Adam (Kingma & Ba, 2014).
|
| 120 |
+
|
| 121 |
+
Our algorithm for training generative models can be generalized to include conditional generation of images given some side information $s$ , such as a text-description of the image or a label. When generating an image y we simply draw $s$ from the training data and condition the generator on it. The rest of the algorithm is identical to Algorithm 1 but with $( \mathbf { Y } , S )$ in place of $\mathbf { Y }$ , and similar substitutions for $\breve { \mathbf { X } } , \mathbf { X } ^ { \prime } , \mathbf { Y } ^ { \prime }$ . The full algorithm for conditional generation is detailed in Algorithm 2 in the appendix.
|
| 122 |
+
|
| 123 |
+
Require: $n _ { g e n }$ , the number of iterations of the generator per critic iteration
|
| 124 |
+
Require: $\eta _ { 0 }$ , initial critic parameters. $\theta _ { 0 }$ , initial generator parameters
|
| 125 |
+
1: for $t = 1$ to $N$ do
|
| 126 |
+
2: Sample $\mathbf { X } , \mathbf { X } ^ { \prime }$ two independent mini-batches from real data, and $\mathbf { Y } , \mathbf { Y } ^ { \prime }$ two independent mini-batches from the generated samples
|
| 127 |
+
3: ${ \mathcal { L } } = \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { Y } ) + \mathcal { W } _ { c } ( \mathbf { \tilde { X } } , \mathbf { Y } ^ { \prime } ) + \mathcal { W } _ { c } \mathbf { \tilde { ( X ' , Y ) } } + \mathcal { W } _ { c } ( \mathbf { X } ^ { \prime } , \mathbf { Y } ^ { \prime } ) - 2 \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) - 2 \mathcal { W } _ { c } ( \mathbf { Y } , \mathbf { Y } ^ { \prime } )$
|
| 128 |
+
4: if $t$ mod $n _ { g e n } + 1 = 0$ then
|
| 129 |
+
5: $\eta \eta + \alpha \cdot \nabla _ { \eta } \mathcal { L }$
|
| 130 |
+
6: else
|
| 131 |
+
7: $\theta \theta - \alpha \cdot \nabla _ { \theta } \mathcal { L }$
|
| 132 |
+
8: end if
|
| 133 |
+
9: end for
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 1: Illustration of OT-GAN. Mini-batches from the generator and training data are embedded into a learned feature space via the critic. A transport cost matrix is calculated between the two mini-batches of features. Soft matching aligns features across mini-batches and aligned features are compared. The figure only illustrates the distance calculation between one pair of mini-batches whereas several are computed.
|
| 137 |
+
|
| 138 |
+
# 5 EXPERIMENTS
|
| 139 |
+
|
| 140 |
+
In this section, we demonstrate the improved stability and consistency of the proposed method on five different datasets with increasing complexity.
|
| 141 |
+
|
| 142 |
+
# 5.1 MIXTURE OF GAUSSIAN DATASET
|
| 143 |
+
|
| 144 |
+
One advantage of OT-GAN compared to regular GAN is that for any setting of the transport cost $c$ , i.e. any fixed critic, the objective is statistically consistent for training the generator $g$ . Even if we stop updating the critic, the generator should thus never diverge. With a bad fixed cost function $c$ the signal for learning $g$ may be very weak, but at least it should never point in the wrong direction. We investigate whether this theoretical property holds in practice by examining a simple toy example. We train generative models using different types of GAN on a 2D mixture of 8 Gaussians, with means arranged on a circle. The goal for the generator is to recover all 8 modes. For the proposed method and all the baseline methods, the architectures are simple MLPs with ReLU activations. A similar experimental setting has been considered in (Metz et al., 2017; Li et al., 2017) to demonstrate the mode coverage behavior of various GAN models. There, GANs using mini-batch features, DAN-S (Li et al., 2017), are shown to capture all the 8 modes when training converges. To test the consistency of GAN models, we stop updating the discriminator after $1 5 \mathrm { k }$ iterations and visualize the generator distribution for an additional 25K iterations. As shown in Figure 2, mode collapse occurs in a mini-batch feature GAN after a few thousand iterations training with a fixed discriminator. However, using the mini-batch energy distance, the generator does not diverge and the generated samples still cover all 8 modes of the data.
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 2: Results for consistency when fixing the critic on data generated from 8 Gaussian mixtures. The first column shows the data distribution. The top row shows the training results of OT-GAN using mini-batch energy distance. The bottom row shows the training result with the original GAN loss (DAN-S). The latter collapses to 3 out of 8 modes after fixing the discriminator, while OT-GAN remains consistent.
|
| 148 |
+
|
| 149 |
+
# 5.2 CIFAR-10
|
| 150 |
+
|
| 151 |
+
CIFAR-10 is a well-studied dataset of $3 2 \times 3 2$ color images for generative models (Krizhevsky, 2009). We use this data set to investigate the importance of the different design decisions made with OT-GAN, and we compare the visual quality of its generated samples with other state-of-theart GAN models. Our model and the other reported results are trained in an unsupervised manner. We choose “inception score” (Salimans et al., 2016) as numerical assessment to compare the visual quality of samples generated by different models. Our generator and critic are standard convnets, similar to those used by DCGAN (Radford et al., 2015), but without any batch normalization, layer normalization, or other stabilizing additions. Appendix B contains additional architecture and training details.
|
| 152 |
+
|
| 153 |
+
We first investigate the effect of batch size on training stability and sample quality. As shown in Figure 3, training is not very stable when the batch size is small (i.e. 200). As batch size increases, training becomes more stable and the inception score of samples increases. Unlike previous methods, our objective (the minibatch energy distance, Section 3) depends on the chosen minibatch size: Larger minibatches are more likely to cover many modes of the data distribution, thereby not only yielding lower variance estimates but also making our distance metric more discriminative. To reach the large batch sizes needed for optimal performance we make use of multi GPU training. In this work we only use up to 8 GPUs per experiment, but we anticipate more GPUs to be useful when using larger models.
|
| 154 |
+
|
| 155 |
+
In Figure 4 we present the samples generated by our model trained with a batch size of 8000. In addition, we also compare with the sample quality of other state-of-the-art GAN models in Table 1. OT-GAN achieves a score of $8 . 4 7 \pm . 1 2$ , outperforming all baseline models.
|
| 156 |
+
|
| 157 |
+
To evaluate the importance of using optimal transport in OT-GAN, we repeat our CIFAR-10 experiment with random matching of samples. Our minibatch energy distance objective remains valid when we match samples randomly rather than using optimal transport. In this case the minibatch energy distance reduces to the regular (generalized) energy distance. We repeat our CIFAR-10 experiment and train a generator with the same architecture and hyperparameters as above, but with random matching of samples instead of optimal transport. The highest resulting Inception score achieved during the training process is 4.64 using this approach, as compared to 8.47 with optimal transport. Figure 5 shows a random sample from the resulting model.
|
| 158 |
+
|
| 159 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Inception score</td></tr><tr><td rowspan=1 colspan=1>Real Data</td><td rowspan=1 colspan=1>11.95 ± .12</td></tr><tr><td rowspan=1 colspan=1>DCGAN</td><td rowspan=1 colspan=1>6.16±.07</td></tr><tr><td rowspan=1 colspan=1>Improved GAN</td><td rowspan=1 colspan=1>6.86±.06</td></tr><tr><td rowspan=1 colspan=1>DenoisingFM</td><td rowspan=1 colspan=1>7.72±.13</td></tr><tr><td rowspan=1 colspan=1>WGAN-GP</td><td rowspan=1 colspan=1>7.86± .07</td></tr><tr><td rowspan=1 colspan=1>OT-GAN</td><td rowspan=1 colspan=1>8.47±.12</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Table 1: Inception scores on CIFAR-10. All the models are trained in an unsupervised manner.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 3: CIFAR-10 inception score over the course of training for different batch sizes.
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
Figure 4: Samples generated by OT-GAN on CIFAR-10, without using labels.
|
| 168 |
+
|
| 169 |
+

|
| 170 |
+
Figure 5: Samples generated without using optimal transport.
|
| 171 |
+
|
| 172 |
+
# 5.3 IMAGENET DOGS
|
| 173 |
+
|
| 174 |
+
To illustrate the ability of OT-GAN in generating high quality images on more complex data sets, we train OT-GAN to generate $1 2 8 \times 1 2 8$ images on the dog subset of ImageNet (Russakovsky et al., 2015). A smaller batch size of 2048 is used due to GPU memory contraints. As shown in Figure 6, the samples generated by OT-GAN contain less nonsensical images, and the sample quality is significantly better than that of a tuned DCGAN variant which still suffers from mode collapse. The superior image quality is confirmed by the inception score achieved by OT-GAN $( 8 . 9 7 { \scriptstyle \pm 0 . 0 9 } )$ on this dataset, which outperforms that of DCGAN(8.19±0.11)
|
| 175 |
+
|
| 176 |
+

|
| 177 |
+
Figure 6: ImageNet Dog subset samples generated by OT-GAN (left) and DCGAN (right).
|
| 178 |
+
|
| 179 |
+
# 5.4 CONDITIONAL GENERATION OF BIRDS
|
| 180 |
+
|
| 181 |
+
To further demonstrate the effectiveness of the proposed method on conditional image synthesis, we compare OT-GAN with state-of-the-art models on text-to-image generation (Reed et al., 2016b;a; Zhang et al., 2017). As shown in Table 2, the images generated by OT-GAN with batch size 2048 also achieve the best inception score here. Example images generated by our conditional generative model on the CUB test set are presented in Figure 7.
|
| 182 |
+
|
| 183 |
+
Table 2: Inception scores by state-of-the-art methods (Reed et al., 2016b;a; Zhang et al., 2017) and the proposed OT-GAN on the CUB test set. Higher inception scores mean better image quality.
|
| 184 |
+
|
| 185 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>GAN-INT-CLS</td><td rowspan=1 colspan=1>GAWWN</td><td rowspan=1 colspan=1>StackGAN</td><td rowspan=1 colspan=1>OT-GAN</td></tr><tr><td rowspan=1 colspan=1>Inception Score</td><td rowspan=1 colspan=1>2.88± .04</td><td rowspan=1 colspan=1>3.62 ± .07</td><td rowspan=1 colspan=1>3.70±.04</td><td rowspan=1 colspan=1>3.84 ± .05</td></tr></table>
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 7: Bird example images generated by conditional OT-GAN
|
| 189 |
+
|
| 190 |
+
# 6 DISCUSSION
|
| 191 |
+
|
| 192 |
+
We have presented OT-GAN, a new variant of GANs where the generator is trained to minimize a novel distance metric over probability distributions. This metric, which we call mini-batch energy distance, combines optimal transport in primal form with an energy distance defined in an adversarially learned feature space, resulting in a highly discriminative distance function with unbiased mini-batch gradients. OT-GAN was shown to be uniquely stable when trained with large mini-batches and to achieve state-of-the-art results on several common benchmarks.
|
| 193 |
+
|
| 194 |
+
One downside of OT-GAN, as currently proposed, is that it requires large amounts of computation and memory. We achieve the best results when using very large mini-batches, which increases the time required for each update of the parameters. All experiments in this paper, except for the mixture of Gaussians toy example, were performed using 8 GPUs and trained for several days. In future work we hope to make the method more computationally efficient, as well as to scale up our approach to multi-machine training to enable generation of even more challenging and high resolution image data sets.
|
| 195 |
+
|
| 196 |
+
A unique property of OT-GAN is that the mini-batch energy distance remains a valid training objective even when we stop training the critic. Our implementation of OT-GAN updates the generative model more often than the critic, where GANs typically do this the other way around (see e.g. Gulrajani et al., 2017). As a result we learn a relatively stable transport cost function $c ( \mathbf { x } , \mathbf { y } )$ , describing how (dis)similar two images are, as well as an image embedding function $v _ { \eta } ( \mathbf { x } )$ capturing the geometry of the training data. Preliminary experiments suggest these learned functions can be used successfully for unsupervised learning and other applications, which we plan to investigate further in future work.
|
| 197 |
+
|
| 198 |
+
# REFERENCES
|
| 199 |
+
|
| 200 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
|
| 201 |
+
Marc G Bellemare, Ivo Danihelka, Will Dabney, Shakir Mohamed, Balaji Lakshminarayanan, Stephan Hoyer, and Remi Munos. The cramer distance as a solution to biased wasserstein gradients. ´ arXiv preprint arXiv:1705.10743, 2017.
|
| 202 |
+
Olivier Bousquet, Sylvain Gelly, Ilya Tolstikhin, Carl-Johann Simon-Gabriel, and Bernhard Schoelkopf. From optimal transport to generative modeling: the vegan cookbook. arXiv preprint arXiv:1705.07642, 2017.
|
| 203 |
+
Michael Carter. Foundations of mathematical economics. MIT Press, 2001.
|
| 204 |
+
Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, pp. 2292–2300, 2013.
|
| 205 |
+
Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. arXiv preprint arXiv:1612.08083, 2016.
|
| 206 |
+
Aude Genevay, Gabriel Peyre, and Marco Cuturi. Gan and vae from an optimal transport point of view. ´ arXiv preprint arXiv:1706.01807, 2017a.
|
| 207 |
+
Aude Genevay, Gabriel Peyre, and Marco Cuturi. Sinkhorn-autodiff: Tractable wasserstein learning of genera- ´ tive models. arXiv preprint arXiv:1706.00292, 2017b.
|
| 208 |
+
Aude Genevay, Gabriel Peyre, and Marco Cuturi. Learning generative models with sinkhorn divergences. ´ AISTATS Proceedings, 2018.
|
| 209 |
+
Aidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. In Advances in Neural Information Processing Systems, pp. 2211– 2221, 2017.
|
| 210 |
+
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.
|
| 211 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
|
| 212 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 213 |
+
Lev Borisovich Klebanov, Viktor Benes, and Ivan Saxl. ˇ N-distances and their applications. Charles University in Prague, the Karolinum Press, 2005.
|
| 214 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
|
| 215 |
+
Chengtao Li, David Alvarez-Melis, Keyulu Xu, Stefanie Jegelka, and Suvrit Sra. Distributional adversarial networks. arXiv:1706.09549, 2017.
|
| 216 |
+
Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. In ICLR, 2017.
|
| 217 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
|
| 218 |
+
Scott Reed, Zeynep Akata, Santosh Mohan, Samuel Tenka, Bernt Schiele, and Honglak Lee. Learning what and where to draw. In NIPS, 2016a.
|
| 219 |
+
Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text-to-image synthesis. In ICML, 2016b.
|
| 220 |
+
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.
|
| 221 |
+
Tim Salimans and Diederik 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.
|
| 222 |
+
Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016.
|
| 223 |
+
Dino Sejdinovic, Bharath Sriperumbudur, Arthur Gretton, and Kenji Fukumizu. Equivalence of distance-based and rkhs-based statistics in hypothesis testing. The Annals of Statistics, pp. 2263–2291, 2013.
|
| 224 |
+
Wenling Shang, Kihyuk Sohn, Diogo Almeida, and Honglak Lee. Understanding and improving convolutional neural networks via concatenated rectified linear units. In International Conference on Machine Learning, pp. 2217–2225, 2016.
|
| 225 |
+
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. In ICCV, 2017.
|
| 226 |
+
|
| 227 |
+
A CONDITIONAL GENERATION
|
| 228 |
+
|
| 229 |
+
Algorithm 2 Conditional Optimal Transport GAN (OT-GAN) training algorithm with step size α, using minibatch SGD for simplicity
|
| 230 |
+
|
| 231 |
+
Require: $n _ { g e n }$ , the number of iterations of the generator per critic iteration
|
| 232 |
+
Require: $\eta _ { 0 }$ , initial critic parameters. $\theta _ { 0 }$ , initial generator parameters
|
| 233 |
+
1: for $t = 1$ to $N$ do
|
| 234 |
+
2: Sample $( \mathbf { X } , S )$ , $( \mathbf { X } ^ { \prime } , S ^ { \prime } )$ two independent mini-batches from real data, with side information, and $( \mathbf { Y } , S ) , ( \mathbf { Y } ^ { \prime } , S ^ { \prime } )$ two independent mini-batches from the generator, re-using the same side information
|
| 235 |
+
3: $\begin{array} { r l r } { \mathcal { L } } & { { } = } & { \mathcal { W } _ { c } [ ( { \bf X } , S ) , ( { \bf Y } ^ { \prime } , S ^ { \prime } ) ] ~ + ~ \mathcal { W } _ { c } [ ( { \bf X } ^ { \prime } , S ^ { \prime } ) , ( { \bf Y } , S ) ] ~ - ~ \mathcal { W } _ { c } [ ( { \bf X } , S ) , ( { \bf X } ^ { \prime } , S ^ { \prime } ) ] ~ - ~ \mathcal { W } _ { c } [ ( { \bf X } , S ) , ( { \bf X } ^ { \prime } , S ^ { \prime } ) ] ~ } \end{array}$ $\mathcal { W } _ { c } [ ( \mathbf { Y } , S ) , ( \mathbf { Y } ^ { \prime } , S ^ { \prime } ) ]$
|
| 236 |
+
4: if $t$ mod $n _ { g e n } + 1 = 0$ then
|
| 237 |
+
5: $\eta \eta + \alpha \cdot \nabla _ { \eta } \mathcal { L }$
|
| 238 |
+
6: else
|
| 239 |
+
7: $\theta \theta - \alpha \cdot \nabla _ { \theta } \mathcal { L }$
|
| 240 |
+
8: end if
|
| 241 |
+
9: end for
|
| 242 |
+
|
| 243 |
+
# B CIFAR-10 ARCHITECTURE AND TRAINING DETAILS
|
| 244 |
+
|
| 245 |
+
The generator and critic are implemented as convolutional networks. Their architectures are loosely based on DCGAN with various modifications. Weight normalization and data-dependent initialization (Salimans & Kingma, 2016) are used for both. The generator maps latent codes sampled from a 100 dimensional uniform distribution between $^ { - 1 }$ and 1 to $3 2 \times 3 2$ color images. The main module of the generator is a $2 \mathbf { x } 2$ nearest-neighbor upsampling operation followed by a convolution with a $5 \times 5$ kernel using gated linear units (Dauphin et al., 2016). The main module of the critic is a convolution with a $5 \times 5$ kernel and stride 2 using the concatenated ReLU activation function (Shang et al., 2016). Notably, the generator and critic do not use an activation normalization technique such as batch or layer normalization. We train the model using Adam with a learning rate of $3 \times 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We update the generator 3 times for every critic update. OT-GAN includes two additional hyperparameters for the Sinkhorn algorithm, the number of iterations to run the algorithm and $\textstyle { \frac { 1 } { \lambda } }$ which is the entropy penalty of alignments. Initial tuning found a value of 500 to work well for both.
|
| 246 |
+
|
| 247 |
+
Table 3: Generator architecture for CIFAR-10.
|
| 248 |
+
|
| 249 |
+
<table><tr><td>operation</td><td>activation</td><td>kernel</td><td>stride</td><td>output shape</td></tr><tr><td rowspan="5">Z linear reshape 2x NN upsample convolution 2x NN upsample convolution</td><td>GLU</td><td></td><td></td><td>100 16384</td></tr><tr><td></td><td></td><td></td><td>1024×4×4</td></tr><tr><td>GLU</td><td>5×5</td><td>1</td><td>1024×8×8 512×8×8</td></tr><tr><td></td><td></td><td></td><td>512 ×16 × 16</td></tr><tr><td>GLU</td><td>5×5</td><td>1</td><td>256×1 16 ×16</td></tr><tr><td>2x NN upsample</td><td></td><td></td><td></td><td>256 × 32 × 32</td></tr><tr><td>convolution</td><td>GLU</td><td>5×5</td><td>1</td><td>128 × 32 × 32</td></tr><tr><td>convolution</td><td>tanh</td><td>5×5</td><td>1</td><td>3 × 32× 32</td></tr></table>
|
| 250 |
+
|
| 251 |
+
Table 4: Critic architecture for CIFAR-10.
|
| 252 |
+
|
| 253 |
+
<table><tr><td rowspan=1 colspan=1>operation</td><td rowspan=1 colspan=2>activation</td><td rowspan=1 colspan=1>kernel</td><td rowspan=1 colspan=1>stride</td><td rowspan=1 colspan=1> output shape</td></tr><tr><td rowspan=1 colspan=1>convolution</td><td rowspan=1 colspan=2>CReLU</td><td rowspan=1 colspan=1>5×5</td><td rowspan=1 colspan=1>1</td><td rowspan=5 colspan=1>256× 32×32512 ×16×161024×8×82048×4×43276832768</td></tr><tr><td rowspan=4 colspan=1>convolutionconvolutionconvolutionreshape12 normalize</td><td rowspan=3 colspan=2>CReLUCReLUCReLU</td><td rowspan=1 colspan=1>5×5</td><td rowspan=4 colspan=1>222</td></tr><tr><td rowspan=2 colspan=1>5×55×5</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td></tr></table>
|
| 254 |
+
|
| 255 |
+
# C ADVERSARIALLY LEARNING THE TRANSPORT COST FUNCTION
|
| 256 |
+
|
| 257 |
+
To illustrate the importance of learning the transport cost function adversarially, we repeat our CIFAR-10 experiment using cosine distance defined in the original feature space:
|
| 258 |
+
|
| 259 |
+
$$
|
| 260 |
+
c ( \mathbf { x } , \mathbf { y } ) = 1 - { \frac { \mathbf { x } \cdot \mathbf { y } } { \| \mathbf { x } \| _ { 2 } \| \mathbf { y } \| _ { 2 } } } ,
|
| 261 |
+
$$
|
| 262 |
+
|
| 263 |
+
where x, y are original image pixel values. In this case, only the transport cost function is a fixed distance function, but all the rest experiment settings are the same as those of OT-GAN. The highest inception score during the training process is 4.93, as compared to 8.47 when learning cost function adversarially using another neural network. The generated samples are shown in Figure 8.
|
| 264 |
+
|
| 265 |
+

|
| 266 |
+
Figure 8: CIFAR-10 Samples generated without adversarially learning the cost function.
|
| 267 |
+
|
| 268 |
+
# D MODEL COLLAPSE AND SAMPLE DIVERSITY
|
| 269 |
+
|
| 270 |
+
To further investigate sample diversity and mode collapse in GANs, we train the same generator using DCGAN and OT-GAN on the Imagenet dog data set for a large number of epochs. For DCGAN we observe mode collapse starting to occur after about 900 epochs, as indicated in figure 9. The model does not recover from this if we continue training. We have observed similar behavior for many other types of GAN. For OT-GAN we continued to train for 13000 epochs on this data set but never observed any mode collapse or reduction in sample diversity.
|
| 271 |
+
|
| 272 |
+

|
| 273 |
+
Figure 9: Imagenet dog samples generated with DCGAN (left) after 900 epochs and OT-GAN (right) after 13000 epochs. When training long enough, DCGAN suffers from mode collapse as indicated by the highlighted samples. We did not observe any mode collapse for OT-GAN, even when training for many more epochs.
|
md/train/rkQu4Wb0Z/rkQu4Wb0Z.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DNN REPRESENTATIONS AS CODEWORDS:MANIPULATING STATISTICAL PROPERTIES V I APENALTY REGULARIZATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Performance of Deep Neural Network (DNN) heavily depends on the characteristics of hidden layer representations. Unlike the codewords of channel coding, however, the representations of learning cannot be directly designed or controlled. Therefore, we develop a family of penalty regularizers where each one aims to affect one of the representation’s statistical properties such as sparsity, variance, or covariance. The regularizers are extended to perform class-wise regularization, and the extension is found to provide an outstanding shaping capability. A variety of statistical properties are investigated for ten different regularization strategies including dropout and batch normalization, and several interesting findings are reported. Using the family of regularizers, performance improvements are confirmed for MNIST, CIFAR-100, and CIFAR-10 classification problems. But more importantly, our results suggest that understanding how to manipulate statistical properties of representations can be an important step toward understanding DNN, and that the role and effect of DNN regularizers need to be reconsidered.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
With a Deep Neural Network (DNN), information contained in the input data $x$ is transformed into multiple representations over multiple layers. Performance of machine learning tasks is known to heavily depend on the choice of representations over $p ( x )$ , but $p ( x )$ is almost always unknown and the representations cannot be directly controlled to match an arbitrary design even if $p ( x )$ was known. As of today, the best that can be done is to indirectly affect the representations by adding constraints, modifying cost function, and tuning learning process, etc.
|
| 12 |
+
|
| 13 |
+
In Shannon’s information theory, channel coding theory deals with the problem of reliably sending the maximum amount of information through a given channel $p ( y | x )$ (Cover & Thomas, 2012). Because the channel is known and fixed, coding becomes a design problem where one needs to design codebook, encoder, and decoder. Usually, the channel is used $n$ times in a sequence to send a codeword of length $n$ (expressed as $x ^ { n }$ ). A codebook is a collection of all codewords that can be chosen and sent to the channel, and each message $w$ with information of interest is mapped into one of the codewords during the design phase.
|
| 14 |
+
|
| 15 |
+
Because channel coding is a design problem, the optimal solutions are well understood for some of the important applications such as Gaussian channel and Binary Symmetric Channel (BSC). Gaussian channel is the most important continuous alphabet channel problem. It assumes that the received signal $y ^ { n }$ is a noisy version of $x ^ { n }$ , where the noise is independent of $x$ and additive with an i.i.d. Gaussian distribution over the $n$ symbols. Surprisingly, when $n \to \infty$ , the optimal codebook turns out to be a collection of codewords that are generated by randomly drawing numbers from a Gaussian distribution. Then, a codeword’s $n$ symbols form an i.i.d. Gaussian distribution (for instance, see Chap. 9 of Cover & Thomas (2012)). BSC is one of the most popular discrete alphabet channel problems, and $x$ can take a value of 0 or 1. The received signal $y$ is a corrupted version of $x$ where it is flipped with a fixed probability. For BSC, Hamming code is a well-known solution where redundant bits are included in $x ^ { n }$ to resist the corruption (for instance, see Chap. 7 of Cover & Thomas (2012)). The correction capability is dependent on the minimum Hamming distance among all pairs of two different codewords.
|
| 16 |
+
|
| 17 |
+
It would be helpful if the elegant channel coding theories can be applied to the design and control of DNN representation, but unfortunately the representation problem is clearly different from the channel coding problem. First of all, a learning problem does not have a fixed and known channel $p ( y ^ { n } | x ^ { n } )$ . Secondly, we can design and control the DNN model to use, but we do not have the luxury of explicitly designing codebook. Therefore, the representations can be formed in any way that is possible.
|
| 18 |
+
|
| 19 |
+
Nonetheless, we can attempt to gain insights and ideas from the established coding theory. In this work, we first recognize that the optimal solution to Gaussian channel problem has i.i.d. Gaussian codewords. Although it is unclear if forcing representations of a layer to have an i.i.d. Gaussian property will be helpful, we experiment the idea by expanding known penalty regularization strategies to include L1, variance, and covariance. L1 and covariance (Cogswell et al., 2016) have been studied before (individually), but with our best knowledge, variance of a unit (neuron) and using a combination of them have not been considered in the literature. Secondly, we recognize that only a single codeword is assigned to a message (label for learning problems) for a well designed codebook. When this idea is applied to learning problems via penalty regularization, the penalty term needs to be applied per-class such that we can shape the codeword of each label. Note that almost all of the existing penalty regularization strategies have been applied to all classes together. Thirdly, we recognize that Gaussian codebook and Hamming codebook are fundamentally different. A Gaussian codebook uses continuous alphabets in an uncorrelated manner over $n$ symbols, but Hamming codebook uses only binary values (0 and 1). With the difference, it is inevitable for Gaussian code to utilize long codewords (very large $n$ ) and probabilistically guarantee pair-wise distance, while it is essential for Hamming code to utilize carefully designed vector-space structures (orthogonality, null space, etc.) using relatively short codewords. Because we are often interested in a relatively small number of neurons for representations, we consider a regularization strategy where each label’s activation for a unit is ‘hardened’ (by cw-VR regularizer that is introduced later) such that the representation vector is closer to a binary codeword than an i.i.d. Gaussian codeword.
|
| 20 |
+
|
| 21 |
+
# 1.1 RELATED WORKS
|
| 22 |
+
|
| 23 |
+
# Regularization
|
| 24 |
+
|
| 25 |
+
The classical regularizers apply L2 (Hoerl & Kennard, 1970) and L1 (Tibshirani, 1996) penalties to the weights of models, and they are widely used for DNN as well. Wen et al. (2016) extended L1 regularizer by using group lasso to regularize the structures of DNN (i.e., filters, channels, filter shapes, and layer depth). Regularization has been applied to representations, too. Srivastava et al. (2014) devised dropout that randomly applies activation masking over the neurons. While dropout is applied in a multiplicative manner, Glorot et al. (2011) used L1 penalty regularization on the activations to encourage sparse representations. XCov proposed by Cheung et al. (2014) minimizes the covariance between autoencoding units and label encoding units of the same layer such that representations can be disentangled. DeCov, developed by Cogswell et al. (2016), is also a penalty regularizer and it minimizes the off-diagonals of a layer’s representation covariance matrix. DeCov reduces co-adaptation of units by encouraging units to be decorrelated. It is called CR (Covariance Regularizer) in this study for consistent naming. Statistics over mini-batch samples or in-layer activations have been used for regularization, too. Batch normalization proposed by Ioffe & Szegedy (2015) exploits mini-batch statistics to normalize activations. It was developed to accelerate training speed by preventing internal covariate shift, but it was also found to be a useful regularizer. In line with batch normalization, weight normalization, developed by Salimans & Kingma (2016), uses mini-batch statistics to normalize weight vectors. Layer normalization proposed by Ba et al. (2016) is a RNN version of batch normalization, where they compute the mean and variance used for normalization from all of the summed inputs to the neurons in a layer on a single training case. There are many other publications on DNN regularization techniques, but we still do not have a sufficient understanding on how they really work. A recent work by Zhang et al. (2016) shows that the traditional concept of controlling generalization error by regularizing the effective capacity cannot be applied to DNN.
|
| 26 |
+
|
| 27 |
+
# Class-wise Learning
|
| 28 |
+
|
| 29 |
+
True class information is available for supervised learning problems. Traditionally, the class information has been used only for evaluating the correctness of predictions and the relevant cost function terms. Some of the recent works, however, have adopted the class-wise concept in the learning algorithm itself. In those works, class information is used as a switch or for emphasizing the discriminative aspects over different classes. As an example, Li et al. (2008) proposed a kernel learning method using class-wise information to model the manifold structure. They modify locality preserving projection to be class dependent. Jiang et al. (2011) added label consistent regularizers for learning a discriminative dictionary. As for DNN, a recent work by Liao et al. (2016) used a clustering based regularization that encourages parsimonious representations. In their work, similar representations in sample, spatial, and channel dimensions are clustered and used for regularization such that similar representations are encouraged to become even more similar. While their work can be applied to unsupervised as well as supervised problems, our work utilizes a much simpler method of directly using class labels during training to avoid $\mathbf { k }$ -means like clustering. Another recent work by Belharbi et al. (2017) directly uses class labels to encourage similar representations per class as in our work. Their work, however, is based on sum of pair-wise distances among the mini-batch samples of the same labels, and therefore computationally more demanding. The cw-VR (classwise Variance Regularizer) and cw-CR (class-wise Covariance Regularizer) in this work are very simple penalty regularizers that were designed for the purpose of controlling statistical properties of representations.
|
| 30 |
+
|
| 31 |
+
# 2 THREE STATISTICAL PROPERTIES AND CLASS-WISE REGULARIZATION
|
| 32 |
+
|
| 33 |
+
For channel coding problems, we can characterize the statistical properties of optimal codewords as discussed in Section 1. Our goal is to make DNN representation vectors to have such statistical properties and analyze their effects. Because an explicit design and control of representation vector is not possible for the learning problems, we utilize penalty regularizers to manipulate the statistical properties instead.
|
| 34 |
+
|
| 35 |
+
# 2.1 THREE STATISTICAL PROPERTIES
|
| 36 |
+
|
| 37 |
+
Three of the most basic statistical properties are considered in this work - sparsity, variance, and covariance. Sparsity over layer $l$ ’s representation vector $\mathbf { h } _ { l }$ has been extensively studied in the literature. For variance, we are referring to the variance of a unit’s activation values over mini-batch samples. When the variance is forced to be very small, the activation value needs to be close to the sample mean for all labels, and therefore the unit loses its discriminative power over multiple labels. While this is undesirable, regularizing variance turns out to be meaningful because the cross-entropy cost function prevents the variance becoming zero, and a healthy compromise can be achieved between cross-entropy and variance terms. This is similar to the situation of classic weight regularization, where the weights actually never become zero by regularization. For covariance, we calculate pair-wise covariance over the unit activations of a layer. When covariance is evaluated to be large for a pair of units (neurons) in the same layer, it indicates that the two are strongly correlated. This is undesirable if we are pursuing i.i.d. property over unit activations, and having a regularizer to control the level of correlation can be useful.
|
| 38 |
+
|
| 39 |
+
# 2.2 CLASS-WISE REGULARIZATION
|
| 40 |
+
|
| 41 |
+
To pursue statistical properties for each class, we adopt the concept of class-wise learning.
|
| 42 |
+
|
| 43 |
+
For instance, it is undesirable if the variance becomes exactly zero for a unit’s activation as mentioned above. Variance of zero for a class, however, can be desirable because it simply states that a consistent activation value will be observed over all samples with the same class label. Note that overall variance over all labels can be still large while class-wise variance is zero - as long as interclass difference exists, the overall variance will not be zero. We combine this concept of class-wise regularization to the three concepts of sparsity, variance, and covariance. Analytical formulations can be found in the following section.
|
| 44 |
+
|
| 45 |
+
# 3 PENALTY LOSS FUNCTIONS
|
| 46 |
+
|
| 47 |
+
In this section, we provide the model for calculating basic statistics and formulate the penalty loss functions that are used for regularization.
|
| 48 |
+
|
| 49 |
+
# 3.1 BASIC STATISTICS
|
| 50 |
+
|
| 51 |
+
For layer $l$ , the output activation vector of a linear filter followed by ReLU is defined as $\mathbf { h } _ { l } \ =$ $\mathrm { m a x } ( \bar { \mathbf { W } } _ { l } ^ { \top } \mathbf { h } _ { l - 1 } + \mathbf { b } _ { l } ^ { \top } , 0 )$ . Because we will be focusing on layer $l$ for most of the explanations, we drop the layer index and $\mathbf { h }$ is used to indicate $\mathbf { h } _ { l }$ instead. Then, $h _ { i }$ is the ith element of $\mathbf { h }$ (i.e. activation of $i$ th unit), and $w _ { k i }$ is the $( k , i )$ element of $\mathbf { W }$ .
|
| 52 |
+
|
| 53 |
+
To use statistical properties of representations, we define mean of unit $i$ , $\mu _ { i }$ , and covariance between unit $i$ and unit $j , c _ { i , j }$ , using the $N$ samples in each mini-batch.
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { l } { \displaystyle \mu _ { i } = \frac { 1 } { N } \sum _ { n } h _ { i , n } } \\ { \displaystyle c _ { i , j } = \frac { 1 } { N } \sum _ { n } ( h _ { i , n } - \mu _ { i } ) ( h _ { j , n } - \mu _ { j } ) } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
Here, $h _ { i , n }$ is the activation of unit $i$ for nth sample in the mini-batch. From equation (2), variance of $i$ unit can be written as below.
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\nu _ { i } = c _ { i , i }
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
When class-wise statistics need to be considered, we choose a single label $m$ and evaluate mean, covariance, and variance using only the data samples with label $m$ in the mini-batch.
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { l } { \displaystyle \mu _ { i } ^ { m } = \frac { 1 } { \vert S _ { m } \vert } \sum _ { n \in S _ { m } } h _ { i , n } } \\ { \displaystyle c _ { i , j } ^ { m } = \frac { 1 } { \vert S _ { m } \vert } \sum _ { n \in S _ { m } } ( h _ { i , n } - \mu _ { i } ^ { m } ) ( h _ { j , n } - \mu _ { j } ^ { m } ) } \\ { \displaystyle \nu _ { i } ^ { m } = c _ { i , i } ^ { m } } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Here, $S _ { m }$ is the set containing indexes of the samples whose label is $m$ , and $| S _ { m } |$ is the cardinality of the set $S _ { m }$ .
|
| 72 |
+
|
| 73 |
+
# 3.2 PENALTY LOSS FUNCTIONS
|
| 74 |
+
|
| 75 |
+
Using the notations in Section 3.1, the loss functions and their derivatives can be derived and summarized as in Table 1. L1-weight and L2-weight are well-known, and they impose L1 and L2 penalties on the weights, respectively. The rest in the table apply penalties on the representation. L1-rep is similar to L1-weight, but the penalty is applied to the representation h. Obviously, L2 can also be applied to the representation, but it is excluded in this study because it tends to perform worse than L1 when applied to representation. VR (Variance Regularization) calculates variance of each unit’s activation over mini-batch dataset and uses the calculated value as the penalty. CR (Cross-covariance Regularization) uses off-diagonal terms of the mini-batch covariance matrix of activations as the penalty term. As mentioned earlier, CR in this work is the same as DeCov presented by Cogswell et al. (2016), but we use the term CR for the consistency of naming. As in DeCov, we subtract variance terms and consider cross-covariance terms only (see penalty loss function in Table 1). cw-VR and cw-CR are similar to VR and CR, respectively, except that the values are calculated for each class using the mini-batch samples with the same class label. cw-L1-rep can be defined, but its penalty loss function turns out to be the same as L1-rep’s loss function. Therefore, cw-L1-rep is excluded in this study.
|
| 76 |
+
|
| 77 |
+
# Interpretation of derivatives
|
| 78 |
+
|
| 79 |
+
While the penalty functions were chosen from the three distinct statistical properties and class-wise concept, their derivatives show that some of them are closely related. For the derivatives of VR and
|
| 80 |
+
|
| 81 |
+
Table 1: Penalty loss functions of regularizers
|
| 82 |
+
|
| 83 |
+
<table><tr><td>Penalty loss function</td><td>Derivatives</td></tr><tr><td>ΩL1-weight =∑∑ |wkil ki</td><td>0SL1-weight = sign(Wki) wki</td></tr><tr><td>ΩL2-weight =∑∑ wi</td><td>L2-weight = 2Wki dwki</td></tr><tr><td>ki ΩL1-rep =∑∑Ihinl</td><td>SL1-rep = sign(hi,n) dhi,n</td></tr><tr><td>n i ΩvR =Mui</td><td>0vR 2 (hin-μi) Ohi,n N</td></tr><tr><td>i =∑∑(ci,j)²-∑(ui)² ΩCR</td><td>0ScR 2 £ Ci,j(hj,n-μj) Ohi,n N</td></tr><tr><td>i i -∑∑ Ωcw-VR u</td><td>ji 0Scw-VR 2 (hi,n- μm),n ∈ Sm Ohi,n |Sml</td></tr><tr><td>m i Ωcw-CR =∑(∑∑(ci,j)²-∑(ui)²)</td><td>0Scw-CR 2 £ c(hjn-μ),n ∈ Sm dhi,n |Sml ji</td></tr></table>
|
| 84 |
+
|
| 85 |
+
CR, it can be observed that they have similar structures. If VR’s derivative $\frac { \partial \Omega _ { V R } } { \partial h _ { i , n } }$ becomes zero for all $i$ , then CR’s derivative $\frac { \partial \Omega _ { C R } } { \partial h _ { i , n } }$ becomes zero as well. The vice versa does not hold, but the effects of VR and CR can be expected to be similar or at least related to each other for the learning process. In the same way, the relationship between cw-VR and cw-CR is the same as the relationship between VR and CR. Therefore, we can expect cw-VR and cw-CR to have similar effects, too. On the other hand, the derivative of L1-rep has a distinct formulation, and it can be expected to have a distinct effect on learning.
|
| 86 |
+
|
| 87 |
+
There is another important effect that is not necessarily obvious from the derivative formulations. For L1-weight and L2-weight, the derivatives are dependent on the weights $w _ { k i }$ only, and they are independent of the activations $h _ { i , n }$ . Therefore, the weights need to become smaller to reduce the regularization penalty. For the other five representation regularizers, their derivatives are all dependent on activation $h _ { i , n }$ . So, a simple way to reduce the regularization penalties is to scale the activations to small values (instead of satisfying the balances among the terms in the equation to reach zero gradients and force the desired statistical properties). This scaling will not have any effect on prediction output as long as all the elements of $\bar { \mathbf { h } } ^ { l }$ are scaled together to $\alpha \mathbf { h } ^ { l }$ - the last softmax layer works as a normalization function for the output layer, and therefore the cross-entropy penalty term is not affected by such a scaling. This means that there is a chance for the learning algorithm to squash activations just so that representation regularization terms can be ignored. As we will see later, indeed activation squashing happens by learning, but the desired statistical properties are still sufficiently enforced. Nonetheless, it must be possible to design better penalty regularizers that are immune to activation squashing, and such regularizers might be much more effective for manipulating statistical properties of representations.
|
| 88 |
+
|
| 89 |
+
# 4 EXPERIMENTS - MNIST
|
| 90 |
+
|
| 91 |
+
In this section, we consider ten regularization strategies and compare them using the MNIST dataset (LeCun et al., 1998). We use a Multilayer Perceptron (MLP) with five hidden fully connected layers and an output layer. Each hidden layer has 100 units with Rectified Linear Unit (ReLU) activation function, and the output layer consists of 10 softmax units. All experiments (in this work) were carried out using TensorFlow 1.3.
|
| 92 |
+
|
| 93 |
+
Table 2: Error performance of popular regularizers (MNIST)
|
| 94 |
+
|
| 95 |
+
<table><tr><td rowspan="2">Layer</td><td rowspan="2">Baseline</td><td colspan="2">Penalty on weight</td><td colspan="2">Implicit method</td></tr><tr><td>L1-weight</td><td>L2-weight</td><td>Dropout</td><td>BN</td></tr><tr><td>All</td><td>3.06±0.15</td><td>2.90±0.08</td><td>2.96±0.09</td><td>4.08±0.06</td><td>2.69±0.06</td></tr></table>
|
| 96 |
+
|
| 97 |
+
Table 3: Error performance of representation regularizers (MNIST)
|
| 98 |
+
|
| 99 |
+
<table><tr><td rowspan="2">Layer</td><td colspan="3">All classes</td><td colspan="2">Class-wise</td></tr><tr><td>L1-rep</td><td>VR</td><td>CR</td><td>cw-VR</td><td>cw-CR</td></tr><tr><td>Output</td><td>2.61±0.04</td><td>2.67±0.15</td><td>2.62±0.07</td><td>2.56±0.02</td><td>2.55±0.08</td></tr><tr><td>Layer 5</td><td>2.61±0.11</td><td>2.70±0.03</td><td>2.67±0.04</td><td>2.63±0.05</td><td>2.61±0.06</td></tr><tr><td>Layer 4</td><td>2.75±0.05</td><td>2.89±0.11</td><td>2.69±0.13</td><td>2.67±0.12</td><td>2.71±0.04</td></tr><tr><td>Layer 3</td><td>3.35±0.08</td><td>3.16±0.09</td><td>3.11±0.13</td><td>3.22±0.06</td><td>3.22±0.06</td></tr><tr><td>Layer 2</td><td>3.40±0.11</td><td>3.15±0.21</td><td>3.01±0.10</td><td>3.14±0.10</td><td>3.24±0.11</td></tr><tr><td>Layer 1</td><td>4.31±0.14</td><td>2.98±0.09</td><td>3.13±0.09</td><td>3.25±0.04</td><td>3.14±0.03</td></tr></table>
|
| 100 |
+
|
| 101 |
+
Table 4: Error performance of representation regularizers - multiple layers (MNIST)
|
| 102 |
+
|
| 103 |
+
<table><tr><td></td><td>L1-rep</td><td>VR</td><td>CR</td><td>cw-VR</td><td>cw-CR</td></tr><tr><td>Output</td><td>2.61±0.04</td><td>2.67±0.15</td><td>2.62±0.07</td><td>2.56±0.02</td><td>2.55±0.08</td></tr><tr><td>Output, 5</td><td>2.48±0.12</td><td>2.67±0.11</td><td>2.43±0.08</td><td>2.46±0.07</td><td>2.55±0.10</td></tr><tr><td>Output, 5, 4</td><td>2.78±0.11</td><td>2.58±0.06</td><td>2.80±0.12</td><td>2.53±0.07</td><td>2.48±0.07</td></tr><tr><td>Output, 5, 4, 3</td><td>2.79±0.10</td><td>2.78±0.08</td><td>2.83±0.14</td><td>2.80±0.10</td><td>2.72±0.04</td></tr><tr><td>Output, 5,4, 3, 2</td><td>3.19±0.10</td><td>2.91±0.13</td><td>2.77±0.07</td><td>2.90±0.10</td><td>2.75±0.07</td></tr><tr><td>All</td><td>3.26±0.09</td><td>2.86±0.07</td><td>2.80±0.08</td><td>2.83±0.07</td><td>2.85±0.12</td></tr></table>
|
| 104 |
+
|
| 105 |
+
# 4.1 PERFORMANCE RESULTS
|
| 106 |
+
|
| 107 |
+
For each regularization term, the level of regularization was determined by tuning the penalty loss weight using a validation dataset and a grid search. Then, we trained each model five-times and calculated the test error performance as the average and one standard deviation over the five performance results. In Table 2 and Table 3, the results show that representation regularizers outperform the popular regularizers and that the representation strategies perform better when applied to upper layers of DNN. Interestingly, the best performance is achieved by applying representation regularization to the output layer as shown in Table 3. This might be because the regularizer directly affects only the regularizing layer and the layers below, or because manipulating statistical properties is more effective for the higher layer representations that have stronger or codeword-like structures. To better understand the effect of a layer, multiple layer results are shown in Table 4. The best performance is achieved when output layer is regularized together with one or two upper hidden layers. Among all the results in the three tables, CR performs best and achieves $2 . 4 3 \%$ of error.
|
| 108 |
+
|
| 109 |
+
# 4.2 STATISTICAL PROPERTIES OF 10 REGULARIZATION STRATEGIES
|
| 110 |
+
|
| 111 |
+
We use nine metrics to compare the statistical properties of the ten regularization strategies. Among the nine metrics, first seven of them are calculated by directly evaluating the penalty loss functions shown in Table 1. The raw evaluation values, however, are difficult to interpret because they have different scales. So, we normalize the metrics as following (see the raw evaluation values shown in Table 10 and Table 11). First, square-root is applied to L2-weight, VR, and CR because their units are quadratic, and square-root of square-root is applied to cw-VR and cw-CR because their units are quartic. Then, all the metrics of each regularizer are divided by the regularizer’s own $\sqrt { \Omega _ { L 2 - w e i g h t } }$ such that all are normalized with respect to its 2-norm weight values. Finally, all the metrics are normalized by baseline’s metrics and 100 is multiplied such that we can focus on the relative change in percentage compared to the baseline’s metrics. The remaining two metrics are the average number of activated classes per unit as the measure of sparsity and ratio of dead units, and they are explained in Appendix C. $\Omega _ { L 1 - w e i g h t }$ and $\Omega _ { L { 2 } - w e i g h t }$ are calculated from the weights of all layers excluding biases, and the others are calculated from layer 5’s activations using test dataset.
|
| 112 |
+
|
| 113 |
+
Table 5: Evaluation of statistical properties (layer 5) - popular strategies
|
| 114 |
+
|
| 115 |
+
<table><tr><td rowspan="2">Metric</td><td rowspan="2">Baseline</td><td colspan="2">Penalty on weight</td><td colspan="2">Implicit method</td></tr><tr><td>L1-weight</td><td>L2-weight</td><td>Dropout</td><td>BN</td></tr><tr><td>ΩL1-weight (all)</td><td>100.00</td><td>88.05</td><td>92.25</td><td>99.14</td><td>84.82</td></tr><tr><td>ΩL2-weight (all)</td><td>100.00</td><td>100.00</td><td>100.00</td><td>100.00</td><td>100.00</td></tr><tr><td>ΩL1-rep</td><td>100.00</td><td>115.28</td><td>110.26</td><td>36.11</td><td>16.94</td></tr><tr><td>ΩvR</td><td>100.00</td><td>113.97</td><td>109.58</td><td>61.18</td><td>27.69</td></tr><tr><td>ΩcR</td><td>100.00</td><td>111.55</td><td>107.51</td><td>39.35</td><td>5.80</td></tr><tr><td>Ωcw-VR</td><td>100.00</td><td>114.08</td><td>109.68</td><td>72.91</td><td>50.50</td></tr><tr><td>Ωcw-CR</td><td>100.00</td><td>112.68</td><td>108.55</td><td>78.49</td><td>20.54</td></tr><tr><td>Aug_Act_Class</td><td>5.24</td><td>5.54</td><td>5.35</td><td>4.60</td><td>2.48</td></tr><tr><td>Ratio_Dead_Unit</td><td>14%</td><td>5%</td><td>9%</td><td>0%</td><td>1%</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 6: Evaluation of statistical properties (layer 5) - representation regularizers
|
| 118 |
+
|
| 119 |
+
<table><tr><td rowspan="2">Metric</td><td colspan="3">All classes</td><td colspan="2">Class-wise</td></tr><tr><td>L1-rep</td><td>VR</td><td>CR</td><td>cw-VR</td><td>cw-CR</td></tr><tr><td>ΩL1-weight (all)</td><td>93.08</td><td>96.42</td><td>95.83</td><td>86.85</td><td>84.14</td></tr><tr><td>ΩL2-weight (all)</td><td>100.00</td><td>100.00</td><td>100.00</td><td>100.00</td><td>100.00</td></tr><tr><td>ΩL1-rep</td><td>1.07</td><td>9.16</td><td>9.73</td><td>3.41</td><td>5.49</td></tr><tr><td>ΩvR</td><td>7.77</td><td>9.24</td><td>9.42</td><td>3.91</td><td>5.28</td></tr><tr><td>ΩCR</td><td>0.33</td><td>0.64</td><td>0.63</td><td>0.15</td><td>0.27</td></tr><tr><td>Ωcw-VR</td><td>19.85</td><td>28.12</td><td>29.61</td><td>11.25</td><td>14.27</td></tr><tr><td>Ωcw-CR</td><td>3.69</td><td>6.79</td><td>7.15</td><td>1.66</td><td>2.37</td></tr><tr><td>Avg_Act_Class</td><td>0.23</td><td>5.12</td><td>5.38</td><td>4.14</td><td>5.29</td></tr><tr><td>Ratio_Dead_Unit</td><td>77%</td><td>9%</td><td>5%</td><td>23%</td><td>7%</td></tr></table>
|
| 120 |
+
|
| 121 |
+
We can observe two distinct groups of regularizers by investigating Table 5 and Table 6. We can observe that the representation regularizers have much smaller values for the representation metrics. This is because the representation regularizers squash activations in the way described in Section 3.2. As mentioned in Section 3.2, VR and cw-VR are related to CR and cw-CR, respectively. We can see that their values of metrics are similar to each other. Despite this similarity of the five representation regularization, L1-rep and cw-VR have unique characteristics. L1-rep obviously enforces sparsity and causes much more dead units than the others. The regularizer cw-VR always shows the smallest metric values among four strategies (VR, CR, cw-VR, and cw-CR). This can be an evidence of the four regularizers’ close relationship. The metric values of dropout and batch normalization (BN) are located somewhere between baseline and representation regularizers. They cause similar effects on representation metrics as the representation regularizers, but much less effect are observed. It is also interesting to note that both dropout and BN have only $0 \sim 1 \%$ of dead units (neurons). Dropout and BN are implicit methods in the sense that they do not target any particular statistical property, but they certainly seem to have distinct effects compared to the other regularizers.
|
| 122 |
+
|
| 123 |
+
# 4.3 VISUALIZATION OF REPRESENTATIONS
|
| 124 |
+
|
| 125 |
+
Due to activation squashing, metrics of statistical properties can become misleading. Therefore, we visualize the representation of Layer 5 to more intuitively understand the statistical properties that are affected by the regularizers. Samples for three regularizers are shown in Figure 1 and Figure 2, and all figures for the ten regularizers are shown in appendix (Figure 3 and Figure 4).
|
| 126 |
+
|
| 127 |
+
# Histogram of a single unit
|
| 128 |
+
|
| 129 |
+
We first visualize the distribution of activation per unit in Figure 1 to observe sparsity and variance properties. Activation histograms were generated by using 10,000 test data, and each color corresponds to a different class. Since activations are generated as the output of ReLU activation function, many have zero value that can distort the histogram. We, therefore, excluded zeros from activations when drawing the histogram plots. In Figure 1(a), it can be seen that baseline has a large class-wise variance and inter-class overlaps. The histogram of cw-VR in (b), however, shows the effect of separating the classes because class-wise variance is significantly reduced. For each class, the activation is ‘hardened’. L1-rep in (c) can be confirmed to have only one class that is activated, and this confirms the sparsity. As described in Table 6, Avg Act Class of L1-rep is close to zero, so most of its histograms show very few active samples.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 1: Histogram of a sample nueron’s activation values over test dataset. The sample was chosen from $\mathbf { h } _ { 5 }$ . Compared to baseline, cw-VR clearly shows non-overlapping distributions for different labels. L1-rep shows a similar distribution shape as in the baseline, but only a single label is activated in this example. Best viewed in color.
|
| 133 |
+
|
| 134 |
+
# Scatter plot of a pair of units
|
| 135 |
+
|
| 136 |
+
To show the relationship between two representation units, we randomly chose two units from a representation vector $\mathbf { h } _ { 5 }$ and drew a scatter plot of their activation values for the test dataset. As shown in Figure 2, baseline shows a modest linearity, which is consistent with the high covariance value. Since CR in (b) reduces cross-covariance per unit, it can be seen that overall linearity is significantly reduced compared to the baseline and the randomly chosen pair of units becomes almost independent. In the same way, cw-CR has reduced class-wise cross-covariance. Furthermore, its class-wise variance is small and thus end up having small ball-shaped concentrations of points.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 2: Scatter plot of activation values of randomly chosen two units from $\mathbf { h } _ { 5 }$ . Compared to baseline, CR has clearly less correlation indicating less co-adaptation. cw-CR also shows low coadaptation, but it has smaller ball shapes per label because of the low class-wise variance. Best viewed in color.
|
| 140 |
+
|
| 141 |
+
# 5 EXPERIMENTS - CIFAR-10/100
|
| 142 |
+
|
| 143 |
+
While performance improvement is not the primary focus of this work, we provide additional test results with performance evaluations and show that the representation regularizers are useful for pushing the accuracy performance to the next level. In particular, we provide additional test results for CIFAR-100 and CIFAR-10 datasets (Krizhevsky & Hinton, 2009). For CIFAR-100, we have chosen a toy CNN architecture to confirm performance improvement of representation regularizers. Concurrently using two of the regularizers is experimented as well. For CIFAR-10, we have tested representation regularizers using Residual Network (ResNet) that is known as one of the best performing deep neural networks for image data.
|
| 144 |
+
|
| 145 |
+
Table 7: Error performance of regularizers (CIFAR-100)
|
| 146 |
+
|
| 147 |
+
<table><tr><td colspan="2">Regularizer</td><td>Train error</td><td>Test error</td></tr><tr><td>Baseline</td><td>None</td><td>25.50</td><td>56.02</td></tr><tr><td rowspan="2">Penalty on weight</td><td>L1-weight</td><td>18.16</td><td>55.99</td></tr><tr><td>L2-weight Dropout (fc)</td><td>33.75 28.02</td><td>54.93 55.28</td></tr><tr><td rowspan="2" colspan="2">Implicit method</td><td>Dropout (all) 79.28 28.28</td><td>80.08 55.33</td></tr><tr><td>BN (fc) BN (all) L1-rep 98.93</td><td>8.63 57.82 99.00</td></tr><tr><td rowspan="6">Penalty on representation</td><td rowspan="2">Single</td><td>VR CR cw-VR</td><td>27.02 53.66</td></tr><tr><td>33.24 22.85</td><td>54.67 54.15</td></tr><tr><td>cW-CR VR+CR</td><td>27.84</td><td>53.78</td></tr><tr><td></td><td>13.88</td><td>54.68</td></tr><tr><td>VR+cw-VR</td><td>19.43</td><td>56.12</td></tr><tr><td>VR+cw-CR</td><td></td><td></td></tr><tr><td rowspan="8">Combination</td><td></td><td>28.53</td><td>54.94</td></tr><tr><td>CR+cw-VR</td><td>21.11</td><td></td></tr><tr><td>CR + cw-CR</td><td></td><td>53.30</td></tr><tr><td>cw-VR+ cW-CR</td><td>18.05 25.77</td><td>54.75</td></tr><tr><td></td><td>98.93</td><td>55.64</td></tr><tr><td>L1-rep + VR</td><td></td><td>99.00</td></tr><tr><td>L1-rep + CR</td><td>98.93</td><td>99.00</td></tr><tr><td>L1-rep + cw-VR L1-rep + cw-CR</td><td>98.93 98.93</td><td>99.00 99.00</td></tr></table>
|
| 148 |
+
|
| 149 |
+
# 5.1 COMBINING MULTIPLE STRATEGIES: CIFAR-100
|
| 150 |
+
|
| 151 |
+
We use a toy CNN network for experimenting with CIFAR-100. The CNN network consists of four convolution layers and a fully connected layer, all with 100 hidden units. ReLU is used as the activation function. The second, third, and fourth convolution layers are followed by a max pooling layer. The last 10,000 instances of 50,000 training data were used as the validation data. Using the validation data, validation performance was evaluated for the regularizer weight values of $\{ 0 . 1 , \bar { 0 } . 0 1$ , $0 . 0 0 1 , 0 . 0 0 0 1 \}$ . The best weight value was found for each regularizer, and the test performance was evaluated for the fixed weight values. For representation regularizers, regularization was applied to the fully connected layer. The performance results are shown in Table 7. From the table, it can be seen that the test error is improved from baseline $5 6 . 0 2 \%$ to $5 3 . 6 6 \%$ by using a single regularizer (VR) and to $5 3 . 3 0 \%$ by using two regularizers (CR and cw-VR). Therefore, $2 . 7 2 \%$ of improvement is achieved by the best performing regularizer combination. Aside from the performance improvement, it is interesting to observe that L1-rep consistently fails to train for the CIFAR-100 data. With 100 labels, too much sparsity might hurt the performance. This is a plausible hypothesis considering that we have only 100 neurons to encode 100 labels. A shared use of neurons over multiple classes might be a better direction to pursue. In general, the relationship between the number of labels and the desired statistical properties of representation remains a topic to be studied.
|
| 152 |
+
|
| 153 |
+
# 5.2 PERFORMANCE IMPROVEMENT OF RESNET-32
|
| 154 |
+
|
| 155 |
+
ResNet was first proposed by He et al. (2016). ResNet consists of multiple basic blocks that are serially connected, and shortcut connections to force residuals to be calculated. We apply five regularization strategies without modifying the ResNet-32 architecture. Regularization was applied to the output layer only. Experimental results in Table 8 show that performance is improved over the state-of-the-art ResNet-32 model, and cw-VR shows the best performance. This indicates that representation regularizers are compatible with ResNet, and most likely also with other state-of-the-art models.
|
| 156 |
+
|
| 157 |
+
Table 8: Error performance of regularizers on ResNet-32 (CIFAR-10)
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Model</td><td>He et al.</td><td>Ours</td></tr><tr><td>ResNet-32</td><td>7.51</td><td>7.39</td></tr><tr><td rowspan="3">ResNet-32 +L1-rep ResNet-32 + VR ResNet-32+CR</td><td>7.27</td><td></td></tr><tr><td></td><td>7.22</td></tr><tr><td></td><td>7.27</td></tr><tr><td>ResNet-32+cw-VR</td><td></td><td>7.17</td></tr><tr><td>ResNet-32 + cw-CR</td><td></td><td>7.21</td></tr></table>
|
| 160 |
+
|
| 161 |
+
# 6 CONCLUSION
|
| 162 |
+
|
| 163 |
+
In this work, we have investigated five different penalty regularizers for manipulating statistical properties of DNN representations. The regularizers were conceived by examining optimal codewords of well-known channel coding problems, and the three statistical properties of sparsity, variance, and covariance were integrated into the regularizers along with the concept of class-wise regularization. It was found that many statistical properties including cross-covariance, co-adaptation, per-class variance, average number of active class per-unit, and the ratio of dead units can be manipulated. Each regularizer, however, tended to manipulate multiple properties at the same time, making it difficult to manipulate each property individually. While manipulation was shown to be possible and helpful for improving the performance of all three DNN classification problems that were investigated, it is still unclear if any statistical property of representation is generally helpful when strengthened. Due to the complicated nature of learning process where back-propagation affects not only the signal of interest but also other signals and irrelevant noise, it still remains an open question on how to establish procedures that generally improve learning of any deep learning problems.
|
| 164 |
+
|
| 165 |
+
The contributions of this work can be summarized as follow. First, a complete set of very simple regularizers for controlling sparsity, variance, and covariance of representations was presented. Among them, VR, cw-VR, and cw-CR have been designed and used for the first time and they work very well. The visualizations clearly show that the new regularizers are effective for manipulating statistical properties of representations in new ways. Secondly, by analyzing statistical properties in a quantitative way, we have shown that none of the popular regualrizers works in a distinct way. Even the well-known dropout does not control co-adaptation(covariance) only. In fact, sparsity and class-wise variance are affected together by dropout, and therefore it is difficult to claim if indeed reduction in co-adaptation is why dropout works well. Thirdly, we have provided partial results on which statistical properties can be helpful or harmful for different learning tasks (tasks with more labels, with more complexity, etc.). This part needs to be further investigated to see if general rules can be derived.
|
| 166 |
+
|
| 167 |
+
# ACKNOWLEDGMENTS
|
| 168 |
+
|
| 169 |
+
To be added.
|
| 170 |
+
|
| 171 |
+
# REFERENCES
|
| 172 |
+
|
| 173 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 174 |
+
|
| 175 |
+
Soufiane Belharbi, Clement Chatelain, Romain Herault, and Sebastien Adam. Neural networks regularization through invariant features learning. arXiv preprint arXiv:1709.01867, 2017.
|
| 176 |
+
|
| 177 |
+
Brian Cheung, Jesse A Livezey, Arjun K Bansal, and Bruno A Olshausen. Discovering hidden factors of variation in deep networks. arXiv preprint arXiv:1412.6583, 2014.
|
| 178 |
+
|
| 179 |
+
Michael Cogswell, Faruk Ahmed, Ross Girshick, Larry Zitnick, and Dhruv Batra. Reducing overfitting in deep networks by decorrelating representations. 2016.
|
| 180 |
+
|
| 181 |
+
Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012.
|
| 182 |
+
|
| 183 |
+
Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 315–323, 2011.
|
| 184 |
+
|
| 185 |
+
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.
|
| 186 |
+
|
| 187 |
+
Arthur E Hoerl and Robert W Kennard. Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 12(1):55–67, 1970.
|
| 188 |
+
|
| 189 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
|
| 190 |
+
|
| 191 |
+
Zhuolin Jiang, Zhe Lin, and Larry S Davis. Learning a discriminative dictionary for sparse coding via label consistent $\mathbf { k }$ -svd. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 1697–1704. IEEE, 2011.
|
| 192 |
+
|
| 193 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 194 |
+
|
| 195 |
+
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.
|
| 196 |
+
|
| 197 |
+
Jun-Bao Li, Jeng-Shyang Pan, and Shu-Chuan Chu. Kernel class-wise locality preserving projection. Information Sciences, 178(7):1825–1835, 2008.
|
| 198 |
+
|
| 199 |
+
Renjie Liao, Alex Schwing, Richard Zemel, and Raquel Urtasun. Learning deep parsimonious representations. In Advances in Neural Information Processing Systems, pp. 5076–5084, 2016.
|
| 200 |
+
|
| 201 |
+
Tim Salimans and Diederik 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.
|
| 202 |
+
|
| 203 |
+
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.
|
| 204 |
+
|
| 205 |
+
Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), pp. 267–288, 1996.
|
| 206 |
+
|
| 207 |
+
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.
|
| 208 |
+
|
| 209 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
|
| 210 |
+
|
| 211 |
+
# APPENDIX
|
| 212 |
+
|
| 213 |
+
A PERFORMANCE OF POPULAR REGULARIZERS WHEN APPLIED TO EACH LAYER
|
| 214 |
+
|
| 215 |
+
Table 9: Error performance of popular regularizers - applied to each layer
|
| 216 |
+
|
| 217 |
+
<table><tr><td rowspan="2">Layer</td><td rowspan="2">Baseline</td><td colspan="2">Penalty on weight</td><td colspan="2">Implicit method</td></tr><tr><td>L1-weight</td><td>L2-weight</td><td>Dropout</td><td>BN</td></tr><tr><td>All</td><td rowspan="6">3.06±0.15</td><td>2.90±0.08</td><td>2.96±0.09</td><td>4.08±0.06</td><td>2.69±0.06</td></tr><tr><td>Output</td><td>3.02±0.15</td><td>2.96±0.06</td><td>2.99±0.18</td><td>2.97±0.08</td></tr><tr><td>Layer 5</td><td>2.98±0.05</td><td>2.99±0.13</td><td>2.80±0.08</td><td>3.04±0.09</td></tr><tr><td>Layer 4</td><td>2.98±0.08</td><td>2.98±0.09</td><td>2.67±0.05</td><td>2.84±0.15</td></tr><tr><td>Layer 3</td><td>3.04±0.09</td><td>3.03±0.18</td><td>2.67±0.16</td><td>2.94±0.13</td></tr><tr><td>Layer 2</td><td>2.91±0.05</td><td>2.76±0.16</td><td>2.70±0.08</td><td>2.84±0.16</td></tr><tr><td>Layer 1</td><td></td><td>2.93±0.05</td><td>2.52±0.10</td><td>3.07±0.07</td><td>2.58±0.07</td></tr></table>
|
| 218 |
+
|
| 219 |
+
# B EVALUATION OF STATISTICAL PROPERTIES
|
| 220 |
+
|
| 221 |
+
Table 10: Evaluation of statistical properties (raw) - popular regularizers
|
| 222 |
+
|
| 223 |
+
<table><tr><td rowspan="2">Property</td><td rowspan="2">Baseline</td><td colspan="2"> Penalty on weight</td><td colspan="2">Implicit method</td></tr><tr><td>L1-weight</td><td>L2-weight</td><td>Dropout</td><td>BN</td></tr><tr><td>ΩL1-weight (all)</td><td>9795.03</td><td>7504.60</td><td>8220.21</td><td>9461.52</td><td>9488.60</td></tr><tr><td>ΩL2-weight (all)</td><td>607.46</td><td>459.85</td><td>502.71</td><td>576.60</td><td>792.24</td></tr><tr><td>ΩL1-rep</td><td>3.24 × 106</td><td>3.25 × 106</td><td>3.25 × 106</td><td>1.14 × 106</td><td>6.27 ×105</td></tr><tr><td>SvR</td><td>865.69</td><td>851.24</td><td>860.34</td><td>307.64</td><td>86.59</td></tr><tr><td>ScR</td><td>58178.00</td><td>54803.10</td><td>55650.20</td><td>8551.84</td><td>255.31</td></tr><tr><td>Ωcw-VR</td><td>2398.03</td><td>2327.79</td><td>2377.46</td><td>610.58</td><td>265.46</td></tr><tr><td>Ωcw-CR</td><td>63726.20</td><td>58891.60</td><td>60610.20</td><td>21795.60</td><td>193.26</td></tr></table>
|
| 224 |
+
|
| 225 |
+
Table 11: Evaluation of statistical properties (raw) - representation regularizers
|
| 226 |
+
|
| 227 |
+
<table><tr><td rowspan="2">Property</td><td colspan="3">All classes</td><td colspan="2">Class-wise</td></tr><tr><td>L1-rep</td><td>VR</td><td>CR</td><td>Cw-VR</td><td>CW-CR</td></tr><tr><td>ΩL1-weight (all)</td><td>9975.62</td><td>9732.16</td><td>9826.06</td><td>9843.84</td><td>9772.89</td></tr><tr><td>ΩL2-weight (all)</td><td>727.22</td><td>645.03</td><td>665.57</td><td>813.20</td><td>853.98</td></tr><tr><td>ΩL1-rep</td><td>38183.20</td><td>3.06 × 105</td><td>3.39 × 105</td><td>1.28 × 105</td><td>2.11 × 105</td></tr><tr><td>ΩvR</td><td>6.26</td><td>7.85</td><td>8.43</td><td>1.78</td><td>3.40</td></tr><tr><td>ScR</td><td>0.80</td><td>2.55</td><td>2.55</td><td>0.19</td><td>0.64</td></tr><tr><td>Ωcw-VR</td><td>5.34</td><td>16.91</td><td>22.15</td><td>0.69</td><td>1.97</td></tr><tr><td>Ωcw-CR</td><td>0.17</td><td>1.53</td><td>2.00</td><td>8.83 × 10-3</td><td>0.04</td></tr></table>
|
| 228 |
+
|
| 229 |
+
# C METRICS
|
| 230 |
+
|
| 231 |
+
# Activated class and dead unit
|
| 232 |
+
|
| 233 |
+
ReLU’s output becomes positive when the input has a positive value. In this work, we say a class is activated for a nueron if the probability of the neuron’s output being positive is above a threshold for the given class. We use the entire test dataset to check the probability, and threshold value of 0.9 is used for the evaluations. If many classes are activated for a neuron, it indicates that the neuron is used for representations of many classes. On the other hand, if only a single class is activated for a neuron, it indicates that the neuron is used for representations of only one class and kept zero for all the other classes. When the number of activated class is zero for a neuron, it indicates that the neuron does not carry any information and may be ignored. Such a neuron is called a dead unit. The equations below show how to calculate if a class $m$ is activated for a nueron $i , I$ is an indicator function, and $N _ { u }$ is the number of units in the layer.
|
| 234 |
+
|
| 235 |
+
$$
|
| 236 |
+
N u m \_ A c t \_ I n C l a s s ( i , m ) = \sum _ { n \in S _ { m } } I ( h _ { i , n } > 0 )
|
| 237 |
+
$$
|
| 238 |
+
|
| 239 |
+
$$
|
| 240 |
+
A c t \_ C l a s s ( i , m ) = I ( \frac { N u m \_ A c t ( i , m ) } { | S _ { m } | } > t h r e s h o l d )
|
| 241 |
+
$$
|
| 242 |
+
|
| 243 |
+
# Average number of activated classes
|
| 244 |
+
|
| 245 |
+
The number of activated classes can be calculated for each unit. Then, the average number of activated classes can be calculated over all units in the same layer. When $A v g \_ A c t \_ C l a s s$ is large for a regularizer, it means the regularizer tends to encourage many units to be used for representations. If the value is small, it indicates the regularizer makes only a small number of units to be coded in positive values for the representation.
|
| 246 |
+
|
| 247 |
+
$$
|
| 248 |
+
N u m . A c t . C l a s s ( i ) = \sum _ { m } A c t . C l a s s ( i , m )
|
| 249 |
+
$$
|
| 250 |
+
|
| 251 |
+
$$
|
| 252 |
+
A v g \_ A c t \_ C l a s s = \frac { \sum _ { i } N u m \_ A c t \_ C l a s s ( i ) } { N _ { u } }
|
| 253 |
+
$$
|
| 254 |
+
|
| 255 |
+
# Ratio of dead units
|
| 256 |
+
|
| 257 |
+
Typically, ’dead neuron’ is widely used to represent neurons that are not activated - output is zero all the time over all classes. To extend the concept of ‘activated class’, we define $A l l \_ C l a s s \_ D e a d ( i )$ and Ratio Dead Unit as below. When Ratio Dead Unit is large, it indicates many of the neurons can be removed without affecting the representation.
|
| 258 |
+
|
| 259 |
+
$$
|
| 260 |
+
A l l _ { - } C l a s s \_ D e a d ( i ) = I ( \sum _ { m } A c t _ { - } C l a s s ( i , m ) = 0 )
|
| 261 |
+
$$
|
| 262 |
+
|
| 263 |
+
$$
|
| 264 |
+
R a t i o \_ D e a d \_ U n i t = \frac { \sum _ { i } A l l \_ C l a s s \_ D e a d ( i ) } { N _ { u } }
|
| 265 |
+
$$
|
| 266 |
+
|
| 267 |
+
# D VISUALIZATION OF REPRESENTATIONS
|
| 268 |
+
|
| 269 |
+

|
| 270 |
+
Figure 3: Histograms of activation values for 10 regularizers. Best viewed in color.
|
| 271 |
+
|
| 272 |
+

|
| 273 |
+
Figure 4: Scatter plots of activation values of two units (neurons) for 10 regularizers. Best viewed in color.
|
md/train/rkRwGg-0Z/rkRwGg-0Z.md
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BEYOND WORD IMPORTANCE: CONTEXTUAL DECOMPOSITION TO EXTRACT INTERACTIONS FROM LSTMS
|
| 2 |
+
|
| 3 |
+
Peter J. Liu Google Brain Mountain View, CA
|
| 4 |
+
|
| 5 |
+
W. James Murdoch ∗ Department of Statistics University of California, Berkeley jmurdoch@berkeley.edu
|
| 6 |
+
|
| 7 |
+
Bin Yu
|
| 8 |
+
Department of Statistics
|
| 9 |
+
Department of EECS
|
| 10 |
+
University of California, Berkeley
|
| 11 |
+
|
| 12 |
+
# ABSTRACT
|
| 13 |
+
|
| 14 |
+
The driving force behind the recent success of LSTMs has been their ability to learn complex and non-linear relationships. Consequently, our inability to describe these relationships has led to LSTMs being characterized as black boxes. To this end, we introduce contextual decomposition (CD), an interpretation algorithm for analysing individual predictions made by standard LSTMs, without any changes to the underlying model. By decomposing the output of a LSTM, CD captures the contributions of combinations of words or variables to the final prediction of an LSTM. On the task of sentiment analysis with the Yelp and SST data sets, we show that CD is able to reliably identify words and phrases of contrasting sentiment, and how they are combined to yield the LSTM’s final prediction. Using the phrase-level labels in SST, we also demonstrate that CD is able to successfully extract positive and negative negations from an LSTM, something which has not previously been done.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
In comparison with simpler linear models, techniques from deep learning have achieved impressive accuracy by effectively learning non-linear interactions between features. However, due to our inability to describe the learned interactions, this improvement in accuracy has come at the cost of state of the art predictive algorithms being commonly regarded as black-boxes. In the domain of natural language processing (NLP), Long Short Term Memory networks (LSTMs) (Hochreiter & Schmidhuber, 1997) have become a basic building block, yielding excellent performance across a wide variety of tasks (Sutskever et al., 2014) (Rajpurkar et al., 2016) (Melis et al., 2017), while remaining largely inscrutable.
|
| 19 |
+
|
| 20 |
+
In this work, we introduce contextual decomposition (CD), a novel interpretation method for explaining individual predictions made by an LSTM without any modifications to the underlying model. CD extracts information about not only which words contributed to a LSTM’s prediction, but also how they were combined in order to yield the final prediction. By mathematically decomposing the LSTM’s output, we are able to disambiguate the contributions made at each step by different parts of the sentence.
|
| 21 |
+
|
| 22 |
+
To validate the CD interpretations extracted from an LSTM, we evaluate on the problem of sentiment analysis. In particular, we demonstrate that CD is capable of identifying words and phrases of differing sentiment within a given review. CD is also used to successfully extract positive and negative negations from an LSTM, something that has not previously been done. As a consequence of this analysis, we also show that prior interpretation methods produce scores which have document-level information built into them in complex, unspecified ways. For instance, prior work often identifies strongly negative phrases contained within positive reviews as neutral, or even positive.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
The most relevant prior work on interpreting LSTMs has focused on approaches for computing word-level importance scores, with evaluation protocols varying greatly. Murdoch & Szlam (2017) introduced a decomposition of the LSTM’s output embedding into a sum over word coefficients, and demonstrated that those coefficients are meaningful by using them to distill LSTMs into rules-based classifiers. Li et al. (2016) took a more black box approach, called Leave One Out, by observing the change in log probability resulting from replacing a given word vector with a zero vector, and relied solely on anecdotal evaluation. Finally, Sundararajan et al. (2017) presents a general gradient-based technique, called Integrated Gradients, which was validated both theoretically and with empirical anecdotes. In contrast to our proposed method, this line of work has been limited to word-based importance scores, ignoring the interactions between variables which make LSTMs so accurate.
|
| 27 |
+
|
| 28 |
+
Another line of work (Karpathy et al., 2015) (Strobelt et al., 2016) has focused on analysing the movement of raw gate activations over a sequence. Karpathy et al. (2015) was able to identify some co-ordinates of the cell state that correspond to semantically meaningful attributes, such as whether the text is in quotes. However, most of the cell co-ordinates were uninterpretable, and it is not clear how these co-ordinates combine to contribute to the actual prediction.
|
| 29 |
+
|
| 30 |
+
Decomposition-based approaches to interpretation have also been applied to convolutional neural networks (CNNs) (Bach et al., 2015) (Shrikumar et al., 2017). However, they have been limited to producing pixel-level importance scores, ignoring interactions between pixels, which are clearly quite important. Our approach is similar to these in that it computes an exact decomposition, but we leverage the unique gating structure of LSTMs in order to extract interactions.
|
| 31 |
+
|
| 32 |
+
Attention based models (Bahdanau et al., 2014) offer another means of providing some interpretability. Such models have been successfully applied to many problems, yielding improved performance (Rush et al., 2015) (Xu et al., 2015). In contrast to other word importance scores, attention is limited in that it only provides an indirect indicator of importance, with no directionality, i.e. what class the word is important for. Although attention weights are often cited anecdotally, they have not been evaluated, empirically or otherwise, as an interpretation technique. As with other prior work, attention is also incapable of describing interactions between words.
|
| 33 |
+
|
| 34 |
+
# 3 CONTEXTUAL DECOMPOSITION OF LSTMS
|
| 35 |
+
|
| 36 |
+
Given an arbitrary phrase contained within an input, we present a novel decomposition of the output of an LSTM into a sum of two contributions: those resulting solely from the given phrase, and those involving other factors. The key insight behind this decomposition is that the gating dynamics unique to LSTMs are a vehicle for modeling interactions between variables.
|
| 37 |
+
|
| 38 |
+
# 3.1 LONG SHORT TERM MEMORY NETWORKS
|
| 39 |
+
|
| 40 |
+
Over the past few years, LSTMs have become a core component of neural NLP systems. Given a sequence of word embeddings $x _ { 1 } , . . . , x _ { T } \in \mathbb { R } ^ { d _ { 1 } }$ , a cell and state vector $c _ { t } , h _ { t } \in \mathbb { R } ^ { \dot { d } _ { 2 } }$ are computed for each element by iteratively applying the below equations, with initialization $h _ { 0 } = c _ { 0 } = 0$ .
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r l } & { o _ { t } = \sigma ( W _ { o } x _ { t } + V _ { o } h _ { t - 1 } + b _ { o } ) } \\ & { f _ { t } = \sigma ( W _ { f } x _ { t } + V _ { f } h _ { t - 1 } + b _ { f } ) } \\ & { i _ { t } = \sigma ( W _ { i } x _ { t } + V _ { i } h _ { t - 1 } + b _ { i } ) } \\ & { g _ { t } = \operatorname { t a n h } ( W _ { g } x _ { t } + V _ { g } h _ { t - 1 } + b _ { g } ) } \\ & { c _ { t } = f _ { t } \odot c _ { t - 1 } + i _ { t } \odot g _ { t } } \\ & { h _ { t } = o _ { t } \odot \operatorname { t a n h } ( c _ { t } ) } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
Where Wo, Wi, Wf , Wg ∈ Rd1×d2 , $V _ { o } , V _ { f } , V _ { i } , V _ { g } \in \mathbb { R } ^ { d _ { 2 } \times d _ { 2 } } , b _ { o } , b _ { g } , b _ { i } , b _ { g } \in \mathbb { R } ^ { d _ { 2 } }$ and $\odot$ denotes element-wise multiplication. $o _ { t } , f _ { t }$ and $i _ { t }$ are often referred to as output, forget and input gates, respectively, due to the fact that their values are bounded between 0 and 1, and that they are used in element-wise multiplication.
|
| 47 |
+
|
| 48 |
+
After processing the full sequence, the final state $h _ { T }$ is treated as a vector of learned features, and used as input to a multinomial logistic regression, often called SoftMax, to return a probability distribution $p$ over $C$ classes, with
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
p _ { j } = \mathrm { S o f t M a x } ( W h _ { T } ) _ { j } = \frac { \exp ( W _ { j } h _ { T } ) } { \sum _ { k = 1 } ^ { C } \exp ( W _ { k } h _ { t } ) }
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
# 3.2 CONTEXTUAL DECOMPOSITION OF LSTM
|
| 55 |
+
|
| 56 |
+
We now introduce contextual decomposition, our proposed method for interpreting LSTMs. Given an arbitrary phrase $x _ { q } , . . . , x _ { r }$ , where $1 \leq q \leq r \leq T$ , we now decompose each output and cell state $c _ { t } , h _ { t }$ in Equations 5 and 6 into a sum of two contributions.
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\begin{array} { l } { h _ { t } = \beta _ { t } + \gamma _ { t } } \\ { c _ { t } = \beta _ { t } ^ { c } + \gamma _ { t } ^ { c } } \end{array}
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
The decomposition is constructed so that $\beta _ { t }$ corresponds to contributions made solely by the given phrase to $h _ { t }$ , and that $\gamma _ { t }$ corresponds to contributions involving, at least in part, elements outside of the phrase. $\beta _ { t } ^ { c }$ and $\gamma _ { t } ^ { c }$ represent analogous contributions to $c _ { t }$ .
|
| 63 |
+
|
| 64 |
+
Using this decomposition for the final output state $W h _ { T }$ in Equation 7 yields
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
p = \operatorname { S o f t M a x } ( W \beta _ { T } + W \gamma _ { T } )
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
Here $W \beta _ { T }$ provides a quantitative score for the phrase’s contribution to the LSTM’s prediction. As this score corresponds to the input to a logistic regression, it may be interpreted in the same way as a standard logistic regression coefficient.
|
| 71 |
+
|
| 72 |
+
# 3.2.1 DISAMBIGUATING INTERACTIONS BETWEEN GATES
|
| 73 |
+
|
| 74 |
+
In the cell update Equation 5, neuron values in each of $i _ { t }$ and $g _ { t }$ are independently determined by both the contribution at that step, $x _ { t }$ , as well as prior context provided by $h _ { t - 1 } = \beta _ { t - 1 } + \gamma _ { t - 1 }$ . Thus, in computing the element-wise product $i _ { t } \odot g _ { t }$ , often referred to as gating, contributions made by $x _ { t }$ to $i _ { t }$ interact with contributions made by $h _ { t }$ to $g _ { t }$ , and vice versa.
|
| 75 |
+
|
| 76 |
+
We leverage this simple insight to construct our decomposition. First, assume that we have a way of linearizing the gates and updates in Equations 2, 3, 4 so that we can write each of them as a linear sum of contributions from each of their inputs.
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array} { r l } & { i _ { t } = \sigma ( W _ { i } x _ { t } + V _ { i } h _ { t - 1 } + b _ { i } ) } \\ & { \quad = L _ { \sigma } ( W _ { i } x _ { t } ) + L _ { \sigma } ( V _ { i } h _ { t - 1 } ) + L _ { \sigma } ( b _ { i } ) } \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
When we use this linearization in the cell update Equation 5, the products between gates become products over linear sums of contributions from different factors. Upon expanding these products, the resulting cross-terms yield a natural interpretation as being interactions between variables. In particular, cross-terms can be assigned as to whether they resulted solely from the phrase, e.g. $\mathsf { \bar { L } } _ { \sigma } ( V _ { i } \beta _ { t - 1 } ) \odot L _ { \operatorname { t a n h } } ( V _ { g } \beta _ { t - 1 } )$ , from some interaction between the phrase and other factors, e.g. $L _ { \sigma } ( V _ { i } \beta _ { t - 1 } ) \odot L _ { \operatorname { t a n h } } ( V _ { g } \gamma _ { t - 1 } )$ , or purely from other factors, e.g. $L _ { \sigma } ( \bar { b } _ { i } ) \odot L _ { \mathrm { t a n h } } ( V _ { g } \gamma _ { t - 1 } )$ .
|
| 83 |
+
|
| 84 |
+
Mirroring the recurrent nature of LSTMs, the above insights allow us to recursively compute our decomposition, with the initializations $\beta _ { 0 } = \beta _ { 0 } ^ { c } = \gamma _ { 0 } = \gamma _ { 0 } ^ { c } = 0$ . We derive below the update equations for the case where $q \leq t \leq r$ , so that the current time step is contained within the phrase. The other case is similar, and the general recursion formula is provided in Appendix 6.2.
|
| 85 |
+
|
| 86 |
+
For clarity, we decompose the two products in the cell update Equation 5 separately. As discussed above, we simply linearize the gates involved, expand the resulting product of sums, and group the cross-terms according to whether or not their contributions derive solely from the specified phrase, or otherwise. Terms are determined to derive solely from the specified phrase if they involve products from some combination of $\beta _ { t - 1 } , \beta _ { t - 1 } ^ { c } , x _ { t }$ and $b _ { i }$ or $b _ { g }$ (but not both). When $t$ is not within the phrase, products involving $x _ { t }$ are treated as not deriving from the phrase.
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r l } & { f _ { t } \odot c _ { t - 1 } = \left( L _ { \sigma } ( W _ { f } x _ { t } ) + L _ { \sigma } ( V _ { f } \beta _ { t - 1 } ) + L _ { \sigma } ( V _ { f } \gamma _ { t - 1 } ) + L _ { \sigma } ( b _ { f } ) \right) \odot \left( \beta _ { t - 1 } ^ { c } + \gamma _ { t - 1 } ^ { c } \right) } \\ & { \qquad = \left( \left[ L _ { \sigma } ( W _ { f } x _ { t } ) + L _ { \sigma } ( V _ { f } \beta _ { t - 1 } ) + L _ { \sigma } ( b _ { f } ) \right] \odot \beta _ { t - 1 } ^ { c } \right) } \\ & { \qquad + \left( L _ { \sigma } ( V _ { f } \gamma _ { t - 1 } ) \odot \beta _ { t - 1 } ^ { c } + f _ { t } \odot \gamma _ { t - 1 } ^ { c } \right) } \\ & { \qquad = \beta _ { t } ^ { f } + \gamma _ { t } ^ { f } } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r l } { i _ { t } \odot g _ { t } = [ L _ { \sigma } ( W _ { i } x _ { t } ) + L _ { \sigma } ( V _ { i } \beta _ { t - 1 } ) + L _ { \sigma } ( V _ { i } \gamma _ { t - 1 } ) + L _ { \sigma } ( b _ { i } ) ] } \\ { \odot [ L _ { \mathrm { t a n h } } ( W _ { g } x _ { t } ) + L _ { \mathrm { t a n h } } ( V _ { g } \beta _ { t - 1 } ) + L _ { \mathrm { t a n h } } ( V _ { g } \gamma _ { t - 1 } ) + L _ { \mathrm { t a n h } } ( b _ { g } ) ] } \\ { = [ L _ { \sigma } ( W _ { i } x _ { t } ) \odot [ L _ { \mathrm { t a n h } } ( W _ { g } x _ { t } ) + L _ { \mathrm { t a n h } } ( V _ { g } \beta _ { t - 1 } ) + L _ { \mathrm { t a n h } } ( b _ { g } ) ] } \\ { + L _ { \sigma } ( V _ { i } \beta _ { t - 1 } ) \odot [ L _ { \mathrm { t a n h } } ( W _ { g } x _ { t } ) + L _ { \mathrm { t a n h } } ( V _ { g } \beta _ { t - 1 } ) + L _ { \mathrm { t a n h } } ( b _ { g } ) ] } \\ { + L _ { \sigma } ( b _ { i } ) \odot [ L _ { \mathrm { t a n h } } ( W _ { g } x _ { t } ) + L _ { \mathrm { t a n h } } ( V _ { g } \beta _ { t - 1 } ) ] ] } \\ { + [ L _ { \sigma } ( V _ { i } \gamma _ { t - 1 } ) \odot g _ { t } + i _ { t } \odot L _ { \mathrm { t a n h } } ( V _ { g } \gamma _ { t - 1 } ) - L _ { \sigma } ( V _ { i } \gamma _ { t - 1 } ) \odot L _ { \mathrm { t a n h } } ( V _ { g } \gamma _ { t - 1 } ) } \\ { + \ell _ { \sigma } ( b _ { i } ) \odot L _ { \mathrm { t a n h } } ( b _ { g } ) ] } \\ { = \beta _ { t } ^ { u } + \gamma _ { t } ^ { u } } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Having decomposed the two components of the cell update equation, we can attain our decomposition of $c _ { t }$ by summing the two contributions.
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\begin{array} { l } { \beta _ { t } ^ { c } = \beta _ { t } ^ { f } + \beta _ { t } ^ { u } } \\ { \gamma _ { t } ^ { c } = \gamma _ { t } ^ { f } + \gamma _ { t } ^ { u } } \end{array}
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
Once we have computed the decomposition of $c _ { t }$ , it is relatively simple to compute the resulting transformation of $h _ { t }$ by linearizing the tanh function in 6. Note that we could similarly decompose the output gate as we treated the forget gate above, but we empirically found this to not produce improved results.
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\begin{array} { r l } & { h _ { t } = o _ { t } \odot \operatorname { t a n h } ( c _ { t } ) } \\ & { \phantom { = } = o _ { t } \odot [ L _ { \operatorname { t a n h } } ( \beta _ { t } ^ { c } ) + L _ { \operatorname { t a n h } } ( \gamma _ { t } ^ { c } ) ] } \\ & { \phantom { = } = o _ { t } \odot L _ { \operatorname { t a n h } } ( \beta _ { t } ^ { c } ) + o _ { t } \odot L _ { \operatorname { t a n h } } ( \gamma _ { t } ^ { c } ) } \\ & { \phantom { = } = \beta _ { t } + \gamma _ { t } } \end{array}
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
# 3.2.2 LINEARIZING ACTIVATION FUNCTIONS
|
| 109 |
+
|
| 110 |
+
We now describe the linearizing functions $L _ { \sigma } , L _ { \mathrm { t a n h } }$ used in the above decomposition. Formally, for arbitrary $\{ y _ { 1 } , . . . , y _ { N } \} \in \mathbb { R }$ , where $N \leq 4$ , the problem is how to write
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\operatorname { t a n h } ( \sum _ { i = 1 } ^ { N } y _ { i } ) = \sum _ { i = 1 } ^ { N } L _ { \operatorname { t a n h } } ( y _ { i } )
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
In the cases where there is a natural ordering to $\{ y _ { i } \}$ , prior work (Murdoch & Szlam, 2017) has used a telescoping sum consisting of differences of partial sums as a linearization technique, which we show below.
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
L _ { \operatorname { t a n h } } ^ { \prime } ( y _ { k } ) = \operatorname { t a n h } ( \sum _ { j = 1 } ^ { k } y _ { j } ) - \operatorname { t a n h } ( \sum _ { j = 1 } ^ { k - 1 } y _ { j } )
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
However, in our setting $\{ y _ { i } \}$ contains terms such as $\beta _ { t - 1 }$ , $\gamma _ { t - 1 }$ and $x _ { t }$ , which have no clear ordering. Thus, there is no natural way to order the sum in Equation 26. Instead, we compute an average over all orderings. Letting $\pi _ { 1 } , . . . , \pi _ { M _ { N } }$ denote the set of all permutations of $1 , . . . , N$ , our score is given below. Note that when $\pi _ { i } ( j ) = j$ , the corresponding term is equal to equation 26.
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
L _ { \mathrm { t a n h } } ( y _ { k } ) = { \frac { 1 } { M _ { N } } } \sum _ { i = 1 } ^ { M _ { N } } [ \mathrm { t a n h } ( \sum _ { j = 1 } ^ { \pi _ { i } ^ { - 1 } ( k ) } y _ { \pi _ { i } ( j ) } ) - \mathrm { t a n h } ( \sum _ { j = 1 } ^ { \pi _ { i } ^ { - 1 } ( k ) - 1 } y _ { \pi _ { i } ( j ) } ) ]
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
$L _ { \sigma }$ can be analogously derived. When one of the terms in the decomposition is a bias, we saw improvements when restricting to permutations where the bias is the first term.
|
| 129 |
+
|
| 130 |
+
As $N$ only ranges between 2 and 4, this linearization generally takes very simple forms. For instance, when $N = 2$ , the contribution assigned to $y _ { 1 }$ is
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
L _ { \operatorname { t a n h } } ( y _ { 1 } ) = { \frac { 1 } { 2 } } ( [ \operatorname { t a n h } ( y _ { 1 } ) - \operatorname { t a n h } ( 0 ) ] + [ \operatorname { t a n h } ( y _ { 2 } + y _ { 1 } ) - \operatorname { t a n h } ( y _ { 1 } ) ] )
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
This linearization was presented in a scalar context where $y _ { i } \in \mathbb { R }$ , but trivially generalizes to the vector setting $y _ { i } \in \mathbb { R } ^ { d _ { 2 } }$ . It can also be viewed as an approximation to Shapely values, as discussed in Lundberg & Lee (2016) and Shrikumar et al. (2017).
|
| 137 |
+
|
| 138 |
+
# 4 EXPERIMENTS
|
| 139 |
+
|
| 140 |
+
We now describe our empirical validation of CD on the task of sentiment analysis. First, we verify that, on the standard problem of word-level importance scores, CD compares favorably to prior work. Then we examine the behavior of CD for word and phrase level importance in situations involving compositionality, showing that CD is able to capture the composition of phrases of differing sentiment. Finally, we show that CD is capable of extracting instances of positive and negative negation. Code for computing CD scores is available online 1.
|
| 141 |
+
|
| 142 |
+
# 4.1 TRAINING DETAILS
|
| 143 |
+
|
| 144 |
+
We first describe the process for fitting models which are used to produce interpretations. As the primary intent of this paper is not predictive accuracy, we used standard best practices without much tuning. We implemented all models in Torch using default hyperparameters for weight initializations. All models were optimized using Adam (Kingma & Ba, 2014) with the default learning rate of 0.001 using early stopping on the validation set. For the linear model, we used a bag of vectors model, where we sum pre-trained Glove vectors (Pennington et al., 2014) and add an additional linear layer from the word embedding dimension, 300, to the number of classes, 2. We fine tuned both the word vectors and linear parameters. We will use the two data sets described below to validate our new CD method.
|
| 145 |
+
|
| 146 |
+
# 4.1.1 STANFORD SENTIMENT TREEBANK
|
| 147 |
+
|
| 148 |
+
We trained an LSTM model on the binary version of the Stanford Sentiment Treebank (SST) (Socher et al., 2013), a standard NLP benchmark which consists of movie reviews ranging from 2 to 52 words long. In addition to review-level labels, it also provides labels for each phrase in the binarized constituency parse tree. Following the hyperparameter choices in Tai et al. (2015), the word and hidden representations of our LSTM were set to 300 and 168, and word vectors were initialized to pretrained Glove vectors (Pennington et al., 2014). Our LSTM attains $8 7 . 2 \%$ accuracy, and we also train a logistic regression model with bag of words features, which attains $8 3 . 2 \%$ accuracy.
|
| 149 |
+
|
| 150 |
+
# 4.1.2 YELP POLARITY
|
| 151 |
+
|
| 152 |
+
Originally introduced in Zhang et al. (2015), the Yelp review polarity dataset was obtained from the Yelp Dataset Challenge and has train and test sets of sizes 560,000 and 38,000. The task is binary prediction for whether the review is positive (four or five stars) or negative (one or two stars). The reviews are relatively long, with an average length of 160.1 words. Following the guidelines from Zhang et al. (2015), we implement an LSTM model which attains $4 . 6 \%$ error, and an ngram logistic regression model, which attains $5 . 7 \%$ error. For computational reasons, we report interpretation results on a random subset of sentences of length at most 40 words. When computing integrated gradient scores, we found that numerical issues produced unusable outputs for roughly $6 \%$ of the samples. These reviews are excluded.
|
| 153 |
+
|
| 154 |
+
# 4.1.3 INTERPRETATION BASELINES
|
| 155 |
+
|
| 156 |
+
We compare the interpretations produced by CD against four state of the art baselines: cell decomposition (Murdoch & Szlam, 2017), integrated gradients (Sundararajan et al., 2017), leave one out (Li et al., 2016), and gradient times input. We refer the reader to Section 2 for descriptions of these algorithms. For our gradient baseline, we compute the gradient of the output probability with respect to the word embeddings, and report the dot product between the word vector and its gradient. For integrated gradients, producing reasonable values required extended experimentation and communication with the creators regarding the choice of baselines and scaling issues. We ultimately used sequences of periods for our baselines, and rescaled the scores for each review by the standard deviation of the scores for that review, a trick not previously mentioned in the literature. To obtain phrase scores for word-based baselines integrated gradients, cell decomposition, and gradients, we sum the scores of the words contained within the phrase.
|
| 157 |
+
|
| 158 |
+
# 4.2 UNIGRAM (WORD) SCORES
|
| 159 |
+
|
| 160 |
+
Before examining the novel, phrase-level dynamics of CD, we first verify that it compares favorably to prior work for the standard use case of producing unigram coefficients. When sufficiently accurate in terms of prediction, logistic regression coefficients are generally treated as a gold standard for interpretability. In particular, when applied to sentiment analysis the ordering of words given by their coefficient value provides a qualitatively sensible measure of importance. Thus, when determining the validity of coefficients extracted from an LSTM, we should expect there to be a meaningful relationship between the CD scores and logistic regression coefficients.
|
| 161 |
+
|
| 162 |
+
In order to evaluate the word-level coefficients extracted by the CD method, we construct scatter plots with each point consisting of a single word in the validation set. The two values plotted correspond to the coefficient from logistic regression and importance score extracted from the LSTM. For a quantitative measure of accuracy, we use pearson correlation coefficient.
|
| 163 |
+
|
| 164 |
+
We report quantitative and qualitative results in Appendix 6.1.3. For SST, CD and integrated gradients, with correlations of 0.76 and 0.72, respectively, are substantially better than other methods, with correlations of at most 0.51. On Yelp, the gap is not as big, but CD is still very competitive, having correlation 0.52 with other methods ranging from 0.34 to 0.56. Having verified reasonably strong results in this base case, we now proceed to show the benefits of CD.
|
| 165 |
+
|
| 166 |
+
# 4.3 IDENTIFYING DISSENTING SUBPHRASES
|
| 167 |
+
|
| 168 |
+
We now show that, for phrases of at most five words, existing methods are unable to recognize subphrases with differing sentiments. For example, consider the phrase “used to be my favorite”, which is of negative sentiment. The word “favorite”, however, is strongly positive, having a logistic regression coefficient in the 93rd percentile. Nonetheless, existing methods consistently rank “favorite” as being highly negative or neutral. In contrast, as shown in Table 1, CD is able to identify “my favorite” as being strongly positive, and ”used to be” as strongly negative. A similar dynamic also occurs with the phrase “not worth the time”. The main justification for using LSTMs over simpler models is precisely that they are able to capture these kinds of interactions. Thus, it is important that an interpretation algorithm is able to properly uncover how the interactions are being handled.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Table 1: Heat maps for portion of yelp review with different attribution techniques. Only CD captures that ”favorite” is positive.
|
| 172 |
+
|
| 173 |
+
Using the above as a motivating example, we now show that a similar trend holds throughout the Yelp polarity dataset. In particular, we conduct a search for situations similar to the above, where a strongly positive/negative phrase contains a strongly dissenting subphrase. Phrases are scored using the logistic regression with n-gram features described in Section 4.1, and included if their absolute score is over 1.5. We then examine the distribution of scores for the dissenting subphrases, which are analogous to “favorite”.
|
| 174 |
+
|
| 175 |
+
For an effective interpretation algorithm, the distribution of scores for positive and negative dissenting subphrases should be significantly separate, with positive subphrases having positive scores, and vice versa. However, as can be seen in Appendix 6.1.1, for prior methods these two distributions are nearly identical. The CD distributions, on the other hand, are significantly separate, indicating that what we observed anecdotally above holds in a more general setting.
|
| 176 |
+
|
| 177 |
+
# 4.4 EXAMINING HIGH-LEVEL COMPOSITIONALITY
|
| 178 |
+
|
| 179 |
+
We now show that prior methods struggle to identify cases where a sizable portion of a review (between one and two thirds) has polarity different from the LSTM’s prediction. For instance, consider the review in Table 2, where the first phrase is clearly positive, but the second phrase causes the review to ultimately be negative. CD is the only method able to accurately capture this dynamic.
|
| 180 |
+
|
| 181 |
+
By leveraging the phrase-level labels provided in SST, we can show that this pattern holds in the general case. In particular, we conduct a search for reviews similar to the above example. The search criteria are whether a review contains a phrase labeled by SST to be of opposing sentiment to the review-level SST label, and is between one and two thirds the length of the review.
|
| 182 |
+
|
| 183 |
+
In Appendix 6.1.2, we show the distribution of the resulting positive and negative phrases for different attribution methods. A successful interpretation method would have a sizable gap between these two distributions, with positive phrases having mostly positive scores, and negative phrases mostly negative. However, prior methods struggle to satisfy these criteria. $87 \%$ of all positive phrases are labelled as negative by integrated gradients, and cell decompositions (Murdoch & Szlam, 2017) even have the distributions flipped, with negative phrases yielding more positive scores than the positive phrases. CD, on the other hand, provides a very clear difference in distributions. To quantify this separation between positive and negative distributions, we examine a two-sample KolmogorovSmirnov one-sided test statistic, a common test for the difference of distributions with values ranging from 0 to 1. CD produces a score of 0.74, indicating a strong difference between positive and negative distributions, with other methods achieving scores of 0 (cell decomposition), 0.33 (integrated gradients), 0.58 (leave one out) and 0.61 (gradient), indicating weaker distributional differences. Given that gradient and leave one out were the weakest performers in unigram scores, this provides strong evidence for the superiority of CD.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Table 2: Heat maps for portion of review from SST with different attribution techniques. Only CD captures that the first phrase is positive.
|
| 187 |
+
|
| 188 |
+
# 4.5 CONTEXTUAL DECOMPOSITION (CD) CAPTURES NEGATION
|
| 189 |
+
|
| 190 |
+
In order to understand an LSTM’s prediction mechanism, it is important to understand not just the contribution of a phrase, but how that contribution is computed. For phrases involving negation, we now demonstrate that we can use CD to empirically show that our LSTM learns a negation mechanism.
|
| 191 |
+
|
| 192 |
+
Using the phrase labels in SST, we search over the training set for instances of negation. In particular, we search for phrases of length less than ten with the first child containing a negation phrase (such as “not” or “lacks”, full list provided in Appendix 6.3) in the first two words, and the second child having positive or negative sentiment. Due to noise in the labels, we also included phrases where the entire phrase was non-neutral, and the second child contained a non-neutral phrase. We identify both positive negation, such as “isn’t a bad film”, and negative negation, such as “isn’t very interesting”, where the direction is given by the SST-provided label of the phrase.
|
| 193 |
+
|
| 194 |
+
For a given negation phrase, we extract a negation interaction by computing the CD score of the entire phrase and subtracting the CD scores of the phrase being negated and the negation term itself. The resulting score can be interpreted as an n-gram feature. Note that, of the methods we compare against, only leave one out is capable of producing such interaction scores. For reference, we also provide the distribution of all interactions for phrases of length less than 5.
|
| 195 |
+
|
| 196 |
+
We present the distribution of extracted scores in Figure 1. For CD, we can see that there is a clear distinction between positive and negative negations, and that the negation interactions are centered on the outer edges of the distribution of interactions. Leave one out is able to capture some of the interactions, but has a noticeable overlap between positive and negative negations around zero, indicating a high rate of false negatives.
|
| 197 |
+
|
| 198 |
+
# 4.6 IDENTIFYING SIMILAR PHRASES
|
| 199 |
+
|
| 200 |
+
Another benefit of using CDs for interpretation is that, in addition to providing importance scores, it also provides dense embeddings for arbitrary phrases and interactions, in the form of $\beta _ { T }$ discussed in Section 3.2. We anecdotally show that similarity in this embedding space corresponds to semantic similarity in the context of sentiment analysis.
|
| 201 |
+
|
| 202 |
+
In particular, for all words and binary interactions, we compute the average embedding $\beta _ { T }$ produced by CD across the training and validation sets. In Table 3, we show the nearest neighbours using a cosine similarity metric. The results are qualitatively sensible for three different kinds of interactions: positive negation, negative negation and modification, as well as positive and negative words. Note that we for positive and negative words, we chose the positive/negative parts of the negations, in order to emphasize that CD can disentangle this composition.
|
| 203 |
+
|
| 204 |
+

|
| 205 |
+
Figure 1: Distribution of scores for positive and negative negation coefficients relative to all interaction coefficients. Only leave one out and CD are capable of producing these interaction scores.
|
| 206 |
+
|
| 207 |
+
Table 3: Nearest neighbours for selected unigrams and interactions using CD embeddings
|
| 208 |
+
|
| 209 |
+
<table><tr><td>not entertain- ing</td><td>not bad</td><td>very funny</td><td>entertaining</td><td>bad</td></tr><tr><td>not funny</td><td>never dull</td><td>well-put- together piece</td><td>intelligent</td><td>dull</td></tr><tr><td>not engaging</td><td>n't drag</td><td>entertaining romp</td><td>engaging</td><td>drag</td></tr><tr><td>never satisfac- tory</td><td>never fails</td><td>very good</td><td>satisfying</td><td>awful</td></tr><tr><td>not well</td><td>without sham</td><td>surprisingly sweet</td><td>admirable</td><td>tired</td></tr><tr><td>not fit</td><td>without missing</td><td>very well- written</td><td>funny</td><td>dreary</td></tr></table>
|
| 210 |
+
|
| 211 |
+
# 5 CONCLUSION
|
| 212 |
+
|
| 213 |
+
In this paper, we have proposed contextual decomposition (CD), an algorithm for interpreting individual predictions made by LSTMs without modifying the underlying model. In both NLP and general applications of LSTMs, CD produces importance scores for words (single variables in general), phrases (several variables together) and word interactions (variable interactions). Using two sentiment analysis datasets for empirical validation, we first show that for information also produced by prior methods, such as word-level scores, our method compares favorably. More importantly, we then show that CD is capable of identifying phrases of varying sentiment, and extracting meaningful word (or variable) interactions. This movement beyond word-level importance is critical for understanding a model as complex and highly non-linear as LSTMs.
|
| 214 |
+
|
| 215 |
+
# ACKNOWLEDGMENTS
|
| 216 |
+
|
| 217 |
+
This research was started during a summer internship at Google Brain, and later supported by a postgraduate scholarship-doctoral from NSERC and a data science research award from Adobe. This work is partially supported by Center for Science of Information (CSoI), an NSF Science and
|
| 218 |
+
|
| 219 |
+
Technology Center, under grant agreement CCF-0939370, ONR grant N00014-16-1-2664 and ARO grant W911NF1710005.
|
| 220 |
+
|
| 221 |
+
# REFERENCES
|
| 222 |
+
|
| 223 |
+
Sebastian Bach, Alexander Binder, Gregoire Montavon, Frederick Klauschen, Klaus-Robert M ´ uller, ¨ and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7):e0130140, 2015.
|
| 224 |
+
|
| 225 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
|
| 226 |
+
|
| 227 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 228 |
+
|
| 229 |
+
Andrej Karpathy, Justin Johnson, and Li Fei-Fei. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078, 2015.
|
| 230 |
+
|
| 231 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 232 |
+
|
| 233 |
+
Jiwei Li, Will Monroe, and Dan Jurafsky. Understanding neural networks through representation erasure. CoRR, abs/1612.08220, 2016. URL http://arxiv.org/abs/1612.08220.
|
| 234 |
+
|
| 235 |
+
Scott Lundberg and Su-In Lee. An unexpected unity among methods for interpreting model predictions. arXiv preprint arXiv:1611.07478, 2016.
|
| 236 |
+
|
| 237 |
+
Gabor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language ´ models. CoRR, abs/1707.05589, 2017. URL http://arxiv.org/abs/1707.05589.
|
| 238 |
+
|
| 239 |
+
W James Murdoch and Arthur Szlam. Automatic rule extraction from long short term memory networks. ICLR, 2017.
|
| 240 |
+
|
| 241 |
+
Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
|
| 242 |
+
|
| 243 |
+
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.
|
| 244 |
+
|
| 245 |
+
Alexander M Rush, Sumit Chopra, and Jason Weston. A neural attention model for abstractive sentence summarization. arXiv preprint arXiv:1509.00685, 2015.
|
| 246 |
+
|
| 247 |
+
Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. arXiv preprint arXiv:1704.02685, 2017.
|
| 248 |
+
|
| 249 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { N g }$ , 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.
|
| 250 |
+
|
| 251 |
+
Hendrik Strobelt, Sebastian Gehrmann, Bernd Huber, Hanspeter Pfister, and Alexander M Rush. Visual analysis of hidden state dynamics in recurrent neural networks. arXiv preprint arXiv:1606.07461, 2016.
|
| 252 |
+
|
| 253 |
+
Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. CoRR, abs/1703.01365, 2017. URL http://arxiv.org/abs/1703.01365.
|
| 254 |
+
|
| 255 |
+
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.
|
| 256 |
+
|
| 257 |
+
Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. arXiv preprint arXiv:1503.00075, 2015.
|
| 258 |
+
|
| 259 |
+
Table 4: Correlation coefficients between logistic regression coefficients and extracted scores.
|
| 260 |
+
|
| 261 |
+
<table><tr><td>Attribution Method</td><td>Stanford Sentiment</td><td>Yelp Polarity</td></tr><tr><td>Gradient</td><td>0.375</td><td>0.336</td></tr><tr><td>Leave one out (Li et al., 2016)</td><td>0.510</td><td>0.358</td></tr><tr><td>Cell decomposition (Murdoch & Szlam, 2017)</td><td>0.490</td><td>0.560</td></tr><tr><td>Integrated gradients (Sundararajan et al., 2017)</td><td>0.724</td><td>0.471</td></tr><tr><td>Contextual decompo- sition</td><td>0.758</td><td>0.520</td></tr></table>
|
| 262 |
+
|
| 263 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International Conference on Machine Learning, pp. 2048–2057, 2015.
|
| 264 |
+
|
| 265 |
+
Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in neural information processing systems, pp. 649–657, 2015.
|
| 266 |
+
|
| 267 |
+
# 6 APPENDIX
|
| 268 |
+
|
| 269 |
+
# 6.1 PLOTS
|
| 270 |
+
|
| 271 |
+
6.1.1 PLOTS FOR DISSENTING SUBPHRASES
|
| 272 |
+
|
| 273 |
+
We provide here the plots described in Section 4.3.
|
| 274 |
+
|
| 275 |
+
6.1.2 PLOTS FOR HIGH-LEVEL COMPOSITIONALITY
|
| 276 |
+
|
| 277 |
+
We provide here the plots referenced in Section 4.4.
|
| 278 |
+
|
| 279 |
+
6.1.3 LOGISTIC REGRESSION VERSUS EXTRACTED COEFFICIENTS SCATTERPLOTS
|
| 280 |
+
|
| 281 |
+
We provide here the scatterplots and correlations referenced in section 4.2.
|
| 282 |
+
|
| 283 |
+
# 6.2 GENERAL RECURSION FORMULA
|
| 284 |
+
|
| 285 |
+
We provide here the general recursion formula referenced in Section 3.2.1. The two cases that are considered is whether the current time step is during the phrase $\ Q \leq t \leq r ,$ ) or outside of the phrase ( $t < q$ or $t > r$ ).
|
| 286 |
+
|
| 287 |
+
$$
|
| 288 |
+
\begin{array} { r l r } { { \beta _ { t } ^ { f } = [ L _ { \sigma } ( V _ { f } \beta _ { t - 1 } ) + L _ { \sigma } ( b _ { f } ) + L _ { \sigma } ( V _ { f } x _ { t } ) ] _ { q \le t \le r } \| \odot \beta _ { t - 1 } ^ { c } } } \\ & { r _ { t } ^ { f } = f _ { t } \odot \gamma _ { t - 1 } ^ { c } + [ L _ { \sigma } ( V _ { f } \gamma _ { t - 1 } ) + L _ { \sigma } ( V _ { f } x _ { t } ) ] _ { t > q , t \le r } ] \odot \beta _ { t - 1 } ^ { c } } & { ( 3 0 ) } \\ & { u _ { t } ^ { u } = L _ { \sigma } ( V _ { i } \beta _ { t - 1 } ^ { c } ) \odot [ L _ { \operatorname { t a n h } } ( V _ { g } \beta _ { t - 1 } ^ { c } + L _ { \operatorname { t a n h } } ( b _ { g } ) ] + L _ { \sigma } ( b _ { i } ) \odot L _ { \operatorname { t a n h } } ( V _ { g } \beta _ { t - 1 } ^ { c } ) } & { ( 3 1 ) } \\ & { + [ L _ { \sigma } ( W _ { i } x _ { t } ) \odot [ L _ { \operatorname { t a n h } } ( W _ { g } x _ { t } ) + L _ { \operatorname { t a n h } } ( V _ { g } \beta _ { t - 1 } ) + L _ { \operatorname { t a n h } } ( b _ { g } ) ] + L _ { \operatorname { t a n h } } ( b _ { g } ) ] + L _ { \sigma } ( b _ { i } ) \odot L _ { \operatorname { t a n h } } ( W _ { g } x _ { t } ) ] _ { 1 q \le t \le r } } \\ & { u _ { t } ^ { u } = L _ { \sigma } ( V _ { i } \gamma _ { t - 1 } ) \odot g _ { t } + i _ { t } \odot L _ { \operatorname { t a n h } } ( V _ { g } \gamma _ { t - 1 } ) - L _ { \sigma } ( V _ { i } \gamma _ { t - 1 } ) \odot L _ { \operatorname { t a n h } } ( V _ { g } \gamma _ { t - 1 } ) + L _ { \sigma } ( b _ { i } ) \odot L _ { \operatorname { t a n h } } ( b _ { g } ) } \end{array}
|
| 289 |
+
$$
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
+ \left[ L _ { \sigma } ( W _ { i } x _ { t } ) \odot [ L _ { \operatorname { t a n h } } ( W _ { g } x _ { t } ) + L _ { \operatorname { t a n h } } ( V _ { g } \beta _ { t - 1 } ) + L _ { \operatorname { t a n h } } ( b _ { g } ) ] + L _ { \sigma } ( b _ { i } ) \odot L _ { \operatorname { t a n h } } ( W _ { g } x _ { t } ) ] 1 _ { t < q , t > \tau } \right] \Biggr \} .
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+

|
| 296 |
+
Figure 2: The distribution of attributions for positive (negative) sub-phrases contained within negative (positive) phrases of length at most five in the Yelp polarity dataset. The positive and negative distributions are nearly identical for all methods except CD, indicating an inability of prior methods to distinguish between positive and negative phrases when occurring in the context of a phrase of the opposite sentiment
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure 3: Distribution of positive and negative phrases, of length between one and two thirds of the full review, in SST. The positive and negative distributions are significantly more separate for CD than other methods, indicating that even at this coarse level of granularity, other methods still struggle.
|
| 300 |
+
|
| 301 |
+

|
| 302 |
+
Figure 4: Logistic regression coefficients versus coefficients extracted from an LSTM on SST. We include a least squares regression line. Stronger linear relationships in the plots correspond to better interpretation techniques.
|
| 303 |
+
|
| 304 |
+
# 6.3 LIST OF WORDS USED TO IDENTIFY NEGATIONS
|
| 305 |
+
|
| 306 |
+
To search for negations, we used the following list of negation words: not, n’t, lacks, nobody, nor, nothing, neither, never, none, nowhere, remotely
|
md/train/rkTBjG-AZ/rkTBjG-AZ.md
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEEPARCHITECT: AUTOMATICALLY DESIGNING ANDTRAINING DEEP ARCHITECTURES
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In deep learning, performance is strongly affected by the choice of architecture and hyperparameters. While there has been extensive work on automatic hyperparameter optimization for simple spaces, complex spaces such as the space of deep architectures remain largely unexplored. As a result, the choice of architecture is done manually by the human expert through a slow trial and error process guided mainly by intuition. In this paper we describe a framework for automatically designing and training deep models. We propose an extensible and modular language that allows the human expert to compactly represent complex search spaces over architectures and their hyperparameters. The resulting search spaces are treestructured and therefore easy to traverse. Models can be automatically compiled to computational graphs once values for all hyperparameters have been chosen. We can leverage the structure of the search space to introduce different model search algorithms, such as random search, Monte Carlo tree search (MCTS), and sequential model-based optimization (SMBO). We present experiments comparing the different algorithms on CIFAR-10 and show that MCTS and SMBO outperform random search. We also present experiments on MNIST, showing that the same search space achieves near state-of-the-art performance with a few samples. These experiments show that our framework can be used effectively for model discovery, as it is possible to describe expressive search spaces and discover competitive models without much effort from the human expert. Code for our framework and experiments has been made publicly available.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep learning has seen a surge in popularity due to breakthroughs in applications such as computer vision, natural language processing, and reinforcement learning (He et al., 2016; Karpathy & FeiFei, 2015; Silver et al., 2016; Sutskever et al., 2014). An important observation in much of the recent work is that complex architectures are important for achieving high performance (He et al., 2016; Mnih et al., 2013). Larger datasets and more powerful computing infrastructures are likely to increase our ability to effectively train larger, deeper, and more complex architectures. However, improving the performance of a neural network is not as simple as adding more layers or parameters—it often requires clever ideas such as creating more branches (Szegedy et al., 2015) or adding skip connections (He et al., 2016). Even popular techniques such as dropout (Srivastava et al., 2014) and batch normalization (Ioffe & Szegedy, 2015) do not always lead to better performance, and need to be judiciously applied to be helpful.
|
| 12 |
+
|
| 13 |
+
Currently, choosing appropriate values for these architectural hyperparameters requires close supervision by a human expert, in a trial and error manual search process largely guided by intuition. The expert is burdened by having to make the large number of choices involved in the specification of a deep model. Choices interact in non-obvious ways and strongly impact performance. The typical workflow has the expert specify a single model, train it, and compute a validation score. Based on the validation score, previous experience, and information gathered during training, the expert decides if the trained model is satisfactory or not. If the model is considered unsatisfactory, the expert has to think about model variations that may lead to better performance.
|
| 14 |
+
|
| 15 |
+
From the perspective of the expert, it would be convenient to search over architectures automatically, just as we search over simple scalar hyperparameters, such as the learning rate and the regularization coefficient. Ideally, the expert would have control in setting up the search space to incorporate inductive biases about the task being solved and constraints about computational resources. Prior to this work, achieving this goal was hard because expressing model search spaces using general hyperparameter optimization tools requires the human expert to manually distill a set of relevant scalar architectural hyperparameters.
|
| 16 |
+
|
| 17 |
+
The main contributions of our work are
|
| 18 |
+
|
| 19 |
+
1. a modular, compositional, and extensible language for compactly representing expressive search spaces over models that
|
| 20 |
+
|
| 21 |
+
(a) gives control to the human expert over what model variations to consider; (b) makes it easy to automatically search for performant models in the search space; (c) allows models to be directly compiled to computational graphs without the human expert having to write additional code.
|
| 22 |
+
|
| 23 |
+
2. model search algorithms that rely on the tree-structured search spaces induced by our language to systematically and efficiently search for performant models; namely, we
|
| 24 |
+
|
| 25 |
+
(a) show that by using constructs in our language, even random search can be effective;
|
| 26 |
+
(b) compare different model search algorithms experimentally, and show that random search is outperformed by algorithms that leverage the structure of the search space to generalize more effectively across different models.
|
| 27 |
+
|
| 28 |
+
The main differences between our work and previous work are that we develop a modular, composable and extensible language, focusing on the problem of searching over deep architectures. This focus allows the expert to compactly set up a search space, search over it, and automatically compile models to their corresponding computational graphs. Our language can be seen as an effort to combine the functionalities of a deep model specification language (e.g., Tensorflow (Abadi et al., 2016)) and a structured hyperparameter search language (e.g., Hyperopt (Yamins et al., 2013)).
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
Model search has a long and rich history in machine learning and statistics. There has been a wide variety of theoretical and empirical research in this area (Agarwal et al., 2011; Bergstra et al., 2011; Bergstra & Bengio, 2012; Sabharwal et al., 2015), including Bayesian optimization methods (Hutter et al., 2011; Kandasamy et al., 2015; Snoek et al., 2012). However, conventional methods are primarily designed for searching over hyperparameters living in Euclidean space. Such methods are ill suited in today’s context, where the discrete architectural choices are just as important as the numerical values of the hyperparameters. Searching over architectures using current hyperparameter optimization algorithms requires the expert to distill structural choices into scalar hyperparameters. As a result, typically only a few simple global structural hyperparameters are considered, e.g., the depth of the network or whether to use dropout or not. This constrains the richness of the search space, preventing the expert from finding unexpected model variations leading to better performance; e.g., perhaps dropout is useful only after certain types of layers, or batch normalization only helps in the first half of the network.
|
| 33 |
+
|
| 34 |
+
Architecture search has also been considered under the topic of neuroevolution (Stanley & Miikkulainen, 2002), which uses evolutionary (i.e., genetic) strategies to define and search a space of models. In classical approaches, neuroevolution attempts to jointly choose the topology and the parameters of the architecture using genetic algorithms.
|
| 35 |
+
|
| 36 |
+
Architecture search has received renewed interest recently. Wierstra et al. (2005), Floreano et al. (2008), and Real et al. (2017) use evolutionary algorithms which start from an initial model and evolve it based on its validation performance. Zoph & Le (2017) propose a reinforcement learning procedure based on policy gradient for searching for convolutional and LSTM architectures. Baker et al. (2016) propose a reinforcement learning procedure based on Q-learning for searching for convolutional architectures.
|
| 37 |
+
|
| 38 |
+
Unfortunately all these approaches consider fixed hard-coded model search spaces that do not easily allow the human expert to incorporate inductive biases about the task being solved, making them unsuitable as general tools for architecture search. For example, evolutionary approaches require an encoding for the models in the search space and genetic operators (e.g., mutation and crossover) which generate encodings for new models out of encodings of old ones. These aspects are handcrafted and hard-coded so it is hard for the human expert to change the search space in flexible ways. Perhaps different model encodings or genetic operators can be considered, but these knobs give somewhat loose and indirect control over the model search space. The reinforcement learning approaches considered suffer from similar issues—the search spaces are hard-coded and not easily modifiable. None of these approaches have the compositionality, modularity, and extensibility properties of our language.
|
| 39 |
+
|
| 40 |
+
Bergstra et al. (2011) propose Tree of Parzen Estimators (TPE), which can be used to search over structured hyperparameter spaces, and use it to tune the hyperparameters of a Deep Boltzmann Machine. Yamins et al. (2013) use TPE to search for values of the hyperparameters of a computer vision system, and show that it can find better values than the best ones previously known.
|
| 41 |
+
|
| 42 |
+
TPE is a general hyperparameter search algorithm, and therefore requires considerable effort to use—for any fixed model search space, using TPE requires the human expert to distill the hyperparameters of the search space, express the search space in Hyperopt (Yamins et al., 2013) (an implementation of TPE), and write the code describing how values of the hyperparameters in the search space compile to a computational graph. In contrast, our language is modular and composable in the sense that:
|
| 43 |
+
|
| 44 |
+
1. search spaces (defined through modules) are constructed compositionally out of simpler search spaces (i.e., simpler modules);
|
| 45 |
+
2. hyperparameters for composite modules are derived automatically from the hyperparameters of simpler modules;
|
| 46 |
+
3. once values for all hyperparameters of a module have been chosen, the resulting model can be automatically mapped to a computational graph without the human expert having to write additional code.
|
| 47 |
+
|
| 48 |
+
# 3 ROADMAP TO THE DEEPARCHITECT FRAMEWORK
|
| 49 |
+
|
| 50 |
+
Our framework reduces the problem of searching over models into three modular components: the model search space specification language, the model search algorithm, and the model evaluation algorithm.
|
| 51 |
+
|
| 52 |
+
Model Search Specification Language: The model search space specification language is built around the concept of a modular computational module. This is akin to the concept of a module (Bottou & Gallinari, 1991) used in deep learning frameworks such as Torch (Collobert et al., 2011): by implementing the module interface, the internal implementation becomes irrelevant. These modules allow one to express easily complex design choices such as whether to include a module or not, choose between modules of different types, or choose how many times to repeat a module structure. The main insight is that complex modules can be created compositionally out of simpler ones. The behavior of complex modules is generated automatically out of the behavior of simpler modules. Furthermore, our language is extensible, allowing the implementation of new types of modules by implementing a high-level interface local to the module.
|
| 53 |
+
|
| 54 |
+
Model Search Algorithm: The way the model search space is explored is determined by the model search algorithm. This part of the framework decides how much effort to allocate to each part of the search space based on the performance observed for previous models. The model search algorithm typically requires a model evaluation algorithm that computes the performance of a fully specified model. The search algorithm will then use this information to determine which models to try next. The search algorithm interacts with the search space only through a minimal interface that allows it to traverse the space of models and evaluate models discovered this way. This interface is the same irrespective of the specific search space under consideration. We experiment with different search algorithms, such as Monte Carlo tree search (Browne et al., 2012) and Sequential Model Based Optimization (Hutter et al., 2011).
|
| 55 |
+
|
| 56 |
+
Model Evaluation Algorithm: Having fully specified a model, i.e., having reached a leaf in the tree defined by our model search space, we can evaluate how good this model is according to some criterion defined by the expert. This typically involves training the model on a training set and evaluating it on a validation set. The training procedure often has multiple hyperparameters that can be tuned (e.g., the choice of the optimization algorithm and its hyperparameters, and the learning rate schedule). If the expert does not know how to write down a reasonable training procedure for every model in the search space, the expert can introduce hyperparameters for the evaluation algorithm and search over them using our specification language.
|
| 57 |
+
|
| 58 |
+
Any of the above components can be changed, improved, or extended, while keeping the others fixed. The fact that different components interact only through well-defined interfaces makes it possible to extend and reuse this framework. We believe that DeepArchitect will be an interesting platform for future research in deep learning and hyperparameter tuning for architecture search.
|
| 59 |
+
|
| 60 |
+
# 4 MODEL SEARCH SPACE SPECIFICATION LANGUAGE
|
| 61 |
+
|
| 62 |
+
# 4.1 SEARCH SPACE DEFINITION
|
| 63 |
+
|
| 64 |
+
The computational module is the fundamental unit of our model search space specification language. We define a computational module as a function
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
f : n \to \left( \mathcal { H } \to ( \mathbb { R } ^ { p } \to ( \mathbb { R } ^ { n } \to \mathbb { R } ^ { m } ) ) \right) ,
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where $n$ is the dimensionality of the input, $\mathcal { H }$ is the set of valid values for the hyperparameters, $p$ is the number of parameters, and $m$ is the dimensionality of the output. The set $\mathcal { H }$ can be structured or simply the cross product of scalar hyperparameter sets, i.e., $\mathcal { H } = \mathcal { H } _ { 1 } \times . . . \times \mathcal { H } _ { H }$ , where $H$ is the number of scalar hyperparameters. The set $\mathcal { H }$ is assumed to be discrete in both cases.
|
| 71 |
+
|
| 72 |
+
Definition (1) merits some discussion. For conciseness we have not explicitly represented it, but the number of parameters $p$ and the output dimensionality $m$ can both be functions of the input dimensionality $n$ and the chosen hyperparameter values $h \in \mathcal H$ . For example, an affine module with $h$ dense hidden units has output dimensionality $m = h$ and number of parameters $p = ( n + 1 ) h$ : a weight matrix $W \in \mathbb { R } ^ { h \times n }$ and a bias vector $b \in \mathbb { R } ^ { h }$ . A similar reasoning can be carried out for a convolutional module: the number of parameters $p$ depends on the input dimensionality, the number of filters, and the size of the filters; the dimensionality of the output $m$ depends on the input dimensionality, the number of filters, the size of the filters, the stride, and the padding scheme. The fact that $p$ and $m$ are functions of the input dimensionality and the chosen hyperparameter values is one of the main observations that allows us to do architecture search—once we know the input dimensionality and have fixed values for the hyperparameters, the structure of the computation performed by the module is determined, and this information can be propagated to other modules. We say that a module is fully specified when values for all hyperparameters of the module have been chosen and the input dimensionality is known.
|
| 73 |
+
|
| 74 |
+
We focus on search spaces for architectures that have a single input terminal and a single output terminal. By this, we only mean that the input and output of the module have to be a single tensor of arbitrary order and dimensionality. For example, convolutional modules take as input an order three tensor and return as output an order three tensor, therefore they are single-input single-output modules under our definition. We also assume that the output of a module is used as input to at most a single module, i.e., we assume no output sharing.
|
| 75 |
+
|
| 76 |
+
These restrictions were introduced to simplify exposition. The single-input single-output case with no sharing is simpler to develop and exemplifies the main ideas that allow us to develop a framework for automatic architecture search. The ideas developed in this work extend naturally to the multipleinput multiple-output case with sharing. Additionally, often we can represent modules that are not single-input single-output by defining new modules that encapsulate many signal paths from input to output. For example, a residual module (He et al., 2016) can be treated in our framework by noting that it is single-input before the skip connection split and single-output after the skip connection merge. Many top performing architectures, such as AlexNet (Krizhevsky et al., 2012), VGG (Simonyan & Zisserman, 2014), and ResNet (He et al., 2016), are captured in our language.
|
| 77 |
+
|
| 78 |
+
We distinguish between basic computational modules and composite computational modules. Basic modules do some well defined transformation. Affine, batch normalization, and dropout are examples of basic modules. Composite modules are defined in terms of other (composite or basic) modules, i.e., the instantiation of a composite module takes other modules as arguments. Composite modules may introduce hyperparameters of their own and inherit hyperparameters of the modules taken as arguments. For example, an $\bigcirc \mathtt { r }$ module takes a list of modules and chooses one of the modules to use. It introduces a discrete hyperparameter for which module to use, and chooses values for the hyperparameters of the chosen module; the hyperparameters available are conditional on the choice of the module to use. Most of the representational power of our language arises from the compositionality of composite and basic modules.
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 1: (a) A simple search space with 24 different models. (b) A path through the search space encoding a convolutional module with 64 filters of size $3 \times 3$ , with stride 1, followed by batch normalization, ReLU and affine modules. The model does not use dropout. Branches encoding hyperparameters with a single choice were omitted.
|
| 82 |
+
|
| 83 |
+
The ideas developed in this section are perhaps best illustrated with an example. See Figure 1a for the definition of an example search space in LISP-like pseudocode that closely parallels our implementation. The search space, which results from the composition of several modules, and therefore is also a module itself, encodes 24 different models, corresponding to the different 24 possible paths from the root to the leaves of the tree. The space is defined using three composite modules (Concat, MaybeSwap, and Optional) and five basic modules (Conv2D, BatchNormalization, ReLU, Dropout, and Affine). Concat introduces no additional hyperparameters, but it has to specify all the modules that have been delegated to it; MaybeSwap introduces a binary hyperparameter that encodes whether to swap the order of the pair of modules or not; Optional introduces a binary hyperparameter that encodes whether to include the module or not. The behavior of the basic modules in Figure 1a is simple: Conv2D takes lists of possible values for the number of filters, the size of the filters, and the stride; BatchNormalization and ReLU have no hyperparameters; Dropout takes a list for the possible values for the dropout probability; Affine takes a list for the possible values of the number of hidden units.
|
| 84 |
+
|
| 85 |
+
Choosing different values for the hyperparameters of the composite modules may affect the structure of the resulting architecture, while choosing different values for the hyperparameters of the basic modules only affects the structure of the corresponding local transformations. The search space of Figure 1a results from the composition of basic and composite modules; therefore it is a module itself and can be characterized by its input, output, parameters, and hyperparameters. Our set of composite modules in not minimal: e.g., given an Empty basic module, which has no hyperparameters or parameters and simply does the identity transformation, and a Or composite module, which introduces an extra hyperparameter encoding the choice of a specific module in its list, the composite modules Optional and MaybeSwap can be defined as (Optional B) $=$ ( $\bigcirc \mathtt { r }$ Empty B) and (MaybeSwap B1 B2) $=$ (Or (Concat B1 B2), (Concat B2 B1)).
|
| 86 |
+
|
| 87 |
+
# 4.2 SEARCH SPACE TRAVERSAL
|
| 88 |
+
|
| 89 |
+
Given a search space defined by a module, there is an underlying tree over fully specified models: we build this tree by sequentially assigning values to each of the hyperparameters of the module.
|
| 90 |
+
|
| 91 |
+
Each internal node in the tree corresponds to some partial assignment to the hyperparameters of the module, and each terminal node (i.e., each leaf) corresponds to a fully specified model. We can also think about an internal node as corresponding to the state of a module before assigning a value to the next unassigned hyperparameter. The branching factor of a node corresponds to the number of possible values for the hyperparameter under consideration at that node, and traversing a specific edge from that node to a child corresponds to assigning the value encoded by that edge to the hyperparameter under consideration. As a tree has a single path between the root and any leaf, the paths from root to leaves are in one-to-one correspondence with fully specified models. A leaf is reached when there are no hyperparameters left to specify.
|
| 92 |
+
|
| 93 |
+
In Figure 1b we have drawn a path through the search space of Figure 1a from the root (labeled node 0), where all hyperparameters are unassigned, to a terminal node (labeled node 4), where all hyperparameters have been assigned values. Each branch in the tree corresponds to the assignment of some value to some hyperparameter. At node 0, we are choosing between 32 or 64 filters; at node 1, we are choosing between filters of size 3 or 5; at node 2, we are choosing between applying batch normalization before or after ReLU; at node 3, we are choosing whether to do dropout or not. Node 4 is terminal and corresponds to a fully specified model. Decisions at each node are conditional on decisions previously made. Internal nodes with a single child (i.e., branches for hyperparameters with a single possible value) have been collapsed and omitted from Figure 1a. Other paths may have different lengths, e.g., picking a path through the right child of node 3 corresponds to adding a Dropout module, which requires an additional hyperparameter choice for the dropout probability when compared to the path from the root to node 4.
|
| 94 |
+
|
| 95 |
+
Search spaces arising from module composition have their traversal functionality automatically derived from the traversal functionality of their component modules: a basic module knows how to sequentially assign values to its hyperparameters, and a composite module knows how to sequentially assign values to its hyperparameters and call the sequential assignment functionality for its component modules. This is akin to recursive expression evaluation in programming languages.
|
| 96 |
+
|
| 97 |
+
To traverse the search space, i.e., to assign values to all hyperparameters of the module defining the search space, all that it is needed is that each module knows how to sequentially specify itself. Modules resulting from the composition of modules will then be automatically sequentially specifiable. The three local operations that a module needs to implement for traversal are: to test whether it is fully specified (i.e., whether it has reached a leaf yet); if it is not specified, to return which hyperparameter it is specifying and what are the possible values for it; and given a choice for the current hyperparameter under consideration, to traverse the edge to the child of the current node corresponding to chosen value.
|
| 98 |
+
|
| 99 |
+
# 4.3 COMPILATION
|
| 100 |
+
|
| 101 |
+
Once values for all hyperparameters of a module have been chosen, the fully specified model can be automatically mapped to its corresponding computational graph. We call this mapping compilation. This operation only requires that each module knows how to locally map itself to a computational graph: compilation is derived recursively from the compilation of simpler modules. For example, if we know how to compile Conv2D, ReLU, and $\bigcirc \mathtt { r }$ modules, we will automatically be able to compile all modules built from them. This behavior is also similar to recursive expression evaluation in programming languages.
|
| 102 |
+
|
| 103 |
+
# 5 MODEL SEARCH ALGORITHMS
|
| 104 |
+
|
| 105 |
+
In this section, we consider different search algorithms that are built on top of the functionality described above. Some of these algorithms rely on the search space being tree structured. One of the challenges of our setting is that deep models are expensive to train, so unless we have access to extraordinary computational resources, only a moderate number of evaluations will be practical.
|
| 106 |
+
|
| 107 |
+
# 5.1 RANDOM SEARCH
|
| 108 |
+
|
| 109 |
+
Random search is the simplest algorithm that we can consider. At each node of the tree, we choose an outgoing edge uniformly at random, until we reach a leaf node (i.e., a model). Even just random
|
| 110 |
+
|
| 111 |
+
search is interesting, as the model search space specification language allows us to capture expressive structural search spaces. Without our language, randomly selecting an interesting architecture to try would not be possible without considerable effort from the human expert.
|
| 112 |
+
|
| 113 |
+
# 5.2 MONTE CARLO TREE SEARCH
|
| 114 |
+
|
| 115 |
+
Monte Carlo tree search (MCTS) (Browne et al., 2012; Kocsis & Szepesvari, 2006) is an approxi- ´ mate planning technique that has been used effectively in many domains (Silver et al., 2016). Contrary to random search, MCTS uses the information gathered so far to steer its policy towards better performing parts of the search space. MCTS maintains a search tree that is expanded incrementally one node at a time. MCTS uses two policies: a tree policy, which determines the path to be traversed from the root to the frontier of the already expanded tree; and a rollout policy, which determines the path to be traversed from the frontier of the already expanded tree until a leaf is reached. Once a leaf is reached, the model encoded by it is evaluated (e.g., trained on the training set and evaluated on the validation set), and the resulting score is used to update the statistics of the nodes in the currently expanded tree in the path to the leaf. Each node in the expanded tree keeps statistics about the number of times it was visited and the average score of the models that were evaluated in the subtree at that node. The rollout policy is often simple, e.g., the random policy described in Section 5.1.
|
| 116 |
+
|
| 117 |
+
The tree policy typically uses an upper confidence bound (UCB) approach. Let $n$ be the number of visits of a node $v \in \mathcal T$ , where $\tau$ denotes the currently expanded tree, and $n _ { 1 } , \ldots , n _ { b }$ and ${ \bar { X } } _ { 1 } , \dots , { \bar { X } } _ { b }$ be, respectively, the number of visits and the average scores of the $b$ children of $v$ . The tree policy at $x$ chooses to traverse an edge corresponding to a child maximizing the UCB score:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\operatorname* { m a x } _ { i \in \{ 1 , \dots , b \} } { \bar { X } } _ { i } + 2 c \sqrt { \frac { 2 \log n } { n _ { i } } } ,
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
where $c \in \mathbb { R } _ { + }$ is a constant capturing the trade-off between exploration and exploitation—larger values of $c$ correspond to larger amounts of exploration. If at node $x$ , some of its children have not been added to the tree, there will be some $i \in \{ 1 , \ldots , b \}$ for which $n _ { i } = 0$ ; in this case we define the UCB score to be infinite, and therefore, unexpanded children always take precedence over expanded children. If multiple unexpanded children are available, we expand one uniformly at random.
|
| 124 |
+
|
| 125 |
+
# 5.3 MONTE CARLO TREE SEARCH WITH TREE RESTRUCTURING
|
| 126 |
+
|
| 127 |
+
When MCTS visits a node in the expanded part of the tree, it has to expand all children of that node before expanding any children of its currently expanded children. This is undesirable when there are hyperparameters that can take a large number of related values.
|
| 128 |
+
|
| 129 |
+
We often consider hyperparameters which take numeric values, and similar values result in similar performance. For example, choosing between 64 or 80 filters for a convolutional module might not have a dramatic impact on performance. A way of addressing such hyperparameters is to restructure the branches of the tree by doing bisection. Assume that the set of hyperparameters has a natural ordering. At a node, rather than committing directly to a value of the hyperparameter, we commit sequentially—first we decide if we are choosing a value in the first or second half of the set of hyperparameters, and then we recurse on the chosen half until we have narrow it down to a single value. See an example tree in Figure 2a and the corresponding restructured tree in Figure 2b.
|
| 130 |
+
|
| 131 |
+
Tree restructuring involves a tradeoff between depth and breadth: the tree in Figure 2a has depth 1, while the tree in Figure 2b has depth 3. The restructured tree can have better properties in the sense that there more sharing between different values of the hyperparameters. We could also consider restructured trees with branching factors different than two, again trading off depth and breadth. If the branching factor of the restructured tree is larger than the number of children of the hyperparameter, the restructuring has no effect, i.e., the original and restructured trees are equal. The restructuring operation allows MCTS to effectively consider hyperparameters with a large number of possible values.
|
| 132 |
+
|
| 133 |
+
# 5.4 SEQUENTIAL MODEL BASED OPTIMIZATION
|
| 134 |
+
|
| 135 |
+
MCTS is tabular in the sense that it keeps statistics for each node in the tree. While the restructuring operation described in Section 5.3 increases sharing between different hyperparameter values, it still suffers from the problem that nodes have no way of sharing information other than through common ancestors. This is problematic because differences in hyperparameter values at the top levels of the tree lead to little sharing between models, even if the resulting models happen to be very similar.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 2: (a) A tree encoding an hyperparameter and its five possible values. MCTS applied to this tree is sample-inefficient as there is no sharing of information between the different child nodes. (b) The result of restructuring the tree with bisection. MCTS applied to this tree results in more sharing when compared to the original tree. For example, sampling a path reaching node 1 provides information about nodes 1, 2, and 3.
|
| 139 |
+
|
| 140 |
+
Sequential Model Based Optimization (SMBO) (Hutter et al., 2011) allows us to address this problem by introducing a surrogate function which can be used to capture relationships between models and how promising it is to evaluate any specific model. The surrogate function can use expressive features to capture architecture patterns that influence performance, e.g., features about sequences of basic modules that occur in the model.
|
| 141 |
+
|
| 142 |
+
The surrogate function can then be optimized to choose which model to evaluate next. Exactly optimizing the surrogate function over a search space can be difficult as often there is a combinatorially large number of models. To approximately optimize the surrogate function, we do some number of random rollouts from the root of the tree until we hit leaf nodes (i.e., models), we evaluate the surrogate function (i.e., we determine, according to the surrogate function, how promising it is to evaluate that model), and evaluate the model that has the highest score according to the surrogate function. We also introduce an exploratory component where we flip a biased coin and choose between evaluating a random model or evaluating the best model according to the surrogate function. The surrogate function is updated after each evaluation.
|
| 143 |
+
|
| 144 |
+
In our experiments, we use a simple surrogate function: we train a ridge regressor to predict model performance, using the models evaluated so far and their corresponding performances as training data. We only use features based on $n$ -grams of sequences of basic modules, disregarding the values of the hyperparameters. More complex features, surrogate functions, and training losses are likely to lead to better search performance, but we leave these to future work.
|
| 145 |
+
|
| 146 |
+
# 6 MODEL EVALUATION ALGORITHMS
|
| 147 |
+
|
| 148 |
+
As a reminder, once we assign values to all hyperparameters of the module defining the search space, we need to compute a score for the resulting model, i.e., a score for the path from the root to the corresponding leaf encoding the model to evaluate. The specific way to compute scores is defined by the human expert, and it typically amounts to training the model on a training set and evaluating the trained model on a validation set. The score of the model is the resulting validation performance. The training process often has its own hyperparameters, such as: what optimization algorithm to use and its corresponding hyperparameters, the learning rate schedule (e.g., the initial learning rate, the learning rate reduction multiplier, and how many epochs without improving the validation performance the algorithm waits before reducing the learning rate), how many epochs without improving the validation performance the algorithm waits before terminating the training process (i.e., early stopping), and what data augmentation strategies to use and their corresponding hyperparameters. The behavior of the evaluation algorithm with respect to the values of its hyperparameters is defined by the expert for the task being considered, so the compilation step described in Section 4.3 for this functionality has to be implemented by the expert. Nonetheless, these user hyperparameters can be included in the search space and searched over in the same way as the architecture hyperparameters described in Section 4.1.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 3: (a, b) Average maximum validation score achieved as a function of the number of evaluation across five repetitions. The error bars indicate standard error. The range of 64 evaluations is split into two plots for clearer visualization. (c) Percentage of models above a given validation threshold performance. MCTS with bisection and SMBO outperform random search. The error bars have size equal to the standard error.
|
| 152 |
+
|
| 153 |
+
# 7 EXPERIMENTS
|
| 154 |
+
|
| 155 |
+
We illustrate how our framework can be used to search over all hyperparameters of a model, i.e., both architecture and training hyperparameters, using only high-level insights. We choose a search space of deep convolutional models based around the ideas that depth is important, batch normalization helps convergence, and dropout is sometimes helpful. We search over architectures and evaluate our models on CIFAR-10 (Krizhevsky, 2009).
|
| 156 |
+
|
| 157 |
+
The training hyperparameters that we consider are whether to use ADAM or SGD with momentum, the initial learning rate, the learning rate reduction multiplier, and the rate reduction patience, i.e., how many epochs without improvement to wait before reducing the current learning rate. We use standard data augmentation techniques: we zero pad the CIFAR-10 images to size $4 0 \times 4 0 \times 3$ , randomly crop a $3 2 \times 3 2$ portion, and flip horizontally at random. We could search over these too if desired.
|
| 158 |
+
|
| 159 |
+
We compare the search algorithms described in Section 5 in terms of the best model found, according to validation performance, as a function of the number of evaluations. We run each algorithm 5 times, for 64 model evaluations each time. All models were trained for 30 minutes on GeForce GTX 970 GPUs in machines with similar specifications.
|
| 160 |
+
|
| 161 |
+
In Figure 3a and Figure 3b, we see that all search algorithms find performant solutions (around $8 9 \%$ accuracy) after 64 evaluations. In Figure 3a, we see that for fewer than 6 evaluations there is considerable variance between the different algorithms; the more sophisticated model search algorithms are not able to outperform random search with so few evaluations. In Figure 3b, we see that both SMBO and MCTS with bisection eventually outperform random search; MCTS with bisection starts outperforming random search around 32 evaluations, while for SMBO, it happens around 16 evaluations.
|
| 162 |
+
|
| 163 |
+
Surprisingly, MCTS without restructuring does not outperform random search. We think that this is because there are too many possible values for the first few hyperparameters in the tree, so MCTS will not be able to identify and focus on high-performance regions of the search space within the number of evaluations available. MCTS with bisection and SMBO do not suffer from these problems, and therefore can identify and focus on high performance regions of the search space earlier. In addition to achieving a higher top accuracy, MCTS with bisection and SMBO evaluate a larger fraction of high-performance models when compared to random search, as can be seen in Figure 3c.
|
| 164 |
+
|
| 165 |
+
The main goal of the previous experiment is to show that more complex model search algorithms can outperform random search by better leveraging the structure of the search. We are not attempting to achieve state-of-the-art performance. We now show that using the same search space on MNIST with a larger time budget leads to close to state-of-the-art performance. The data augmentation scheme is slightly different, as we no longer randomly flip the image horizontally, but now consider random rotations where the maximum angle of rotation is also added as a hyperparameter to the search space.
|
| 166 |
+
|
| 167 |
+
In this experiment, we randomly sample 16 models in the search space and train them for up to 3 hours or until the validation performance fails to increase for more than 128 epochs. The best model among the models sampled chosen according to validation performance obtained among the 16 sampled models has test accuracy equal to $9 9 . { \bar { 7 } } 2 \%$ , which is close to the single model state-of-theart of $9 9 . 7 7 \%$ (Sato et al., 2015). Additionally, taking a simple majority voting emsemble of the 5 best performing models yielded the same validation accuracy as the best single model and increased test accuracy to $9 9 . 7 5 \%$ . The performance profile of the sampled models and the architecture and hyperparameters of the best model are presented in Appendix A.
|
| 168 |
+
|
| 169 |
+
We can build good ensembles by sampling models in the search space and building an ensemble out of the best ones. It has been observed in the literature that model diversity often improves emsemble performance. Our results suggest that it is possible to define search spaces that work well across a range of tasks, having the potential to significantly reduce the burden on the human expert.
|
| 170 |
+
|
| 171 |
+
# 8 CONCLUSION
|
| 172 |
+
|
| 173 |
+
We described a framework for automatically designing and training deep models. This framework consists of three fundamental components: the model search space specification language, the model search algorithm, and the model evaluation algorithm. The model search space specification language is composable, modular, and extensible, and allows us to easily define expressive search spaces over architectures. The model evaluation algorithm determines how to compute a score for a model in the search space. Models can be automatically compiled to their corresponding computational graphs. Using the model search space specification language and the model evaluation algorithm, we can introduce model search algorithms for exploring the search space. Using our framework, it is possible to do random search over interesting spaces of architectures without much effort from the expert. We also described more complex model search algorithms, such as MCTS, MCTS with tree restructuring, and SMBO. We present experiments on CIFAR-10 comparing different model search algorithms and show that MCTS with tree restructuring and SMBO outperform random search. Code for our framework and experiments has been made publicly available. We hope that this paper will lead to more work and better tools for automatic architecture search.
|
| 174 |
+
|
| 175 |
+
# REFERENCES
|
| 176 |
+
|
| 177 |
+
Martın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv:1603.04467, 2016.
|
| 178 |
+
Alekh Agarwal, John Duchi, Peter Bartlett, and Clement Levrard. Oracle inequalities for computationally budgeted model selection. In Conference on Learning Theory, 2011.
|
| 179 |
+
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. arXiv:1611.02167, 2016.
|
| 180 |
+
James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. Journal of Machine Learning Research, 13(Feb):281–305, 2012.
|
| 181 |
+
James Bergstra, Remi Bardenet, Yoshua Bengio, and Bal ´ azs K ´ egl. Algorithms for hyper-parameter ´ optimization. In Neural Information Processing Systems, 2011.
|
| 182 |
+
Leon Bottou and Patrick Gallinari. ´ A framework for the cooperation of learning algorithms. 1991.
|
| 183 |
+
Cameron Browne, Edward Powley, Daniel Whitehouse, Simon Lucas, Peter Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. A survey of
|
| 184 |
+
|
| 185 |
+
Monte Carlo tree search methods. IEEE Transactions on Computational Intelligence and AI in Games, 4(1):1–43, 2012.
|
| 186 |
+
|
| 187 |
+
Ronan Collobert, Koray Kavukcuoglu, and Clement Farabet. Torch7: A Matlab-like environment ´ for machine learning. In BigLearn, NIPS Workshop, 2011.
|
| 188 |
+
|
| 189 |
+
Dario Floreano, Peter Durr, and Claudio Mattiussi. Neuroevolution: from architectures to learning. ¨ Evolutionary Intelligence, 1(1):47–62, 2008.
|
| 190 |
+
|
| 191 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In International Conference on Artificial Intelligence and Statistics, 2010.
|
| 192 |
+
|
| 193 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In International Conference on Computer Vision, 2015.
|
| 194 |
+
|
| 195 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Conference on Computer Vision and Pattern Recognition, 2016.
|
| 196 |
+
|
| 197 |
+
Frank Hutter, Holger Hoos, and Kevin Leyton-Brown. Sequential model-based optimization for general algorithm configuration. In International Conference on Learning and Intelligent Optimization, 2011.
|
| 198 |
+
|
| 199 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv:1502.03167, 2015.
|
| 200 |
+
|
| 201 |
+
Kirthevasan Kandasamy, Jeff Schneider, and Barnabas P ´ oczos. High dimensional Bayesian opti- ´ misation and bandits via additive models. In International Conference on Machine Learning, 2015.
|
| 202 |
+
|
| 203 |
+
Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In Conference on Computer Vision and Pattern Recognition, 2015.
|
| 204 |
+
|
| 205 |
+
Levente Kocsis and Csaba Szepesvari. Bandit based Monte Carlo planning. In ´ European Conference on Machine Learning, 2006.
|
| 206 |
+
|
| 207 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
|
| 208 |
+
|
| 209 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton. ImageNet classification with deep convolutional neural networks. In Neural Information Processing Systems, 2012.
|
| 210 |
+
|
| 211 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing Atari with deep reinforcement learning. arXiv:1312.5602, 2013.
|
| 212 |
+
|
| 213 |
+
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. arXiv:1703.01041, 2017.
|
| 214 |
+
|
| 215 |
+
Ashish Sabharwal, Horst Samulowitz, and Gerald Tesauro. Selecting near-optimal learners via incremental data allocation. In AAAI, 2015.
|
| 216 |
+
|
| 217 |
+
Ikuro Sato, Hiroki Nishimura, and Kensuke Yokoi. APAC: Augmented pattern classification with neural networks. arXiv:1505.03229, 2015.
|
| 218 |
+
|
| 219 |
+
David Silver, Aja Huang, Chris 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.
|
| 220 |
+
|
| 221 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv:1409.1556, 2014.
|
| 222 |
+
|
| 223 |
+
Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical Bayesian optimization of machine learning algorithms. In Neural Information Processing Systems, 2012.
|
| 224 |
+
|
| 225 |
+
Nitish Srivastava, Geoffrey 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.
|
| 226 |
+
|
| 227 |
+
Kenneth Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary Computation, 10(2):99–127, 2002.
|
| 228 |
+
|
| 229 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to sequence learning with neural networks. In Neural Information Processing Systems, 2014.
|
| 230 |
+
|
| 231 |
+
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Conference on Computer Vision and Pattern Recognition, 2015.
|
| 232 |
+
|
| 233 |
+
Daan Wierstra, Faustino Gomez, and Jurgen Schmidhuber. Modeling systems with internal state �� using Evolino. In Proceedings of the 7th Annual Conference on Genetic and Evolutionary Computation, 2005.
|
| 234 |
+
|
| 235 |
+
Daniel Yamins, David Tax, and James Bergstra. Making a science of model search: hyperparameter optimization in hundreds of dimensions for vision architectures. In International Conference on Machine Learning, 2013.
|
| 236 |
+
|
| 237 |
+
Barret Zoph and Quoc Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations, 2017.
|
| 238 |
+
|
| 239 |
+
# A DETAILED EXPERIMENTAL SETUP
|
| 240 |
+
|
| 241 |
+
In Section 7, we considered a search space of deep convolutional models having structural hyperparameters for the depth of the network, whether to apply batch normalization before or after ReLU, and whether to use dropout; hyperparameters for the number and size of the convolutional filters; training hyperparameters for the learning rate schedule. We show in Figure 4 the LISP-like pseudocode for the search space considered in Section 7, and in Figure 5 the corresponding runnable Python implementation in our framework.
|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
Figure 4: Specification of the model search space used in Section 7 in LISP-like pseudocode. See Figure 5 for the corresponding runnable Python code.
|
| 245 |
+
|
| 246 |
+
In Figure 4 and Figure 5, to include training hyperparameters in the search space, we concatenate the module that encapsulates the training hyperparameters (the module assigned to MH) and the modules that encapsulate the remaining model hyperparameters (the modules other than MH in the declaration of M).
|
| 247 |
+
|
| 248 |
+
The Python specification of the model search space in Figure 5 is remarkably close in both semantics and length to the LISP-like pseudocode in Figure 4. We omit some hyperparameters in Figure 4 because we did not consider multiple values for them, e.g., for Conv2D modules, we always used same size padding and the initialization scheme described in He et al. (2015).
|
| 249 |
+
|
| 250 |
+
Our implementation has code modularity and reusability benefits. For example, we can define an auxiliary function to instantiate modules and then use it in the instantiation of the module for the complete search space. This is illustrated in Figure 5 with the definition of Module fn and its use in the declaration of M.
|
| 251 |
+
|
| 252 |
+
See Figure 6a for the performance profile of 16 models randomly sampled from the search space in Figure 5. See Figure 6b for the architecture and training hyperparameters of the best model found in the 16 samples.
|
| 253 |
+
|
| 254 |
+
# B LIST OF MODULES
|
| 255 |
+
|
| 256 |
+
We provide a brief description of a representative subset of the types of basic and composite modules that we have implemented in our framework. It is simple to define new modules this list by implementing the module interface described in Section C.
|
| 257 |
+
|
| 258 |
+
# B.1 BASIC MODULES
|
| 259 |
+
|
| 260 |
+
Basic modules take no other modules when instantiated, having only local hyperparameters and parameters.
|
| 261 |
+
|
| 262 |
+
• Affine: Dense affine transformation. Hyperparameters: number of the hidden units and initialization scheme of the parameters. Parameters: dense matrix and bias vector.
|
| 263 |
+
|
| 264 |
+
MH $=$ UserHyperparams([’optimizer_type’, ’learning_rate_init’, ’rate_mult’, ’rate_patience’, ’stop_patience’, ’learning_rate_min’, ’angle_delta’, ’scale_delta’, ’weight_decay_coeff’], [[’adam’, ’sgd_mom’], list( np.logspace(-2, -6, num=32) ), list( np.logspace(-2, np.log10(0.9), num=8) ), range(8, 65, 4), [128], [1e-6], [0, 5, 10, 15, 20, 25, 30, 35], [0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35], [0.0, 1e-6, 1e-5, 1e-4] ])
|
| 265 |
+
|
| 266 |
+
conv_initers $=$ [ kaiming2015delving_initializer_conv(1.0) ] aff_initers $=$ [ xavier_initializer_affine( 1.0 )]
|
| 267 |
+
|
| 268 |
+
def Module_fn(filter_ns, filter_ls, keep_ps, repeat_ns): b $=$ RepeatTied( Concat([ Conv2D(filter_ns, filter_ls, [1], ["SAME"], conv_initers), MaybeSwap_fn( ReLU(), BatchNormalization() ), Optional_fn( Dropout(keep_ps) ) ]), repeat_ns) return b
|
| 269 |
+
|
| 270 |
+
filter_nums $=$ range(48, 129, 16) repeat_nums $= \ [ 2 \star \star$ i for i in xrange(6)] mult_fn $=$ lambda ls, alpha: list(alpha $^ { \star }$ np.array(ls))
|
| 271 |
+
|
| 272 |
+
$\mathrm { ~ \textmu ~ } =$ Concat([MH, Conv2D(filter_nums, [3, 5, 7], [2], ["SAME"], conv_initers), Module_fn(filter_nums, [3, 5], [0.5, 0.9], repeat_nums), Conv2D(filter_nums, [3, 5, 7], [2], ["SAME"], conv_initers), Module_fn(mult_fn(filter_nums, 2), [3, 5], [0.5, 0.9], repeat_nums), Affine([num_classes], aff_initers) ])
|
| 273 |
+
|
| 274 |
+
Figure 5: Runnable specification of the model search space used in Section 7 in our Python implementation of the framework. See Figure 4 for the specification of the same search space in the LISP-like pseudocode used throughout this paper.
|
| 275 |
+
|
| 276 |
+

|
| 277 |
+
Figure 6: (a) The performance profile of the 16 sampled models in decreasing order of their validation accuracy. The model with the highest validation accuracy $( 9 9 . 8 0 \% )$ has also the highest test accuracy $( 9 9 . 7 2 \% )$ ). (b) The best performing model found from sampling 16 models of search space in Figure 5 with a random model searcher. The hyperparameters of UserHyperparams are as in the search space in Figure 5. The hyperparameters of the layers are as described in Appendix B. The parameters of the Affine and Conv2d modules were initialized according to Glorot & Bengio (2010) and He et al. (2015), respectively.
|
| 278 |
+
|
| 279 |
+
( ( ’UserHyperparams’,
|
| 280 |
+
’adam’,
|
| 281 |
+
0.003046989570903508,
|
| 282 |
+
0.24882127247602889,
|
| 283 |
+
52,
|
| 284 |
+
128,
|
| 285 |
+
1e-06,
|
| 286 |
+
15,
|
| 287 |
+
0.1,
|
| 288 |
+
1e-06),
|
| 289 |
+
(’Conv2D’, 80, 7, 2, ’SAME’),
|
| 290 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 291 |
+
(’ReLU’,),
|
| 292 |
+
(’BatchNormalization’,),
|
| 293 |
+
(’Dropout’, 0.9),
|
| 294 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 295 |
+
(’ReLU’,),
|
| 296 |
+
(’BatchNormalization’,),
|
| 297 |
+
(’Dropout’, 0.9),
|
| 298 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 299 |
+
(’ReLU’,),
|
| 300 |
+
(’BatchNormalization’,),
|
| 301 |
+
(’Dropout’, 0.9),
|
| 302 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 303 |
+
(’ReLU’,),
|
| 304 |
+
(’BatchNormalization’,),
|
| 305 |
+
(’Dropout’, 0.9),
|
| 306 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 307 |
+
(’ReLU’,),
|
| 308 |
+
(’BatchNormalization’,),
|
| 309 |
+
(’Dropout’, 0.9),
|
| 310 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 311 |
+
(’ReLU’,),
|
| 312 |
+
(’BatchNormalization’,),
|
| 313 |
+
(’Dropout’, 0.9),
|
| 314 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 315 |
+
(’ReLU’,),
|
| 316 |
+
(’BatchNormalization’,),
|
| 317 |
+
(’Dropout’, 0.9),
|
| 318 |
+
(’Conv2D’, 96, 3, 1, ’SAME’),
|
| 319 |
+
(’ReLU’,),
|
| 320 |
+
(’BatchNormalization’,),
|
| 321 |
+
(’Dropout’, 0.9),
|
| 322 |
+
(’Conv2D’, 128, 7, 2, ’SAME’),
|
| 323 |
+
(’Conv2D’, 128, 3, 1, ’SAME’),
|
| 324 |
+
(’BatchNormalization’,),
|
| 325 |
+
(’ReLU’,),
|
| 326 |
+
(’Dropout’, 0.5),
|
| 327 |
+
(’Affine’, 10))
|
| 328 |
+
• ReLU: ReLU nonlinearity. Hyperparameters: none. Parameters: none.
|
| 329 |
+
• Dropout: Dropout. Hyperparameter: dropout probability. Parameters: none.
|
| 330 |
+
• Conv2D: Two-dimensional convolution. Hyperparameters: number of filters, size of the filters, stride, padding scheme, and initialization scheme of the parameters. Parameters: convolutional filters and bias vector.
|
| 331 |
+
• MaxPooling2D: Two-dimensional max pooling. Hyperparameters: size of the filters, stride, and padding scheme. Parameters: none.
|
| 332 |
+
• BatchNormalization: Batch normalization. Hyperparameters: none. Parameters: translation coefficients and scaling coefficients.
|
| 333 |
+
• UserHyperparams: User-defined hyperparameters. Hyperparameters: hyperparameters determined by the user expert. Parameters: none.
|
| 334 |
+
• Empty: Identity. Hyperparameters: none. Parameters: none.
|
| 335 |
+
|
| 336 |
+
# B.2 COMPOSITE MODULES
|
| 337 |
+
|
| 338 |
+
Composite modules take other modules as arguments when instantiated, which we will call submodules. The behavior of a composite module depends on its submodules. The hyperparameters which a composite module has to specify depend on the values of the hyperparameters of the composite module and the hyperparameters of the submodules; e.g., $\bigcirc \mathtt { r }$ takes a list of submodules but it only has to specify the hyperparameters of the submodule that it ends up choosing. A composite module is responsible for specifying its submodules, which is done through calls to the module interfaces of the submodules.
|
| 339 |
+
|
| 340 |
+
• Concat: Takes a list of submodules and connects them in series. Hyperparameters: hyperparameters of the submodules. Parameters: parameters of the submodules.
|
| 341 |
+
• Or: Chooses one of its submodules to use. Hyperparameters: which submodule to use and hyperparameters of the submodule chosen. Parameters: parameters of the submodule chosen.
|
| 342 |
+
• Repeat: Repeats a submodule some number of times, connecting the repetitions in series; values for the hyperparameters of the repetitions are chosen independently. Hyperparameters: number of times to repeat the submodule and hyperparameters of the repetitions of the submodule. Parameters: parameters of the repetitions of the submodule. RepeatTied: Same as Repeat, but values for the hyperparameters of the submodule are chosen once and used for all the submodule repetitions. Hyperparameters: the number of times to repeat the submodule and hyperparameters of the submodule. Parameters: parameters of the repetitions of the submodule. Optional: Takes a submodule and chooses whether to use it or not. Hyperparameters: whether to include the submodule or not and, if included, hyperparameters of the submodule. Parameters: if included, parameters of the submodule. Residual: Takes a submodule and implements a skip connection adding the input and output; if the input and output have different dimensions, they are padded to make addition possible. Hyperparameters: hyperparameters of the submodule. Parameters: parameters of the submodule. MaybeSwap: Takes two submodules and connects them in series, choosing which submodule comes first. Hyperparameters: which of the submodules comes first and hyperparameters of the submodules. Parameters: parameters of the submodules.
|
| 343 |
+
|
| 344 |
+
# C MODULE INTERFACE
|
| 345 |
+
|
| 346 |
+
We describe the module interface as we implemented it in Python. To implement a new type of module, one only needs to implement the module interface.
|
| 347 |
+
|
| 348 |
+
class Module(object): def initialize(self, in_d, scope) def get_outdim(self) def is_specified(self) def get_choices(self) def choose(self, choice_i) def compile(self, in_x, train_feed, eval_feed)
|
| 349 |
+
|
| 350 |
+
Figure 7: Module interface used by all modules irrespective if they are basic or composite. To implement a new type of module, the human expert only needs to implement the module interface.
|
| 351 |
+
|
| 352 |
+
• initialize: Tells a module its input dimensionality. A composite module is responsible for initializing the submodules that it uses.
|
| 353 |
+
|
| 354 |
+
get outdim: Once a module is fully specified, we can determine its output dimensionality by calling get outdim. The output dimensionality is a function of the input dimensionality (which is determined when initialize is called) and the values of the hyperparameters chosen. is specified: Tests whether a module is fully specified. If a module is fully specified, outdim and compile may be called.
|
| 355 |
+
• get choices: Returns a list of the possible values for the hyperparameter currently being specified.
|
| 356 |
+
• choose: Chooses one of the possible values for the hyperparameter being specified. The module assigns the chosen value to that hyperparameter and either transitions to the next hyperparameter to specify or becomes fully specified. The module maintains internally the state of its search process. compile: Creates the computational graph of the model in a deep learning model specification language, such as Tensorflow or PyTorch. For composite modules, compilation can be performed recursively, through calls to the compile functions of its submodules.
|
| 357 |
+
|
| 358 |
+
Composite modules rely on calls to the module interfaces of its submodules to implement their own module interfaces. For example, Concat needs to call out dim for the last submodule of the series connection to determine its own output dimensionality, and needs to call choose on the submodules to specify itself. One of the design choices that make the language modular is the fact that a composite module can implement its own module interface through calls to the module interfaces of its submodules. All information about the specification of a module is local to itself or kept within its submodules.
|
| 359 |
+
|
| 360 |
+
# D BEYOND SINGLE-INPUT SINGLE-OUTPUT MODULES
|
| 361 |
+
|
| 362 |
+
We can define new modules with complex signal paths as long as their existence is encapsulated, i.e., a module may have many signal paths as long they fork from a single input and merge to a single output, as illustrated in Figure 8.
|
| 363 |
+
|
| 364 |
+

|
| 365 |
+
Figure 8: A module with many signal paths from input to output. To implement a module, the human expert only needs to implement its module interface. M1, M2, M3, and M4 are arbitrary single-input single-output modules; $g _ { 1 }$ and $g _ { 2 }$ are arbitrary transformations that may have additional hyperparameters. The hyperparameters of $g _ { 1 }$ and $g _ { 2 }$ can be managed internally by NewModule.
|
| 366 |
+
|
| 367 |
+
In Figure 8 there is a single input fed into M1, M2, and M3. M1, M2, M3, M4, M5 are arbitrary single-input single-output submodules of NewModule. The module interface of NewModule can be implemented using the module interfaces of its submodules. Instantiating a module of type NewModule requires submodules for M1, M2, M3, M4, and M5, and potentially lists of possible values for the hyperparameters of $g _ { 1 }$ and $g _ { 2 }$ . A residual module which chooses what type of merging function to apply, e.g., additive or multiplicative, is an example of a module with hyperparameters for the merging functions
|
| 368 |
+
|
| 369 |
+
A module of the type NewModule is fully specified after we choose values for all the hyperparameters of M1, M2, M3, M4, M5, $g _ { 1 }$ , and $g _ { 2 }$ . Testing if M1, M2, M3, M4, and M5 are fully specified can be done by calling is specified on the corresponding submodule.
|
| 370 |
+
|
| 371 |
+
The output dimensionality of NewModule can be computed as a function of the values of the hyperparameters of $g _ { 2 }$ and the output dimensionality of M5 and M4, which can be obtained by calling get outdim. Similarly, for get choices we have to keep track of which hyperparameter we are specifying, which can either come from M1, M2, M3, M4, and M5, or from $g _ { 1 }$ and $g _ { 2 }$ . If we are choosing values for an hyperparameter in M1, M2, M3, M4, and M5 we can call get choices and choose on that submodule, while for the hyperparameters of $g _ { 1 }$ and $g _ { 2 }$ we have to keep track of the state in NewModule. compile is similar in the sense that it is implemented using calls to the compile functionality of the submodules.
|
md/train/rkTS8lZAb/rkTS8lZAb.md
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BOUNDARY-SEEKING GENERATIVE ADVERSARIAL NETWORKS
|
| 2 |
+
|
| 3 |
+
R Devon Hjelm∗ MILA, University of Montreal, IVADO ´ erroneus@gmail.com
|
| 4 |
+
|
| 5 |
+
Athul Paul Jacob∗MILA, MSR, University of Waterlooapjacob@edu.uwaterloo.ca
|
| 6 |
+
|
| 7 |
+
Tong Che MILA, University of Montreal ´ tong.che@umontreal.ca
|
| 8 |
+
|
| 9 |
+
Adam Trischler
|
| 10 |
+
MSR
|
| 11 |
+
adam.trischler@microsoft.com
|
| 12 |
+
|
| 13 |
+
Kyunghyun Cho New York University, CIFAR Azrieli Global Scholar kyunghyun.cho@nyu.edu
|
| 14 |
+
|
| 15 |
+
# Yoshua Bengio
|
| 16 |
+
|
| 17 |
+
MILA, University of Montreal, CIFAR, IVADO ´ yoshua.bengio@umontreal.ca
|
| 18 |
+
|
| 19 |
+
# ABSTRACT
|
| 20 |
+
|
| 21 |
+
Generative adversarial networks (GANs, Goodfellow et al., 2014) are a learning framework that rely on training a discriminator to estimate a measure of difference between a target and generated distributions. GANs, as normally formulated, rely on the generated samples being completely differentiable w.r.t. the generative parameters, and thus do not work for discrete data. We introduce a method for training GANs with discrete data that uses the estimated difference measure from the discriminator to compute importance weights for generated samples, thus providing a policy gradient for training the generator. The importance weights have a strong connection to the decision boundary of the discriminator, and we call our method boundary-seeking GANs (BGANs). We demonstrate the effectiveness of the proposed algorithm with discrete image and character-based natural language generation. In addition, the boundary-seeking objective extends to continuous data, which can be used to improve stability of training, and we demonstrate this on Celeba, Large-scale Scene Understanding (LSUN) bedrooms, and Imagenet without conditioning.
|
| 22 |
+
|
| 23 |
+
# 1 INTRODUCTION
|
| 24 |
+
|
| 25 |
+
Generative adversarial networks (GAN, Goodfellow et al., 2014) involve a unique generative learning framework that uses two separate models, a generator and discriminator, with opposing or adversarial objectives. Training a GAN only requires back-propagating a learning signal that originates from a learned objective function, which corresponds to the loss of the discriminator trained in an adversarial manner. This framework is powerful because it trains a generator without relying on an explicit formulation of the probability density, using only samples from the generator to train.
|
| 26 |
+
|
| 27 |
+
GANs have been shown to generate often-diverse and realistic samples even when trained on highdimensional large-scale continuous data (Radford et al., 2015). GANs however have a serious limitation on the type of variables they can model, because they require the composition of the generator and discriminator to be fully differentiable.
|
| 28 |
+
|
| 29 |
+
With discrete variables, this is not true. For instance, consider using a step function at the end of a generator in order to generate a discrete value. In this case, back-propagation alone cannot provide the training signal, because the derivative of a step function is 0 almost everywhere. This is problematic, as many important real-world datasets are discrete, such as character- or word-based representations of language. The general issue of credit assignment for computational graphs with discrete operations (e.g. discrete stochastic neurons) is difficult and open problem, and only approximate solutions have been proposed in the past (Bengio et al., 2013; Gu et al., 2015; Gumbel & Lieblein, 1954; Jang et al., 2016; Maddison et al., 2016; Tucker et al., 2017). However, none of these have yet been shown to work with GANs. In this work, we make the following contributions:
|
| 30 |
+
|
| 31 |
+
• We provide a theoretical foundation for boundary-seeking GANs (BGAN), a principled method for training a generator of discrete data using a discriminator optimized to estimate an $f$ -divergence (Nguyen et al., 2010; Nowozin et al., 2016). The discriminator can then be used to formulate importance weights which provide policy gradients for the generator. We verify this approach quantitatively works across a set of $f$ -divergences on a simple classification task and on a variety of image and natural language benchmarks. • We demonstrate that BGAN performs quantitatively better than WGAN-GP (Gulrajani et al., 2017) in the simple discrete setting. • We show that the boundary-seeking objective extends theoretically to the continuous case and verify it works well with some common and difficult image benchmarks. Finally, we show that this objective has some improved stability properties within training and without.
|
| 32 |
+
|
| 33 |
+
# 2 BOUNDARY-SEEKING GANS
|
| 34 |
+
|
| 35 |
+
In this section, we will introduce boundary-seeking GANs (BGAN), an approach for training a generative model adversarially with discrete data, as well as provide its theoretical foundation. For BGAN, we assume the normal generative adversarial learning setting commonly found in work on GANs (Goodfellow et al., 2014), but these ideas should extend elsewhere.
|
| 36 |
+
|
| 37 |
+
# 2.1 GENERATIVE ADVERSARIAL LEARNING AND PROBLEM STATEMENT
|
| 38 |
+
|
| 39 |
+
Assume that we are given empirical samples from a target distribution, $\{ \boldsymbol { x } ^ { ( i ) } \in \mathcal { X } \} _ { i = 1 } ^ { M }$ , where $\mathcal { X }$ is the domain (such as the space of images, word- or character- based representations of natural language, etc.). Given a random variable $Z$ over a space $\mathcal { Z }$ (such as $[ 0 , 1 ] ^ { m } )$ , we wish to find the optimal parameters, $\hat { \theta } \in \mathbb { R } ^ { d }$ , of a function, $G _ { \theta } : \mathcal { Z } \to \mathcal { X }$ (such as a deep neural network), whose induced probability distribution, $\mathbb { Q } _ { \theta }$ , describes well the empirical samples.
|
| 40 |
+
|
| 41 |
+
In order to put this more succinctly, it is beneficial to talk about a probability distribution of the empirical samples, $\mathbb { P }$ , that is defined on the same space as $\mathbb { Q } _ { \theta }$ . We can now consider the difference measure between $\mathbb { P }$ and $\mathbb { Q } _ { \theta }$ $\phantom { } _ { \theta } , D ( \mathbb { P } , \mathbb { Q } _ { \theta } )$ , so the problem can be formulated as finding the parameters:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\begin{array} { r } { \hat { \theta } = \underset { \theta } { \arg \operatorname* { m i n } } D ( \mathbb { P } , \mathbb { Q } _ { \theta } ) . } \end{array}
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
Defining an appropriate difference measure is a long-running problem in machine learning and statistics, and choosing the best one depends on the specific setting. Here, we wish to avoid making strong assumptions on the exact forms of $\mathbb { P }$ or $\mathbb { Q } _ { \theta }$ , and we desire a solution that is scalable and works with very high dimensional data. Generative adversarial networks (GANs, Goodfellow et al., 2014) fulfill these criteria by introducing a discriminator function, $D _ { \phi } : \mathcal { X } \mathbb { R }$ , with parameters, $\phi$ , then defining a value function,
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\mathcal { V } ( \mathbb { P } , \mathbb { Q } _ { \theta } , D _ { \phi } ) = \mathbb { E } _ { \mathbb { P } } \left[ \log D _ { \phi } ( x ) \right] + \mathbb { E } _ { h ( z ) } \left[ \log ( 1 - D _ { \phi } ( G ( z ) ) \right] ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where samples $z$ are drawn from a simple prior, $h ( z )$ (such as $U ( 0 , 1 )$ or $\mathcal { N } ( 0 , 1 ) )$ . Here, $D _ { \phi }$ is a neural network with a sigmoid output activation, and as such can be interpreted as a simple binary classifier, and the value function can be interpreted as the negative of the Bayes risk. GANs train the discriminator to maximize this value function (minimize the mis-classification rate of samples coming from $\mathbb { P }$ or $\mathbb { Q } _ { \theta }$ ), while the generator is trained to minimize it. In other words, GANs solve an optimization problem:
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
( \hat { \theta } , \hat { \phi } ) = \underset { \theta } { \arg \operatorname* { m i n } } \underset { \phi } { \arg \operatorname* { m a x } } \mathcal { V } ( \mathbb { P } , \mathbb { Q } _ { \theta } , D _ { \phi } ) .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
Optimization using only back-propogation and stochastic gradient descent is possible when the generated samples are completely differentiable w.r.t. the parameters of the generator, $\theta$ .
|
| 60 |
+
|
| 61 |
+
In the non-parametric limit of an optimal discriminator, the value function is equal to a scaled and shifted version of the Jensen-Shannon divergence, $2 * \mathcal { D } _ { J S D } ( \mathbb { P } | | \mathbb { Q } _ { \theta } ) - \log 4 , ^ { 1 }$ which implies the generator is minimizing this divergence in this limit. $f$ -GAN (Nowozin et al., 2016) generalized this idea over all $f$ -divergences, which includes the Jensen-Shannon (and hence also GANs) but also the Kullback–Leibler, Pearson $\chi ^ { 2 }$ , and squared-Hellinger. Their work provides a nice formalism for talking about GANs that use $f$ -divergences, which we rely on here.
|
| 62 |
+
|
| 63 |
+
Definition 2.1 ( $f$ -divergence and its dual formulation). Let $f : \mathbb { R } _ { + } \to \mathbb { R }$ be a convex lower semicontinuous function and $f ^ { \star } : \mathcal { C } \subseteq \mathbb { R } \to \mathbb { R }$ be the convex conjugate with domain $\mathcal { C }$ . Next, let $\tau$ be an arbitrary family of functions, $\mathcal { T } = \{ T : \mathcal { X } \mathcal { C } \}$ . Finally, let $\mathbb { P }$ and $\mathbb { Q }$ be distributions that are completely differentiable w.r.t. the same Lebesgue measure, $\mu$ .2 The $f$ -divergence, $\mathcal { D } _ { f } ( \mathbb { P } | | \mathbb { Q } _ { \theta } )$ , generated by $f$ , is bounded from below by its dual representation (Nguyen et al., 2010),
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\mathcal { D } _ { f } \big ( \mathbb { P } | | \mathbb { Q } \big ) = \mathbb { E } _ { \mathbb { Q } } \left[ f \left( \frac { d \mathbb { P } / d \mu } { d \mathbb { Q } / d \mu } \right) \right] \geq \operatorname* { s u p } _ { T \in \mathcal { T } } \big ( \mathbb { E } _ { \mathbb { P } } [ T ( x ) ] - \mathbb { E } _ { \mathbb { Q } } [ f ^ { \star } ( T ( x ) ) ] \big ) .
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
The inequality becomes tight when $\tau$ is the family of all possible functions. The dual form allows us to change a problem involving likelihood ratios (which may be intractable) to an maximization problem over $\tau$ . This sort of optimization is well-studied if $\tau$ is a family of neural networks with parameters $\phi$ (a.k.a., deep learning), so the supremum can be found with gradient ascent (Nowozin et al., 2016).
|
| 70 |
+
|
| 71 |
+
Definition 2.2 (Variational lower-bound for the $f$ -divergence). Let $T _ { \phi } = \nu \circ F _ { \phi }$ be a function, which is the composition of an activation function, $\nu : \mathbb { R } \to \mathcal { C }$ and a neural network, $F _ { \phi } : \mathcal { X } \mathbb { R }$ . We can write the variational lower-bound of the supremum in Equation 4 as 3:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\begin{array} { r } { \mathcal { D } _ { f } ( \mathbb { P } | | \mathbb { Q } _ { \theta } ) \geq \mathbb { E } _ { \mathbb { P } } [ \nu \circ F _ { \phi } ( x ) ] - \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ f ^ { \star } ( \nu \circ F _ { \phi } ( x ) ) ] = \mathcal { V } ( \mathbb { P } , \mathbb { Q } _ { \theta } , T _ { \phi } ) . } \end{array}
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Maximizing Equation 5 provides a neural estimator of $f$ -divergence, or neural divergence (Huang et al., 2018). Given the family of neural networks, $\mathcal { T } _ { \Phi } \stackrel { \cdot } { = } \{ T _ { \phi } \} _ { \phi \in \Phi }$ , is sufficiently expressive, this bound can become arbitrarily tight, and the neural divergence becomes arbitrarily close to the true divergence. As such, GANs are extremely powerful for training a generator of continuous data, leveraging a dual representation along with a neural network with theoretically unlimited capacity to estimate a difference measure.
|
| 78 |
+
|
| 79 |
+
For the remainder of this work, we will refer to $T _ { \phi } = \nu \circ F _ { \phi }$ as the discriminator and $F _ { \phi }$ as the statistic network (which is a slight deviation from other works). We use the general term $G A N$ to refer to all models that simultaneously minimize and maximize a variational lower-bound, $\nu ( \mathbb { P } , \mathbb { Q } _ { \theta } , T _ { \phi } )$ , of a difference measure (such as a divergence or distance). In principle, this extends to variants of GANs which are based on integral probability metrics (IPMs, Sriperumbudur et al., 2009) that leverage a dual representation, such as those that rely on restricting $\tau$ through parameteric regularization (Arjovsky et al., 2017) or by constraining its output distribution (Mroueh & Sercu, 2017; Mroueh et al., 2017; Sutherland et al., 2016).
|
| 80 |
+
|
| 81 |
+
# 2.2 ESTIMATION OF THE TARGET DISTRIBUTION
|
| 82 |
+
|
| 83 |
+
Here we will show that, with the variational lower-bound of an $f$ -divergence along with a family of positive activation functions, $\nu : \mathbb { R } \to \mathbb { R } _ { + }$ , we can estimate the target distribution, $\mathbb { P }$ , using the generated distribution, $\mathbb { Q } _ { \theta }$ , and the discriminator, $T _ { \phi }$ .
|
| 84 |
+
|
| 85 |
+
Theorem 1. Let $f$ be a convex function and $T ^ { \star } \in \mathcal { T }$ a function that satisfies the supremum in Equation 4 in the non-parametric limit. Let us assume that $\mathbb { P }$ and $\mathbb { Q } _ { \theta } ( x )$ are absolutely continuous w.r.t. a measure $\mu$ and hence admit densities, $p ( x )$ and $q _ { \theta } ( x )$ . Then the target density function, $p ( x )$ , is equal to $( \partial f ^ { \star } / \partial T ) ( T ^ { \star } ( x ) ) q _ { \theta } ( x )$ .
|
| 86 |
+
|
| 87 |
+
Table 1: Important weights and nonlinearities that ensure
|
| 88 |
+
|
| 89 |
+
<table><tr><td rowspan=1 colspan=3>Importance weights for f-divergences</td></tr><tr><td rowspan=1 colspan=1>f-divergence</td><td rowspan=1 colspan=1>v(y)</td><td rowspan=1 colspan=1>w(x)= (0f*/0T)(T(x))</td></tr><tr><td rowspan=1 colspan=1>GAN</td><td rowspan=1 colspan=1>-log(1+e-𝑦)</td><td rowspan=1 colspan=1>=eF(x)1-e-T</td></tr><tr><td rowspan=1 colspan=1>Jensen-Shannon</td><td rowspan=1 colspan=1>log2-log(1+e-y)</td><td rowspan=1 colspan=1>12-e-T=eF()</td></tr><tr><td rowspan=1 colspan=1>KL</td><td rowspan=1 colspan=1>y+1</td><td rowspan=1 colspan=1>e(T(x)-1)=eF(x)</td></tr><tr><td rowspan=1 colspan=1>Reverse KL</td><td rowspan=1 colspan=1>-e-y</td><td rowspan=1 colspan=1>1 =eF(x)T(x)</td></tr><tr><td rowspan=1 colspan=1>Squared-Hellinger</td><td rowspan=1 colspan=1>1-e-u/2</td><td rowspan=1 colspan=1>(1-T(x))² = eF(𝑥)</td></tr></table>
|
| 90 |
+
|
| 91 |
+
Proof. Following the definition of the $f$ -divergence and the convex conjugate, we have:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\mathcal { D } _ { f } \big ( \mathbb { P } | | \mathbb { Q } _ { \theta } \big ) = \mathbb { E } _ { \mathbb { Q } _ { \theta } } \left[ f \left( \frac { p ( x ) } { q ( x ) } \right) \right] = \mathbb { E } _ { \mathbb { Q } _ { \theta } } \left[ \operatorname* { s u p } _ { t } \left\{ t \frac { p ( x ) } { q ( x ) } - f ^ { \star } ( t ) \right\} \right] .
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
As $f ^ { \star }$ is convex, there is an absolute maximum when $\begin{array} { r } { \frac { \partial f ^ { \star } } { \partial t } ( t ) = \frac { p ( x ) } { q _ { \theta } ( x ) } } \end{array}$ . Rephrasing $t$ as a function, $T ( x )$ , and by the definition of $T ^ { \star } ( x )$ , we arrive at the desired result. □
|
| 98 |
+
|
| 99 |
+
Theorem 1 indicates that the target density function can be re-written in terms of a generated density function and a scaling factor. We refer to this scaling factor, $w ^ { \star } ( x ) = ( \partial f ^ { \star } / \partial T ) ( T ^ { \star } ( x ) )$ , as the optimal importance weight to make the connection to importance sampling 4. In general, an optimal discriminator is hard to guarantee in the saddle-point optimization process, so in practice, $T _ { \phi }$ will define a lower-bound that is not exactly tight w.r.t. the $f$ -divergence. Nonetheless, we can define an estimator for the target density function using a sub-optimal $T _ { \phi }$ .
|
| 100 |
+
|
| 101 |
+
Definition 2.3 $f$ -divergence importance weight estimator). Let $f$ and $f ^ { \star }$ , and $T _ { \phi } ( x )$ be defined as in Definitions 2.1 and 2.2 but where $\nu : \mathbb { R } \to \mathbb { R } _ { + } \subseteq \mathcal { C }$ is a positive activation function. Let $w ( x ) =$ $( \partial f ^ { \star } / \partial T ) ( T ( x ) )$ and $\beta = \mathbb { E } _ { \mathbb { Q } _ { \phi } } [ w ( x ) ]$ be a partition function. The $f$ -divergence importance weight estimator, $\tilde { p } ( x )$ is
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\tilde { p } ( x ) = \frac { w ( x ) } { \beta } q _ { \theta } ( x ) .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
The non-negativity of $\nu$ is important as the densities are positive. Table 1 provides a set of $f$ - divergences (following suggestions of Nowozin et al. (2016) with only slight modifications) which are suitable candidates and yield positive importance weights. Surprisingly, each of these yield the same function over the neural network before the activation function: $\bar { w ( x ) } = e ^ { F _ { \phi } ( x ) }$ .5 It should be noted that $\tilde { p } ( x )$ is a potentially biased estimator for the true density; however, the bias only depends on the tightness of the variational lower-bound: the tighter the bound, the lower the bias. This problem reiterates the problem with all GANs, where proofs of convergence are only provided in the optimal or near-optimal limit (Goodfellow et al., 2014; Nowozin et al., 2016; Mao et al., 2016).
|
| 108 |
+
|
| 109 |
+
# 2.3 BOUNDARY-SEEKING GANS
|
| 110 |
+
|
| 111 |
+
As mentioned above and repeated here, GANs only work when the value function is completely differentiable w.r.t. the parameters of the generator, $\theta$ . The gradients that would otherwise be used to train the generator of discrete variables are zero almost everywhere, so it is impossible to train the generator directly using the value function. Approximations for the back-propagated signal exist (Bengio et al., 2013; Gu et al., 2015; Gumbel & Lieblein, 1954; Jang et al., 2016; Maddison et al., 2016; Tucker et al., 2017), but as of this writing, none has been shown to work satisfactorily in training GANs with discrete data.
|
| 112 |
+
|
| 113 |
+
Here, we introduce the boundary-seeking GAN as a method for training GANs with discrete data. We first introduce a policy gradient based on the KL-divergence which uses the importance weights as a reward signal. We then introduce a lower-variance gradient which defines a unique reward signal for each $z$ and prove this can be used to solve our original problem.
|
| 114 |
+
|
| 115 |
+
Algorithm 1 . Discrete Boundary Seeking GANs
|
| 116 |
+
|
| 117 |
+
<table><tr><td colspan="2">(0,)← initialize the parameters of the generator and statistic network</td></tr><tr><td>repeat x(n)~P</td><td>>Draw N samples from the empirical distribution</td></tr><tr><td>z(n)~h(2) x(m|n) ~ ge(x| z(n))</td><td>>Draw N samples from the prior distribution >Draw M samples from each conditional ge(x|z(m)) (drawn</td></tr><tr><td>independently if P and Q are multi-variate)</td><td></td></tr><tr><td>w(x(mln))←(df*/aT)o(voF(x(mln)))</td><td>ω(x(mln)) ← w(x(m|n))/∑m' w(x(m'|n)DCompute the un-normalized and normalized</td></tr><tr><td>importance weights (applied uniformly if P and Qe are multi-variate)</td><td>>Estimate the variational</td></tr><tr><td>V(P,Qθ,To)←N∑nF(x(n))-1∑nM∑mw(x(mln) lower-bound</td><td>←Φ+γaVΦV(P,Qθ,TΦ) Optimize the discriminator parameters 0 ←θ+ γgN∑n,mω(x(mln))Vθ log ge(x(mln)| z) DOptimize the generator parameters</td></tr></table>
|
| 118 |
+
|
| 119 |
+
Policy gradient based on importance sampling Equation 7 offers an option for training a generator in an adversarial way. If we know the explicit density function, $q _ { \theta }$ , (such as a multivariate Bernoulli distribution), then we can, using $\tilde { p } ( x )$ as a target (keeping it fixed w.r.t. optimization of $\theta$ ), train the generator using the gradient of the KL-divergence:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\nabla _ { \boldsymbol { \theta } } \mathcal { D } _ { K L } \big ( \tilde { p } ( \boldsymbol { x } ) | | \boldsymbol { q } _ { \boldsymbol { \theta } } \big ) = - \mathbb { E } _ { \mathbb { Q } _ { \boldsymbol { \theta } } } \left[ \frac { w ( \boldsymbol { x } ) } { \beta } \nabla _ { \boldsymbol { \theta } } \log q _ { \boldsymbol { \theta } } ( \boldsymbol { x } ) \right] .
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
Here, the connection to importance sampling is even clearer, and this gradient resembles other importance sampling methods for training generative models in the discrete setting (Bornschein & Bengio, 2014; Rubinstein $\&$ Kroese, 2016). However, we expect the variance of this estimator will be high, as it requires estimating the partition function, $\beta$ (for instance, using Monte-Carlo sampling). We address reducing the variance from estimating the normalized importance weights next.
|
| 126 |
+
|
| 127 |
+
Lower-variance policy gradient Let $\begin{array} { r } { q _ { \theta } ( x ) = \int _ { \mathcal { Z } } g _ { \theta } ( x \mid z ) h ( z ) d z } \end{array}$ be a probability density function with a conditional density, $g _ { \theta } ( x \mid z ) : \mathcal { Z } [ 0 , 1 ] ^ { d }$ (e.g., a multivariate Bernoulli distribution), and prior over $z$ , $h ( z )$ . Let $\begin{array} { r } { \alpha ( z ) = \mathbb { E } _ { g _ { \theta } ( x \mid z ) } [ w ( \bar { x } ) ] = \int _ { \mathcal { X } } g _ { \theta } ( x \mid z ) w ( x ) d x } \end{array}$ be a partition function over the conditional distribution. Let us define $\begin{array} { r } { \tilde { p } ( x \mid z ) = \frac { w ( x ) } { \alpha ( z ) } g _ { \theta } ( x \mid z ) } \end{array}$ w(x)α(z) gθ(x | z) as the (normalized) conditional distribution weighted by $\frac { w ( x ) } { \alpha ( z ) }$ . The expected conditional KL-divergence over $h ( z )$ is:
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\mathbb { E } _ { h ( z ) } [ { \cal D } _ { K L } \left( \tilde { p } ( x \mid z ) \| g _ { \theta } ( x \mid z ) \right) ] = \int _ { z } h ( z ) { \cal D } _ { K L } \left( \tilde { p } ( x \mid z ) \| g _ { \theta } ( x \mid z ) \right) d z
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
Let $x ^ { ( m ) } \sim g _ { \theta } ( x \mid z )$ be samples from the prior and $\begin{array} { r } { \tilde { w } ( x ^ { ( m ) } ) = \frac { w ( x ^ { ( m ) } ) } { \sum _ { m ^ { \prime } } w ( x ^ { ( m ^ { \prime } ) } ) } } \end{array}$ be a Monte-Carlo estimate of the normalized importance weights. The gradient of the expected conditional KL-divergence w.r.t. the generator parameters, $\theta$ , becomes:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\nabla _ { \theta } \mathbb { E } _ { h ( z ) } [ \mathcal { D } _ { K L } \left( \tilde { p } ( x \mid z ) \| g _ { \theta } ( x \mid z ) \right) ] = - \mathbb { E } _ { h ( z ) } \left[ \sum _ { m } \tilde { w } ( x ^ { ( m ) } ) \nabla _ { \theta } \log g _ { \theta } ( x ^ { ( m ) } \mid z ) \right] ,
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
where we have approximated the expectation using the Monte-Carlo estimate.
|
| 140 |
+
|
| 141 |
+
Minimizing the expected conditional KL-divergences is stricter than minimizing the KL-divergence in Equation 7, as it requires all of the conditional distributions to match independently. We show that the KL-divergence of the marginal probabilities is zero when the expectation of the conditional KL-divergence is zero as well as show this estimator works better in practice in the Appendix.
|
| 142 |
+
|
| 143 |
+
Algorithm 1 describes the training procedure for discrete BGAN. This algorithm requires an additional $M$ times more computation to compute the normalized importance weights, though these can be computed in parallel exchanging space for time. When the $\mathbb { P }$ and $\mathbb { Q } _ { \theta }$ are multi-variate (such as with discrete image data), we make the assumption that the observed variables are independent conditioned on $Z$ . The importance weights, $w$ , are then applied uniformly across each of the observed variables.
|
| 144 |
+
|
| 145 |
+
Connection to policy gradients REINFORCE is a common technique for dealing with discrete data in GANs (Che et al., 2017; Li et al., 2017). Equation 9 is a policy gradient in the special case that the reward is the normalized importance weights. This reward approaches the likelihood ratio in the non-parametric limit of an optimal discriminator. Here, we make another connection to REINFORCE as it is commonly used, with baselines, by deriving the gradient of the reversed KL-divergence.
|
| 146 |
+
|
| 147 |
+
Definition 2.4 (REINFORCE-based BGAN). Let $T _ { \phi } ( x )$ be defined as above where $\partial f ^ { \star } / \partial T ( T _ { \phi } ( x ) ) = e ^ { F _ { \phi } ( x ) }$ . Consider the gradient of the reversed KL-divergence:
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\begin{array} { l } { \nabla _ { \theta } \mathcal { D } _ { K L } \left( q \theta \| \tilde { p } \right) = - \mathbb { E } _ { h ( z ) } \left[ \displaystyle \sum _ { m } ( \log w ( x ^ { ( m ) } ) - \log \beta + 1 ) \nabla _ { \theta } \log g _ { \theta } ( x ^ { ( m ) } \mid z ) \right] } \\ { = - \mathbb { E } _ { h ( z ) } \left[ \displaystyle \sum _ { m } ( F _ { \phi } ( x ) - b ) \nabla _ { \theta } \log g _ { \theta } ( x ^ { ( m ) } \mid z ) \right] } \end{array}
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
From this, it is clear that we can consider the output of the statistic network, $F _ { \phi } ( x )$ , to be a reward and $b = \log \beta = \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ w ( x ) ]$ to be the analog of a baseline.6 This gradient is similar to those used in previous works on discrete GANs, which we discuss in more detail in Section 3.
|
| 154 |
+
|
| 155 |
+
# 2.4 CONTINUOUS VARIABLES AND THE STABILITY OF GANS
|
| 156 |
+
|
| 157 |
+
For continuous variables, minimizing the variational lower-bound suffices as an optimization technique as we have the full benefit of back-propagation to train the generator parameters, $\theta$ . However, while the convergence of the discriminator is straightforward, to our knowledge there is no general proof of convergence for the generator except in the non-parametric limit or near-optimal case. What’s worse is the value function can be arbitrarily large and negative. Let us assume that max $T = M < \infty$ is unique. As $f ^ { \star }$ is convex, the minimum of the lower-bound over $\theta$ is:
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\begin{array} { r l } & { \underset { \theta } { \operatorname* { i n f } } \ V ( \mathbb { P } , \mathbb { Q } _ { \theta } , D _ { \phi } ) = \underset { \theta } { \operatorname* { i n f } } \ \mathbb { E } _ { \mathbb { P } } [ T _ { \phi } ( x ) ] - \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ f ^ { \star } ( T _ { \phi } ( x ) ) ] } \\ & { = \mathbb { E } _ { \mathbb { P } } [ T _ { \phi } ( x ) ] - \underset { \theta } { \operatorname* { s u p } } \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ f ^ { \star } ( T _ { \phi } ( x ) ) ] = \mathbb { E } _ { \mathbb { P } } [ T _ { \phi } ( x ) ] - f ^ { \star } ( M ) . } \end{array}
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
In other words, the generator objective is optimal when the generated distribution, $\mathbb { Q } _ { \theta }$ , is nonzero only for the set $\{ x \mid T ( x ) = M \}$ . Even outside this worst-case scenario, the additional consequence of this minimization is that this variational lower-bound can become looser w.r.t. the $f$ -divergence, with no guarantee that the generator would actually improve. Generally, this is avoided by training the discriminator in conjunction with the generator, possibly for many steps for every generator update. However, this clearly remains one source of potential instability in GANs.
|
| 164 |
+
|
| 165 |
+
Equation 7 reveals an alternate objective for the generator that should improve stability. Notably, we observe that for a given estimator, $\tilde { p } ( x )$ , $q _ { \theta } ( x )$ matches when $w ( x ) = ( \partial f ^ { \star } / \partial T ) ( T ( x ) ) = 1$ .
|
| 166 |
+
|
| 167 |
+
Definition 2.5 (Continuous BGAN objective for the generator). Let $G _ { \theta } : \mathcal { Z } \to \mathcal { X }$ be a generator function that takes as input a latent variable drawn from a simple prior, $z \sim h ( z )$ . Let $T _ { \phi }$ and $w ( x )$ be defined as above. We define the continuous BGAN objective as: $\hat { \theta } = \arg \operatorname* { m i n } _ { \theta } ( \log w ( G _ { \theta } ( z ) ) ) ^ { 2 }$ . We chose the log, as with our treatments of $f$ -divergences in Table 1, the objective is just the square of the statistic network output:
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
\widehat { \theta } = \underset { \theta } { \arg \operatorname* { m i n } } F _ { \phi } ( G _ { \theta } ( z ) ) ^ { 2 } .
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
This objective can be seen as changing a concave optimization problem (which is poor convergence properties) to a convex one.
|
| 174 |
+
|
| 175 |
+
# 3 RELATED WORK AND DISCUSSION
|
| 176 |
+
|
| 177 |
+
On estimating likelihood ratios from the discriminator Our work relies on estimating the likelihood ratio from the discriminator, the theoretical foundation of which we draw from $f$ - GAN (Nowozin et al., 2016). The connection between the likelihood ratios and the policy gradient is known in previous literature (Jie & Abbeel, 2010), and the connection between the discriminator output and the likelihood ratio was also made in the context of continuous GANs (Mohamed & Lakshminarayanan, 2016; Tran et al., 2017). However, our work is the first to successfully formulate and apply this approach to the discrete setting.
|
| 178 |
+
|
| 179 |
+
Importance sampling Our method is very similar to re-weighted wake-sleep (RWS, Bornschein & Bengio, 2014), which is a method for training Helmholtz machines with discrete variables. RWS also relies on minimizing the KL divergence, the gradients of which also involve a policy gradient over the likelihood ratio. Neural variational inference and learning (NVIL, Mnih & Gregor, 2014), on the other hand, relies on the reverse KL. These two methods are analogous to our importance sampling and REINFORCE-based BGAN formulations above.
|
| 180 |
+
|
| 181 |
+
GAN for discrete variables Training GANs with discrete data is an active and unsolved area of research, particularly with language model data involving recurrent neural network (RNN) generators (Yu et al., 2016; Li et al., 2017). Many REINFORCE-based methods have been proposed for language modeling (Yu et al., 2016; Li et al., 2017; Dai et al., 2017) which are similar to our REINFORCE-based BGAN formulation and effectively use the sigmoid of the estimated loglikelihood ratio. The primary focus of these works however is on improving credit assignment, and their approaches are compatible with the policy gradients provided in our work.
|
| 182 |
+
|
| 183 |
+
There have also been some improvements recently on training GANs on language data by rephrasing the problem into a GAN over some continuous space (Lamb et al., 2016; Kim et al., 2017; Gulrajani et al., 2017). However, each of these works bypass the difficulty of training GANs with discrete data by rephrasing the deterministic game in terms of continuous latent variables or simply ignoring the discrete sampling process altogether, and do not directly solve the problem of optimizing the generator from a difference measure estimated from the discriminator.
|
| 184 |
+
|
| 185 |
+
Remarks on stabilizing adversarial learning, IPMs, and regularization A number of variants of GANs have been introduced recently to address stability issues with GANs. Specifically, generated samples tend to collapse to a set of singular values that resemble the data on neither a persample or distribution basis. Several early attempts in modifying the train procedure (Berthelot et al., 2017; Salimans et al., 2016) as well as the identifying of a taxonomy of working architectures (Radford et al., 2015) addressed stability in some limited setting, but it wasn’t until Wassertstein GANs (WGAN, Arjovsky et al., 2017) were introduced that there was any significant progress on reliable training of GANs.
|
| 186 |
+
|
| 187 |
+
WGANs rely on an integral probability metric (IPM, Sriperumbudur et al., 2009) that is the dual to the Wasserstein distance. Other GANs based on IPMs, such as Fisher GAN (Mroueh & Sercu, 2017) tout improved stability in training. In contrast to GANs based on $f$ -divergences, besides being based on metrics that are “weak”, IPMs rely on restricting $\tau$ to a subset of all possible functions. For instance in WGANs, $\mathcal { T } = \{ T \ | \ \| T \| _ { L } \leq K \}$ , is the set of K-Lipschitz functions. Ensuring a statistic network, $T _ { \phi }$ , with a large number of parameters is Lipschitz-continuous is hard, and these methods rely on some sort of regularization to satisfy the necessary constraints. This includes the original formulation of WGANs, which relied on weight-clipping, and a later work (Gulrajani et al., 2017) which used a gradient penalty over interpolations between real and generated data.
|
| 188 |
+
|
| 189 |
+
Unfortunately, the above works provide little details on whether $T _ { \phi }$ is actually in the constrained set in practice, as this is probably very hard to evaluate in the high-dimensional setting. Recently, Roth et al. (2017) introduced a gradient norm penalty similar to that in Gulrajani et al. (2017) without interpolations and which is formulated in terms of $f$ -divergences. In our work, we’ve found that this approach greatly improves stability, and we use it in nearly all of our results. That said, it is still unclear empirically how the discriminator objective plays a strong role in stabilizing adversarial learning, but at this time it appears that correctly regularizing the discriminator is sufficient.
|
| 190 |
+
|
| 191 |
+
# 4 DISCRETE VARIABLES: EXPERIMENTS AND RESULTS
|
| 192 |
+
|
| 193 |
+
# 4.1 ADVERSARIAL CLASSIFICATION
|
| 194 |
+
|
| 195 |
+
We first verify the gradient estimator provided by BGAN works quantitatively in the discrete setting by evaluating its ability to train a classifier with the CIFAR-10 dataset (Krizhevsky & Hinton, 2009). The “generator” in this setting is a multinomial distribution, $g _ { \boldsymbol { \theta } } ( \boldsymbol { y } \mid \boldsymbol { x } )$ modeled by the softmax output of a neural network. The discriminator, $T _ { \phi } ( x , y )$ , takes as input an image $/$ label pair so that the variational lower-bound is:
|
| 196 |
+
|
| 197 |
+
$$
|
| 198 |
+
\mathcal { V } ( \mathbb { P } _ { X Y } , \mathbb { Q } _ { Y | X } \mathbb { P } _ { X } , T _ { \phi } ) = \mathbb { E } _ { p ( x , y ) } [ T _ { \phi } ( x , y ) ] - \mathbb { E } _ { g _ { \theta } ( y | x ) p ( x ) } [ f ^ { \star } ( T _ { \phi } ( x , y ) ) ] \quad
|
| 199 |
+
$$
|
| 200 |
+
|
| 201 |
+
For these experiments, we used a simple 4-layer convolutional neural network with an additional 3 fully-connected layers. We trained the importance sampling BGAN on the set of $f$ -divergences given in Table 1 as well as the REINFORCE counterpart for 200 epochs and report the accuracy on the test set. In addition, we ran a simple classification baseline trained on cross-entropy as well as a continuous approximation to the problem as used in WGAN-based approaches (Gulrajani et al., 2017). No regularization other than batch normalization (BN, Ioffe & Szegedy, 2015) was used with the generator, while gradient norm penalty (Roth et al., 2017) was used on the statistic networks. For WGAN, we used clipping, and chose the clipping parameter, the number of discriminator updates, and the learning rate separately based on training set performance. The baseline for the REINFORCE method was learned using a moving average of the reward.
|
| 202 |
+
|
| 203 |
+
Table 2: Adversarial classification on CIFAR-10. All methods are BGAN with importance sampling (left) or REINFORCE (right) except for the baseline (cross-entropy) and Wasserstein GAN (WGAN)
|
| 204 |
+
|
| 205 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Measure</td><td rowspan=1 colspan=2>Error(%)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=2>26.6</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>WGAN (clipping)</td><td rowspan=1 colspan=2>72.3</td></tr><tr><td rowspan=1 colspan=1>BAAN</td><td rowspan=1 colspan=1>GANJensen-ShannonKLReverse KLSquared-Hellinger</td><td rowspan=1 colspan=1>IS26.226.028.127.827.0</td><td rowspan=1 colspan=1>REINFORCE27.127.728.028.228.0</td></tr></table>
|
| 206 |
+
|
| 207 |
+
Our results are summarized in Table 2. Overall, BGAN performed similarly to the baseline on the test set, with the REINFORCE method performing only slightly worse. For WGAN, despite our best efforts, we could only achieve an error rate of $7 2 . 3 \%$ on the test set, and this was after a total of 600 epochs to train. Our efforts to train WGAN using gradient penalty failed completely, despite it working with higher-dimension discrete data (see Appendix).
|
| 208 |
+
|
| 209 |
+
# 4.2 DISCRETE IMAGE AND NATURAL LANGUAGE GENERATION
|
| 210 |
+
|
| 211 |
+
Image data: binary MNIST and quantized CelebA We tested BGAN using two imaging benchmarks: the common discretized MNIST dataset (Salakhutdinov & Murray, 2008) and a new quantized version of the CelebA dataset (see Liu et al., 2015, for the original CelebA dataset).
|
| 212 |
+
|
| 213 |
+
For CelebA quantization, we first downsampled the images from $6 4 \times 6 4$ to $3 2 \times 3 2$ . We then generated a 16-color palette using Pillow, a fork of the Python Imaging Project (https://pythonpillow.org). This palette was then used to quantize the RGB values of the CelebA samples to a one-hot representation of 16 colors. Our models used deep convolutional GANs (DCGAN, Radford et al., 2015). The generator is fed a vector of 64 i.i.d. random variables drawn from a uniform distribution, $[ 0 , 1 ]$ . The output nonlinearity was sigmoid for MNIST to model the Bernoulli centers for each pixel, while the output was softmax for quantized CelebA.
|
| 214 |
+
|
| 215 |
+
Our results show that training the importance-weighted BGAN on discrete MNIST data is stable and produces realistic and highly variable generated handwritten digits (Figure 1). Further quantitative experiments comparing BGAN against WGAN with the gradient penalty (WGAN-GP Gulrajani et al., 2017) showed that when training a new discriminator on the samples directly (keeping the
|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
Figure 1: Left: Random samples from the generator trained as a boundary-seeking GAN (BGAN) with discrete MNIST data. Shown are the Bernoulli centers of the generator conditional distribution.
|
| 219 |
+
|
| 220 |
+

|
| 221 |
+
Figure 2: Left: Groundtruth 16-color (4-bit) quantized CelebA images downsampled to $3 2 ~ \times ~ 3 2$ . Right: Samples produced from the generator trained as a boundaryseeking GAN on the quantized CelebA for 50 epochs.
|
| 222 |
+
|
| 223 |
+
Table 3: Random samples drawn from a generator trained with the discrete BGAN objective. The model is able to successfully learn many important character-level English language patterns.
|
| 224 |
+
|
| 225 |
+
And it ’s miant a quert could he ” We pait of condels of money wi Lankard Avaloma was Mr. Palin , Thene says the sounded Sunday in About dose and warthestrinds fro
|
| 226 |
+
|
| 227 |
+
He weirst placed produces hopesi Sance Jory Chorotic , Sen doesin What was like one of the July 2 The BBC nothing overton and slea College is out in contesting rev
|
| 228 |
+
|
| 229 |
+
What ’s word your changerg bette In Lep Edger ’s begins of a find”, ” I stroke like we all call on a With there was a passes ipposing And tear he jumped by even a roy
|
| 230 |
+
|
| 231 |
+
generator fixed), the final estimated distance measures were higher (i.e., worse) for WGAN-GP than BGAN, even when comparing using the Wasserstein distance. The complete experiment and results are provided in the Appendix. For quantized CelebA, the generator trained as a BGAN produced reasonably realistic images which resemble the original dataset well and with good diversity.
|
| 232 |
+
|
| 233 |
+
1-billion word Next, we test BGAN in a natural language setting with the 1-billion word dataset (Chelba et al., 2013), modeling at the character-level and limiting the dataset to sentences of at least 32 and truncating to 32 characters. For character-level language generation, we follow the architecture of recent work (Gulrajani et al., 2017), and use deep convolutional neural networks for both the generator and discriminator.
|
| 234 |
+
|
| 235 |
+
Training with BGAN yielded stable, reliably good character-level generation (Table 3), though generation is poor compared to recurrent neural network-based methods (Sutskever et al., 2011; Mikolov, 2012). However, we are not aware of any previous work in which a discrete GAN, without any continuous relaxation (Gulrajani et al., 2017), was successfully trained from scratch without pretraining and without an auxiliary supervised loss to generate any sensible text. Despite the low quality of the text relative to supervised recurrent language models, the result demonstrates the stability and capability of the proposed boundary-seeking criterion for training discrete GANs.
|
| 236 |
+
|
| 237 |
+
# 5 CONTINUOUS VARIABLES: EXPERIMENTS AND RESULTS
|
| 238 |
+
|
| 239 |
+
Here we present results for training the generator on the boundary-seeking objective function. In these experiments, we use the original GAN variational lower-bound from Goodfellow et al. (2014), only modifying the generator function. All results use gradient norm regularization (Roth et al., 2017) to ensure stability.
|
| 240 |
+
|
| 241 |
+
# 5.1 GENERATION BENCHMARKS
|
| 242 |
+
|
| 243 |
+
We test here the ability of continuous BGAN to train on high-dimensional data. In these experiments, we train on the CelebA, LSUN (Yu et al., 2015) datasets, and the 2012 ImageNet dataset with all 1000 labels (Krizhevsky et al., 2012). The discriminator and generator were both modeled as 4-layer Resnets (He et al., 2016) without conditioning on labels or attributes.
|
| 244 |
+
|
| 245 |
+
Figure 3 shows examples from BGAN trained on these datasets. Overall, the sample quality is very good. Notably, our Imagenet model produces samples that are high quality, despite not being trained conditioned on the label and on the full dataset. However, the story here may not be that BGAN necessarily generates better images than using the variational lower-bound to train the generator, since we found that images of similar quality on CelebA could be attained without the boundaryseeking loss as long as gradient norm regularization was used, rather we confirm that BGAN works well in the high-dimensional setting.
|
| 246 |
+
|
| 247 |
+

|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
Figure 3: Highly realistic samples from a generator trained with BGAN on the CelebA and LSUN datasets. These models were trained using a deep ResNet architecture with gradient norm regularization (Roth et al., 2017). The Imagenet model was trained on the full 1000 label dataset without conditioning.
|
| 251 |
+
LSUN
|
| 252 |
+
|
| 253 |
+
# 5.2 STABILITY OF CONTINUOUS BGAN
|
| 254 |
+
|
| 255 |
+
As mentioned above, gradient norm regularization greatly improves stability and allows for training with very large architectures. However, training still relies on a delicate balance between the generator and discriminator: over-training the generator may destabilize learning and lead to worse results. We find that the BGAN objective is resilient to such over-training.
|
| 256 |
+
|
| 257 |
+
Stability in training with an overoptimized generator To test this, we train on the CIFAR-10 dataset using a simple DCGAN architecture. We use the original GAN objective for the discriminator, but vary the generator loss as the variational lower-bound, the proxy loss (i.e., the generator loss function used in Goodfellow et al., 2014), and the boundary-seeking loss (BGAN). To better study the effect of these losses, we update the generator for 5 steps for every discriminator step.
|
| 258 |
+
|
| 259 |
+
Our results (Figure 4) show that over-optimizing the generator significantly degrades sample quality. However, in this difficult setting, BGAN learns to generate reasonable samples in fewer epochs than other objective functions, demonstrating improved stability.
|
| 260 |
+
|
| 261 |
+
Following the generator gradient We further test the different objectives by looking at the effect of gradient descent on the pixels. In this setting, we train a DCGAN (Radford et al., 2015) using the proxy loss. We then optimize the discriminator by training it for another 1000 updates. Next, we perform gradient descent directly on the pixels, the original variational lower-bound, the proxy, and the boundary seeking losses separately.
|
| 262 |
+
|
| 263 |
+

|
| 264 |
+
Figure 4: Training a GAN with different generator loss functions and 5 updates for the generator for every update of the discriminator. Over-optimizing the generator can lead to instability and poorer results depending on the generator objective function. Samples for GAN and GAN with the proxy loss are quite poor at 50 discriminator epochs (250 generator epochs), while BGAN is noticeably better. At 100 epochs, these models have improved, though are still considerably behind BGAN.
|
| 265 |
+
|
| 266 |
+
Our results show that following the BGAN objective at the pixel-level causes the least degradation of image quality. This indicates that, in training, the BGAN objective is the least likely to disrupt adversarial learning.
|
| 267 |
+
|
| 268 |
+
# 6 CONCLUSION
|
| 269 |
+
|
| 270 |
+
Reinterpreting the generator objective to match the proposal target distribution reveals a novel learning algorithm for training a generative adversarial network (GANs, Goodfellow et al., 2014). This proposed approach of boundary-seeking provides us with a unified framework under which learning algorithms for both discrete and continuous variables are derived. Empirically, we verified our approach quantitatively and showed the effectiveness of training a GAN with the proposed learning algorithm, which we call a boundary-seeking GAN (BGAN), on both discrete and continuous variables, as well as demonstrated some properties of stability.
|
| 271 |
+
|
| 272 |
+
# ACKNOWLEDGEMENTS
|
| 273 |
+
|
| 274 |
+
RDH thanks IVADO, MILA, UdeM, NIH grants R01EB006841 and P20GM103472, and NSF grant 1539067 for support. APJ thanks UWaterloo, Waterloo AI lab and MILA for their support and Michael Noukhovitch, Pascal Poupart for constructive discussions. KC thanks AdeptMind, TenCent, eBay, Google (Faculty Awards 2015, 2016), NVIDIA Corporation (NVAIL) and Facebook for their support. YB thanks CIFAR, NSERC, IBM, Google, Facebook and Microsoft for their support. We would like to thank Simon Sebbagh for his input and help with Theorem 2. Finally, we wish to thank the developers of Theano (Al-Rfou et al., 2016), Lasagne http://lasagne.readthedocs. io, and Fuel (Van Merrienboer et al., 2015) for their valuable code-base. ¨
|
| 275 |
+
|
| 276 |
+
# REFERENCES
|
| 277 |
+
|
| 278 |
+
Al-Rfou, Rami, Alain, Guillaume, Almahairi, Amjad, Angermueller, Christof, Bahdanau, Dzmitry, Ballas, Nicolas, Bastien, Fred´ eric, Bayer, Justin, Belikov, Anatoly, et al. Theano: A python ´ framework for fast computation of mathematical expressions. arXiv preprint arXiv:1605.02688, 2016.
|
| 279 |
+
|
| 280 |
+
Arjovsky, Martin, Chintala, Soumith, and Bottou, Leon. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
|
| 281 |
+
|
| 282 |
+
Bengio, Yoshua, Leonard, Nicholas, and Courville, Aaron. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 283 |
+
|
| 284 |
+

|
| 285 |
+
Figure 5: Following the generator objective using gradient descent on the pixels. BGAN and the proxy have sharp initial gradients that decay to zero quickly, while the variational lower-bound objective gradient slowly increases. The variational lower-bound objective leads to very poor images, while the proxy and BGAN objectives are noticeably better. Overall, BGAN performs the best in this task, indicating that its objective will not overly disrupt adversarial learning.
|
| 286 |
+
|
| 287 |
+
Berthelot, David, Schumm, Tom, and Metz, Luke. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
|
| 288 |
+
|
| 289 |
+
Bornschein, Jorg and Bengio, Yoshua. Reweighted wake-sleep. ¨ arXiv preprint arXiv:1406.2751, 2014.
|
| 290 |
+
|
| 291 |
+
Che, Tong, Li, Yanran, Zhang, Ruixiang, Hjelm, R Devon, Li, Weijie, Song, Yangqiu, and Bengio, Yoshua. Maximum-likelihood augmented discrete generative adversarial networks. arXiv preprint, 2017.
|
| 292 |
+
|
| 293 |
+
Chelba, Ciprian, Mikolov, Tomas, Schuster, Mike, Ge, Qi, Brants, Thorsten, Koehn, Phillipp, and Robinson, Tony. One billion word benchmark for measuring progress in statistical language modeling. arXiv preprint arXiv:1312.3005, 2013.
|
| 294 |
+
|
| 295 |
+
Dai, Bo, Lin, Dahua, Urtasun, Raquel, and Fidler, Sanja. Towards diverse and natural image descriptions via a conditional gan. arXiv preprint arXiv:1703.06029, 2017.
|
| 296 |
+
|
| 297 |
+
Goodfellow, Ian, Pouget-Abadie, Jean, Mirza, Mehdi, Xu, Bing, Warde-Farley, David, Ozair, Sherjil, Courville, Aaron, and Bengio, Yoshua. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
|
| 298 |
+
|
| 299 |
+
Gu, Shixiang, Levine, Sergey, Sutskever, Ilya, and Mnih, Andriy. Muprop: Unbiased backpropagation for stochastic neural networks. arXiv preprint arXiv:1511.05176, 2015.
|
| 300 |
+
|
| 301 |
+
Gulrajani, Ishaan, Ahmed, Faruk, Arjovsky, Martin, Dumoulin, Vincent, and Courville, Aaron. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
|
| 302 |
+
|
| 303 |
+
Gumbel, Emil Julius and Lieblein, Julius. Statistical theory of extreme values and some practical applications: a series of lectures. US Govt. Print. Office, 1954.
|
| 304 |
+
|
| 305 |
+
He, Kaiming, Zhang, Xiangyu, Ren, Shaoqing, and Sun, Jian. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
|
| 306 |
+
|
| 307 |
+
Huang, Gabriel, Berard, Hugo, Touati, Ahmed, Gidel, Gauthier, Vincent, Pascal, and Lacoste-Julien, Simon. Parametric adversarial divergences are good task losses for generative modeling. arXiv preprint arXiv:1708.02511, 2018.
|
| 308 |
+
|
| 309 |
+
Ioffe, Sergey and Szegedy, Christian. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
|
| 310 |
+
|
| 311 |
+
Jang, Eric, Gu, Shixiang, and Poole, Ben. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
|
| 312 |
+
|
| 313 |
+
Jie, Tang and Abbeel, Pieter. On a connection between importance sampling and the likelihood ratio policy gradient. In Advances in Neural Information Processing Systems, pp. 1000–1008, 2010.
|
| 314 |
+
|
| 315 |
+
Kim, Yoon, Zhang, Kelly, Rush, Alexander M, LeCun, Yann, et al. Adversarially regularized autoencoders for generating discrete structures. arXiv preprint arXiv:1706.04223, 2017.
|
| 316 |
+
|
| 317 |
+
Krizhevsky, Alex and Hinton, Geoffrey. Learning multiple layers of features from tiny images. Citeseer, 2009.
|
| 318 |
+
|
| 319 |
+
Krizhevsky, Alex, Sutskever, Ilya, and Hinton, Geoffrey E. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
|
| 320 |
+
|
| 321 |
+
Lamb, Alex M, GOYAL, Anirudh Goyal ALIAS PARTH, Zhang, Ying, Zhang, Saizheng, Courville, Aaron C, and Bengio, Yoshua. Professor forcing: A new algorithm for training recurrent networks. In Advances In Neural Information Processing Systems, pp. 4601–4609, 2016.
|
| 322 |
+
|
| 323 |
+
Li, Jiwei, Monroe, Will, Shi, Tianlin, Ritter, Alan, and Jurafsky, Dan. Adversarial learning for neural dialogue generation. arXiv preprint arXiv:1701.06547, 2017.
|
| 324 |
+
|
| 325 |
+
Liu, Ziwei, Luo, Ping, Wang, Xiaogang, and Tang, Xiaoou. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
|
| 326 |
+
|
| 327 |
+
Maddison, Chris J, Mnih, Andriy, and Teh, Yee Whye. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016.
|
| 328 |
+
|
| 329 |
+
Mao, Xudong, Li, Qing, Xie, Haoran, Lau, Raymond YK, Wang, Zhen, and Smolley, Stephen Paul. Least squares generative adversarial networks. arXiv preprint ArXiv:1611.04076, 2016.
|
| 330 |
+
|
| 331 |
+
Mikolov, Toma´s.ˇ Statistical Language Models Based on Neural Networks. PhD thesis, Ph. D. thesis, Brno University of Technology, 2012.
|
| 332 |
+
|
| 333 |
+
Mnih, Andriy and Gregor, Karol. Neural variational inference and learning in belief networks. In Proceedings of the 31st International Conference on Machine Learning (ICML-14), pp. 1791– 1799, 2014.
|
| 334 |
+
|
| 335 |
+
Mohamed, Shakir and Lakshminarayanan, Balaji. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016.
|
| 336 |
+
|
| 337 |
+
Mroueh, Youssef and Sercu, Tom. Fisher gan. arXiv preprint arXiv:1705.09675, 2017.
|
| 338 |
+
|
| 339 |
+
Mroueh, Youssef, Sercu, Tom, and Goel, Vaibhava. Mcgan: Mean and covariance feature matching gan. arXiv preprint arXiv:1702.08398, 2017.
|
| 340 |
+
|
| 341 |
+
Nguyen, XuanLong, Wainwright, Martin J, and Jordan, Michael I. Estimating divergence functionals and the likelihood ratio by convex risk minimization. IEEE Transactions on Information Theory, 56(11):5847–5861, 2010.
|
| 342 |
+
|
| 343 |
+
Nowozin, Sebastian, Cseke, Botond, and Tomioka, Ryota. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, pp. 271–279, 2016.
|
| 344 |
+
|
| 345 |
+
Radford, Alec, Metz, Luke, and Chintala, Soumith. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
|
| 346 |
+
|
| 347 |
+
Roth, Kevin, Lucchi, Aurelien, Nowozin, Sebastian, and Hofmann, Thomas. Stabilizing training of generative adversarial networks through regularization. arXiv preprint arXiv:1705.09367, 2017.
|
| 348 |
+
|
| 349 |
+
Rubinstein, Reuven Y and Kroese, Dirk P. Simulation and the Monte Carlo method, volume 10. John Wiley & Sons, 2016.
|
| 350 |
+
|
| 351 |
+
Salakhutdinov, Ruslan and Murray, Iain. On the quantitative analysis of deep belief networks. In Proceedings of the 25th international conference on Machine learning, pp. 872–879. ACM, 2008.
|
| 352 |
+
|
| 353 |
+
Salimans, Tim, Goodfellow, Ian, Zaremba, Wojciech, Cheung, Vicki, Radford, Alec, and Chen, Xi. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2234–2242, 2016.
|
| 354 |
+
|
| 355 |
+
Sriperumbudur, Bharath K, Fukumizu, Kenji, Gretton, Arthur, Scholkopf, Bernhard, and Lanck- ¨ riet, Gert RG. On integral probability metrics,\phi-divergences and binary classification. arXiv preprint arXiv:0901.2698, 2009.
|
| 356 |
+
|
| 357 |
+
Sutherland, Dougal J, Tung, Hsiao-Yu, Strathmann, Heiko, De, Soumyajit, Ramdas, Aaditya, Smola, Alex, and Gretton, Arthur. Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016.
|
| 358 |
+
|
| 359 |
+
Sutskever, Ilya, Martens, James, and Hinton, Geoffrey E. Generating text with recurrent neural networks. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 1017–1024, 2011.
|
| 360 |
+
|
| 361 |
+
Tran, Dustin, Ranganath, Rajesh, and Blei, David M. Deep and hierarchical implicit models. arXiv preprint arXiv:1702.08896, 2017.
|
| 362 |
+
|
| 363 |
+
Tucker, George, Mnih, Andriy, Maddison, Chris J, and Sohl-Dickstein, Jascha. Rebar: Lowvariance, unbiased gradient estimates for discrete latent variable models. arXiv preprint arXiv:1703.07370, 2017.
|
| 364 |
+
|
| 365 |
+
Van Merrienboer, Bart, Bahdanau, Dzmitry, Dumoulin, Vincent, Serdyuk, Dmitriy, Warde-Farley, ¨ David, Chorowski, Jan, and Bengio, Yoshua. Blocks and fuel: Frameworks for deep learning. arXiv preprint arXiv:1506.00619, 2015.
|
| 366 |
+
|
| 367 |
+
Yu, Fisher, Zhang, Yinda, Song, Shuran, Seff, Ari, and Xiao, Jianxiong. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
| 368 |
+
|
| 369 |
+
Yu, Lantao, Zhang, Weinan, Wang, Jun, and Yu, Yong. Seqgan: sequence generative adversarial nets with policy gradient. arXiv preprint arXiv:1609.05473, 2016.
|
| 370 |
+
|
| 371 |
+
# 7 APPENDIX
|
| 372 |
+
|
| 373 |
+
# 7.1 COMPARISON OF DISCRETE METHODS
|
| 374 |
+
|
| 375 |
+
In these experiments, we produce some quantitative measures for BGAN against WGAN with the gradient penalty (WGAN-GP, Gulrajani et al., 2017) on the discrete MNIST dataset. In order to use back-propagation to train the generator, WGAN-GP uses the softmax probabilities directly, bypassing the sampling process at pixel-level and problems associated with estimating gradients through discrete processes. Despite this, WGAN-GP is been able to produce samples that visually resemble the target dataset.
|
| 376 |
+
|
| 377 |
+
Here, we train 3 models on the discrete MNIST dataset using identical architectures with the BGAN with the JS and reverse KL $f$ -divergences and WGAN-GP objectives. Each model was trained for 300 generator epochs, with the discriminator being updated 5 times per generator update for WGAN-GP and 1 time per generator update for the BGAN models (in other words, the generators were trained for the same number of updates). This model selection procedure was chosen as the difference measure (i.e., JSD, reverse KL divergence, and Wasserstein distance) as estimated during training converged for each model. WGAN-GP was trained with a gradient penalty hyper-parameter of 5.0, which did not differ from the suggested 10.0 in our experiments with discrete MNIST. The BGAN models were trained with the gradient norm penalty of 5.0 (Roth et al., 2017).
|
| 378 |
+
|
| 379 |
+
Next, for each model, we trained 3 new discriminators with double capacity (twice as many hidden units on each layer) to maximize the the JS and reverse KL divergences and Wasserstein distance, keeping the generators fixed. These discriminators were trained for 200 epochs (chosen from convergence) with the same gradient-based regularizations as above. For all of these models, the discriminators were trained using the samples, as they would be used in practical applications. For comparison, we also trained an additional discriminator, evaluating the WGAN-GP model above on the Wasserstein distance using the softmax probabilities.
|
| 380 |
+
|
| 381 |
+
Table 4: Estimated Jensen-Shannon and KL-divergences and Wasserstein distance by a discriminator trained to maximize the respective lowerbound (lower is better). Numbers are estimates averaged ovwe 12 batches of 5000 samples with standard devations provided in parentheses. All discriminators were trained using samples drawn from the softmax probabilities, with exception to an additional discriminator used to evaluate WGAN-GP where the softmax probabilities were used directly. In general, BGAN out-performs WGAN-GP even when comparing the Wasserstein distances.
|
| 382 |
+
|
| 383 |
+
<table><tr><td rowspan=1 colspan=1>Train Measure</td><td rowspan=1 colspan=3>Eval Measure (lower is better)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JS</td><td rowspan=1 colspan=1>reverse KL</td><td rowspan=1 colspan=1>Wasserstein</td></tr><tr><td rowspan=1 colspan=1>BGAN - JSBGAN - reverse KLWGAN-GP (samples)WGAN-GP (softmax)</td><td rowspan=1 colspan=1>0.37 (±0.02)0.44 (±0.02)0.45 (±0.03)1</td><td rowspan=1 colspan=1>0.16 (±0.01)0.44 (±0.03)1.32 (±0.06)1</td><td rowspan=1 colspan=1>0.40(±0.03)0.45 (±0.04)0.87 (±0.18)0.54 (±0.12)</td></tr></table>
|
| 384 |
+
|
| 385 |
+
Final evaluation was done by estimating difference measures using 60000 MNIST training examples againt 60000 samples from each generator, averaged over 12 batches of 5000. We used the training set as this is the distribution over which the discriminators were trained. Test set estimates in general were close and did not diverge from training set distances, indicating the discriminators were not overfitting, but training set estimates were slightly higher on average.
|
| 386 |
+
|
| 387 |
+
Our results show that the estimates from the sampling distribution from BGAN is consistently lower than that from WGAN-GP, even when evaluating using the Wasserstein distance. However, when training the discriminator on the softmax probabilities, WGAN-GP has a much lower Wasserstein distance. Despite quantitative differences, samples from these different models were indistinguishable as far as quality by visual inspection. This indicates that, though playing the adversarial game using the softmax outputs can generate realistic-looking samples, this procedure ultimately hurts the generator’s ability to model a truly discrete distribution.
|
| 388 |
+
|
| 389 |
+
Here we validate the policy gradient provided in Equation 10 theoretically and empirically. Theorem 2. Let the expectation of the conditional $K L$ -divergence be defined as in Equation 9. Then $\mathbb { E } _ { h ( z ) } [ \mathcal { D } _ { K L } \left( \tilde { p } ( x \mid z ) \lVert \dot { g } _ { \theta } ( x \mid z ) \right) ] \stackrel { \cdot } { = } 0 \implies \mathcal { D } _ { K L } ( \tilde { p } ( x ) | | q _ { \theta } ) \stackrel { \cdot } { = } 0 .$ .
|
| 390 |
+
|
| 391 |
+
Proof. As the conditional KL-divergence is has an absolute minimum at zero, the expectation can only be zero when the all of the conditional KL-divergences are zero. In other words:
|
| 392 |
+
|
| 393 |
+
$$
|
| 394 |
+
\mathbb { E } _ { h ( z ) } [ \mathcal { D } _ { K L } \left( \tilde { p } ( x \mid z ) \lVert g _ { \theta } ( x \mid z ) \right) ] = 0 \implies \tilde { p } ( x \mid z ) = g _ { \theta } ( x \mid z ) .
|
| 395 |
+
$$
|
| 396 |
+
|
| 397 |
+
As per the definition of $\tilde { p } ( x \mid z )$ , this implies that $\alpha ( z ) = w ( x ) = C$ is a constant. If $w ( x )$ is a constant, then the partition function $\beta = C \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ 1 ] = C$ is a constant. Finally, when $\begin{array} { r } { { \frac { w ( x ) } { \beta } } = 1 } \end{array}$ , $\tilde { p } ( x ) = q _ { \theta } \implies \mathcal { D } _ { K L } \big ( \tilde { p } ( x ) | | q _ { \theta } \big ) = 0 .$ □
|
| 398 |
+
|
| 399 |
+
In order to empirically evaluate the effect of using an Monte-Carlo estimate of $\beta$ from Equation 8 versus the variance-reducing method in Equation 10, we trained several models using various sample sizes from the prior, $h ( z )$ , and the conditional, $g _ { \boldsymbol { \theta } } ( x \mid z )$ .
|
| 400 |
+
|
| 401 |
+
We compare both methods with 64 samples from the prior and 5, 10, and 100 samples from the conditional. In addition, we compare to a model that estimates $\beta$ using 640 samples from the prior and a single sample from the conditional. These models were all run on discrete MNIST for 50 epochs with the same architecture as those from Section 4.2 with a gradient penalty of 1.0, which was the minimum needed to ensure stability in nearly all the models.
|
| 402 |
+
|
| 403 |
+
Our results (Figure 6) show a clear improvement using the variance-reducing method from Equation 10 over estimating $\beta$ . Wall-clock times were nearly identical for methods using the same number of total samples (blue, green, and red dashed and solid line pairs). Both methods improve as the number of conditional samples is increased.
|
| 404 |
+
|
| 405 |
+

|
| 406 |
+
Figure 6: Comparison of the variance-reducing method from Equation 10 and estimating $\beta$ using Monte-Carlo in Equation 8. $\alpha$ indicates the variance-reducing method, and $\beta$ is estimating $\beta$ using Monte-Carlo. $z =$ indicates the number of samples from the prior, $h ( z )$ , and $x =$ indicates the number of samples from the conditional, $g _ { \boldsymbol { \theta } } ( \boldsymbol { x } \mid z )$ used in estimation. Plotted are the estimated GAN distances $\left( 2 * \mathrm { J S D - \log 4 } \right)$ from the discriminator. The minimum GAN distance, $- \log 4$ , is included for reference. Using the variance-reducing method gives a generator with consistently lower estimated distances than estimating $\beta$ directly.
|
md/train/rkWN3g-AZ/rkWN3g-AZ.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# XGAN: UNSUPERVISED IMAGE-TO-IMAGE TRANSLATION FOR MANY-TO-MANY MAPPINGS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Style transfer usually refers to the task of applying color and texture information from a specific style image to a given content image while preserving the structure of the latter. Here we tackle the more generic problem of semantic style transfer: given two unpaired collections of images, we aim to learn a mapping between the corpus-level style of each collection, while preserving semantic content shared across the two domains. We introduce XGAN, a dual adversarial autoencoder, which captures a shared representation of the common domain semantic content in an unsupervised way, while jointly learning the domain-to-domain image translations in both directions. We exploit ideas from the domain adaptation literature and define a semantic consistency loss which encourages the model to preserve semantics in the learned embedding space. We report promising qualitative results for the task of face-to-cartoon translation. The cartoon dataset we collected for this purpose will also be released as a new benchmark for semantic style transfer.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Image-to-image translation – learning to map images from one domain to another – covers several classical computer vision tasks such as style transfer (rendering an image in the style of a given input (Gatys et al., 2016)), colorization (mapping grayscale images to color images (Zhang et al., 2016)), super-resolution (increasing the resolution of an input image (Ledig et al., 2016)), or semantic segmentation (inferring pixelwise semantic labeling of a scene (Long et al., 2015)). In many cases, one can rely on supervision in the form of labels or paired samples. This assumption holds for instance for colorization, where ground-truth pairs are easily obtained by generating grayscale images from colored inputs.
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: On the left, we depict a high-level motivational example for semantic style transfer, the task of adapting an image to the visual appearance of an other domain without altering its semantic content. The proposed XGAN applied on the face-to-cartoon task preserves important face semantics such as hair style or face shape (right).
|
| 15 |
+
|
| 16 |
+
In this work, we consider the task of semantic style transfer: learning to map an image from one domain into the style of another domain without altering its semantic content (see Figure 1). In that sense, our goal is akin to style transfer: We aim to transfer style while keeping content consistent. The key differences with traditional techniques are that (i) we work with image collections instead of having a single style image, and (ii) we aim to retain higher-level semantic content in the feature space rather than pixel-level structure. In particular, we experiment on the task of translating faces to cartoons while preserving their various facial attributes (hair color, eye color, etc.). Note that without loss of generality, a photo of a face can be mapped to many valid cartoons, and vice versa. Semantic style transfer is therefore a many-to-many mapping problem, for which obtaining labeled examples is ambiguous and costly. Although this paper specifically focuses on the face-to-cartoon setting, many other examples fall under this category: mapping landscape pictures to paintings (where the different scene objects and their composition describe the input semantics), transforming sketches to images, or even cross-domain tasks such as generating images from text. In this setting, we only rely on two unlabeled training image collections or corpora, one for each domain, with no known image pairings across domains. Hence, we are faced with a double domain shift, first in terms of global domain appearance, and second in terms of the content distribution of the two collections.
|
| 17 |
+
|
| 18 |
+
Recent work (Kim et al., 2017; Zhu et al., 2017; Yi et al., 2017; Bousmalis et al., 2017) report good performance using GAN-based models for unsupervised image-to-image translation when the two input domains share similar pixel-level structure (e.g., horses and zebras) but fail for more general transformations (e.g., dogs and cats). Perhaps the best known recent example is CycleGAN (Zhu et al., 2017). Given two image domains $\mathcal { D } _ { 1 }$ and $\mathcal { D } _ { 2 }$ , the model is trained with a pixel-level cycleconsistency loss which ensures that the mapping $g _ { 1 2 }$ from $\mathcal { D } _ { 1 }$ to $\mathcal { D } _ { 2 }$ followed by its inverse, $g _ { 2 1 }$ , yields the identity function; i.e., $g _ { 1 2 } \circ g _ { 2 1 } = i d$ . However, we argue that such a pixel-level constraint is not sufficient in our case; the category of transformations we are interested in requires a constraint in semantic space even though the transformation occurs in the pixel space.
|
| 19 |
+
|
| 20 |
+
To this end, we propose XGAN (“Cross-GAN”), a dual adversarial autoencoder which learns a shared semantic representation of the two input domains in an unsupervised way, while jointly learning both domain-to-domain translations. In other words, the domain-to-domain translation $g _ { 1 2 }$ consists of an encoder $e _ { 1 }$ taking inputs in $\mathcal { D } _ { 1 }$ , followed by a decoder $d _ { 2 }$ with outputs in $\mathcal { D } _ { 2 }$ (and likewise for $g _ { 2 1 } \dot { } ,$ ) such that $e _ { 1 }$ and $e _ { 2 }$ , as well as $d _ { 1 }$ and $d _ { 2 }$ , are partially shared. The main novelty lies in how we constrain the shared embedding using techniques from the domain adaptation literature, as well as a novel semantic consistency loss. The latter ensures that the domain-to-domain translations preserve the semantic representation, i.e., that $e _ { 1 } \approx e _ { 2 } \circ g _ { 1 2 }$ and $e _ { 2 } \approx e _ { 1 } \circ g _ { 2 1 }$ . Therefore, it acts as a form of self-supervision which alleviates the need for paired examples and preserves semantic featurelevel information rather than pixel-level content. In the following section, we review relevant recent work before discussing the XGAN model in more detail in Section 3. In Section 4, we introduce CARTOONSET, our dataset of cartoon faces for research on semantic style transfer, which we are currently in the process of making publicly available. Finally, in Section 5 we report experimental results of XGAN on the face-to-cartoon task, and discuss various ablation experiments.
|
| 21 |
+
|
| 22 |
+
# 2 RELATED WORK
|
| 23 |
+
|
| 24 |
+
Recent literature suggests two main directions for tackling the semantic style transfer task: traditional style transfer and pixel-level domain adaptation. The first approach is inadequate as it only transfers texture information from a single style image, and therefore does not capture the style of an entire corpus. The latter category also fails in practice as it assumes pixel-level similarity which does not allow for significant structural change of the input. Instead, we draw inspiration from the domain adaptation and feature-level image-to-image translation literature.
|
| 25 |
+
|
| 26 |
+
Style Transfer. Style transfer traditionally refers to the task of transferring the texture of a specific style image while preserving the pixel-level structure of an input content image (Gatys et al., 2016; Johnson et al., 2016). Recently, (Li & Wand, 2016; Liao et al., 2017) proposed to compare the style and generated image via a dense local patch-based matching approach in the feature space, as opposed to global feature matching, allowing for transformations between visually dissimilar domains. Still, these models only perform image-specific transfer rather than learning a global corpus-level style, and do not provide a meaningful joint semantic domain representation.
|
| 27 |
+
|
| 28 |
+
Domain adaptation. XGAN relies on learning a shared semantic representation of both domains in an unsupervised setting. For this purpose, we make use of the domain-adversarial training scheme (Ganin et al., 2016). Moreover, recent domain adaptation work (Bousmalis et al., 2016; Shrivastava et al., 2017; Bousmalis et al., 2017) can be framed as semantic style transfer as they tackle the problem of mapping synthetic images, easy to generate, to natural images, which are more difficult to obtain. The generated samples are then used to train a model that can be applied to natural images. Contrary to our work however, they only consider pixel-level transformations.
|
| 29 |
+
|
| 30 |
+
Image-to-Image translation. Recent work (Kim et al., 2017; Zhu et al., 2017; Yi et al., 2017) tackle the unsupervised pixel-level image-to-image translation task by learning both cross-domain mappings jointly, each as a separate generative network, via a cycle-consistency loss which ensures that applying each mapping followed by its reverse yields the identity function. This intuitive form of self-supervision leads to good results for pixel-level transformations, but often fails to capture significant structural changes Zhu et al. (2017). In comparison, our proposed semantic consistency loss acts at the feature-level, allowing for more flexible transformations. Orthogonal to this work is UNIT (Liu et al., 2017). While also trained with pixel-level cycle-consistency, it consists of a coupled VAEGAN Larsen et al. (2015); Liu & Tuzel (2016) with a shared embedding bottleneck, similar to XGAN. However, UNIT assumes that sharing high-level layers in the architecture is sufficient to learn a joint representation of both domains, while XGAN’s objective explicitly introduces the semantic consistency component.
|
| 31 |
+
|
| 32 |
+
The Domain Transfer Network (DTN) (Taigman et al., 2016; Wolf et al., 2017) is closest to our work. DTN is a single autoencoder trained to map images from a source to a target domain with self-supervised semantic-consistency feedback. It was also successfully applied to the problem of feature-level image-to-image translation, in particular to the face-to-cartoon problem. Contrary to XGAN however, the DTN encoder is pretrained and fixed, and is assumed to produce meaningful embeddings for both the face and the cartoon domains. This assumption is very restrictive, as offthe-shelf models pretrained on natural images do not necessarily generalize to other domains. In fact, while the reported results are convincing, we show in Section 5 that using a fixed encoder does not generalize well in the presence of large domain shift between the two input domains.
|
| 33 |
+
|
| 34 |
+
# 3 PROPOSED MODEL
|
| 35 |
+
|
| 36 |
+
Let $\mathcal { D } _ { 1 }$ and $\mathcal { D } _ { 2 }$ be two domains that differ in terms of visual appearance but share common semantic content. Note that while it is easier to think of domain semantics as a high-level notion, as for instance semantic attributes, we do not require such annotations in practice, but instead consider learning a feature-level representation that automatically captures these semantics without supervision. Our goal is thus to learn in an unsupervised fashion, i.e., without paired examples, a joint domain-invariant embedding that is semantically-consistent and meaningful for both domains; i.e., semantically similar inputs in both domains will be embedded nearby in the learned semantic space.
|
| 37 |
+
|
| 38 |
+
Architecture-wise, XGAN is a dual autoencoder on domains $\mathcal { D } _ { 1 }$ and $\mathcal { D } _ { 2 }$ (Figure 2(A)). We denote by $e _ { 1 }$ the encoder and by $d _ { 1 }$ the decoder for domain $\mathcal { D } _ { 1 }$ ; likewise $e _ { 2 }$ and $d _ { 2 }$ for $\mathcal { D } _ { 2 }$ . For simplicity, we also denote by $g _ { 1 2 } = d _ { 2 } \circ e _ { 1 }$ the transformation from $\mathcal { D } _ { 1 }$ to $\mathcal { D } _ { 2 }$ ; likewise $g _ { 2 \to 1 }$ for $\mathcal { D } _ { 2 }$ to $\mathcal { D } _ { 1 }$ .
|
| 39 |
+
|
| 40 |
+
The training objective can be decomposed into five main components:
|
| 41 |
+
|
| 42 |
+
the reconstruction loss, $\mathcal { L } _ { r e c }$ , encourages the learned embedding to encode meaningful knowledge for each domain; the domain-adversarial loss, $\mathcal { L } _ { d a n n }$ , pushes embeddings from $\mathcal { D } _ { 1 }$ and $\mathcal { D } _ { 2 }$ to lie in the same subspace, bridging the domain gap at the semantic level; the semantic consistency loss, $\mathcal { L } _ { s e m }$ , ensures that input semantics are preserved after domain translation; $\mathcal { L } _ { g a n }$ is a simple generative adversarial (GAN) objective, encouraging the model to generate more realistic samples, and finally, $\mathcal { L } _ { t e a c h }$ is an optional teacher loss that distills prior knowledge from a fixed pretrained teacher embedding, when available. The total loss function is defined as:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
{ \mathcal { L } } _ { \mathrm { X G a N } } = { \mathcal { L } } _ { r e c } + \omega _ { d a n n } { \mathcal { L } } _ { d a n n } + \omega _ { s e m } { \mathcal { L } } _ { s e m } + \omega _ { g a n } { \mathcal { L } } _ { g a n } + \omega _ { t e a c h } { \mathcal { L } } _ { t e a c h } ,
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where the $\omega$ hyper-parameters control the contributions from each of the individual objectives. An overview of the model is given in Figure 2, and we discuss each objective in more detail in the rest of this section.
|
| 49 |
+
|
| 50 |
+
Reconstruction loss. $\mathcal { L } _ { r e c }$ encourages the model to encode enough information on each domain for the input to be reconstructed by the autoencoder. More specifically $\mathcal { L } _ { r e c } = \mathcal { L } _ { r e c , 1 } + \mathcal { L } _ { r e c , 2 }$ is the sum of reconstruction losses for each domain.
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\begin{array} { r } { \mathcal { L } _ { r e c , 1 } = \mathbb { E } _ { \mathbf { x } \sim p _ { \mathcal { D } _ { 1 } } } \left( \Vert \mathbf { x } - d _ { 1 } ( e _ { 1 } ( \mathbf { x } ) ) \Vert _ { 2 } \right) , \ \mathrm { a n d } \ \mathrm { l i k e w i s e } \ \mathrm { f o r } \ \mathcal { L } _ { r e c , 2 } } \end{array}
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
Domain-adversarial loss. $\mathcal { L } _ { d a n n }$ is the domain-adversarial loss between $\mathcal { D } _ { 1 }$ and $\mathcal { D } _ { 2 }$ , as introduced in Ganin et al. (2016). It encourages the embeddings learned by $e _ { 1 }$ and $e _ { 2 }$ to lie in the same subspace. In particular, it guarantees the soundness of the cross-domain transformations $g _ { 1 2 }$ and $g _ { 2 \to 1 }$ . More formally, this is achieved by training a binary classifier, $c _ { d a n n }$ , on top of the embedding layer to categorize encoded images from both domains as coming from either $\mathcal { D } _ { 1 }$ or $\mathcal { D } _ { 2 }$ (see Figure 2(B1)). $c _ { d a n n }$ is trained to maximize its classification accuracy $\mathcal { L } _ { d a n n }$ while the encoders $e _ { 1 }$ and $e _ { 2 }$ simultaneously strive to minimize it, i.e., to confuse the domain-adversarial classifier. Denoting model parameters by $\theta$ and a classification loss function by $\ell$ (e.g., cross-entropy), we have:
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 2: The XGAN architecture (A) is trained via an objective that encourages the model to learn a meaningful joint embedding (B1) ( $\mathcal { L } _ { r e c }$ and $\mathcal { L } _ { d a n n . }$ ), which should be preserved through domain translation (B2) $( \mathcal { L } _ { s e m } )$ , while producing output samples of good quality (B3) ( $\mathcal { L } _ { g a n }$ and $\mathcal { L } _ { t e a c h }$ )
|
| 60 |
+
|
| 61 |
+
min ma $\mathrm { : } \mathcal { L } _ { d a n n } , \mathrm { w h e r e } \ \mathcal { L } _ { d a n n } = \mathbb { E } _ { p _ { \mathcal { D } _ { 1 } } } \ell ( 1 , c _ { d a n n } ( e _ { 1 } ( \mathbf { x } ) ) ) + \mathbb { E } _ { p _ { \mathcal { D } _ { 2 } } } \ell \left( 2 , c _ { d a n n } ( e _ { 2 } ( \mathbf { x } ) ) \right)$ θe1 ,θe2 θdann
|
| 62 |
+
|
| 63 |
+
Semantic consistency loss, $\mathcal { L } _ { s e m }$ . Our key contribution is a semantic consistency feedback loop that acts as self-supervision for the cross-domain translations $g _ { 1 2 }$ and $g _ { 2 1 }$ . It reinforces the action of the domain-adversarial loss $\mathcal { L } _ { d a n n }$ by mapping the embedding of an input image and the embedding of its translated counterpart to the same point. Intuitively, we want the semantics of input $\mathbf { x } \in \mathcal { D } _ { 1 }$ to be preserved when translated to the other domain, $\dot { g _ { 1 \to 2 } } ( \mathbf { x } ) \in \mathcal { D } _ { 2 }$ , and similarly for the reverse mapping. However this consistency property is hard to assess at the pixel-level as we do not have paired data and pixel-level metrics are suboptimal for image comparison. Instead, we introduce a feature-level semantic consistency loss, which encourages the network to preserve the learned embedding during domain translation. Formally, $\mathcal { L } _ { s e m } = \mathcal { L } _ { s e m , 1 2 } + \mathcal { L } _ { s e m , 2 1 }$ , where:
|
| 64 |
+
|
| 65 |
+
$\mathcal { L } _ { s e m , 1 \to 2 } = \mathbb { E } _ { \mathbf { x } \sim p _ { \mathcal { D } _ { 1 } } } \| e _ { 1 } ( \mathbf { x } ) - e _ { 2 } ( g _ { 1 \to 2 } ( \mathbf { x } ) ) \|$ , where $\| \cdot \|$ is a distance between vectors.
|
| 66 |
+
|
| 67 |
+
$\mathcal { L } _ { s e m , 2 1 }$ is defined in the same way for the transformation from $\mathcal { D } _ { 2 }$ to $\mathcal { D } _ { 1 }$ .
|
| 68 |
+
|
| 69 |
+
GAN objective, $\mathcal { L } _ { g a n }$ . Although the key aim of XGAN is to learn a joint meaningful and semantically consistent embedding, we find that generating realistic image transformations has a crucial positive effect as the produced samples are fed back through the encoders when computing the semantic consistency loss: Making the transformed distribution $\mathsf { \bar { p } } ( g _ { 2 \to 1 } ( \mathcal { D } _ { 2 } ) )$ as close as possible to the original domain $p ( \mathcal { D } _ { 1 } )$ ensures that the encoder $e _ { 1 }$ does not have to cope with an additional domain shift. Therefore, with the purpose of improving sample quality, we define $\mathcal { L } _ { g a n } = \mathcal { L } _ { g a n , 1 2 } + \mathcal { L } _ { g a n , 2 1 }$ , where $\mathcal { L } _ { g a n , 1 2 }$ is a state-of-the-art GAN objective (Goodfellow et al., 2014) where the generator $g _ { 1 2 }$ is paired against the discriminator $D _ { 1 2 }$ (and likewise for $g _ { 2 \to 1 }$ and $D _ { 2 \to 1 }$ ). The models are trained jointly in an adversarial scheme where $D _ { 1 2 }$ strives to distinguish generated samples from real samples in $\mathcal { D } _ { 2 }$ , while the generator aims to produce samples that confuse the discriminator, i.e.,
|
| 70 |
+
|
| 71 |
+
$\operatorname* { m i n } _ { \theta _ { g _ { 1 } \to 2 } } \operatorname* { m a x } _ { \theta _ { D _ { 1 } \to 2 } } \mathcal { L } _ { g a n , 1 \to 2 }$ , where
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathcal { L } _ { g a n , 1 \to 2 } = \mathbb { E } _ { \mathbf { x } \sim p _ { \mathcal { D } _ { 2 } } } \left( \log ( D _ { 1 \to 2 } ( \mathbf { x } ) ) \right) + \mathbb { E } _ { \mathbf { x } \sim p _ { \mathcal { D } _ { 1 } } } \left( \log ( 1 - D _ { 1 \to 2 } ( g _ { 1 \to 2 } ( \mathbf { x } ) ) ) \right)
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Once again $\mathcal { L } _ { g a n , 2 1 }$ is the symmetric version for the transformation from $\mathcal { D } _ { 2 }$ to $\mathcal { D } _ { 1 }$ .
|
| 78 |
+
|
| 79 |
+
Teacher loss, $\mathcal { L } _ { t e a c h }$ . We introduce an optional component to easily incorporate prior knowledge in the model when available, i.e., when working in a semi-supervised framework. $\mathcal { L } _ { t e a c h }$ encourages the learned embeddings to lie in a region of the subspace defined by the output of the representation layer of a teacher network $T$ . In other words, it distills knowledge from a pretrained teacher and constrains the embeddings to a more meaningful subregion (relative to the task on which $T$ was trained), which can be seen as a form of regularization of the learned embedding. $\mathcal { L } _ { t e a c h }$ is asymmetric by definition. It should not be used for both domains simultaneously as each term would potentially push the learned embedding in two different directions. Assuming it is applied to domain $\mathcal { D } _ { 1 }$ , leads to the following definition:
|
| 80 |
+
|
| 81 |
+
$\mathcal { L } _ { t e a c h } = \mathbb { E } _ { \mathbf { x } \sim p _ { \mathcal { D } _ { 1 } } } \| T ( \mathbf { x } ) - e _ { 1 } ( \mathbf { x } ) \|$ , where $\| \cdot \|$ is a distance between vectors.
|
| 82 |
+
|
| 83 |
+
# 3.1 ARCHITECTURE AND TRAINING PROCEDURE
|
| 84 |
+
|
| 85 |
+
We use a simple mirrored convolutional architecture for the autoencoder. It consists of 5 convolutional blocks for each encoder, the two last ones being shared across domains, and likewise for the decoders (5 deconvolutional blocks with the two first ones shared). This encourages the model to learn shared representations at different levels of the architecture rather than only in the middle layer. For the teacher network, we use the highest convolutional layer of FaceNet (Schroff et al., 2015), a state-of-the-art model pretrained for the task of face recognition. Note that FaceNet was trained on natural images only, i.e., it does not contain any prior knowledge of the cartoon domain. A more detailed description is given in Appendix 7.1.
|
| 86 |
+
|
| 87 |
+
The XGAN training objective is obtained by minimizing Equation (1). In particular, the two adversarial losses $\mathcal { L } _ { g a n }$ and $\mathcal { L } _ { d a n n } )$ leads to minmax optimization problems that require careful optimization. For the GAN loss $\mathcal { L } _ { g a n }$ , we use a standard adversarial training scheme Goodfellow et al. (2014). Note that in order to ease training, we only use one of the discriminators in practice, namely $D _ { 1 2 }$ which corresponds to the face-to-cartoon path, our target application. We first update the parameters of the generators $g _ { 1 2 }$ and $g _ { 2 \to 1 }$ in one step. We then keep these fixed and update the parameters for the discriminator $D _ { 1 2 }$ . Finally, we train the model by iterating this alternating process. The adversarial training scheme for $\mathcal { L } _ { d a n n }$ can be easily implemented in practice by connecting the classifier $c _ { d a n n }$ and the embedding layer via a gradient reversal layer (Ganin et al., 2016): The feed-forward pass is unaffected, however the gradient is backpropagated to the encoders with a sign-inversion representing the minmax alternation. This update is performed in the same step as for the generator parameters. Finally, we use ADAM optimization (Kingma & Ba, 2015) with an initial learning rate of 0.0001 to train the model.
|
| 88 |
+
|
| 89 |
+
# 4 THE CARTOONSET DATASET1
|
| 90 |
+
|
| 91 |
+

|
| 92 |
+
Figure 3: Random samples from our cartoon dataset, CartoonSet. Each cartoon face is composed of 16 discrete attributes resulting in the order of 100 million possible cartoon faces.
|
| 93 |
+
|
| 94 |
+
Although previous work has tackled the task of transforming frontal faces to a specific cartoon style, there is currently no such dataset publicly available. For this purpose, we introduce a new dataset, CartoonSet, which we will release publicly to further aid research on this topic.
|
| 95 |
+
|
| 96 |
+
Each cartoon face is composed of 16 components including 12 facial attributes (e.g., facial hair, eye shape, etc) and 4 color attributes (such as skin or hair color) which are chosen from a discrete set of RGB values. The number of options per attribute category ranges from 3, for short/medium/long chin length, to 111, for the largest category, hairstyle. Each of these components and their variation were drawn by the same artist, resulting in approximately 250 cartoon components artworks and $1 0 ^ { 8 }$ possible combinations. Furthermore, the artwork components are divided into a fixed set of layers that define a Z-ordering for rendering. For instance, face shape is defined on a layer below eyes and glasses, so that the artworks are rendered in the correct order. Hair style is a more complex case and needs to be defined on two layers, one behind the face and one in front. There are 8 total layers: hair back, face, hair front, eyes, eyebrows, mouth, facial hair, and glasses. The mapping from attribute to artwork is also defined by the artist such that any random selection of attributes produces a visually appealing cartoon without any misaligned artwork; this sometimes involves handling interaction between attributes. For example, the proper way to display a ”short beard” changes for different face shapes, which required the artist to create a ”short beard” artwork for each face shape.
|
| 97 |
+
|
| 98 |
+
We create the CartoonSet dataset from arbitrary cartoon faces by randomly sampling a value for each attribute. The corresponding artworks are rendered back-to-front. We then filter out unusual hair colors (pink, green etc) or unrealistic attribute combinations, which results in a final dataset of approximately $9 , 0 0 0$ cartoons. In particular, the filtering step guarantees that the dataset only contains realistic cartoons, while being completely unrelated to the source dataset.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 4: Random samples from the centered aligned VGG-Face dataset.
|
| 102 |
+
|
| 103 |
+
# 5 EXPERIMENTS
|
| 104 |
+
|
| 105 |
+
We experimentally evaluate our XGAN model on semantic style transfer; more specifically, on the task of converting images of frontal faces (source domain) to images of cartoon avatars (target domain) given an unpaired collection of such samples in each domain. Our source domain is composed of real-world frontal-face images from the VGG-Face dataset (Parkhi et al., 2015). In particular, we use an image collection consisting of 18,054 uncropped celebrity frontal face pictures. As a preprocessing step, we align the faces based on eyes and mouth location and remove the background. The target domain is the cartoon style we introduced in Section 4. The corresponding training image collection consists of 9,000 cartoon images that we center-align by localizing the center of the irises, the center of the mouth, and tip of the nose. Finally, we randomly select and take out $20 \%$ of the images from each dataset for testing purposes, and use the remaining $80 \%$ for training. For our experiments we also resize all images to $6 4 \times 6 4$ . As shown in Figures 3 and 4, the two domains vary significantly in appearance. In particular, cartoon faces are rather simplistic compared to real faces, and do not display as much variety (e.g., noses or eyebrows only have a few shape options). Furthermore, we observe a major content distribution shift between the two domains due to the way we collected the data: for instance, certain hair color shades (e.g., bright red, gray) are over-represented in the cartoon domain compared to real faces. Similarly, the cartoon dataset contains many samples with eyeglasses while the source dataset only has a few.
|
| 106 |
+
|
| 107 |
+
Baseline comparison. Our primary evaluation result is a qualitative comparison between the Domain Transfer Network (DTN) (Taigman et al., 2016) and XGAN on the semantic style transfer problem outlined above. To the best of our knowledge, DTN is the current state of the art for semantic style transfer given unpaired image corpora from two domains with significant visual shift. In particular, DTN was also applied to the task of transferring face pictures to cartoons (bitmojis) in the original paper2. See Section 2 for a more detailed introduction. Figure 5 shows the performance of both DTN and XGAN applied to random VGG-Face samples from the test set to produce cartoon versions of each sample. For both models, we present random samples produced with the best set of hyperparameters we found. Evaluation metrics for style transfer are still an active research topic with no good solution yet. Hence we choose optimal hyperparameters by manually evaluating the quality of resulting samples, focusing on accurate transfer of semantic attributes, similarity of the resulting sample to the target domain, and crispness of samples.
|
| 108 |
+
|
| 109 |
+
It is clear from Figure 5 that DTN fails to capture the transformation function that semantically stylizes frontal faces to cartoons from our target domain. In contrast, XGAN is able to produce sensible cartoons both in terms of the style domain – the resulting cartoons look crisp and respect the specific CartoonSet style – and in terms of semantic similarity to the input samples from VGGFace. There are some failure cases such as hair or skin color mismatch, which emerge from the weakly supervised nature of the task and the significant content shift between the two domains (e.g., red hair is over-represented in the target cartoon dataset). We also report selected XGAN samples that we think best illustrate its semantic consistency abilities in Figure 6. Finally, additional random samples for both cross-domain mappings are available in Appendix 7.3.
|
| 110 |
+
|
| 111 |
+

|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 5: A qualitative comparison between DTN and XGAN. In both cases we present random test samples for the face-to-cartoon transformation with optimal hyperparameters. The tables are prganized row-wise where each face input is mapped to the cartoon face immediately on its right.
|
| 115 |
+
Figure 6: Selected samples generated by XGAN on the VGG-Face to CartoonSet task.
|
| 116 |
+
|
| 117 |
+
We believe the failure of DTN is primarily due to its assumption of a fixed joint encoder for both domains. Although the decoder learns to reconstruct inputs from the target domain almost perfectly, the semantics are not well preserved across domains and the decoder yields samples of poor quality for the domain transfer. In fact, FaceNet was originally trained on real faces inputs, hence there is no guarantee it can produce a meaningful representation for CartoonSet samples. In contrast to our dataset, the target bitmoji domain in (Taigman et al., 2016) is visually closer to real faces, as bitmojis are more realistic and customizable than the cartoon style domain we introduce here. This might explain the good reported performance even with a fixed encoder. Our experiments suggest that using a fixed encoder is a very restrictive assumption that does not adapt well to new scenarios. We also report results from a finetuned DTN in Appendix 7.2 and 7.3, which yields samples of better quality than the original DTN. However, this setup is very sensitive to training hyperparameters and prone to mode collapse.
|
| 118 |
+
|
| 119 |
+
Ablation study. We conduct a number of insightful ablation experiments on XGAN. We first consider training only with the reconstruction loss $\mathcal { L } _ { r e c }$ and domain-adversarial loss $\mathcal { L } _ { d a n n }$ . In fact these form the core domain adaptation component in XGAN and, as we will show, are already able to capture basic semantic knowledge across domains in practice. Secondly we experiment with the semantic consistency loss and teacher loss. We show that both have a constraining effect on the embedding space which contributes to improving the sample consistency. We also show in Appendix 7.4.1 that the GAN loss, even though it makes training more complex, is necessary for producing samples of good quality and cannot be replaced with simpler image smoothness objectives.
|
| 120 |
+
|
| 121 |
+
We first experiment on XGAN with only the reconstruction and domain-adversarial losses active. This component prompts the model to (i) encode enough information for each decoder to correctly reconstruct images from the corresponding domain and (ii) to ensure that the embedding lies in a common subspace for both domains. In practice in this setting, the model is robust to hyperparameter choice and does not require much tuning to converge to a good regime, i.e., low reconstruction error and around $50 \%$ accuracy for the domain-adversarial classifier. As a result of (ii), applying each decoder to the output of the other domain’s encoder yields reasonable cross-domain translations, albeit of low quality (see Figure 7). Furthermore, we observe that some simple semantics such as skin tone or gender are overall well preserved by the learned embedding due to the shared autoencoder structure. For comparison, failure modes occur in extreme cases, e.g., when the model capacity is too small, in which case transferred samples are of poor quality, or when $\omega _ { d a n n }$ is too low. In the latter case, the source and target embeddings are easily distinguishable and the cross-domain translations do not look realistic (see Appendix 7.4).
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 7: Test results for XGAN with the reconstruction and domain-adversarial losses only
|
| 125 |
+
|
| 126 |
+
Secondly, we investigate the benefits of adding semantic consistency in XGAN via the following three components: Sharing high-level layers in the autoencoder leads the model to capture common semantics earlier in the architecture. In general, high-level layers in convolutional neural networks are known to encode semantic information. We perform a few experiments when sharing only the middle layer in the dual autoencoder. As expected, the resulting embedding does not capture relevant shared domain semantics. Second, we use the semantic consistency loss as self-supervision for the learned embedding, ensuring that it is preserved through the cross-domain transformations. It also reinforces the action of the domain-adversarial loss as it constrains embeddings from the two input domains to lie close to each other. Finally, the optional teacher loss leads the learned source embedding to lie near the teacher output (in our case, FaceNet’s representation layer), which is meaningful for real faces. It acts in conjunction which the domain-adversarial loss and semantic consistency loss which bring the source and target embedding distributions closer to each other.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 8: Results of ablating the teacher loss (left) and semantic consistency loss (right) in XGAN.
|
| 130 |
+
|
| 131 |
+
In Figure 8 we report random test samples for both domain-to-domain translations when ablating the teacher loss and semantic consistency loss respectively. While it is hard to draw conclusions from qualitative results, it seems that the teacher network has a positive regularization effect on the learned embedding by guiding it to a more reasonable region of the space: Training the model without the teacher loss (Figure 8(a)) yields more distorted samples, especially when the input is an outlier, e.g., person wearing a hat, or cartoons with unusual hairstyles (Figure 5(b)). Conversely, when the semantic consistency is inactive (Figure 8(b)), the generated samples overall display less variety. In particular, rare attributes (e.g., unusual hairstyle) are not as well preserved as when the semantic consistency loss is present.
|
| 132 |
+
|
| 133 |
+
Discussions and Limitations. Our initial motivation for XGAN was to tackle the semantic style transfer problem in a fully unsupervised framework by combining techniques from domain adaptation and image-to-image translation. We first observe that using a simple setup where a partially shared dual autoencoder is trained with reconstruction losses and a domain-adversarial loss already suffices to produce an embedding that captures basic semantics rather well (for instance, skin tone). However, the generated samples are of poor quality and fine-grained attributes such as facial hair are not well captured. These two problems are greatly diminished after adding the GAN loss and the proposed semantic consistency loss, respectively. Failure cases still exist, especially on nonrepresentative input samples (e.g., a person wearing a hat) which are mapped to unrealistic cartoons. Adding the teacher loss reduces this problem by regularizing the learned embedding, however it requires additional supervision and makes the model dependent on the specific representation provided by the teacher network. Future work will focus on evaluating XGAN on more tasks. In particular, , while we introduced XGAN as a solution to semantic style transfer, we think the model goes beyond this scenario and could be applied to classical domain adaptation problems, where quantitative evaluation becomes possible.
|
| 134 |
+
|
| 135 |
+
# 6 CONCLUSIONS
|
| 136 |
+
|
| 137 |
+
In this work, we introduced XGAN, a model for unsupervised domain translation applied to the task of semantically-consistent style transfer. In particular, we argue that learning image-to-image translation between two structurally different domains requires passing through a high-level joint semantic representation while discarding local pixel-level dependencies. Additionally, we proposed a semantic consistency loss acting on both domain translations as a form of self-supervision.
|
| 138 |
+
|
| 139 |
+
We reported promising experimental results on the task of mapping the domain of face images to cartoon avatars that clearly outperform the current baseline. We also showed that additional weak supervision, such as a pretrained feature representation, can easily be added to the model in the form of teacher knowledge. While not necessary, it acts as a good regularizer for the learned embeddings and generated samples. This can be particularly useful for natural image data as offthe-shelf pretrained models are abundant.
|
| 140 |
+
|
| 141 |
+
# REFERENCES
|
| 142 |
+
|
| 143 |
+
Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks. In NIPS, 2016.
|
| 144 |
+
|
| 145 |
+
Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. In CVPR, 2017.
|
| 146 |
+
|
| 147 |
+
Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Francois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. Journal of Machine Learning Research, 2016.
|
| 148 |
+
|
| 149 |
+
L. A. Gatys, A. S. Ecker, and M. Bethge. Image style transfer using convolutional neural networks. In CVPR, 2016.
|
| 150 |
+
|
| 151 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
|
| 152 |
+
|
| 153 |
+
Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and superresolution. In ECCV, 2016.
|
| 154 |
+
|
| 155 |
+
Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jung Kwon Lee, and Jiwon Kim. Learning to discover cross-domain relations with generative adversarial networks. In ICML, 2017.
|
| 156 |
+
|
| 157 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 158 |
+
|
| 159 |
+
Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv, 2015.
|
| 160 |
+
|
| 161 |
+
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew ´ Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. arXiv, 2016.
|
| 162 |
+
|
| 163 |
+
Chuan Li and Michael Wand. Combining Markov random fields and convolutional neural networks for image synthesis. In CVPR, 2016.
|
| 164 |
+
|
| 165 |
+
Jing Liao, Yuan Yao, Lu Yuan, Gang Hua, and Sing Bing Kang. Visual attribute transfer through deep image analogy. ACM Transactions on Graphics, 2017.
|
| 166 |
+
|
| 167 |
+
Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS. 2016.
|
| 168 |
+
|
| 169 |
+
Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. arXiv, 2017.
|
| 170 |
+
|
| 171 |
+
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015.
|
| 172 |
+
|
| 173 |
+
O. M. Parkhi, A. Vedaldi, and A. Zisserman. Deep face recognition. In BMVC, 2015.
|
| 174 |
+
|
| 175 |
+
Florian Schroff, Dmitry Kalenichenko, and James Philbin. FaceNet: A unified embedding for face recognition and clustering. In CVPR, 2015.
|
| 176 |
+
|
| 177 |
+
Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Josh Susskind, Wenda Wang, and Russ Webb. Learning from simulated and unsupervised images through adversarial training. In CVPR, 2017.
|
| 178 |
+
|
| 179 |
+
Yaniv Taigman, Adam Polyak, and Lior Wolf. Unsupervised cross-domain image generation. arXiv, 2016.
|
| 180 |
+
|
| 181 |
+
Lior Wolf, Yaniv Taigman, and Adam Polyak. Unsupervised creation of parameterized avatars. In ICCV, 2017.
|
| 182 |
+
|
| 183 |
+
Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. DualGan: Unsupervised dual learning for image-to-image translation. In ICCV, 2017.
|
| 184 |
+
|
| 185 |
+
Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In ECCV, 2016.
|
| 186 |
+
|
| 187 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
|
| 188 |
+
|
| 189 |
+
# 7 APPENDIX
|
| 190 |
+
|
| 191 |
+
# 7.1 ARCHITECTURE DETAILS
|
| 192 |
+
|
| 193 |
+
Autoencoder. Encoders take $6 4 \mathrm { x } 6 4$ images as input, which are then fed through five 2D convolutional blocks. Two fully-connected layers are applied to the last feature map in order to obtain the embedding vector. Finally, we normalize the embedding vector so that it lies in the unit ball. We use the cosine distance for all embedding comparisons (for the semantic consistency and teacher loss). The architecture for the decoder is a mirrored version of the encoder. From the initial flat embedding layer, we apply a sequence of five deconvolutions, the last block outputting an $6 4 \mathrm { x } 6 4$ color image. For both the encoder and decoder, the two highest-level (de)convolutional blocks are shared across domains. This encourages the model to learn shared representations at different levels of the architecture rather than only in the middle layer. A detailed overview of the architecture is presented in Appendix 7.1.
|
| 194 |
+
|
| 195 |
+
Discriminator. The discriminator architecture is very similar to the encoder architecture with the difference that it only needs to output one logit for each input image, representing its binary classification decision. In practice, we use a smaller architecture for the discriminator as it often tends to be too powerful and easily distinguish between real and transformed images.
|
| 196 |
+
|
| 197 |
+
<table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Size</td></tr><tr><td rowspan=1 colspan=1>Inputs</td><td rowspan=1 colspan=1>64x64x3</td></tr><tr><td rowspan=1 colspan=1>conv1</td><td rowspan=1 colspan=1>32x32x32</td></tr><tr><td rowspan=1 colspan=1>conv2</td><td rowspan=1 colspan=1>16x16x64</td></tr><tr><td rowspan=1 colspan=1>(/l) conv3</td><td rowspan=1 colspan=1>8x8x128</td></tr><tr><td rowspan=1 colspan=1>(/l) conv4</td><td rowspan=1 colspan=1>4x4x256</td></tr><tr><td rowspan=1 colspan=1>(/) FC1</td><td rowspan=1 colspan=1>1x1x1024</td></tr><tr><td rowspan=1 colspan=1>(/) FC2</td><td rowspan=1 colspan=1>1x1x1024</td></tr><tr><td rowspan=1 colspan=1>L2 norm.</td><td rowspan=1 colspan=1>1x1x1024</td></tr></table>
|
| 198 |
+
|
| 199 |
+
<table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Size</td></tr><tr><td rowspan=1 colspan=1>Inputs</td><td rowspan=1 colspan=1>1x1x1024</td></tr><tr><td rowspan=1 colspan=1>(//) deconv1</td><td rowspan=1 colspan=1>4x4x512</td></tr><tr><td rowspan=1 colspan=1>(//) deconv2</td><td rowspan=1 colspan=1>8x8x256</td></tr><tr><td rowspan=1 colspan=1>deconv3</td><td rowspan=1 colspan=1>16x16x128</td></tr><tr><td rowspan=1 colspan=1>deconv4</td><td rowspan=1 colspan=1>32x32x64</td></tr><tr><td rowspan=1 colspan=1>deconv5</td><td rowspan=1 colspan=1>64x64x3</td></tr></table>
|
| 200 |
+
|
| 201 |
+
<table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Size</td></tr><tr><td rowspan=1 colspan=1>Inputs</td><td rowspan=1 colspan=1>64x64x3</td></tr><tr><td rowspan=1 colspan=1>conv1</td><td rowspan=1 colspan=1>32x32x16</td></tr><tr><td rowspan=1 colspan=1>conv2</td><td rowspan=1 colspan=1>16x16x32</td></tr><tr><td rowspan=1 colspan=1>conv3</td><td rowspan=1 colspan=1>8x8x32</td></tr><tr><td rowspan=1 colspan=1>conv4</td><td rowspan=1 colspan=1>4x4x32</td></tr><tr><td rowspan=1 colspan=1>FC1</td><td rowspan=1 colspan=1>1x1x1</td></tr></table>
|
| 202 |
+
|
| 203 |
+
(a) Encoder architecture (b) Decoder architecture (c) Discriminator architecture
|
| 204 |
+
|
| 205 |
+
Table 1: Overview of the XGAN architecture used in practice. The encoder and decoder have the same architecture for both domains, and $( / / )$ indicates that the layer is shared across domain.
|
| 206 |
+
|
| 207 |
+
We also report details of the XGAN architecture in Table 1. Note that all layers except the last ones are followed by batch normalization. We also use ReLU as activation function for each of them, except for the last deconvolution of the decoders which uses hyperbolic tangent activation function.
|
| 208 |
+
|
| 209 |
+
# 7.2 FINETUNING THE DTN ENCODER
|
| 210 |
+
|
| 211 |
+
As we noted when experimenting with the DTN, its main drawback seems to come from the assumption to keep a fixed pretrained encoder in the model. Following this observation, we perform another experiment in which we finetune the FaceNet encoder relatively to the semantic consistency loss, additionally to the decoder parameters.
|
| 212 |
+
|
| 213 |
+
While this yields visually better samples (see Figure 9(b)), it also raises the classical domain adaptation issue of guaranteeing that the initial FaceNet embedding knowledge is preserved when retraining the embedding. For comparison, XGAN exploits a teacher network that can be used to distill prior domain knowledge throughout training, when available. Secondly, this finetuned DTN is prone to mode collapse. In fact, the encoder is now only trained relatively to the semantic consistency loss which can be easily minizimed by mapping each domain to the same point in the embedding space, leading to the same cartoon being generated for all of them. In XGAN, the source embeddings are regularized by the reconstruction loss on the source domain. This allows us to learn a joint domain embedding from scratch in a proper domain adaptation framework.
|
| 214 |
+
|
| 215 |
+

|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
(b) Random generated samples with a fine-tuned FaceNet encoder
|
| 219 |
+
|
| 220 |
+
(a) Random generated samples (left) and reconstructions (right) with fixed FaceNet embedding
|
| 221 |
+
|
| 222 |
+
Figure 9: Reproducing the Domain Transfer Network performs badly in our experimental setting (a); fine-tuning the encoder yields better results (b) but is unstable for training in practice.
|
| 223 |
+
|
| 224 |
+
# 7.3 EXTENSIVE QUALITATIVE EVALUATION
|
| 225 |
+
|
| 226 |
+
As mentioned in the main text, the DTN baseline fails to capture a meaningful shared embedding for the two input domains. Instead, we consider and experiment with three different models to tackle the semantic style transfer problem. Selected samples are reported in Figure 10:
|
| 227 |
+
|
| 228 |
+
• Finetuned DTN, as introduced previously. In practice, this model yields satisfactory samples but is very sensitive to hyperparameter choice and often collapses to one model.
|
| 229 |
+
XGAN with $\mathcal { L } _ { r e c }$ and $\mathcal { L } _ { d a n n }$ active only corresponds to a simple domain-adaptation setting: the proposed XGAN model where only the reconstruction loss $\mathcal { L } _ { r e c }$ and the domainadversarial loss $\mathcal { L } _ { d a n n }$ are active. We observe that semantics are globally well preserved across domains although the model still makes some basic mistakes (e.g., gender misclassifications) and the samples quality is poor.
|
| 230 |
+
XGAN, the full proposed model, yields the best visual samples out of the models we experiment on. In the rest of this section, we report a detailed study on its different components and possible failure modes.
|
| 231 |
+
|
| 232 |
+

|
| 233 |
+
Figure 10: Cherry-picked samples for the DTN baseline and three improved models we consider for the semantic style transfer task
|
| 234 |
+
|
| 235 |
+
In Figure 11 we also report a more extensive random selection of samples produced by XGAN. Note that we only used a discriminator for the source to target path (i.e., $\mathcal { L } _ { g a n , 2 1 }$ is inactive); in fact the GAN objective tends to make training more unstable so we only use one for the transformation we care most about for this specific application, i.e., faces to cartoons. Other than the GAN objective, the model appears to be robust to the choice of hyperparameters.
|
| 236 |
+
|
| 237 |
+

|
| 238 |
+
Figure 11: Random samples obtain when applying a trained XGAN on faces from the testing set
|
| 239 |
+
|
| 240 |
+
Overall, the cartoon samples are visually very close to the original dataset and main identity characteristics such as face shape, hair style, skin tone, etc., are well preserved between the two domains. The main failure mode appears to be mismatched hair color: in particular, bright red hair appear very often in generated samples which is likely due to its abundance in the training cartoon dataset. In fact, when looking at the target to source generated samples, we observe that this color shade often gets mapped to dark brown hair in the real face domain. One could expect the teacher network to regularize the hair color mapping, however FaceNet was originally trained for face identification, hence is most likely more sensitive to structural characteristics such as face shape. More generally, most mistakes are due to the shift in content distribution rather than style distribution between the two domains. Other examples include bald faces being mapped to cartoons with light hair (most likely due to the lack of bald cartoon faces and the model mistaking the white background for hair color). Also, eyeglasses on cartoon faces disappear when mapped to the real face domain (only very few faces in the source dataset wear glasses).
|
| 241 |
+
|
| 242 |
+
# 7.4 FAILURE MODE WHEN TRAINING WITH $\mathcal { L } _ { r e c }$ AND $\mathcal { L } _ { d a n n }$
|
| 243 |
+
|
| 244 |
+
In Figure 12 we report examples of failure cases when $\omega _ { d a n n }$ is too high in the setting with the reconstruction and domain-adversarial loss only: The domain-adversarial classifier $c _ { d a n n }$ reaches perfect accuracy and cross-domain translation fails.
|
| 245 |
+
|
| 246 |
+

|
| 247 |
+
Figure 12: Random test samples for both cross-domain translations in the failure mode for the $\mathcal { L } _ { r e c } + \mathcal { L } _ { d a n n }$ only XGAN setting
|
| 248 |
+
|
| 249 |
+
# 7.4.1 GAN LOSS ABLATION EXPERIMENT
|
| 250 |
+
|
| 251 |
+
As mentioned Section 3.1, we only use a GAN loss term for the source target translation, to ease training. This prompts the face-to-cartoon path to generate more realistic samples. As expected, when the GAN loss is inactive, the generated samples are noisy and unrealistic (see Figure 13(a)). For comparison, tackling the low quality problem with simpler regularization techniques such as using total variation smoothness loss leads to more uniform samples but significantly worsen their blurriness on the long term (see Figure 13(b)). This shows the importance of the GAN objective for image generation applications, even though it makes the training process more complex.
|
| 252 |
+
|
| 253 |
+

|
| 254 |
+
Figure 13: Test samples for XGAN when the GAN loss $\mathcal { L } _ { g a }$ is inactive
|
md/train/rkYTTf-AZ/rkYTTf-AZ.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UNSUPERVISED MACHINE TRANSLATION USING MONOLINGUAL CORPORA ONLY
|
| 2 |
+
|
| 3 |
+
Guillaume Lample † ‡ , Alexis Conneau $\dagger$ , Ludovic Denoyer $^ \ddag$ , Marc’Aurelio Ranzato † † Facebook AI Research, ‡ Sorbonne Universites, UPMC Univ Paris 06, LIP6 UMR 7606, CNRS ´ {gl,aconneau,ranzato}@fb.com,ludovic.denoyer@lip6.fr
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Machine translation has recently achieved impressive performance thanks to recent advances in deep learning and the availability of large-scale parallel corpora. There have been numerous attempts to extend these successes to low-resource language pairs, yet requiring tens of thousands of parallel sentences. In this work, we take this research direction to the extreme and investigate whether it is possible to learn to translate even without any parallel data. We propose a model that takes sentences from monolingual corpora in two different languages and maps them into the same latent space. By learning to reconstruct in both languages from this shared feature space, the model effectively learns to translate without using any labeled data. We demonstrate our model on two widely used datasets and two language pairs, reporting BLEU scores of 32.8 and 15.1 on the Multi30k and WMT English-French datasets, without using even a single parallel sentence at training time.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Thanks to recent advances in deep learning (Sutskever et al., 2014; Bahdanau et al., 2015) and the availability of large-scale parallel corpora, machine translation has now reached impressive performance on several language pairs (Wu et al., 2016). However, these models work very well only when provided with massive amounts of parallel data, in the order of millions of parallel sentences. Unfortunately, parallel corpora are costly to build as they require specialized expertise, and are often nonexistent for low-resource languages. Conversely, monolingual data is much easier to find, and many languages with limited parallel data still possess significant amounts of monolingual data.
|
| 12 |
+
|
| 13 |
+
There have been several attempts at leveraging monolingual data to improve the quality of machine translation systems in a semi-supervised setting (Munteanu et al., 2004; Irvine, 2013; Irvine & Callison-Burch, 2015; Zheng et al., 2017). Most notably, Sennrich et al. (2015a) proposed a very effective data-augmentation scheme, dubbed “back-translation”, whereby an auxiliary translation system from the target language to the source language is first trained on the available parallel data, and then used to produce translations from a large monolingual corpus on the target side. The pairs composed of these translations with their corresponding ground truth targets are then used as additional training data for the original translation system.
|
| 14 |
+
|
| 15 |
+
Another way to leverage monolingual data on the target side is to augment the decoder with a language model (Gulcehre et al., 2015). And finally, Cheng et al. (2016); He et al. (2016) have proposed to add an auxiliary auto-encoding task on monolingual data, which ensures that a translated sentence can be translated back to the original one. All these works still rely on several tens of thousands parallel sentences, however.
|
| 16 |
+
|
| 17 |
+
Previous work on zero-resource machine translation has also relied on labeled information, not from the language pair of interest but from other related language pairs (Firat et al., 2016; Johnson et al., 2016; Chen et al., 2017) or from other modalities (Nakayama & Nishida, 2017; Lee et al., 2017). The only exception is the work by Ravi & Knight (2011); Pourdamghani & Knight (2017), where the machine translation problem is reduced to a deciphering problem. Unfortunately, their method is limited to rather short sentences and it has only been demonstrated on a very simplistic setting comprising of the most frequent short sentences, or very closely related languages.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Toy illustration of the principles guiding the design of our objective function. Left (autoencoding): the model is trained to reconstruct a sentence from a noisy version of it. $x$ is the target, $C ( x )$ is the noisy input, $\hat { x }$ is the reconstruction. Right (translation): the model is trained to translate a sentence in the other domain. The input is a noisy translation (in this case, from source-to-target) produced by the model itself, $M$ , at the previous iteration $( t )$ , $y = M ^ { ( t ) } ( x )$ . The model is symmetric, and we repeat the same process in the other language. See text for more details.
|
| 21 |
+
|
| 22 |
+
In this paper, we investigate whether it is possible to train a general machine translation system without any form of supervision whatsoever. The only assumption we make is that there exists a monolingual corpus on each language. This set up is interesting for a twofold reason. First, this is applicable whenever we encounter a new language pair for which we have no annotation. Second, it provides a strong lower bound performance on what any good semi-supervised approach is expected to yield.
|
| 23 |
+
|
| 24 |
+
The key idea is to build a common latent space between the two languages (or domains) and to learn to translate by reconstructing in both domains according to two principles: (i) the model has to be able to reconstruct a sentence in a given language from a noisy version of it, as in standard denoising auto-encoders (Vincent et al., 2008). (ii) The model also learns to reconstruct any source sentence given a noisy translation of the same sentence in the target domain, and vice versa. For (ii), the translated sentence is obtained by using a back-translation procedure (Sennrich et al., 2015a), i.e. by using the learned model to translate the source sentence to the target domain. In addition to these reconstruction objectives, we constrain the source and target sentence latent representations to have the same distribution using an adversarial regularization term, whereby the model tries to fool a discriminator which is simultaneously trained to identify the language of a given latent sentence representation (Ganin et al., 2016). This procedure is then iteratively repeated, giving rise to translation models of increasing quality. To keep our approach fully unsupervised, we initialize our algorithm by using a na¨ıve unsupervised translation model based on a word by word translation of sentences with a bilingual lexicon derived from the same monolingual data (Conneau et al., 2017). As a result, and by only using monolingual data, we can encode sentences of both languages into the same feature space, and from there, we can also decode/translate in any of these languages; see Figure 1 for an illustration.
|
| 25 |
+
|
| 26 |
+
While not being able to compete with supervised approaches using lots of parallel resources, we show in section 4 that our model is able to achieve remarkable performance. For instance, on the WMT dataset we can achieve the same translation quality of a similar machine translation system trained with full supervision on 100,000 sentence pairs. On the Multi30K-Task1 dataset we achieve a BLEU above 22 on all the language pairs, with up to 32.76 on English-French.
|
| 27 |
+
|
| 28 |
+
Next, in section 2, we describe the model and the training algorithm. We then present experimental results in section 4. Finally, we further discuss related work in section 5 and summarize our findings in section 6.
|
| 29 |
+
|
| 30 |
+
# 2 UNSUPERVISED NEURAL MACHINE TRANSLATION
|
| 31 |
+
|
| 32 |
+
In this section, we first describe the architecture of the translation system, and then we explain how we train it.
|
| 33 |
+
|
| 34 |
+
2.1 NEURAL MACHINE TRANSLATION MODEL
|
| 35 |
+
|
| 36 |
+
The translation model we propose is composed of an encoder and a decoder, respectively responsible for encoding source and target sentences to a latent space, and to decode from that latent space to the source or the target domain. We use a single encoder and a single decoder for both domains (Johnson et al., 2016). The only difference when applying these modules to different languages is the choice of lookup tables.
|
| 37 |
+
|
| 38 |
+
Let us denote by $\mathcal { W } _ { S }$ the set of words in the source domain associated with the (learned) words embeddings $\mathcal { Z } ^ { S } = ( z _ { 1 } ^ { s } , . . . . , z _ { | \mathcal { W } _ { S } | } ^ { s } )$ , and by $\mathcal { W } _ { T }$ the set of words in the target domain associated with the embeddings $\mathcal { Z } ^ { T } = ( z _ { 1 } ^ { t } , . . . , z _ { | \mathcal { W } _ { T } | } ^ { t } )$ , $\mathcal { Z }$ being the set of all the embeddings. Given an input sentence of $m$ words $\pmb { x } = ( x _ { 1 } , x _ { 2 } , . . . , x _ { m } )$ in a particular language \`, $\ell \in \{ s r c , t g t \}$ , an encoder $e _ { \theta _ { \mathrm { { e n c } } } , z } ( { \pmb x } , { \pmb \ell } )$ computes a sequence of $m$ hidden states $\boldsymbol { z } = ( z _ { 1 } , z _ { 2 } , . . . , z _ { m } )$ by using the corresponding word embeddings, i.e. ${ \mathcal { Z } } _ { S }$ if $\ell = s r c$ and ${ \mathcal { Z } } _ { T }$ if $\ell = t g t$ ; the other parameters $\theta _ { \mathrm { e n c } }$ are instead shared between the source and target languages. For the sake of simplicity, the encoder will be denoted as $e ( { \pmb x } , { \pmb \ell } )$ in the following. These hidden states are vectors in $\mathbb { R } ^ { n }$ , $n$ being the dimension of the latent space.
|
| 39 |
+
|
| 40 |
+
A decoder $d _ { \theta _ { \mathrm { d e c } } , \mathcal { Z } } ( z , \ell )$ takes as input $_ z$ and a language $\ell$ , and generates an output sequence ${ \textbf { \em y } } =$ $\left( y _ { 1 } , y _ { 2 } , . . . , y _ { k } \right)$ , where each word $y _ { i }$ is in the corresponding vocabulary $\mathcal { W } ^ { \ell }$ . This decoder makes use of the corresponding word embeddings, and it is otherwise parameterized by a vector $\theta _ { \mathrm { d e c } }$ that does not depend on the output language. It will thus be denoted $d ( z , \ell )$ in the following. To generate an output word $y _ { i }$ , the decoder iteratively takes as input the previously generated word $y _ { i - 1 }$ $y _ { 0 }$ being a start symbol which is language dependent), updates its internal state, and returns the word that has the highest probability of being the next one. The process is repeated until the decoder generates a stop symbol indicating the end of the sequence.
|
| 41 |
+
|
| 42 |
+
In this article, we use a sequence-to-sequence model with attention (Bahdanau et al., 2015), without input-feeding. The encoder is a bidirectional-LSTM which returns a sequence of hidden states $\boldsymbol { z } = ( z _ { 1 } , z _ { 2 } , . . . , z _ { m } )$ . At each step, the decoder, which is also an LSTM, takes as input the previous hidden state, the current word and a context vector given by a weighted sum over the encoder states. In all the experiments we consider, both encoder and decoder have 3 layers. The LSTM layers are shared between the source and target encoder, as well as between the source and target decoder. We also share the attention weights between the source and target decoder. The embedding and LSTM hidden state dimensions are all set to 300. Sentences are generated using greedy decoding.
|
| 43 |
+
|
| 44 |
+
# 2.2 OVERVIEW OF THE METHOD
|
| 45 |
+
|
| 46 |
+
We consider a dataset of sentences in the source domain, denoted by $\mathcal { D } _ { s r c }$ , and another dataset in the target domain, denoted by $\mathcal { D } _ { t g t }$ . These datasets do not correspond to each other, in general. We train the encoder and decoder by reconstructing a sentence in a particular domain, given a noisy version of the same sentence in the same or in the other domain.
|
| 47 |
+
|
| 48 |
+
At a high level, the model starts with an unsupervised na¨ıve translation model obtained by making word-by-word translation of sentences using a parallel dictionary learned in an unsupervised way (Conneau et al., 2017). Then, at each iteration, the encoder and decoder are trained by minimizing an objective function that measures their ability to both reconstruct and translate from a noisy version of an input training sentence. This noisy input is obtained by dropping and swapping words in the case of the auto-encoding task, while it is the result of a translation with the model at the previous iteration in the case of the translation task. In order to promote alignment of the latent distribution of sentences in the source and the target domains, our approach also simultaneously learns a discriminator in an adversarial setting. The newly learned encoder/decoder are then used at the next iteration to generate new translations, until convergence of the algorithm. At test time and despite the lack of parallel data at training time, the encoder and decoder can be composed into a standard machine translation system.
|
| 49 |
+
|
| 50 |
+
# 2.3 DENOISING AUTO-ENCODING
|
| 51 |
+
|
| 52 |
+
Training an autoencoder of sentences is a trivial task, if the sequence-to-sequence model is provided with an attention mechanism like in our work 1. Without any constraint, the auto-encoder very quickly learns to merely copy every input word one by one. Such a model would also perfectly copy sequences of random words, suggesting that the model does not learn any useful structure in the data. To address this issue, we adopt the same strategy of Denoising Auto-encoders (DAE) (Vincent et al., 2008)), and add noise to the input sentences (see Figure 1-left), similarly to Hill et al. (2016). Considering a domain $\ell = s r c$ or $\ell = t g t$ , and a stochastic noise model denoted by $C$ which operates on sentences, we define the following objective function:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathcal { L } _ { a u t o } ( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } , \ell ) = \mathbb { E } _ { x \sim \mathcal { D } _ { \ell } , \hat { x } \sim d ( e ( C ( x ) , \ell ) , \ell ) } \left[ \Delta ( \hat { x } , x ) \right]
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\hat { x } \sim d ( e ( C ( x ) , \ell ) , \ell )$ means that $\hat { x }$ is a reconstruction of the corrupted version of $x$ , with $x$ sampled from the monolingual dataset $\mathcal { D } _ { \ell }$ . In this equation, $\Delta$ is a measure of discrepancy between the two sequences, the sum of token-level cross-entropy losses in our case.
|
| 59 |
+
|
| 60 |
+
Noise model $C ( x )$ is a randomly sampled noisy version of sentence $x$ . In particular, we add two different types of noise to the input sentence. First, we drop every word in the input sentence with a probability $p _ { w d }$ . Second, we slightly shuffle the input sentence. To do so, we apply a random permutation $\sigma$ to the input sentence, verifying the condition $\forall i \in \{ 1 , n \} , | \sigma ( i ) - i | \tilde { \leq k }$ where $n$ is the length of the input sentence, and $k$ is a tunable parameter.
|
| 61 |
+
|
| 62 |
+
To generate a random permutation verifying the above condition for a sentence of size $n$ , we generate a random vector $q$ of size $n$ , where $q _ { i } = i + U ( 0 , \alpha )$ , and $U$ is a draw from the uniform distribution in the specified range. Then, we define $\sigma$ to be the permutation that sorts the array $q$ . In particular, $\alpha < 1$ will return the identity, $\alpha = + \infty$ can return any permutation, and $\alpha = k + 1$ will return permutations $\sigma$ verifying $\forall i \ \in \ \{ 1 , n \} , | \sigma ( i ) - i | \ \leq \ k$ . Although biased, this method generates permutations similar to the noise observed with word-by-word translation.
|
| 63 |
+
|
| 64 |
+
In our experiments, both the word dropout and the input shuffling strategies turned out to have a critical impact on the results, see also section 4.5, and using both strategies at the same time gave us the best performance. In practice, we found $p _ { w d } = 0 . 1$ and $k = 3$ to be good parameters.
|
| 65 |
+
|
| 66 |
+
# 2.4 CROSS DOMAIN TRAINING
|
| 67 |
+
|
| 68 |
+
The second objective of our approach is to constrain the model to be able to map an input sentence from a the source/target domain $\ell _ { 1 }$ to the target/source domain $\ell _ { 2 }$ , which is what we are ultimately interested in at test time. The principle here is to sample a sentence $x \in \mathcal { D } _ { \ell _ { 1 } }$ , and to generate a corrupted translation of this sentence in $\ell _ { 2 }$ . This corrupted version is generated by applying the current translation model denoted $M$ to $x$ such that $y = M ( x )$ . Then a corrupted version $C ( y )$ is sampled (see Figure 1-right). The objective is thus to learn the encoder and the decoder such that they can reconstruct $x$ from $C ( y )$ . The cross-domain loss can be written as:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\mathcal { L } _ { c d } \left( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } , \ell _ { 1 } , \ell _ { 2 } \right) = \mathbb { E } _ { x \sim \mathcal { D } _ { \ell _ { 1 } } , \hat { x } \sim d \left( e \left( C \left( M \left( x \right) \right) , \ell _ { 2 } \right) , \ell _ { 1 } \right) } \left[ \Delta \left( \hat { x } , x \right) \right]
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $\Delta$ is again the sum of token-level cross-entropy losses.
|
| 75 |
+
|
| 76 |
+
# 2.5 ADVERSARIAL TRAINING
|
| 77 |
+
|
| 78 |
+
Intuitively, the decoder of a neural machine translation system works well only when its input is produced by the encoder it was trained with, or at the very least, when that input comes from a distribution very close to the one induced by its encoder. Therefore, we would like our encoder to output features in the same space regardless of the actual language of the input sentence. If such condition is satisfied, our decoder may be able to decode in a certain language regardless of the language of the encoder input sentence.
|
| 79 |
+
|
| 80 |
+
Note however that the decoder could still produce a bad translation while yielding a valid sentence in the target domain, as constraining the encoder to map two languages in the same feature space does not imply a strict correspondence between sentences. Fortunately, the previously introduced loss for cross-domain training in equation 2 mitigates this concern. Also, recent work on bilingual lexical induction has shown that such a constraint is very effective at the word level, suggesting that it may also work at the sentence level, as long as the two latent representations exhibit strong structure in feature space.
|
| 81 |
+
|
| 82 |
+
In order to add such a constraint, we train a neural network, which we will refer to as the discriminator, to classify between the encoding of source sentences and the encoding of target sentences (Ganin et al., 2016). The discriminator operates on the output of the encoder, which is a sequence of latent vectors $\left( z _ { 1 } , . . . , z _ { m } \right)$ , with $z _ { i } \in \mathbb { R } ^ { n }$ , and produces a binary prediction about the language of the encoder input sentence: $p _ { D } ( l | z _ { 1 } , . . . , z _ { m } ) \propto \prod _ { j = 1 } ^ { m } p _ { D } ( \ell | z _ { j } )$ , with $p _ { D } : \mathbb { R } ^ { n } [ 0 ; 1 ]$ , where 0 corresponds to the source domain, and 1 to the target domain.
|
| 83 |
+
|
| 84 |
+
The discriminator is trained to predict the language by minimizing the following cross-entropy loss: $\mathcal { L } _ { \mathcal { D } } ( \theta _ { D } | \theta , \mathcal { Z } ) = - \mathbb { E } _ { ( x _ { i } , \ell _ { i } ) } [ \log p _ { D } ( \ell _ { i } | e ( x _ { i } , \ell _ { i } ) ) ]$ , where $( x _ { i } , \ell _ { i } )$ corresponds to sentence and language id pairs uniformly sampled from the two monolingual datasets, $\theta _ { D }$ are the parameters of the discriminator, $\theta _ { \mathrm { e n c } }$ are the parameters of the encoder, and $\mathcal { Z }$ are the encoder word embeddings.
|
| 85 |
+
|
| 86 |
+
The encoder is trained instead to fool the discriminator:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\mathcal { L } _ { a d v } ( \theta _ { \mathrm { e n c } } , \mathcal { Z } | \theta _ { D } ) = - \mathbb { E } _ { ( x _ { i } , \ell _ { i } ) } [ \log p _ { D } ( \ell _ { j } | e ( x _ { i } , \ell _ { i } ) ) ]
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
with $\ell _ { j } = \ell _ { 1 }$ if $\ell _ { i } = \ell _ { 2 }$ , and vice versa.
|
| 93 |
+
|
| 94 |
+
Final Objective function The final objective function at one iteration of our learning algorithm is thus:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\begin{array} { r l } & { \mathcal { L } ( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } ) = \lambda _ { a u t o } [ \mathcal { L } _ { a u t o } ( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } , s r c ) + \mathcal { L } _ { a u t o } ( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } , t g t ) ] + } \\ & { \qquad \lambda _ { c d } [ \mathcal { L } _ { c d } ( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } , s r c , t g t ) + \mathcal { L } _ { c d } ( \theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } , t g t , s r c ) ] + } \\ & { \qquad \lambda _ { a d v } \mathcal { L } _ { a d v } ( \theta _ { \mathrm { e n c } } , \mathcal { Z } | \theta _ { D } ) } \end{array}
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $\lambda _ { a u t o }$ , $\lambda _ { c d }$ , and $\lambda _ { a d v }$ are hyper-parameters weighting the importance of the auto-encoding, cross-domain and adversarial loss. In parallel, the discriminator loss $\mathcal { L } _ { D }$ is minimized to update the discriminator.
|
| 101 |
+
|
| 102 |
+
# 3 TRAINING
|
| 103 |
+
|
| 104 |
+
In this section we describe the overall training algorithm and the unsupervised criterion we used to select hyper-parameters.
|
| 105 |
+
|
| 106 |
+
# 3.1 ITERATIVE TRAINING
|
| 107 |
+
|
| 108 |
+
The final learning algorithm is described in Algorithm 1 and the general architecture of the model is shown in Figure 2. As explained previously, our model relies on an iterative algorithm which starts from an initial translation model $M ^ { ( 1 ) }$ (line 3). This is used to translate the available monolingual data, as needed by the cross-domain loss function of Equation 2. At each iteration, a new encoder and decoder are trained by minimizing the loss of Equation 4 – line 7 of the algorithm. Then, a new translation model $M ^ { ( t + 1 ) }$ is created by composing the resulting encoder and decoder, and the process repeats.
|
| 109 |
+
|
| 110 |
+
To jump start the process, $M ^ { ( 1 ) }$ simply makes a word-by-word translation of each sentence using a parallel dictionary learned using the unsupervised method proposed by Conneau et al. (2017), which only leverages monolingual data.
|
| 111 |
+
|
| 112 |
+
The intuition behind our algorithm is that as long as the initial translation model $M ^ { ( 1 ) }$ retains at least some information of the input sentence, the encoder will map such translation into a representation in feature space that also corresponds to a cleaner version of the input, since the encoder is trained to denoise. At the same time, the decoder is trained to predict noiseless outputs, conditioned on noisy features. Putting these two pieces together will produce less noisy translations, which will enable better back-translations at the next iteration, and so on so forth.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 2: Illustration of the proposed architecture and training objectives. The architecture is a sequence to sequence model, with both encoder and decoder operating on two languages depending on an input language identifier that swaps lookup tables. Top (auto-encoding): the model learns to denoise sentences in each domain. Bottom (translation): like before, except that we encode from another language, using as input the translation produced by the model at the previous iteration (light blue box). The green ellipses indicate terms in the loss function.
|
| 116 |
+
|
| 117 |
+
# Algorithm 1 Unsupervised Training for Machine Translation
|
| 118 |
+
|
| 119 |
+
1: procedure TRAINING $\mathcal { D } _ { s r c }$ , $\mathcal { D } _ { t g t } , T )$
|
| 120 |
+
2: Infer bilingual dictionary using monolingual data (Conneau et al., 2017)
|
| 121 |
+
3: $M ^ { ( 1 ) } \gets$ unsupervised word-by-word translation model using the inferred dictionary
|
| 122 |
+
4: for $t = 1 , T$ do
|
| 123 |
+
5: using ${ \bf \nabla } _ { M } ( t )$ , translate each monolingual dataset
|
| 124 |
+
6: $/ /$ discriminator training $\&$ model training as in eq. 4
|
| 125 |
+
7: $\theta _ { \mathrm { d i s c r } } \arg \operatorname* { m i n } \mathcal { L } _ { D }$ , $\theta _ { \mathrm { e n c } } , \theta _ { \mathrm { d e c } } , \mathcal { Z } \gets \arg \operatorname* { m i n } \mathcal { L }$
|
| 126 |
+
8: $M ^ { ( t + 1 ) } \gets \breve { e } ^ { ( t ) } \circ d ^ { ( t ) } / /$ update MT model
|
| 127 |
+
9: end for
|
| 128 |
+
10: return M (T +1)
|
| 129 |
+
11: end procedure
|
| 130 |
+
|
| 131 |
+
# 3.2 UNSUPERVISED MODEL SELECTION CRITERION
|
| 132 |
+
|
| 133 |
+
In order to select hyper-parameters, we wish to have a criterion correlated with the translation quality. However, we do not have access to parallel sentences to judge how well our model translates, not even at validation time. Therefore, we propose the surrogate criterion which we show correlates well with BLEU (Papineni et al., 2002), the metric we care about at test time.
|
| 134 |
+
|
| 135 |
+
For all sentences $x$ in a domain $\ell _ { 1 }$ , we translate these sentences to the other domain $\ell _ { 2 }$ , and then translate the resulting sentences back to $\ell _ { 1 }$ . The quality of the model is then evaluated by computing the BLEU score over the original inputs and their reconstructions via this two-step translation process. The performance is then averaged over the two directions, and the selected model is the one with the highest average score.
|
| 136 |
+
|
| 137 |
+
Given an encoder $e$ , a decoder $d$ and two non-parallel datasets $\mathcal { D } _ { s r c }$ and $\mathcal { D } _ { t g t }$ , we denote $M _ { s r c t g t } ( x ) = d ( e ( x , s r c ) , t g t )$ the translation model from src to tgt, and $M _ { t g t s r c }$ the model in the opposite direction. Our model selection criterion $M S ( e , d , \mathcal { D } _ { s r c } , \mathcal { D } _ { t g t } )$ is:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
\begin{array} { r c l } { { M S ( e , d , \mathcal { D } _ { s r c } , \mathcal { D } _ { t g t } ) } } & { { = } } & { { \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { x \sim \mathcal { D } _ { s r c } } [ \mathrm { B L E U } ( x , M _ { s r c t g t } \circ M _ { t g t s r c } ( x ) ) ] + } } \\ { { } } & { { } } & { { \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { x \sim \mathcal { D } _ { t g t } } [ \mathrm { B L E U } ( x , M _ { t g t s r c } \circ M _ { s r c t g t } ( x ) ) ] } } \end{array}
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
Figure 3 shows a typical example of the correlation between this measure and the final translation model performance (evaluated here using a parallel dataset).
|
| 144 |
+
|
| 145 |
+
The unsupervised model selection criterion is used both to a) determine when to stop training and b) to select the best hyper-parameter setting across different experiments. In the former case, the
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 3: Unsupervised model selection. BLEU score of the source to target and target to source models on the Multi30k-Task1 English-French dataset as a function of the number of passes through the dataset at iteration $\mathbf { \Omega } ( t ) \ = \ 1$ of the algorithm (training $M ( 2 )$ given $M ( 1 ) ,$ ). BLEU correlates very well with the proposed model selection criterion, see Equation 5.
|
| 149 |
+
|
| 150 |
+
Spearman correlation coefficient between the proposed criterion and BLEU on the test set is 0.95 in average. In the latter case, the coefficient is in average 0.75, which is fine but not nearly as good. For instance, the BLEU score on the test set of models selected with the unsupervised criterion are sometimes up to 1 or 2 BLEU points below the score of models selected using a small validation set of 500 parallel sentences.
|
| 151 |
+
|
| 152 |
+
# 4 EXPERIMENTS
|
| 153 |
+
|
| 154 |
+
In this section, we first describe the datasets and the pre-processing we used, then we introduce the baselines we considered, and finally we report the extensive empirical validation proving the effectiveness of our method. We will release the code to the public once the revision process is over.
|
| 155 |
+
|
| 156 |
+
# 4.1 DATASETS
|
| 157 |
+
|
| 158 |
+
In our experiments, we consider the English-French and English-German language pairs, on three different datasets.
|
| 159 |
+
|
| 160 |
+
WMT’14 English-French We use the full training set of 36 million pairs, we lower-case them and remove sentences longer than 50 words, as well as pairs with a source/target length ratio above 1.5, resulting in a parallel corpus of about 30 million sentences. Next, we build monolingual corpora by selecting the English sentences from 15 million random pairs, and selecting the French sentences from the complementary set. The former set constitutes our English monolingual dataset. The latter set is our French monolingual dataset. The lack of overlap between the two sets ensures that there is not exact correspondence between examples in the two datasets.
|
| 161 |
+
|
| 162 |
+
The validation set is comprised of 3,000 English and French sentences extracted from our monolingual training corpora described above. These sentences are not the translation of each other, and they will be used by our unsupervised model selection criterion, as explained in 3.2. Finally, we report results on the full newstest2014 dataset.
|
| 163 |
+
|
| 164 |
+
WMT’16 English-German We follow the same procedure as above to create monolingual training and validation corpora in English and German, which results in two monolingual training corpora of 1.8 million sentences each. We test our model on the newstest2016 dataset.
|
| 165 |
+
|
| 166 |
+
Multi30k-Task1 The task 1 of the Multi30k dataset (Elliott et al., 2016) has 30,000 images, with annotations in English, French and German, that are translations of each other. We consider the English-French and English-German pairs. We disregard the images and only consider the parallel annotations, with the provided training, validation and test sets, composed of 29,000, 1,000 and 1,000 pairs of sentences respectively. For both pairs of languages and similarly to the WMT datasets above, we split the training and validation sets into monolingual corpora, resulting in 14,500 monolingual source and target sentences in the training set, and 500 sentences in the validation set.
|
| 167 |
+
|
| 168 |
+
Table 1: Multi30k-Task1 and WMT datasets statistics. To limit the vocabulary size in the WMT en-fr and WMT de-en datasets, we only considered words with more than 100 and 25 occurrences, respectively.
|
| 169 |
+
|
| 170 |
+
<table><tr><td></td><td>MMT1 en-fr</td><td>MMT1 de-en</td><td>WMT en-fr</td><td>WMT de-en</td></tr><tr><td>Monolingual sentences</td><td>14.5k</td><td>14.5k</td><td>15M</td><td>1.8M</td></tr><tr><td>Vocabulary size</td><td>10k/11k</td><td>19k/10k</td><td>67k/78k</td><td>80k/46k</td></tr></table>
|
| 171 |
+
|
| 172 |
+
Table 1 summarizes the number of monolingual sentences in each dataset, along with the vocabulary size. To limit the vocabulary size on the WMT en-fr and WMT de-en datasets, we only considered words with more than 100 and 25 occurrences, respectively.
|
| 173 |
+
|
| 174 |
+
# 4.2 BASELINES
|
| 175 |
+
|
| 176 |
+
Word-by-word translation (WBW) The first baseline is a system that performs word-by-word translations of the input sentences using the inferred bilingual dictionary (Conneau et al., 2017). This baseline provides surprisingly good results for related language pairs, like English-French, where the word order is similar, but performs rather poorly on more distant pairs like English-German, as can be seen in Table 2.
|
| 177 |
+
|
| 178 |
+
Word reordering (WR) After translating word-by-word as in WBW, here we reorder words using an LSTM-based language model trained on the target side. Since we cannot exhaustively score every possible word permutation (some sentences have about 100 words), we consider all pairwise swaps of neighboring words, we select the best swap, and iterate ten times. We use this baseline only on the WMT dataset that has a large enough monolingual data to train a language model.
|
| 179 |
+
|
| 180 |
+
Oracle Word Reordering (OWR) Using the reference, we produce the best possible generation using only the words given by WBW. The performance of this method is an upper-bound of what any model could do without replacing words.
|
| 181 |
+
|
| 182 |
+
Supervised Learning We finally consider exactly the same model as ours, but trained with supervision, using the standard cross-entropy loss on the original parallel sentences.
|
| 183 |
+
|
| 184 |
+
# 4.3 UNSUPERVISED DICTIONARY LEARNING
|
| 185 |
+
|
| 186 |
+
To implement our baseline and also to initialize the embeddings $\mathcal { Z }$ of our model, we first train word embeddings on the source and target monolingual corpora using fastText (Bojanowski et al., 2017), and then we apply the unsupervised method proposed by Conneau et al. (2017) to infer a bilingual dictionary which can be use for word-by-word translation.
|
| 187 |
+
|
| 188 |
+
Since WMT yields a very large-scale monolingual dataset, we obtain very high-quality embeddings and dictionaries, with an accuracy of $8 4 . { \bar { 4 } } 8 \%$ and $7 7 . 2 9 \%$ on French-English and GermanEnglish, which is on par with what could be obtained using a state-of-the-art supervised alignment method (Conneau et al., 2017).
|
| 189 |
+
|
| 190 |
+
On the Multi30k datasets instead, the monolingual training corpora are too small to train good word embeddings (more than two order of magnitude smaller than WMT). We therefore learn word vectors on Wikipedia using fastText2.
|
| 191 |
+
|
| 192 |
+
Table 2: BLEU score on the Multi30k-Task1 and WMT datasets using greedy decoding.
|
| 193 |
+
|
| 194 |
+
<table><tr><td></td><td colspan="4">Multi30k-Task1</td><td colspan="4">WMT</td></tr><tr><td></td><td>en-fr</td><td>fr-en</td><td>de-en</td><td>en-de</td><td>en-fr</td><td>fr-en</td><td>de-en</td><td>en-de</td></tr><tr><td>Supervised</td><td>56.83</td><td>50.77</td><td>38.38</td><td>35.16</td><td>27.97</td><td>26.13</td><td>25.61</td><td>21.33</td></tr><tr><td>word-by-word</td><td>8.54</td><td>16.77</td><td>15.72</td><td>5.39</td><td>6.28</td><td>10.09</td><td>10.77</td><td>7.06</td></tr><tr><td>word reordering</td><td>-</td><td>-</td><td>1</td><td>-</td><td>6.68</td><td>11.69</td><td>10.84</td><td>6.70</td></tr><tr><td>oracle word reordering</td><td>11.62</td><td>24.88</td><td>18.27</td><td>6.79</td><td>10.12</td><td>20.64</td><td>19.42</td><td>11.57</td></tr><tr><td>Our model: 1st iteration</td><td>27.48</td><td>28.07</td><td>23.69</td><td>19.32</td><td>12.10</td><td>11.79</td><td>11.10</td><td>8.86</td></tr><tr><td>Our model: 2nd iteration</td><td>31.72</td><td>30.49</td><td>24.73</td><td>21.16</td><td>14.42</td><td>13.49</td><td>13.25</td><td>9.75</td></tr><tr><td>Our model: 3rd iteration</td><td>32.76</td><td>32.07</td><td>26.26</td><td>22.74</td><td>15.05</td><td>14.31</td><td>13.33</td><td>9.64</td></tr></table>
|
| 195 |
+
|
| 196 |
+
# 4.4 EXPERIMENTAL DETAILS
|
| 197 |
+
|
| 198 |
+
Discriminator Architecture The discriminator is a multilayer perceptron with three hidden layers of size 1024, Leaky-ReLU activation functions and an output logistic unit. Following Goodfellow (2016), we include a smoothing coefficient $s = 0 . 1$ in the discriminator predictions.
|
| 199 |
+
|
| 200 |
+
Training Details The encoder and the decoder are trained using Adam (Kingma & Ba, 2014), with a learning rate of 0.0003, $\beta _ { 1 } = 0 . 5$ , and a mini-batch size of 32. The discriminator is trained using RMSProp (Tieleman & Hinton, 2012) with a learning rate of 0.0005. We evenly alternate between one encoder-decoder and one discriminator update. We set $\lambda _ { a u t o } = \lambda _ { c d } = \lambda _ { a d v } = 1$ .
|
| 201 |
+
|
| 202 |
+
# 4.5 EXPERIMENTAL RESULTS
|
| 203 |
+
|
| 204 |
+
Table 2 shows the BLEU scores achieved by our model and the baselines we considered. First, we observe that word-by-word translation is surprisingly effective when translating into English, obtaining a BLEU score of 16.77 and 10.09 for $f r$ -en on respectively Multi30k-Task1 and WMT datasets. Word-reordering only slightly improves upon word-by-word translation. Our model instead, clearly outperforms these baselines, even on the WMT dataset which has more diversity of topics and sentences with much more complicated structure. After just one iteration, we obtain a BLEU score of 27.48 and 12.10 for the en-fr task. Interestingly, we do even better than oracle reordering on some language pairs, suggesting that our model not only reorders but also correctly substitutes some words. After a few iterations, our model obtains BLEU of 32.76 and 15.05 on Multi30k-Task1 and WMT datasets for the English to French task, which is rather remarkable.
|
| 205 |
+
|
| 206 |
+
Comparison with supervised approaches Here, we assess how much labeled data are worth our two large monolingual corpora. On WMT, we trained the very same NMT architecture on both language pairs, but with supervision using various amounts of parallel data. Figure 4-right shows the resulting performance. Our unsupervised approach obtains the same performance than a supervised NMT model trained on about 100,000 parallel sentences, which is impressive. Of course, adding more parallel examples allows the supervised approach to outperform our method, but the good performance of our unsupervised method suggests that it could be very effective for low-resources languages where no parallel data are available. Moreover, these results open the door to the development of semi-supervised translation models, which will be the focus of future investigation. With a phrase-based machine translation system, we obtain 21.6 and 22.4 BLEU on WMT en- ${ \mathcal { f } } { \mathit { r } }$ and $f r { - } e n$ , which is better than the supervised NMT baseline we report for that same amount of parallel sentences, which is 16.8 and 16.4 respectively. However, if we train the same supervised NMT model with BPE (Sennrich et al., 2015b), we obtain 22.6 BLEU for en-fr, suggesting that our results on unsupervised machine translation could also be improved by using BPE, as this removes unknown words (about $9 \%$ of the words in de-en are replaced by the unknown token otherwise).
|
| 207 |
+
|
| 208 |
+
Iterative Learning Figure 4-left illustrates the quality of the learned model after each iteration of the learning process in the language pairs of Multi30k-Task1 dataset, other results being provided in Table 2. One can see that the quality of the obtained model is high just after the first iteration of the process. Subsequent iterations yield significant gains although with diminishing returns. At iteration 3, the performance gains are marginal, showing that our approach quickly converges.
|
| 209 |
+
|
| 210 |
+

|
| 211 |
+
Figure 4: Left: BLEU as a function of the number of iterations of our algorithm on the Multi30kTask1 datasets. Right: The curves show BLEU as a function of the amount of parallel data on WMT datasets. The unsupervised method which leverages about 15 million monolingual sentences in each language, achieves performance (see horizontal lines) close to what we would obtain by employing 100,000 parallel sentences.
|
| 212 |
+
|
| 213 |
+
Table 3: Unsupervised translations. Examples of translations on the French-English pair of the Multi30k-Task1 dataset. Iteration 0 corresponds to word-by-word translation. After 3 iterations, the model generates very good translations.
|
| 214 |
+
|
| 215 |
+
<table><tr><td>Source Iteration O Iteration 1 Iteration 2 Iteration 3 Reference</td><td>un homme est debout pres d'une série de jeux vidéo dans un bar . a man is seated neara series of games video in a bar. a man is standing nearacloseup of other games in a bar . a man is standing near a bunch of video video game in a bar . a man is standing neara bunch of video games ina bar. a man is standing by a group of video games in a bar.</td></tr><tr><td>Source Iteration O</td><td>une femme aux cheveux roses habillée en noir parle ä un homme . a woman at hair roses dressed in black speaks to a man .</td></tr><tr><td>Iteration 1</td><td>a woman at glasses dressed in black talking to a man.</td></tr><tr><td>Iteration 2</td><td>a woman at pink hair dressed in black speaks to a man.</td></tr><tr><td>Iteration 3 Reference</td><td>a woman with pink hair dressed in black is talking to a man.</td></tr><tr><td></td><td>a woman with pink hair dressed in black talks to a man.</td></tr><tr><td>Source</td><td>une photo d'une rue bondée en ville .</td></tr><tr><td>Iteration O</td><td>a photo a street crowded in city .</td></tr><tr><td>Iteration 1</td><td>a picture of a street crowded in a city .</td></tr><tr><td>Iteration 2</td><td></td></tr><tr><td>Iteration 3</td><td>a picture of a crowded city street.</td></tr><tr><td></td><td>a picture of a crowded street in a city .</td></tr><tr><td>Reference</td><td>aview of acrowded citystreet.</td></tr><tr><td></td><td></td></tr></table>
|
| 216 |
+
|
| 217 |
+
Table 3 shows examples of translations of three sentences on the Multi30k dataset, as we iterate. Iteration 0 corresponds to the word-by-word translation obtained with our cross-lingual dictionary, which clearly suffers from word order issues. We can observe that the quality of the translations increases at every iteration.
|
| 218 |
+
|
| 219 |
+
Ablation Study We perform an ablation study to understand the importance of the different components of our system. To this end, we have trained multiple versions of our model with some missing components: the discriminator, the cross-domain loss, the auto-encoding loss, etc. Table 4 shows that the best performance is obtained with the simultaneous use of all the described elements.
|
| 220 |
+
|
| 221 |
+
Table 4: Ablation study on the Multi30k-Task1 dataset.
|
| 222 |
+
|
| 223 |
+
<table><tr><td></td><td>en-fr</td><td>fr-en</td><td>de-en</td><td>en-de</td></tr><tr><td>Xcd=0</td><td>25.44</td><td>27.14</td><td>20.56</td><td>14.42</td></tr><tr><td>Without pretraining</td><td>25.29</td><td>26.10</td><td>21.44</td><td>17.23</td></tr><tr><td>Without pretraining, Xcd = 0</td><td>8.78</td><td>9.15</td><td>7.52</td><td>6.24</td></tr><tr><td>Without noise,C(x) = x</td><td>16.76</td><td>16.85</td><td>16.85</td><td>14.61</td></tr><tr><td>Xauto=0</td><td>24.32</td><td>20.02</td><td>19.10</td><td>14.74</td></tr><tr><td>Aadu =0</td><td>24.12</td><td>22.74</td><td>19.87</td><td>15.13</td></tr><tr><td>Full</td><td>27.48</td><td>28.07</td><td>23.69</td><td>19.32</td></tr></table>
|
| 224 |
+
|
| 225 |
+
The most critical component is the unsupervised word alignment technique, either in the form of a back-translation dataset generated using word-by-word translation, or in the form of pretrained embeddings which enable to map sentences of different languages in the same latent space.
|
| 226 |
+
|
| 227 |
+
On the English-French pair of Multi30k-Task1, with a back-translation dataset but without pretrained embeddings, our model obtains a BLEU score of 25.29 and 26.10, which is only a few points below the model using all components. Similarly, when the model uses pretrained embeddings but no back-translation dataset (when $\lambda _ { c d } = 0$ ), it obtains 25.44 and 27.14. On the other hand, a model that does not use any of these components only reaches 8.78 and 9.15 BLEU.
|
| 228 |
+
|
| 229 |
+
The adversarial component also significantly improves the performance of our system, with a difference of up to 5.33 BLEU in the French-English pair of Multi30k-Task1. This confirms our intuition that, to really benefit from the cross-domain loss, one has to ensure that the distribution of latent sentence representations is similar across the two languages. Without the auto-encoding loss (when $\lambda _ { a u t o } = 0$ ), the model only obtains 20.02, which is 8.05 BLEU points below the method using all components. Finally, performance is greatly degraded also when the corruption process of the input sentences is removed, as the model has much harder time learning useful regularities and merely learns to copy input data.
|
| 230 |
+
|
| 231 |
+
# 5 RELATED WORK
|
| 232 |
+
|
| 233 |
+
A similar work to ours is the style transfer method with non-parallel text by Shen et al. (2017). The authors consider a sequence-to-sequence model, where the latent state given to the decoder is also fed to a discriminator. The encoder is trained with the decoder to reconstruct the input, but also to fool the discriminator. The authors also found it beneficial to train two discriminators, one for the source and one for the target domain. Then, they trained the decoder so that the recurrent hidden states during the decoding process of a sentence in a particular domain are not distinguishable according to the respective discriminator. This algorithm, called Professor forcing, was initially introduced by Lamb et al. (2016) to encourage the dynamics of the decoder observed during inference to be similar to the ones observed at training time.
|
| 234 |
+
|
| 235 |
+
Similarly, Xie et al. (2017) also propose to use an adversarial training approach to learn representations invariant to specific attributes. In particular, they train an encoder to map the observed data to a latent feature space, and a model to make predictions based on the encoder output. To remove bias existing in the data from the latent codes, a discriminator is also trained on the encoder outputs to predict specific attributes, while the encoder is jointly trained to fool the discriminator. They show that the obtained invariant representations lead to better generalization on classification and generation tasks.
|
| 236 |
+
|
| 237 |
+
Before that, Hu et al. (2017) trained a variational autoencoder (Kingma & Welling, 2013) where the decoder input is the concatenation of an unstructured latent vector, and a structured code representing the attribute of the sentence to generate. A discriminator is trained on top of the decoder to classify the labels of generated sentences, while the decoder is trained to satisfy this discriminator. Because of the non-differentiability of the decoding process, at each step, their decoder takes as input the probability vector predicted at the previous step.
|
| 238 |
+
|
| 239 |
+
Perhaps, the most relevant prior work is by He et al. (2016), who essentially optimizes directly for the model selection metric we propose in section 3.2. One drawback of their approach, which has not been applied to the fully unsupervised setting, is that it requires to back-propagate through the sequence of discrete predictions using reinforcement learning-based approaches which are notoriously inefficient. In this work, we instead propose to a) use a symmetric architecture, and b) freeze the translator from source to target when training the translator from target to source, and vice versa. By alternating this process we operate with a fully differentiable model and we efficiently converge.
|
| 240 |
+
|
| 241 |
+
In the vision domain, several studies tackle the unsupervised image translation problem, where the task consists in mapping two image domains A and B, without paired supervision. For instance, in the CoGAN architecture (Liu & Tuzel, 2016), two generators are trained to learn a common representation space between two domains, by sharing some of their convolutional layers. This is similar to our strategy of sharing the LSTM weights across the source and target encoders and decoders. Liu et al. (2017) propose a similar approach, based on variational autoencoders, and generative adversarial networks (Goodfellow et al., 2014). Taigman et al. (2016) use similar approaches for emoji generation, and apply a regularization term to the generator so that it behaves like an identity mapping when provided with input images from the target domain. Zhu et al. (2017) introduced a cycle consistency loss, to capture the intuition that if an image is mapped from A to B, then from B to A, then the resulting image should be identical to the input one.
|
| 242 |
+
|
| 243 |
+
Our approach is also reminiscent of the Fader Networks architecture (Lample et al., 2017), where a discriminator is used to remove the information related to specific attributes from the latent states of an autoencoder of images. The attribute values are then given as input to the decoder. The decoder is trained with real attributes, but at inference, it can be fed with any attribute values to generate variations of the input images. The model presented in this paper can be seen as an extension to the text domain of the Fader Networks, where the attribute is the language itself.
|
| 244 |
+
|
| 245 |
+
# 6 CONCLUSION
|
| 246 |
+
|
| 247 |
+
We presented a new approach to neural machine translation where a translation model is learned using monolingual datasets only, without any alignment between sentences or documents. The principle of our approach is to start from a simple unsupervised word-by-word translation model, and to iteratively improve this model based on a reconstruction loss, and using a discriminator to align latent distributions of both the source and the target languages. Our experiments demonstrate that our approach is able to learn effective translation models without any supervision of any sort.
|
| 248 |
+
|
| 249 |
+
# REFERENCES
|
| 250 |
+
|
| 251 |
+
D. Bahdanau, K. Cho, and Y. Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
|
| 252 |
+
Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5: 135–146, 2017.
|
| 253 |
+
Y. Chen, Y. Liu, Y. Cheng, and V.O.K. Li. A teacher-student framework for zero-resource neural machine translation. In ACL, 2017.
|
| 254 |
+
Y. Cheng, W. Xu, Z. He, W. He, H. Wu, M. Sun, and Y. Liu. Semi-supervised learning for neural machine translation. arXiv:1606.04596, 2016.
|
| 255 |
+
A. Conneau, G. Lample, M. Ranzato, L. Denoyer, and H. Jegou. Word translation without parallel ´ data. arXiv:1710.04087, 2017.
|
| 256 |
+
D.L. Donoho. Compressed sensing. IEEE Transactions on Information Theory, 2006.
|
| 257 |
+
Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. Multi30k: Multilingual englishgerman image descriptions. arXiv preprint arXiv:1605.00459, 2016.
|
| 258 |
+
O. Firat, B. Sankaran, Y. Al-Onaizan, F.T.Y. Vural, and K. Cho. Zero-resource translation with multi-lingual neural machine translation, 2016.
|
| 259 |
+
Y. Ganin, E. Ustinova, h. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky. Domain-adversarial training of neural networks. JMLR, 2016.
|
| 260 |
+
Ian Goodfellow. Nips 2016 tutorial: Generative adversarial networks. arXiv preprint arXiv:1701.00160, 2016.
|
| 261 |
+
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.
|
| 262 |
+
Caglar Gulcehre, Orhan Firat, Kelvin Xu, Kyunghyun Cho, Loic Barrault, Huei-Chi Lin, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. On using monolingual corpora in neural machine translation. arXiv preprint arXiv:1503.03535, 2015.
|
| 263 |
+
Di He, Yingce Xia, Tao Qin, Liwei Wang, Nenghai Yu, Tieyan Liu, and Wei-Ying Ma. Dual learning for machine translation. In Advances in Neural Information Processing Systems, pp. 820–828, 2016.
|
| 264 |
+
Felix Hill, Kyunghyun Cho, and Anna Korhonen. Learning distributed representations of sentences from unlabelled data. arXiv preprint arXiv:1602.03483, 2016.
|
| 265 |
+
Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. Controllable text generation. arXiv preprint arXiv:1703.00955, 2017.
|
| 266 |
+
A. Irvine. Combining bilingual and comparable corpora for low resource machine translation. 2013.
|
| 267 |
+
A. Irvine and C. Callison-Burch. End-to-end statistical machine translation with zero or small parallel texts. Natural Language Engineering, 1(1), 2015.
|
| 268 |
+
M. Johnson, M. Schuster, Q.V. Le, M. Krikun, Y. Wu, Z. Chen, N. Thorat, F. Vigas, M. Wattenberg, G. Corrado, M. Hughes, and J. Dean. Googles multilingual neural machine translation system: Enabling zero-shot translation, 2016.
|
| 269 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 270 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 271 |
+
Alex M Lamb, Anirudh Goyal ALIAS PARTH GOYAL, Ying Zhang, Saizheng Zhang, Aaron C Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. In Advances In Neural Information Processing Systems, pp. 4601–4609, 2016.
|
| 272 |
+
Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic DENOYER, et al. Fader networks: Manipulating images by sliding attributes. In Advances in Neural Information Processing Systems, pp. 5963–5972, 2017.
|
| 273 |
+
J. Lee, K. Cho, J. Weston, and D. Kiela. Emergent translation in multi-agent communication. arXiv:1710.06922, 2017.
|
| 274 |
+
Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In Advances in neural information processing systems, pp. 469–477, 2016.
|
| 275 |
+
Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. arXiv preprint arXiv:1703.00848, 2017.
|
| 276 |
+
D.S. Munteanu, A. Fraser, and D. Marcu. Improved machine translation performance via parallel sentence extraction from comparable corpora. In ACL, 2004.
|
| 277 |
+
H. Nakayama and N. Nishida. Zero-resource machine translation by multimodal encoder-decoder network with multimedia pivot. arXiv:1611.04503, 2017.
|
| 278 |
+
K. Papineni, S. Roukos, T. Ward, and W.J. Zhu. Bleu: a method for automatic evaluation of machine translation. In Annual Meeting on Association for Computational Linguistics, 2002.
|
| 279 |
+
N. Pourdamghani and K. Knight. Deciphering related languages. In EMNLP, 2017.
|
| 280 |
+
S. Ravi and K. Knight. Deciphering foreign language. In ACL, 2011.
|
| 281 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Improving neural machine translation models with monolingual data. arXiv preprint arXiv:1511.06709, 2015a.
|
| 282 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015b.
|
| 283 |
+
Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. Style transfer from non-parallel text by cross-alignment. arXiv preprint arXiv:1705.09655, 2017.
|
| 284 |
+
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.
|
| 285 |
+
Yaniv Taigman, Adam Polyak, and Lior Wolf. Unsupervised cross-domain image generation. arXiv preprint arXiv:1611.02200, 2016.
|
| 286 |
+
T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
|
| 287 |
+
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, pp. 1096–1103. ACM, 2008.
|
| 288 |
+
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.
|
| 289 |
+
Qizhe Xie, Zihang Dai, Yulun Du, Eduard Hovy, and Graham Neubig. Controllable invariance through adversarial feature learning. arXiv preprint arXiv:1705.11122, 2017.
|
| 290 |
+
H. Zheng, Y. Cheng, and Y. Liu. Maximum expected likelihood estimation for zero-resource neural machine translation. In IJCAI, 2017.
|
| 291 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017.
|
md/train/rkZB1XbRZ/rkZB1XbRZ.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/rkZvSe-RZ/rkZvSe-RZ.md
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ENSEMBLE ADVERSARIAL TRAINING: ATTACKS AND DEFENSES
|
| 2 |
+
|
| 3 |
+
Florian Tramer\`
|
| 4 |
+
Stanford University
|
| 5 |
+
tramer@cs.stanford.edu
|
| 6 |
+
Alexey Kurakin
|
| 7 |
+
Google Brain
|
| 8 |
+
kurakin@google.com
|
| 9 |
+
|
| 10 |
+
Nicolas Papernot∗ Pennsylvania State University ngp5056@cse.psu.edu
|
| 11 |
+
|
| 12 |
+
Ian Goodfellow
|
| 13 |
+
Google Brain
|
| 14 |
+
goodfellow@google.com
|
| 15 |
+
|
| 16 |
+
Dan Boneh Stanford University dabo@cs.stanford.edu
|
| 17 |
+
|
| 18 |
+
Patrick McDaniel Pennsylvania State University mcdaniel@cse.psu.edu
|
| 19 |
+
|
| 20 |
+
# ABSTRACT
|
| 21 |
+
|
| 22 |
+
Adversarial examples are perturbed inputs designed to fool machine learning models. Adversarial training injects such examples into training data to increase robustness. To scale this technique to large datasets, perturbations are crafted using fast single-step methods that maximize a linear approximation of the model’s loss.
|
| 23 |
+
|
| 24 |
+
We show that this form of adversarial training converges to a degenerate global minimum, wherein small curvature artifacts near the data points obfuscate a linear approximation of the loss. The model thus learns to generate weak perturbations, rather than defend against strong ones. As a result, we find that adversarial training remains vulnerable to black-box attacks, where we transfer perturbations computed on undefended models, as well as to a powerful novel single-step attack that escapes the non-smooth vicinity of the input data via a small random step.
|
| 25 |
+
|
| 26 |
+
We further introduce Ensemble Adversarial Training, a technique that augments training data with perturbations transferred from other models. On ImageNet, Ensemble Adversarial Training yields models with strong robustness to black-box attacks. In particular, our most robust model won the first round of the NIPS 2017 competition on Defenses against Adversarial Attacks (Kurakin et al., 2017c).
|
| 27 |
+
|
| 28 |
+
# 1 INTRODUCTION
|
| 29 |
+
|
| 30 |
+
Machine learning (ML) models are often vulnerable to adversarial examples, maliciously perturbed inputs designed to mislead a model at test time (Biggio et al., 2013; Szegedy et al., 2013; Goodfellow et al., 2014b; Papernot et al., 2016a). Furthermore, Szegedy et al. (2013) showed that these inputs transfer across models: the same adversarial example is often misclassified by different models, thus enabling simple black-box attacks on deployed models (Papernot et al., 2017; Liu et al., 2017).
|
| 31 |
+
|
| 32 |
+
Adversarial training (Szegedy et al., 2013) increases robustness by augmenting training data with adversarial examples. Madry et al. (2017) showed that adversarially trained models can be made robust to white-box attacks (i.e., with knowledge of the model parameters) if the perturbations computed during training closely maximize the model’s loss. However, prior attempts at scaling this approach to ImageNet-scale tasks (Deng et al., 2009) have proven unsuccessful (Kurakin et al., 2017b).
|
| 33 |
+
|
| 34 |
+
It is thus natural to ask whether it is possible, at scale, to achieve robustness against the class of black-box adversaries Towards this goal, Kurakin et al. (2017b) adversarially trained an Inception v3 model (Szegedy et al., 2016b) on ImageNet using a “single-step” attack based on a linearization of the model’s loss (Goodfellow et al., 2014b). Their trained model is robust to single-step perturbations but remains vulnerable to more costly “multi-step” attacks. Yet, Kurakin et al. (2017b) found that these attacks fail to reliably transfer between models, and thus concluded that the robustness of their model should extend to black-box adversaries. Surprisingly, we show that this is not the case.
|
| 35 |
+
|
| 36 |
+
We demonstrate, formally and empirically, that adversarial training with single-step methods admits a degenerate global minimum, wherein the model’s loss can not be reliably approximated by a linear function. Specifically, we find that the model’s decision surface exhibits sharp curvature near the data points, thus degrading attacks based on a single gradient computation. In addition to the model of Kurakin et al. (2017b), we reveal similar overfitting in an adversarially trained Inception ResNet v2 model (Szegedy et al., 2016a), and a variety of models trained on MNIST (LeCun et al., 1998).
|
| 37 |
+
|
| 38 |
+
We harness this result in two ways. First, we show that adversarially trained models using single-step methods remain vulnerable to simple attacks. For black-box adversaries, we find that perturbations crafted on an undefended model often transfer to an adversarially trained one. We also introduce a simple yet powerful single-step attack that applies a small random perturbation—to escape the nonsmooth vicinity of the data point—before linearizing the model’s loss. While seemingly weaker than the Fast Gradient Sign Method of Goodfellow et al. (2014b), our attack significantly outperforms it for a same perturbation norm, for models trained with or without adversarial training.
|
| 39 |
+
|
| 40 |
+
Second, we propose Ensemble Adversarial Training, a training methodology that incorporates perturbed inputs transferred from other pre-trained models. Our approach decouples adversarial example generation from the parameters of the trained model, and increases the diversity of perturbations seen during training. We train Inception v3 and Inception ResNet v2 models on ImageNet that exhibit increased robustness to adversarial examples transferred from other holdout models, using various single-step and multi-step attacks (Goodfellow et al., 2014b; Carlini & Wagner, 2017a; Kurakin et al., 2017a; Madry et al., 2017). We also show that our methods globally reduce the dimensionality of the space of adversarial examples (Tramer et al., 2017). Our Inception ResNet v2 model won the \` first round of the NIPS 2017 competition on Defenses Against Adversarial Attacks (Kurakin et al., 2017c), where it was evaluated on other competitors’ attacks in a black-box setting.
|
| 41 |
+
|
| 42 |
+
# 2 RELATED WORK
|
| 43 |
+
|
| 44 |
+
Various defensive techniques against adversarial examples in deep neural networks have been proposed (Gu & Rigazio, 2014; Luo et al., 2015; Papernot et al., 2016c; Nayebi & Ganguli, 2017; Cisse et al., 2017) and many remain vulnerable to adaptive attackers (Carlini & Wagner, 2017a;b; Baluja & Fischer, 2017). Adversarial training (Szegedy et al., 2013; Goodfellow et al., 2014b; Kurakin et al., 2017b; Madry et al., 2017) appears to hold the greatest promise for learning robust models.
|
| 45 |
+
|
| 46 |
+
Madry et al. (2017) show that adversarial training on MNIST yields models that are robust to whitebox attacks, if the adversarial examples used in training closely maximize the model’s loss. Moreover, recent works by Sinha et al. (2018), Raghunathan et al. (2018) and Kolter & Wong (2017) even succeed in providing certifiable robustness for small perturbations on MNIST. As we argue in Appendix C, the MNIST dataset is peculiar in that there exists a simple “closed-form” denoising procedure (namely feature binarization) which leads to similarly robust models without adversarial training. This may explain why robustness to white-box attacks is hard to scale to tasks such as ImageNet (Kurakin et al., 2017b). We believe that the existence of a simple robust baseline for MNIST can be useful for understanding some limitations of adversarial training techniques.
|
| 47 |
+
|
| 48 |
+
Szegedy et al. (2013) found that adversarial examples transfer between models, thus enabling blackbox attacks on deployed models. Papernot et al. (2017) showed that black-box attacks could succeed with no access to training data, by exploiting the target model’s predictions to extract (Tramer et al., \` 2016) a surrogate model. Some prior works have hinted that adversarially trained models may remain vulnerable to black-box attacks: Goodfellow et al. (2014b) found that an adversarial maxout network on MNIST has slightly higher error on transferred examples than on white-box examples. Papernot et al. (2017) further showed that a model trained on small perturbations can be evaded by transferring perturbations of larger magnitude. Our finding that adversarial training degrades the accuracy of linear approximations of the model’s loss is as an instance of a gradient-masking phenomenon (Papernot et al., 2016b), which affects other defensive techniques (Papernot et al., 2016c; Carlini & Wagner, 2017a; Nayebi & Ganguli, 2017; Brendel & Bethge, 2017; Athalye et al., 2018).
|
| 49 |
+
|
| 50 |
+
# 3 THE ADVERSARIAL TRAINING FRAMEWORK
|
| 51 |
+
|
| 52 |
+
We consider a classification task with data $x \in [ 0 , 1 ] ^ { d }$ and labels $y _ { \mathrm { t r u e } } \in \mathbb { Z } _ { k }$ sampled from a distribution $\mathcal { D }$ . We identify a model with an hypothesis $h$ from a space $\mathcal { H }$ . On input $x$ , the model outputs class scores $h ( x ) \in \mathbb { R } ^ { k }$ . The loss function used to train the model, e.g., cross-entropy, is $L ( h ( x ) , y )$ .
|
| 53 |
+
|
| 54 |
+
# 3.1 THREAT MODEL
|
| 55 |
+
|
| 56 |
+
For some target model $h \in \mathcal H$ and inputs $( x , y _ { \mathrm { t r u e } } )$ the adversary’s goal is to find an adversarial example $x ^ { \mathrm { a d v } }$ such that $x ^ { \mathrm { a d v } }$ and $x$ are “close” yet the model misclassifies $x ^ { \mathrm { a d v } }$ . We consider the wellstudied class of $\ell _ { \infty }$ bounded adversaries (Goodfellow et al., 2014b; Madry et al., 2017) that, given some budget $\epsilon$ , output examples $x ^ { \mathrm { a d v } }$ where $\| x ^ { \mathrm { a d v } } - x \| _ { \infty } \leq \epsilon .$ . As we comment in Appendix C.1, $\ell _ { \infty }$ robustness is of course not an end-goal for secure ML. We use this standard model to showcase limitations of prior adversarial training methods, and evaluate our proposed improvements.
|
| 57 |
+
|
| 58 |
+
We distinguish between white-box adversaries that have access to the target model’s parameters (i.e., $h _ { . }$ ), and black-box adversaries with only partial information about the model’s inner workings. Formal definitions for these adversaries are in Appendix A. Although security against white-box attacks is the stronger notion (and the one we ideally want ML models to achieve), black-box security is a reasonable and more tractable goal for deployed ML models.
|
| 59 |
+
|
| 60 |
+
# 3.2 ADVERSARIAL TRAINING
|
| 61 |
+
|
| 62 |
+
Following Madry et al. (2017), we consider an adversarial variant of standard Empirical Risk Minimization (ERM), where our aim is to minimize the risk over adversarial examples:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\begin{array} { r l } { h ^ { * } = \underset { h \in \mathcal { H } } { \arg \operatorname* { m i n } } } & { \underset { ( x , y _ { \mathrm { t u e } } ) \sim \mathcal { D } } { \mathbb { E } } \left[ \underset { \| x ^ { \mathrm { a d v } } - x \| _ { \infty } \leq \epsilon } { \operatorname* { m a x } } L ( h ( x ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) \right] . } \end{array}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
Madry et al. (2017) argue that adversarial training has a natural interpretation in this context, where a given attack (see below) is used to approximate solutions to the inner maximization problem, and the outer minimization problem corresponds to training over these examples. Note that the original formulation of adversarial training (Szegedy et al., 2013; Goodfellow et al., 2014b), which we use in our experiments, trains on both the “clean” examples x and adversarial examples xadv.
|
| 69 |
+
|
| 70 |
+
We consider three algorithms to generate adversarial examples with bounded $\ell _ { \infty }$ norm. The first two are single-step (i.e., they require a single gradient computation); the third is iterative—it computes multiple gradient updates. We enforce $x ^ { \mathrm { a d v } } \in [ 0 , 1 ] ^ { d }$ by clipping all components of $x ^ { \mathrm { a d v } }$ .
|
| 71 |
+
|
| 72 |
+
Fast Gradient Sign Method (FGSM). This method (Goodfellow et al., 2014b) linearizes the inner maximization problem in (1):
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
x _ { \mathrm { F G S M } } ^ { \mathrm { a d v } } : = x + \varepsilon \cdot \mathrm { s i g n } \left( \nabla _ { x } L ( h ( x ) , y _ { \mathrm { t r u e } } ) \right) \ .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
Single-Step Least-Likely Class Method (Step-LL). This variant of FGSM introduced by Kurakin et al. (2017a;b) targets the least-likely class, $y _ { \mathrm { L L } } = \arg \operatorname* { m i n } \{ h ( x ) \}$ :
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
x _ { \mathrm { L L } } ^ { \mathrm { a d v } } : = x - \varepsilon \cdot \mathrm { s i g n } \left( \nabla _ { x } L ( h ( x ) , y _ { \mathrm { L L } } ) \right) .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
Although this attack only indirectly tackles the inner maximization in (1), Kurakin et al. (2017b) find it to be the most effective for adversarial training on ImageNet.
|
| 85 |
+
|
| 86 |
+
Iterative Attack (I-FGSM or Iter-LL). This method iteratively applies the FGSM or Step-LL $k$ times with step-size $\alpha \geq \epsilon / k$ and projects each step onto the $\ell _ { \infty }$ ball of norm $\epsilon$ around $x$ . It uses projected gradient descent to solve the maximization in (1). For fixed $\epsilon$ , iterative attacks induce higher error rates than single-step attacks, but transfer at lower rates (Kurakin et al., 2017a;b).
|
| 87 |
+
|
| 88 |
+
# 3.3 A DEGENERATE GLOBAL MINIMUM FOR SINGLE-STEP ADVERSARIAL TRAINING
|
| 89 |
+
|
| 90 |
+
When performing adversarial training with a single-step attack (e.g., the FGSM or Step-LL methods above), we approximate Equation (1) by replacing the solution to the inner maximization problem
|
| 91 |
+
|
| 92 |
+
in with the output of the single-step attack (e.g., $x _ { \mathrm { F G S M } } ^ { \mathrm { a d v } }$ in (2)). That is, we solve
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
h ^ { * } = \underset { h \in \mathcal { H } } { \arg \operatorname* { m i n } } \quad \underset { ( x , y _ { \mathrm { t u c } } ) \sim \mathcal { D } } { \mathbb { E } } \left[ L \big ( h ( x _ { \mathrm { F G S M } } ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } \big ) \right] .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
For model families $\mathcal { H }$ with high expressive power, this alternative optimization problem admits at least two substantially different global minima $h ^ { * }$ :
|
| 99 |
+
|
| 100 |
+
• For an input $x$ from $\mathcal { D }$ , there is no $x ^ { \mathrm { a d v } }$ close to $x$ (in $\ell _ { \infty }$ norm) that induces a high loss. That is,
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
L ( h ^ { * } ( x _ { \mathrm { F G S M } } ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) \approx \operatorname* { m a x } _ { \| x ^ { \mathrm { a d v } } - x \| _ { \infty } \leq \epsilon } L ( h ^ { * } ( x ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) ] \approx 0 .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
In other words, $h ^ { * }$ is robust to all $\ell _ { \infty }$ bounded perturbations.
|
| 107 |
+
|
| 108 |
+
• The minimizer $h ^ { * }$ is a model for which the approximation method underlying the attack (i.e., linearization in our case) poorly fits the model’s loss function. That is,
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
L ( h ^ { * } ( x _ { \mathrm { F G S M } } ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) \ll \operatorname* { m a x } _ { \| x ^ { \mathrm { a d v } } - x \| _ { \infty } \le \epsilon } L ( h ^ { * } ( x ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) ] .
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
Thus the attack when applied to $h ^ { * }$ produces samples $x ^ { \mathrm { a d v } }$ that are far from optimal.
|
| 115 |
+
|
| 116 |
+
Note that this second “degenerate” minimum can be more subtle than a simple case of overfitting to samples produced from single-step attacks. Indeed, we show in Section 4.1 that single-step attacks applied to adversarially trained models create “adversarial” examples that are easy to classify even for undefended models. Thus, adversarial training does not simply learn to resist the particular attack used during training, but actually to make that attack perform worse overall. This phenomenon relates to the notion of Reward Hacking (Amodei et al., 2016) wherein an agent maximizes its formal objective function via unintended behavior that fails to captures the designer’s true intent.
|
| 117 |
+
|
| 118 |
+
# 3.4 ENSEMBLE ADVERSARIAL TRAINING
|
| 119 |
+
|
| 120 |
+
The degenerate minimum described in Section 3.3 is attainable because the learned model’s parameters influence the quality of both the minimization and maximization in (1). One solution is to use a stronger adversarial example generation process, at a high performance cost (Madry et al., 2017). Alternatively, Baluja & Fischer (2017) suggest training an adversarial generator model as in the GAN framework (Goodfellow et al., 2014a). The power of this generator is likely to require careful tuning, to avoid similar degenerate minima (where the generator or classifier overpowers the other).
|
| 121 |
+
|
| 122 |
+
We propose a conceptually simpler approach to decouple the generation of adversarial examples from the model being trained, while simultaneously drawing an explicit connection with robustness to black-box adversaries. Our method, which we call Ensemble Adversarial Training, augments a model’s training data with adversarial examples crafted on other static pre-trained models. Intuitively, as adversarial examples transfer between models, perturbations crafted on an external model are good approximations for the maximization problem in (1). Moreover, the learned model can not influence the “strength” of these adversarial examples. As a result, minimizing the training loss implies increased robustness to black-box attacks from some set of models.
|
| 123 |
+
|
| 124 |
+
Domain Adaptation with multiple sources. We can draw a connection between Ensemble Adversarial Training and multiple-source Domain Adaptation (Mansour et al., 2009; Zhang et al., 2012). In Domain Adaptation, a model trained on data sampled from one or more source distributions $\boldsymbol { S } _ { 1 } , \ldots , \boldsymbol { S } _ { k }$ is evaluated on samples $x$ from a different target distribution $\tau$ .
|
| 125 |
+
|
| 126 |
+
Let $A _ { i }$ be an adversarial distribution obtained by sampling $( x , y _ { \mathrm { t r u e } } )$ from $\mathcal { D }$ , computing an adversarial example $x ^ { \mathrm { a d v } }$ for some model such that $\| x ^ { \mathrm { a d v } } - x \| _ { \infty } \leq \epsilon$ , and outputting $( x ^ { \mathrm { a d v } } , y _ { \mathrm { t r u e } } )$ . In Ensemble Adversarial Training, the source distributions are $\mathcal { D }$ (the clean data) and $\mathcal { A } _ { 1 } , \ldots , \mathcal { A } _ { k }$ (the attacks overs the currently trained model and the static pre-trained models). The target distribution takes the form of an unseen black-box adversary $\mathcal { A } ^ { * }$ . Standard generalization bounds for Domain Adaptation (Mansour et al., 2009; Zhang et al., 2012) yield the following result.
|
| 127 |
+
|
| 128 |
+
Theorem 1 (informal). Let $h ^ { \ast } \in \mathcal { H }$ be a model learned with Ensemble Adversarial Training and static black-box adversaries $\mathcal { A } _ { 1 } , \ldots , \mathcal { A } _ { k }$ . Then, if $h ^ { * }$ is robust against the black-box adversaries $\mathcal { A } _ { 1 } , \ldots \mathcal { A } _ { k }$ used at training time, then $h ^ { * }$ has bounded error on attacks from a future black-box adversary $\mathcal { A } ^ { * }$ , if $\mathcal { A } ^ { * }$ is not “much stronger”, on average, than the static adversaries $\mathcal { A } _ { 1 } , \ldots , \mathcal { A } _ { k }$ .
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 1: Gradient masking in single-step adversarial training. We plot the loss of model ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ on points $x ^ { * } = x + \epsilon _ { 1 } \cdot g + \epsilon _ { 2 } \cdot g ^ { \perp }$ , where $g$ is the signed gradient and $g ^ { \perp }$ is an orthogonal adversarial direction. Plot (b) is a zoom of (a) near $x$ . The gradient poorly approximates the global loss.
|
| 132 |
+
|
| 133 |
+
We give a formal statement of this result and of the assumptions on $\mathcal { A } ^ { * }$ in Appendix B. Of course, ideally we would like guarantees against arbitrary future adversaries. For very low-dimensional tasks (e.g., MNIST), stronger guarantees are within reach for specific classes of adversaries (e.g., $\ell _ { \infty }$ bounded perturbations (Madry et al., 2017; Sinha et al., 2018; Raghunathan et al., 2018; Kolter & Wong, 2017)), yet they also fail to extend to other adversaries not considered at training time (see Appendix C.1 for a discussion). For ImageNet-scale tasks, stronger formal guarantees appear out of reach, and we thus resort to an experimental assessment of the robustness of Ensemble Adversarially Trained models to various non-interactive black-box adversaries in Section 4.2.
|
| 134 |
+
|
| 135 |
+
# 4 EXPERIMENTS
|
| 136 |
+
|
| 137 |
+
We show the existence of a degenerate minimum, as described in Section 3.3, for the adversarially trained Inception v3 model of Kurakin et al. (2017b). Their model (denoted ${ \mathrm { v } } 3 _ { \mathrm { a d v } , }$ ) was trained on a Step-LL attack with $\epsilon \leq 1 6 / 2 5 6$ . We also adversarially train an Inception ResNet v2 model (Szegedy et al., 2016a) using the same setup. We denote this model by $\mathrm { I R v } 2 _ { \mathrm { a d v } }$ . We refer the reader to (Kurakin et al., 2017b) for details on the adversarial training procedure.
|
| 138 |
+
|
| 139 |
+
We first measure the approximation-ratio of the Step-LL attack for the inner maximization in (1). As we do not know the true maximum, we lower-bound it using an iterative attack. For 1,000 random test points, we find that for a standard Inception v3 model, step-LL gets within $1 9 \%$ of the optimum loss on average. This attack is thus a good candidate for adversarial training. Yet, for the ${ \bf V } { \boldsymbol 3 } _ { \mathrm { a d v } }$ model, the approximation ratio drops to $7 \%$ , confirming that the learned model is less amenable to linearization. We obtain similar results for Inception ResNet v2 models. The ratio is $1 7 \%$ for a standard model, and $8 \%$ for $\mathrm { I R v } 2 _ { \mathrm { a d v } }$ . Similarly, we look at the cosine similarity between the perturbations given by a single-step and multi-step attack. The more linear the model, the more similar we expect both perturbations to be. The average similarity drops from 0.13 for Inception v3 to 0.02 for ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ . This effect is not due to the decision surface of ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ being “too flat” near the data points: the average gradient norm is larger for ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ (0.17) than for the standard v3 model (0.10).
|
| 140 |
+
|
| 141 |
+
We visualize this “gradient-masking” effect (Papernot et al., 2016b) by plotting the loss of ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ on examples $x ^ { * } = \bar { x } + \epsilon _ { 1 } \cdot g + \epsilon _ { 2 } \cdot \bar { g } ^ { ^ { \perp } }$ , where $g$ is the signed gradient of model ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ and $g ^ { \bot }$ is a signed vector orthogonal to $g$ . Looking forward to Section 4.1, we actually chose $g ^ { \bot }$ to be the signed gradient of another Inception model, from which adversarial examples transfer to ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ . Figure 1 shows that the loss is highly curved in the vicinity of the data point $x$ , and that the gradient poorly reflects the global loss landscape. Similar plots for additional data points are in Figure 4.
|
| 142 |
+
|
| 143 |
+
We show similar results for adversarially trained MNIST models in Appendix C.2. On this task, input dropout (Srivastava et al., 2014) mitigates adversarial training’s overfitting problem, in some cases. Presumably, the random input mask diversifies the perturbations seen during training (dropout at intermediate layers does not mitigate the overfitting effect). Mishkin et al. (2017) find that input dropout significantly degrades accuracy on ImageNet, so we did not include it in our experiments.
|
| 144 |
+
|
| 145 |
+
Table 1: Error rates $( \mathbf { i n \% } )$ of adversarial examples transferred between models. We use StepLL with $\epsilon = { ^ { 1 6 } } / { 2 5 6 }$ for 10,000 random test inputs. Diagonal elements represent a white-box attack. The best attack for each target appears in bold. Similar results for MNIST models appear in Table 7.
|
| 146 |
+
|
| 147 |
+
<table><tr><td colspan="6">Source</td></tr><tr><td>Target</td><td>V4</td><td>v3</td><td>v3adv</td><td>IRv2</td><td>IRv2adv</td></tr><tr><td>v4</td><td>60.2</td><td>39.2</td><td>31.1</td><td>36.6</td><td>30.9</td></tr><tr><td>v3</td><td>43.8</td><td>69.6</td><td>36.4</td><td>42.1</td><td>35.1</td></tr><tr><td>v3ady</td><td>36.3</td><td>35.6</td><td>26.6</td><td>35.2</td><td>35.9</td></tr><tr><td>IRv2</td><td>38.0</td><td>38.0</td><td>30.8</td><td>50.7</td><td>31.9</td></tr><tr><td>IRv2adv</td><td>31.0</td><td>30.3</td><td>25.7</td><td>30.6</td><td>21.4</td></tr></table>
|
| 148 |
+
|
| 149 |
+
<table><tr><td colspan="6">Source</td></tr><tr><td>Target</td><td>v4</td><td>v3</td><td>v3adv</td><td>IRv2</td><td>IRv2adv</td></tr><tr><td>v4</td><td>31.0</td><td>14.9</td><td>10.2</td><td>13.6</td><td>9.9</td></tr><tr><td>v3</td><td>18.7</td><td>42.7</td><td>13.0</td><td>17.8</td><td>12.8</td></tr><tr><td>v3ady</td><td>13.6</td><td>13.5</td><td>9.0</td><td>13.0</td><td>14.5</td></tr><tr><td>IRv2</td><td>14.1</td><td>14.8</td><td>9.9</td><td>24.0</td><td>10.6</td></tr><tr><td>IRv2adv</td><td>10.3</td><td>10.5</td><td>7.7</td><td>10.4</td><td>58</td></tr></table>
|
| 150 |
+
|
| 151 |
+
# 4.1 ATTACKS AGAINST ADVERSARIALLY TRAINED NETWORKS
|
| 152 |
+
|
| 153 |
+
Kurakin et al. (2017b) found their adversarially trained model to be robust to various single-step attacks. They conclude that this robustness should translate to attacks transferred from other models. As we have shown, the robustness to single-step attacks is actually misleading, as the model has learned to degrade the information contained in the model’s gradient. As a consequence, we find that the ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ model is substantially more vulnerable to single-step attacks than Kurakin et al. (2017b) predicted, both in a white-box and black-box setting. The same holds for the $\mathrm { I R v } 2 _ { \mathrm { a d v } }$ model.
|
| 154 |
+
|
| 155 |
+
In addition to the ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ and $\mathrm { I R v } 2 _ { \mathrm { a d v } }$ models, we consider standard Inception v3, Inception v4 and Inception ResNet v2 models. These models are available in the TensorFlow-Slim library (Abadi et al., 2015). We describe similar results for a variety of models trained on MNIST in Appendix C.2.
|
| 156 |
+
|
| 157 |
+
Black-box attacks. Table 1 shows error rates for single-step attacks transferred between models. We compute perturbations on one model (the source) and transfer them to all others (the targets). When the source and target are the same, the attack is white-box. Adversarial training greatly increases robustness to white-box single-step attacks, but incurs a higher error rate in a black-box setting. Thus, the robustness gain observed when evaluating defended models in isolation is misleading. Given the ubiquity of this pitfall among proposed defenses against adversarial examples (Carlini & Wagner, $2 0 1 7 \mathrm { a }$ ; Brendel & Bethge, 2017; Papernot et al., 2016b), we advise researchers to always consider both white-box and black-box adversaries when evaluating defensive strategies. Notably, a similar discrepancy between white-box and black-box attacks was recently observed in Buckman et al. (2018).
|
| 158 |
+
|
| 159 |
+
Attacks crafted on adversarial models are found to be weaker even against undefended models (i.e., when using ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ or $\mathrm { I R v } 2 _ { \mathrm { a d v } }$ as source, the attack transfers with lower probability). This confirms our intuition from Section 3.3: adversarial training does not just overfit to perturbations that affect standard models, but actively degrades the linear approximation underlying the single-step attack.
|
| 160 |
+
|
| 161 |
+
A new randomized single-step attack. The loss function visualization in Figure 1 shows that sharp curvature artifacts localized near the data points can mask the true direction of steepest ascent. We thus suggest to prepend single-step attacks by a small random step, in order to “escape” the non-smooth vicinity of the data point before linearizing the model’s loss. Our new attack, called $\mathrm { R + F G S M }$ (alternatively, $\mathrm { R } { + } ,$ Step-LL), is defined as follows, for parameters $\epsilon$ and $\alpha$ (where $\alpha < \epsilon$ ):
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
x ^ { \mathrm { a d v } } = x ^ { \prime } + ( \varepsilon - \alpha ) \cdot \mathsf { s i g n } \left( \nabla _ { x ^ { \prime } } J ( x ^ { \prime } , y _ { \mathrm { t r u e } } ) \right) , \quad \mathrm { w h e r e } \quad x ^ { \prime } = x + \alpha \cdot \mathsf { s i g n } ( \mathcal { N } ( \mathbf { 0 } ^ { d } , \mathbf { I } ^ { d } ) ) ~ .
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
Note that the attack requires a single gradient computation. The $\mathrm { R + F G S M }$ is a computationally efficient alternative to iterative methods that have high success rates in a white-box setting. Our attack can be seen as a single-step variant of the general PGD method from (Madry et al., 2017).
|
| 168 |
+
|
| 169 |
+
Table 2 compares error rates for the Step-LL and $\mathsf { R } { + } \mathsf { S }$ tep-LL methods (with $\epsilon \ : = \ : 1 6 / 2 5 6$ and $\alpha = \epsilon / 2 )$ ). The extra random step yields a stronger attack for all models, even those without adversarial training. This suggests that a model’s loss function is generally less smooth near the data points. We further compared the $\mathsf { R } { + } \iota$ Step-LL attack to a two-step Iter-LL attack, which computes two gradient steps. Surprisingly, we find that for the adversarially trained Inception v3 model, the $\mathbf { R } { + } \mathbf { S }$ tep-LL attack is stronger than the two-step Iter-LL attack. That is, the local gradients learned by the adversarially trained model are worse than random directions for finding adversarial examples!
|
| 170 |
+
|
| 171 |
+
<table><tr><td>v4</td><td>v3</td><td>v3adv</td><td>IRv2</td><td>IRv2adv</td></tr><tr><td>60.2</td><td>69.6</td><td>26.6</td><td>50.7</td><td>21.4</td></tr><tr><td>70.5</td><td>80.0</td><td>64.8</td><td>56.3</td><td>37.5</td></tr><tr><td>78.5</td><td>86.3</td><td>58.3</td><td>69.9</td><td>41.6</td></tr></table>
|
| 172 |
+
|
| 173 |
+
Table 2: Error rates $( \mathbf { i n \% } )$ for Step-LL, $\mathbf { R } +$ Step-LL and a two-step Iter-LL on ImageNet. We use $\epsilon = { ^ { 1 6 } } / { 2 5 6 }$ , $\alpha = \epsilon / 2$ on 10,000 random test inputs. $\mathrm { R + F G S M }$ results on MNIST are in Table 7.
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
<table><tr><td>v4</td><td>v3</td><td>v3adv</td><td>IRv2</td><td>IRv2adv</td></tr><tr><td>31.0</td><td>42.7</td><td>9.0</td><td>24.0</td><td>5.8</td></tr><tr><td>42.8</td><td>57.1</td><td>37.1</td><td>29.3</td><td>15.0</td></tr><tr><td>56.2</td><td>70.2</td><td>29.6</td><td>45.4</td><td>16.5</td></tr></table>
|
| 177 |
+
|
| 178 |
+
Table 3: Models used for Ensemble Adversarial Training on ImageNet. The ResNets (He et al., 2016) use either 50 or 101 layers. IncRes stands for Inception ResNet (Szegedy et al., 2016a).
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Trained Model</td><td>Pre-trained Models</td><td>Holdout Models</td></tr><tr><td>Inception v3 (v3adv-ens3)</td><td>Inception v3,ResNet v2 (50)</td><td>Inception v4</td></tr><tr><td>Inception v3 (v3adv-ens4)</td><td>Inception v3,ResNet v2 (5O), IncRes v2</td><td>ResNet v1 (50)</td></tr><tr><td>IncRes v2 (IRv2adv-ens)</td><td>Inception v3, IncRes v2</td><td>ResNetv2(101))</td></tr></table>
|
| 181 |
+
|
| 182 |
+
We find that the addition of this random step hinders transferability (see Table 9). We also tried adversarial training using $\mathrm { R + F G S M }$ on MNIST, using a similar approach as (Madry et al., 2017). We adversarially train a CNN (model A in Table 5) for 100 epochs, and attain $> 9 0 . 0 \%$ accuracy on $\mathrm { R + F G S M }$ samples. However, training on $\mathrm { R + F G S M }$ provides only little robustness to iterative attacks. For the PGD attack of (Madry et al., 2017) with 20 steps, the model attains $1 8 . 0 \%$ accuracy.
|
| 183 |
+
|
| 184 |
+
# 4.2 ENSEMBLE ADVERSARIAL TRAINING
|
| 185 |
+
|
| 186 |
+
We now evaluate our Ensemble Adversarial Training strategy described in Section 3.4. We recall our intuition: by augmenting training data with adversarial examples crafted from static pre-trained models, we decouple the generation of adversarial examples from the model being trained, so as to avoid the degenerate minimum described in Section 3.3. Moreover, our hope is that robustness to attacks transferred from some fixed set of models will generalize to other black-box adversaries.
|
| 187 |
+
|
| 188 |
+
We train Inception v3 and Inception ResNet v2 models (Szegedy et al., 2016a) on ImageNet, using the pre-trained models shown in Table 3. In each training batch, we rotate the source of adversarial examples between the currently trained model and one of the pre-trained models. We select the source model at random in each batch, to diversify examples across epochs. The pre-trained models’ gradients can be precomputed for the full training set. The per-batch cost of Ensemble Adversarial Training is thus lower than that of standard adversarial training: using our method with $n - 1$ pre-trained models, only every $n ^ { \mathrm { t h } }$ batch requires a forward-backward pass to compute adversarial gradients. We use synchronous distributed training on 50 machines, with minibatches of size 16 (we did not pre-compute gradients, and thus lower the batch size to fit all models in memory). Half of the examples in a minibatch are replaced by Step-LL examples. As in Kurakin et al. (2017b), we use RMSProp with a learning rate of 0.045, decayed by a factor of 0.94 every two epochs.
|
| 189 |
+
|
| 190 |
+
To evaluate how robustness to black-box attacks generalizes across models, we transfer various attacks crafted on three different holdout models (see Table 3), as well as on an ensemble of these models (as in Liu et al. (2017)). We use the Step-LL, $\mathbf { R } +$ Step-LL, FGSM, I-FGSM and the PGD attack from Madry et al. (2017) using the hinge-loss function from Carlini & Wagner (2017a). Our results are in Table 4. For each model, we report the worst-case error rate over all black-box attacks transfered from each of the holdout models (20 attacks in total). Results for MNIST are in Table 8.
|
| 191 |
+
|
| 192 |
+
Convergence speed. Convergence of Ensemble Adversarial Training is slower than for standard adversarial training, a result of training on “hard” adversarial examples and lowering the batch size. Kurakin et al. (2017b) report that after 187 epochs ( $1 5 0 k$ iterations with minibatches of size 32), the ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ model achieves $7 8 \%$ accuracy. Ensemble Adversarial Training for models ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 3 }$ and ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 4 }$ converges after 280 epochs ( $4 5 0 k$ iterations with minibatches of size 16). The Inception ResNet v2 model is trained for 175 epochs, where a baseline model converges at around 160 epochs.
|
| 193 |
+
|
| 194 |
+
Table 4: Error rates $( \mathbf { i n \ \% } )$ ) for Ensemble Adversarial Training on ImageNet. Error rates on clean data are computed over the full test set. For 10,000 random test set inputs, and $\epsilon = { ^ { 1 6 } } / { 2 5 6 }$ , we report error rates on white-box Step-LL and the worst-case error over a series of black-box attacks (Step-LL, $R +$ Step-LL, FGSM, I-FGSM, PGD) transferred from the holdout models in Table 3. For both architectures, we mark methods tied for best in bold (based on $9 5 \%$ confidence).
|
| 195 |
+
|
| 196 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">Top 1</td><td colspan="3">Top 5</td></tr><tr><td>Clean</td><td>Step-LL</td><td>Max.Black-Box</td><td>Clean</td><td>Step-LL</td><td>Max.Black-Box</td></tr><tr><td>v3</td><td>22.0</td><td>69.6</td><td>51.2</td><td>6.1</td><td>42.7</td><td>24.5</td></tr><tr><td>v3adv</td><td>22.0</td><td>26.6</td><td>40.8</td><td>6.1</td><td>9.0</td><td>17.4</td></tr><tr><td>v3adv-ens3</td><td>23.6</td><td>30.0</td><td>34.0</td><td>7.6</td><td>10.1</td><td>11.2</td></tr><tr><td>v3adv-ens4</td><td>24.2</td><td>43.3</td><td>33.4</td><td>7.8</td><td>19.4</td><td>10.7</td></tr><tr><td>IRv2</td><td>19.6</td><td>50.7</td><td>44.4</td><td>4.8</td><td>24.0</td><td>17.8</td></tr><tr><td>IRv2adv</td><td>19.8</td><td>21.4</td><td>34.5</td><td>4.9</td><td>5.8</td><td>11.7</td></tr><tr><td>IRv2adv-ens</td><td>20.2</td><td>26.0</td><td>27.0</td><td>5.1</td><td>7.6</td><td>7.9</td></tr></table>
|
| 197 |
+
|
| 198 |
+
White-box attacks. For both architectures, the models trained with Ensemble Adversarial Training are slightly less accurate on clean data, compared to standard adversarial training. Our models are also more vulnerable to white-box single-step attacks, as they were only partially trained on such perturbations. Note that for ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 4 }$ , the proportion of white-box Step-LL samples seen during training is $^ 1 / 4$ (instead of $^ 1 / 3$ for model ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 3 }$ ). The negative impact on the robustness to white-box attacks is large, for only a minor gain in robustness to transferred samples. Thus it appears that while increasing the diversity of adversarial examples seen during training can provide some marginal improvement, the main benefit of Ensemble Adversarial Training is in decoupling the attacks from the model being trained, which was the goal we stated in Section 3.4.
|
| 199 |
+
|
| 200 |
+
Ensemble Adversarial Training is not robust to white-box Iter-LL and $\mathrm { R } { + } \mathrm { : }$ Step-LL samples: the error rates are similar to those for the ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ model, and omitted for brevity (see Kurakin et al. (2017b) for Iter-LL attacks and Table 2 for $\mathrm { R } { + } \mathrm { i }$ Step-LL attacks). Kurakin et al. (2017b) conjecture that larger models are needed to attain robustness to such attacks. Yet, against black-box adversaries, these attacks are only a concern insofar as they reliably transfer between models.
|
| 201 |
+
|
| 202 |
+
Black-box attacks. Ensemble Adversarial Training significantly boosts robustness to all attacks transferred from the holdout models. For the $\mathrm { I R v } 2 _ { \mathrm { a d v - e n s } }$ model, the accuracy loss (compared to IRv2’s accuracy on clean data) is $7 . 4 \%$ (top 1) and $\mathbf { 3 . 1 \% }$ (top 5). We find that the strongest attacks in our test suite (i.e., with highest transfer rates) are the FGSM attacks. Black-box $\mathbf { R } { + } \mathbf { S }$ tep-LL or iterative attacks are less effective, as they do not transfer with high probability (see Kurakin et al. (2017b) and Table 9). Attacking an ensemble of all three holdout models, as in Liu et al. (2017), did not lead to stronger black-box attacks than when attacking the holdout models individually.
|
| 203 |
+
|
| 204 |
+
Our results have little variance with respect to the attack parameters (e.g., smaller $\epsilon$ ) or to the use of other holdout models for black-box attacks (e.g., we obtain similar results by attacking the v3adv-ens3 and ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 4 }$ models with the IRv2 model). We also find that ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 3 }$ is not vulnerable to perturbations transferred from ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 4 }$ . We obtain similar results on MNIST (see Appendix C.2), thus demonstrating the applicability of our approach to different datasets and model architectures.
|
| 205 |
+
|
| 206 |
+
The NIPS 2017 competition on adversarial examples. Our Inception ResNet v2 model was included as a baseline defense in the NIPS 2017 competition on Adversarial Examples (Kurakin et al., 2017c). Participants of the attack track submitted non-interactive black-box attacks that produce adversarial examples with bounded $\ell _ { \infty }$ norm. Models submitted to the defense track were evaluated on all attacks over a subset of the ImageNet test set. The score of a defense was defined as the average accuracy of the model over all adversarial examples produced by all attacks.
|
| 207 |
+
|
| 208 |
+
Our $\mathrm { I R v } 2 _ { \mathrm { a d v - e n s } }$ model finished $\boldsymbol { l } ^ { s t }$ among 70 submissions in the first development round, with a score of $9 5 . 3 \%$ (the second placed defense scored $8 9 . 9 \%$ ). The test data was intentionally chosen as an “easy” subset of ImageNet. Our model achieved $9 7 . 9 \%$ accuracy on the clean test data.
|
| 209 |
+
|
| 210 |
+
After the first round, we released our model publicly, which enabled other users to launch white-box attacks against it. Nevertheless, a majority of the final submissions built upon our released model. The winning submission (team “liaofz” with a score of $9 5 . 3 \%$ ) made use of a novel adversarial denoising technique. The second placed defense (team “cihangxie” with a score of $9 2 . 4 \%$ ) prepends our $\mathrm { I R v } 2 _ { \mathrm { a d v - e n s } }$ model with random padding and resizing of the input image (Xie et al., 2018).
|
| 211 |
+
|
| 212 |
+

|
| 213 |
+
Figure 2: The dimensionality of the adversarial cone. For 500 correctly classified points $x$ , and for $\epsilon \in \{ 4 , 1 0 , 1 6 \}$ , we plot the probability that we find at least $k$ orthogonal vectors $r _ { i }$ such that $\| r _ { i } \| _ { \infty } = \epsilon$ and $\boldsymbol { x } + \boldsymbol { r } _ { i }$ is misclassified. For $\epsilon \geq 1 0$ , model ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ shows a bimodal phenomenon: most points $x$ either have 0 adversarial directions or more than 90.
|
| 214 |
+
|
| 215 |
+
It is noteworthy that the defenses that incorporated Ensemble Adversarial Training faired better against the worst-case black-box adversary. Indeed, although very robust on average, the winning defense achieved as low as $1 1 . 8 \%$ accuracy on some attacks. The best defense under this metric (team “rafaelmm” which randomly perturbed images before feeding them to our $\mathrm { I R v } 2 _ { \mathrm { a d v - e n s } }$ model) achieved at least $5 3 . 6 \%$ accuracy against all submitted attacks, including the attacks that explicitly targeted our released model in a white-box setting.
|
| 216 |
+
|
| 217 |
+
Decreasing gradient masking. Ensemble Adversarial Training decreases the magnitude of the gradient masking effect described previously. For the ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 3 }$ and ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 4 }$ models, we find that the loss incurred on a Step-LL attack gets within respectively $1 3 \%$ and $1 8 \%$ of the optimum loss (we recall that for models v3 and ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ , the approximation ratio was respectively $1 9 \%$ and $7 \%$ ). Similarly, for the $\mathrm { I R v } 2 _ { \mathrm { a d v - e n s } }$ model, the ratio improves from $8 \%$ (for $\mathrm { I R } \mathrm { v } 2 _ { \mathrm { a d v } } ,$ ) to $1 4 \%$ . As expected, not solely training on a white-box single-step attack reduces gradient masking. We also verify that after Ensemble Adversarial Training, a two-step iterative attack outperforms the $\mathrm { R } +$ Step-LL attack from Section 4.1, thus providing further evidence that these models have meaningful gradients.
|
| 218 |
+
|
| 219 |
+
Finally, we revisit the “Gradient-Aligned Adversarial Subspace” (GAAS) method of Tramer et al. \` (2017). Their method estimates the size of the space of adversarial examples in the vicinity of a point, by finding a set of orthogonal perturbations of norm $\epsilon$ that are all adversarial. We note that adversarial perturbations do not technically form a “subspace” (e.g., the 0 vector is not adversarial). Rather, they may form a “cone”, the dimension of which varies as we increase $\epsilon$ . By linearizing the loss function, estimating the dimensionality of this cone reduces to finding vectors $r _ { i }$ that are strongly aligned with the model’s gradient $g = \nabla _ { x } L ( h ( x ) , y _ { \mathrm { t r u e } } )$ . Tramer et al. (2017) give a method \` that finds $k$ orthogonal vectors $r _ { i }$ that satisfy $\begin{array} { r } { \boldsymbol { g } ^ { \intercal } \boldsymbol { r } _ { i } \geq \dot { \epsilon } \cdot \| \boldsymbol { g } \| _ { 2 } \cdot \frac { 1 } { \sqrt { k } } } \end{array}$ (this bound is tight). We extend this result to the $\ell _ { \infty }$ norm, an open question in Tramer et al. (2017). In Section E, we give a randomized \` combinatorial construction (Colbourn, 2010), that finds $k$ orthogonal vectors $r _ { i }$ satisfying $\| r _ { i } \| _ { \infty } =$ $\epsilon$ and $\begin{array} { r } { \mathbb { E } \left[ \boldsymbol { g } ^ { \top } \boldsymbol { r } _ { i } \right] \ge \epsilon \cdot \| \boldsymbol { g } \| _ { 1 } \cdot \frac { 1 } { \sqrt { k } } } \end{array}$ . We show that this result is tight as well.
|
| 220 |
+
|
| 221 |
+
For models v3, ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ and ${ \mathbf { v } } 3 _ { \mathrm { a d v - e n s } 3 }$ , we select 500 correctly classified test points. For each $x$ , we search for a maximal number of orthogonal adversarial perturbations $r _ { i }$ with $\| r _ { i } \| _ { \infty } = \epsilon$ . We limit our search to $k \leq 1 0 0$ directions per point. The results are in Figure 2. For $\epsilon \in \{ 4 , 1 0 , 1 6 \}$ , we plot the proportion of points that have at least $k$ orthogonal adversarial perturbations. For a fixed $\epsilon$ , the value of $k$ can be interpreted as the dimension of a “slice” of the cone of adversarial examples near a data point. For the standard Inception v3 model, we find over 50 orthogonal adversarial directions for $3 0 \%$ of the points. The ${ \bf V } { \boldsymbol 3 } _ { \mathrm { a d v } }$ model shows a curious bimodal phenomenon for $\epsilon \geq 1 0$ : for most points $( \approx 8 0 \%$ ), we find no adversarial direction aligned with the gradient, which is consistent with the gradient masking effect. Yet, for most of the remaining points, the adversarial space is very high-dimensional $k \geq 9 0$ ). Ensemble Adversarial Training yields a more robust model, with only a small fraction of points near a large adversarial space.
|
| 222 |
+
|
| 223 |
+
# 5 CONCLUSION AND FUTURE WORK
|
| 224 |
+
|
| 225 |
+
Previous work on adversarial training at scale has produced encouraging results, showing strong robustness to (single-step) adversarial examples (Goodfellow et al., 2014b; Kurakin et al., 2017b). Yet, these results are misleading, as the adversarially trained models remain vulnerable to simple black-box and white-box attacks. Our results, generic with respect to the application domain, suggest that adversarial training can be improved by decoupling the generation of adversarial examples from the model being trained. Our experiments with Ensemble Adversarial Training show that the robustness attained to attacks from some models transfers to attacks from other models.
|
| 226 |
+
|
| 227 |
+
We did not consider black-box adversaries that attack a model via other means than by transferring examples from a local model. For instance, generative techniques (Baluja & Fischer, 2017) might provide an avenue for stronger attacks. Yet, a recent work by Xiao et al. (2018) found Ensemble Adversarial Training to be resilient to such attacks on MNIST and CIFAR10, and often attaining higher robustness than models that were adversarially trained on iterative attacks.
|
| 228 |
+
|
| 229 |
+
Moreover, interactive adversaries (see Appendix A) could try to exploit queries to the target model’s prediction function in their attack, as demonstrated in Papernot et al. (2017). If queries to the target model yield prediction confidences, an adversary can estimate the target’s gradient at a given point (e.g., using finite-differences as in Chen et al. (2017)) and fool the target with our $\mathrm { R + F G S M }$ attack. Note that if queries only return the predicted label, the attack does not apply. Exploring the impact of these classes of black-box attacks and evaluating their scalability to complex tasks is an interesting avenue for future work.
|
| 230 |
+
|
| 231 |
+
# ACKNOWLEDGMENTS
|
| 232 |
+
|
| 233 |
+
We thank Ben Poole and Jacob Steinhardt for feedback on early versions of this work. Nicolas Papernot is supported by a Google PhD Fellowship in Security. Research was supported in part by the Army Research Laboratory, under Cooperative Agreement Number W911NF-13-2-0045 (ARL Cyber Security CRA), and the Army Research Office under grant W911NF-13-1-0421. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Army Research Laboratory or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for government purposes notwithstanding any copyright notation hereon.
|
| 234 |
+
|
| 235 |
+
# REFERENCES
|
| 236 |
+
|
| 237 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
|
| 238 |
+
|
| 239 |
+
Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mane. Con- ´ crete problems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
|
| 240 |
+
|
| 241 |
+
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.
|
| 242 |
+
|
| 243 |
+
Shumeet Baluja and Ian Fischer. Adversarial transformation networks: Learning to generate adversarial examples. arXiv preprint arXiv:1703.09387, 2017.
|
| 244 |
+
|
| 245 |
+
Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Srndi ˇ c, Pavel Laskov, Gior- ´ gio Giacinto, and Fabio Roli. Evasion attacks against machine learning at test time. In ECMLKDD, pp. 387–402. Springer, 2013.
|
| 246 |
+
|
| 247 |
+
Wieland Brendel and Matthias Bethge. Comment on” biologically inspired protection of deep networks from adversarial attacks”. arXiv preprint arXiv:1704.01547, 2017.
|
| 248 |
+
|
| 249 |
+
Jacob Buckman, Aurko Roy, Colin Raffel, and Ian Goodfellow. Thermometer encoding: One hot way to resist adversarial examples. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=S18Su--CW.
|
| 250 |
+
|
| 251 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy, 2017a.
|
| 252 |
+
|
| 253 |
+
Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. arXiv preprint arXiv:1705.07263, 2017b.
|
| 254 |
+
|
| 255 |
+
Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 15–26. ACM, 2017.
|
| 256 |
+
|
| 257 |
+
Moustapha Cisse, Bojanowski Piotr, Grave Edouard, Dauphin Yann, and Usunier Nicolas. Parseval networks: Improving robustness to adversarial examples. arXiv preprint arXiv:1704.08847, 2017.
|
| 258 |
+
|
| 259 |
+
Charles J Colbourn. CRC handbook of combinatorial designs. CRC press, 2010.
|
| 260 |
+
|
| 261 |
+
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.
|
| 262 |
+
|
| 263 |
+
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.
|
| 264 |
+
|
| 265 |
+
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.
|
| 266 |
+
|
| 267 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014b.
|
| 268 |
+
|
| 269 |
+
Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
|
| 270 |
+
|
| 271 |
+
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.
|
| 272 |
+
|
| 273 |
+
J Zico Kolter and Eric Wong. Provable defenses against adversarial examples via the convex outer adversarial polytope. arXiv preprint arXiv:1711.00851, 2017.
|
| 274 |
+
|
| 275 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In ICLR, 2017a.
|
| 276 |
+
|
| 277 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In ICLR, 2017b.
|
| 278 |
+
|
| 279 |
+
Alexey Kurakin, Ian J Goodfellow, and Samy Bengio. Nips 2017: Defense against adversarial attack, 2017c. URL https://www.kaggle.com/c/ nips-2017-defense-against-adversarial-attack.
|
| 280 |
+
|
| 281 |
+
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.
|
| 282 |
+
|
| 283 |
+
Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In ICLR, 2017.
|
| 284 |
+
|
| 285 |
+
Yan Luo, Xavier Boix, Gemma Roig, Tomaso Poggio, and Qi Zhao. Foveation-based mechanisms alleviate adversarial examples. arXiv preprint arXiv:1511.06292, 2015.
|
| 286 |
+
|
| 287 |
+
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.
|
| 288 |
+
|
| 289 |
+
Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. Domain adaptation: Learning bounds and algorithms. arXiv preprint arXiv:0902.3430, 2009.
|
| 290 |
+
|
| 291 |
+
Dmytro Mishkin, Nikolay Sergievskiy, and Jiri Matas. Systematic evaluation of convolution neural network advances on the imagenet. Computer Vision and Image Understanding, 2017.
|
| 292 |
+
|
| 293 |
+
Aran Nayebi and Surya Ganguli. Biologically inspired protection of deep networks from adversarial attacks. arXiv preprint arXiv:1703.09202, 2017.
|
| 294 |
+
|
| 295 |
+
Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016a.
|
| 296 |
+
|
| 297 |
+
Nicolas Papernot, Patrick McDaniel, Arunesh Sinha, and Michael Wellman. Towards the science of security and privacy in machine learning. arXiv preprint arXiv:1611.03814, 2016b.
|
| 298 |
+
|
| 299 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016c.
|
| 300 |
+
|
| 301 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Asia Conference on Computer and Communications Security (ASIACCS), pp. 506–519. ACM, 2017.
|
| 302 |
+
|
| 303 |
+
Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. In International Conference on Learning Representations, 2018. URL https: //openreview.net/forum?id $=$ Bys4ob-Rb.
|
| 304 |
+
|
| 305 |
+
Aman Sinha, Hongseok Namkoong, and John Duchi. Certifiable distributional robustness with principled adversarial training. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ Hk6kPgZA-.
|
| 306 |
+
|
| 307 |
+
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.
|
| 308 |
+
|
| 309 |
+
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.
|
| 310 |
+
|
| 311 |
+
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alex Alemi. Inception-v4, inceptionresnet and the impact of residual connections on learning. arXiv preprint arXiv:1602.07261, 2016a.
|
| 312 |
+
|
| 313 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, pp. 2818–2826, 2016b.
|
| 314 |
+
|
| 315 |
+
Florian Tramer, Fan Zhang, Ari Juels, Michael K Reiter, and Thomas Ristenpart. Stealing machine\` learning models via prediction apis. In Usenix Security, 2016.
|
| 316 |
+
|
| 317 |
+
Florian Tramer, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. The space \` of transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017.
|
| 318 |
+
|
| 319 |
+
Chaowei Xiao, Bo Li, Jun-Yan Zhu, Warren He, Mingyan Liu, and Dawn Song. Generating adversarial examples with adversarial networks, 2018. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HknbyQbC-.
|
| 320 |
+
|
| 321 |
+
Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ Sk9yuql0Z.
|
| 322 |
+
|
| 323 |
+
Chao Zhang, Lei Zhang, and Jieping Ye. Generalization bounds for domain adaptation. In Advances in neural information processing systems, pp. 3320–3328, 2012.
|
| 324 |
+
|
| 325 |
+
# A THREAT MODEL: FORMAL DEFINITIONS
|
| 326 |
+
|
| 327 |
+
We provide formal definitions for the threat model introduced in Section 3.1. In the following, we explicitly identify the hypothesis space $\mathcal { H }$ that a model belongs to as describing the model’s architecture. We consider a target model $h \in \mathcal H$ trained over inputs $( x , y _ { \mathrm { t r u e } } )$ sampled from a data distribution $\mathcal { D }$ . More precisely, we write
|
| 328 |
+
|
| 329 |
+
$$
|
| 330 |
+
h \gets \mathsf { t r a i n } ( \mathcal { H } , X _ { \mathrm { t r a i n } } , Y _ { \mathrm { t r a i n } } , r ) \ ,
|
| 331 |
+
$$
|
| 332 |
+
|
| 333 |
+
where train is a randomized training procedure that takes in a description of the model architecture $\mathcal { H }$ , a training set $X _ { \mathrm { t r a i n } } , Y _ { \mathrm { t r a i n } }$ sampled from $\mathcal { D }$ , and randomness $r$ .
|
| 334 |
+
|
| 335 |
+
iven a set of test inputs produces adversarial $X , Y = \{ ( x _ { 1 } , y _ { 1 } ) , \dots , ( x _ { m } , y _ { m } ) \}$ om, su $\mathcal { D }$ and a that $\epsilon > 0$ versaryfor all $\mathcal { A }$ $X ^ { \mathrm { a d v } } = \{ x _ { 1 } ^ { \mathrm { a d v } } , \ldots , x _ { m } ^ { \mathrm { a d v } } \}$ $\| x _ { i } - x _ { i } ^ { \mathrm { a d v } } \| _ { \infty } ~ \leq ~ \epsilon$ $i \in [ 1 , m ]$ . We evaluate success of the attack as the error rate of the target model over $X ^ { \mathrm { a d v } }$ :
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathbb { 1 } ( \arg \operatorname* { m a x } h ( x _ { i } ^ { \mathrm { a d v } } ) \neq y _ { i } ) ~ .
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
We assume $\mathcal { A }$ can sample inputs according to the data distribution $\mathcal { D }$ . We define three adversaries.
|
| 342 |
+
|
| 343 |
+
Definition 2 (White-Box Adversary). For a target model $h \in \mathcal H$ , a white-box adversary is given access to all elements of the training procedure, that is train (the training algorithm), $\mathcal { H }$ (the model architecture), the training data $X _ { t r a i n } , Y _ { t r a i n } ,$ , the randomness $r$ and the parameters $h$ . The adversary can use any attack (e.g., those in Section 3.2) to find adversarial inputs.
|
| 344 |
+
|
| 345 |
+
White-box access to the internal model weights corresponds to a very strong adversarial model. We thus also consider the following relaxed and arguably more realistic notion of a black-box adversary. Definition 3 (Non-Interactive Black-Box Adversary). For a target model $h \in \mathcal H$ , a non-interactive black-box adversary only gets access to train (the target model’s training procedure) and $\mathcal { H }$ (the model architecture). The adversary can sample from the data distribution $\mathcal { D }$ , and uses a local algorithm to craft adversarial examples Xadv.
|
| 346 |
+
|
| 347 |
+
Attacks based on transferability (Szegedy et al., 2013) fall in this category, wherein the adversary selects a procedure train0 and model architecture $\mathcal { H } ^ { \prime }$ , trains a local model $\mathit { \Pi } _ { h ^ { ' } }$ over $\mathcal { D }$ , and computes adversarial examples on its local model $h ^ { \prime }$ using white-box attack strategies.
|
| 348 |
+
|
| 349 |
+
Most importantly, a black-box adversary does not learn the randomness $r$ used to train the target, nor the target’s parameters $h$ . The black-box adversaries in our paper are actually slightly stronger than the ones defined above, in that they use the same training data $X _ { \mathrm { t r a i n } } , Y _ { \mathrm { t r a i n } }$ as the target model.
|
| 350 |
+
|
| 351 |
+
We provide $\mathcal { A }$ with the target’s training procedure train to capture knowledge of defensive strategies applied at training time, e.g., adversarial training (Szegedy et al., 2013; Goodfellow et al., 2014b) or ensemble adversarial training (see Section 4.2). For ensemble adversarial training, $\mathcal { A }$ also knows the architectures of all pre-trained models. In this work, we always mount black-box attacks that train a local model with a different architecture than the target model. We actually find that black-box attacks on adversarially trained models are stronger in this case (see Table 1).
|
| 352 |
+
|
| 353 |
+
The main focus of our paper is on non-interactive black-box adversaries as defined above. For completeness, we also formalize a stronger notion of interactive black-box adversaries that additionally issue prediction queries to the target model (Papernot et al., 2017). We note that in cases where ML models are deployed as part of a larger system (e.g., a self driving car), an adversary may not have direct access to the model’s query interface.
|
| 354 |
+
|
| 355 |
+
Definition 4 (Interactive Black-Box Adversary). For a target model $h \in \mathcal H$ , an interactive blackbox adversary only gets access to train (the target model’s training procedure) and $\mathcal { H }$ (the model architecture). The adversary issues (adaptive) oracle queries to the target model. That is, for arbitrary inputs $x \in [ 0 , 1 ] ^ { d }$ , the adversary obtains $y = \arg \operatorname* { m a x } h ( x )$ and uses a local algorithm to craft adversarial examples (given knowledge of $\mathcal { H }$ , train, and tuples $( x , y )$ ).
|
| 356 |
+
|
| 357 |
+
Papernot et al. (2017) show that such attacks are possible even if the adversary only gets access to a small number of samples from $\mathcal { D }$ . Note that if the target model’s prediction interface additionally returns class scores $h ( x )$ , interactive black-box adversaries could use queries to the target model to estimate the model’s gradient (e.g., using finite differences) (Chen et al., 2017), and then apply the attacks in Section 3.2. We further discuss interactive black-box attack strategies in Section 5.
|
| 358 |
+
|
| 359 |
+
# B GENERALIZATION BOUND FOR ENSEMBLE ADVERSARIAL TRAINING
|
| 360 |
+
|
| 361 |
+
We provide a formal statement of Theorem 1 in Section 3.4, regarding the generalization guarantees of Ensemble Adversarial Training. For simplicity, we assume that the model is trained solely on adversarial examples computed on the pre-trained models (i.e., we ignore the clean training data and the adversarial examples computed on the model being trained). Our results are easily extended to also consider these data points.
|
| 362 |
+
|
| 363 |
+
Let $\mathcal { D }$ be the data distribution and $\mathcal { A } _ { 1 } , \ldots , \mathcal { A } _ { k } , \mathcal { A } ^ { * }$ be adversarial distributions where a sample $( x , y )$ is obtained by sampling $( x , y _ { \mathrm { t r u e } } )$ from $\mathcal { D }$ , computing an $x ^ { \mathrm { a d v } }$ such that $\| x ^ { \mathrm { a d v } } - x \| _ { \infty } \leq \epsilon$ and returning $( x ^ { \mathrm { a d v } } , y _ { \mathrm { t r u e } } )$ . We assume the model is trained on $N$ data points $Z _ { \mathrm { t r a i n } }$ , where $\textstyle { \frac { N } { k } }$ data points are sampled from each distribution $A _ { i }$ , for $1 \leq i \leq k$ . We denote $\mathcal { A } _ { \mathrm { t r a i n } } = \{ \mathcal { A } _ { 1 } , . . . , \overset { \because } { \mathcal { A } } _ { k } \}$ . At test time, the model is evaluated on adversarial examples from $\mathcal { A } ^ { * }$ .
|
| 364 |
+
|
| 365 |
+
For a model $h \in \mathcal H$ we define the empirical risk
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
\hat { R } ( h , { \mathcal A } _ { \mathrm { t r a i n } } ) : = \frac { 1 } { N } \sum _ { ( x ^ { \mathrm { a d v } } , y _ { \mathrm { t r u e } } ) \in Z _ { \mathrm { t r a i n } } } L ( h ( x ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) \ ,
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
and the risk over the target distribution (or future adversary)
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
R ( h , \mathcal { A } ^ { \ast } ) : = \underset { ( x ^ { \mathrm { a d v } } , y _ { \mathrm { t r u e } } ) \sim \mathcal { A } ^ { \ast } } { \mathbb { E } } [ L ( h ( x ^ { \mathrm { a d v } } ) , y _ { \mathrm { t r u e } } ) ] .
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
We further define the average discrepancy distance (Mansour et al., 2009) between distributions $A _ { i }$ and $\mathcal { A } ^ { * }$ with respect to a hypothesis space $\mathcal { H }$ as
|
| 378 |
+
|
| 379 |
+
$$
|
| 380 |
+
\operatorname { d i s c } _ { { \mathcal { H } } } ( { \mathcal { A } } _ { \mathrm { t r a i n } } , { \mathcal { A } } ^ { * } ) : = \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \operatorname* { s u p } _ { h _ { 1 } , h _ { 2 } \in { \mathcal { H } } } \left| \frac { \mathbb { E } } { A _ { i } } \big [ \mathbb { 1 } _ { \{ h _ { 1 } ( x ^ { \mathrm { a b } } ) = h _ { 2 } ( x ^ { \mathrm { a b } } ) \} } \big ] - \underline { { \mathbb { E } } } _ { * } \big [ \mathbb { 1 } _ { \{ h _ { 1 } ( x ^ { \mathrm { a b } } ) = h _ { 2 } ( x ^ { \mathrm { a b } } ) \} } \big ] \right| .
|
| 381 |
+
$$
|
| 382 |
+
|
| 383 |
+
This quantity characterizes how “different” the future adversary is from the train-time adversaries. Intuitively, the distance disc $( \mathcal { A } _ { \mathrm { t r a i n } } , \mathcal { A } ^ { * } )$ is small if the difference in robustness between two models to the target attack $\mathcal { A } ^ { * }$ is somewhat similar to the difference in robustness between these two models to the attacks used for training (e.g., if the static black-box attacks $\mathbf { \mathcal { A } } _ { i }$ induce much higher error on some model $h _ { 1 }$ than on another model $h _ { 2 }$ , then the same should hold for the target attack $\mathcal { A } ^ { * }$ ). In other words, the ranking of the robustness of models $h \in \mathcal H$ should be similar for the attacks in $\mathcal { A } _ { \mathrm { t r a i n } }$ as for $\mathcal { A } ^ { * }$ .
|
| 384 |
+
|
| 385 |
+
Finally, let $R _ { N } ( \mathscr { H } )$ be the average Rademacher complexity of the distributions $\mathcal { A } _ { 1 } , \ldots , \mathcal { A } _ { k }$ (Zhang et al., 2012). Note that $R _ { N } ( \mathscr { H } ) \dot { \mathbf { \Omega } } \to 0$ as $N \infty$ . The following theorem is a corollary of Zhang et al. (2012, Theorem 5.2):
|
| 386 |
+
|
| 387 |
+
Theorem 5. Assume that $\mathcal { H }$ is a function class consisting of bounded functions. Then, with probability at least $1 - \epsilon ,$ ,
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\operatorname* { s u p } _ { h \in \mathcal { H } } \vert \hat { R } ( h , { \mathcal A } _ { t r a i n } ) - R ( h , { \mathcal A } ^ { * } ) \vert \leq d i s c _ { \mathcal { H } } ( { \mathcal A } _ { t r a i n } , { \mathcal A } ^ { * } ) + 2 R _ { N } ( \mathcal { H } ) + O \left( \sqrt { \frac { \ln ( 1 / \epsilon ) } { N } } \right) .
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
Compared to the standard generalization bound for supervised learning, the generalization bound for Domain Adaptation incorporates the extra term $\mathrm { d i s c } _ { \mathcal { H } } ( \mathcal { A } _ { \mathrm { t r a i n } } , \mathcal { A } ^ { * } )$ to capture the divergence between the target and source distributions. In our context, this means that the model $h ^ { * }$ learned by Ensemble Adversarial Training has guaranteed generalization bounds with respect to future adversaries that are not “too different” from the ones used during training. Note that $\mathcal { A } ^ { * }$ need not restrict itself to perturbation with bounded $\ell _ { \infty }$ norm for this result to hold.
|
| 394 |
+
|
| 395 |
+
# C EXPERIMENTS ON MNIST
|
| 396 |
+
|
| 397 |
+
We re-iterate our ImageNet experiments on MNIST. For this simpler task, Madry et al. (2017) show that training on iterative attacks conveys robustness to white-box attacks with bounded $\ell _ { \infty }$ norm. Our goal is not to attain similarly strong white-box robustness on MNIST, but to show that our observations on limitations of single-step adversarial training, extend to other datasets than ImageNet.
|
| 398 |
+
|
| 399 |
+

|
| 400 |
+
Figure 3: Adversarial Examples on MNIST. (top) clean examples. (middle) inputs are rotated by $2 0 ^ { \circ }$ and 5 random pixels are flipped. (bottom) The I-FGSM with $\epsilon = 0 . 3$ is applied.
|
| 401 |
+
|
| 402 |
+
C.1 A NOTE ON $\ell _ { \infty }$ ROBUSTNESS ON MNIST
|
| 403 |
+
|
| 404 |
+
The MNIST dataset is a simple baseline for assessing the potential of a defense, but the obtained results do not always generalize to harder tasks. We suggest that this is because achieving robustness to $\ell _ { \infty }$ perturbations admits a simple “closed-form” solution, given the near-binary nature of the data. Indeed, for an average MNIST image, over $8 0 \%$ of the pixels are in $\{ 0 , 1 \}$ and only $6 \%$ are in the range [0.2, 0.8]. Thus, for a perturbation with $\epsilon \leq 0 . 3$ , binarized versions of $x$ and $x ^ { \mathrm { a d v } }$ can differ in at most $6 \%$ of the input dimensions. By binarizing the inputs of a standard CNN trained without adversarial training, we obtain a model that enjoys robustness similar to the model trained by Madry et al. (2017). Concretely, for a white-box I-FGSM attack, we get at most $1 1 . 4 \%$ error.
|
| 405 |
+
|
| 406 |
+
The existence of such a simple robust representation begs the question of why learning a robust model with adversarial training takes so much effort. Finding techniques to improve the performance of adversarial training, even on simple tasks, could provide useful insights for more complex tasks such as ImageNet, where we do not know of a similarly simple “denoising” procedure.
|
| 407 |
+
|
| 408 |
+
These positive results on MNIST for the $\ell _ { \infty }$ norm also leave open the question of defining a general norm for adversarial examples. Let us motivate the need for such a definition: we find that if we first rotate an MNIST digit by $2 0 ^ { \circ }$ , and then use the I-FGSM, our rounding model and the model from Madry et al. (2017) achieve only $6 5 \%$ accuracy (on “clean” rotated inputs, the error is $< 5 \%$ ). If we further randomly “flip” 5 pixels per image, the accuracy of both models drops to under $5 0 \%$ . Thus, we successfully evade the model by slightly extending the threat model (see Figure 3).
|
| 409 |
+
|
| 410 |
+
Of course, we could augment the training set with such perturbations (see Engstrom et al. (2017)). An open question is whether we can enumerate all types of “adversarial” perturbations. In this work, we focus on the $\ell _ { \infty }$ norm to illustrate our findings on the limitations of single-step adversarial training on ImageNet and MNIST, and to showcase the benefits of our Ensemble Adversarial Training variant. Our approach can easily be extended to consider multiple perturbation metrics. We leave such an evaluation to future work.
|
| 411 |
+
|
| 412 |
+
# C.2 RESULTS
|
| 413 |
+
|
| 414 |
+
We repeat experiments from Section 4 on MNIST. We use the architectures in Table 5. We train a standard model for 6 epochs, and an adversarial model with the FGSM $\epsilon = 0 . 3$ ) for 12 epochs.
|
| 415 |
+
|
| 416 |
+
During adversarial training, we avoid the label leaking effect described by Kurakin et al. (2017b) by using the model’s predicted class arg max $h ( x )$ instead of the true label $y _ { \mathrm { t r u e } }$ in the FGSM,
|
| 417 |
+
|
| 418 |
+
We first analyze the “degenerate” minimum of adversarial training, described in Section 3.3. For each trained model, we compute the approximation-ratio of the FGSM for the inner maximization problem in equation (1). That is, we compare the loss produced by the FGSM with the loss of a strong iterative attack. The results appear in Table 6. As we can see, for all model architectures, adversarial training degraded the quality of a linear approximation to the model’s loss.
|
| 419 |
+
|
| 420 |
+
Table 5: Neural network architectures used in this work for the MNIST dataset. Conv: convolutional layer, FC: fully connected layer.
|
| 421 |
+
|
| 422 |
+
<table><tr><td>A</td><td>B</td><td>C</td><td>D</td></tr><tr><td>Conv(64,5,5) +Relu</td><td>Dropout(0.2)</td><td>Conv(128,3,3) + Tanh</td><td>[FC(300) + Relu] ×4</td></tr><tr><td>Conv(64,5,5) + Relu</td><td>Conv(64,8,8) + Relu</td><td>MaxPool(2,2)</td><td>Dropout(0.5)</td></tr><tr><td>Dropout(0.25)</td><td>Conv(128,6,6) +Relu</td><td>Conv(64,3,3) + Tanh</td><td>FC +Softmax</td></tr><tr><td>FC(128) + Relu</td><td>Conv(128,5,5) +Relu</td><td>MaxPool(2,2)</td><td></td></tr><tr><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>FC(128) + Relu</td><td></td></tr><tr><td>FC + Softmax</td><td>FC + Softmax</td><td>FC + Softmax</td><td></td></tr></table>
|
| 423 |
+
|
| 424 |
+
Table 6: Approximation ratio between optimal loss and loss induced by single-step attack on MNIST. Architecture $\mathbf { B } ^ { \prime }$ is the same as B without the input dropout layer.
|
| 425 |
+
|
| 426 |
+
<table><tr><td>A</td><td>Aadv</td><td>B</td><td>Badv</td><td>B*</td><td>Bdv</td><td>C</td><td>Cadv</td><td>D</td><td>Dady</td></tr><tr><td>17%</td><td>0%</td><td>25%</td><td>8%</td><td>23%</td><td>1%</td><td>25%</td><td>0%</td><td>49%</td><td>16%</td></tr></table>
|
| 427 |
+
|
| 428 |
+
We find that input dropout (Srivastava et al., 2014) (i.e., randomly dropping a fraction of input features during training) as used in architecture B limits this unwarranted effect of adversarial training.2 If we omit the input dropout (we call this architecture $\boldsymbol { \mathrm { B } } ^ { * }$ ) the single-step attack degrades significantly. We discuss this effect in more detail below. For the fully connected architecture D, we find that the learned model is very close to linear and thus also less prone to the degenerate solution to the min-max problem, as we postulated in Section 3.3.
|
| 429 |
+
|
| 430 |
+
Attacks. Table 7 compares error rates of undefended and adversarially trained models on whitebox and black-box attacks, as in Section 4.1. Again, model B presents an anomaly. For all other models, we corroborate our findings on ImageNet for adversarial training: (1) black-box attacks trump white-box single-step attacks; (2) white-box single-step attacks are significantly stronger if prepended by a random step. For model $\mathrm { \Delta B _ { a d v } }$ , the opposite holds true. We believe this is because input dropout increases diversity of attack samples similarly to Ensemble Adversarial Training.
|
| 431 |
+
|
| 432 |
+
Table 7: White-box and black-box attacks against standard and adversarially trained models. For each model, the strongest single-step white-box and black box attacks are marked in bold.
|
| 433 |
+
|
| 434 |
+
<table><tr><td rowspan="2"></td><td colspan="2">white-box</td><td colspan="5">black-box</td></tr><tr><td>FGSM</td><td>R+FGSM</td><td>FGSMA</td><td>FGSMB</td><td>FGSMB*</td><td>FGSMc</td><td>FGSMD</td></tr><tr><td>A</td><td>64.7</td><td>69.7</td><td>1</td><td>61.5</td><td>53.2</td><td>46.8</td><td>41.5</td></tr><tr><td>Aadv</td><td>2.2</td><td>14.8</td><td>6.6</td><td>10.7</td><td>8.8</td><td>6.5</td><td>8.3</td></tr><tr><td>B</td><td>85.0</td><td>86.0</td><td>45.7</td><td>1</td><td>69.9</td><td>59.9</td><td>85.9</td></tr><tr><td>Badv</td><td>11.6</td><td>11.1</td><td>6.4</td><td>8.9</td><td>8.5</td><td>4.9</td><td>6.1</td></tr><tr><td>B*</td><td>75.7</td><td>74.1</td><td>44.3</td><td>72.8</td><td>-</td><td>46.0</td><td>62.6</td></tr><tr><td>Badv</td><td>4.3</td><td>40.6</td><td>16.1</td><td>14.7</td><td>15.0</td><td>17.9</td><td>9.1</td></tr><tr><td>C</td><td>81.8</td><td>81.8</td><td>40.2</td><td>55.8</td><td>49.5</td><td>1</td><td>59.4</td></tr><tr><td>Cadv</td><td>3.7</td><td>17.1</td><td>9.8</td><td>29.3</td><td>21.5</td><td>11.9</td><td>21.9</td></tr><tr><td>D</td><td>92.4</td><td>95.4</td><td>61.3</td><td>74.1</td><td>68.9</td><td>65.1</td><td>-</td></tr><tr><td>Dadv</td><td>25.5</td><td>47.5</td><td>32.1</td><td>30.5</td><td>29.3</td><td>28.2</td><td>21.8</td></tr></table>
|
| 435 |
+
|
| 436 |
+
While training with input dropout helps avoid the degradation of the single-step attack, it also significantly delays convergence of the model. Indeed, model $\mathrm { \Delta B _ { a d v } }$ retains relatively high error on white-box FGSM examples. Adversarial training with input dropout can be seen as comparable to training with a randomized single-step attack, as discussed in Section 4.1.
|
| 437 |
+
|
| 438 |
+
The positive effect of input dropout is architecture and dataset specific: Adding an input dropout layer to models A, C and D confers only marginal benefit, and is outperformed by Ensemble Adversarial Training, discussed below. Moreover, Mishkin et al. (2017) find that input dropout significantly degrades accuracy on ImageNet. We thus did not incorporate it into our models on ImageNet.
|
| 439 |
+
|
| 440 |
+
Ensemble Adversarial Training. To evaluate Ensemble Adversarial Training 3.4, we train two models per architecture. The first, denoted $[ \mathrm { A } \mathrm { - } \mathrm { D } ] _ { \mathrm { a d v - e n s } }$ , uses a single pre-trained model of the same type (i.e., $\mathbf { A } _ { \mathrm { a d v - e n s } }$ is trained on perturbations from another model A). The second model, denoted [A$\mathrm { D l a d v } { \mathrm { - e n s } } 3$ , uses 3 pre-trained models $( \{ A , C , D \}$ or $\{ B , C , D \} )$ . We train all models for 12 epochs.
|
| 441 |
+
|
| 442 |
+
We evaluate our models on black-box attacks crafted on models A,B,C,D (for a fair comparison, we do not use the same pre-trained models for evaluation, but retrain them with different random seeds).
|
| 443 |
+
|
| 444 |
+
Table 8: Ensemble Adversarial Training on MNIST. For black-box robustness, we report the maximum and average error rate over a suite of 12 attacks, comprised of the FGSM, I-FGSM and PGD (Madry et al., 2017) attacks applied to models A,B,C and D. We use $\epsilon = 1 6$ in all cases. For each model architecture, we mark the models tied for best (at a $9 5 \%$ confidence level) in bold.
|
| 445 |
+
|
| 446 |
+
<table><tr><td></td><td>Clean</td><td>FGSM</td><td>Max.Black Box</td><td>Avg. Black Box</td></tr><tr><td>Aadv</td><td>0.8</td><td>2.2</td><td>10.8</td><td>7.7</td></tr><tr><td>Aadv-ens</td><td>0.8</td><td>7.0</td><td>6.6</td><td>5.2</td></tr><tr><td>Aadv-ens3</td><td>0.7</td><td>5.4</td><td>6.5</td><td>4.3</td></tr><tr><td>Badv</td><td>0.8</td><td>11.6</td><td>8.9</td><td>5.5</td></tr><tr><td>Badv-ens</td><td>0.7</td><td>10.5</td><td>6.8</td><td>5.3</td></tr><tr><td>Badv-ens3</td><td>0.8</td><td>14.0</td><td>8.8</td><td>5.1</td></tr><tr><td>Cadv</td><td>1.0</td><td>3.7</td><td>29.3</td><td>18.7</td></tr><tr><td>Cadv-ens</td><td>1.3</td><td>1.9</td><td>17.2</td><td>10.7</td></tr><tr><td>Cadv-ens3</td><td>1.4</td><td>3.6</td><td>14.5</td><td>8.4</td></tr><tr><td>Dadv</td><td>2.6</td><td>25.5</td><td>32.5</td><td>23.5</td></tr><tr><td>Dadv-ens</td><td>2.6</td><td>21.5</td><td>38.6</td><td>28.0</td></tr><tr><td>Dadv-ens3</td><td>2.6</td><td>29.4</td><td>29.8</td><td>15.6</td></tr></table>
|
| 447 |
+
|
| 448 |
+
The attacks we consider are the FGSM, I-FGSM and the PGD attack from Madry et al. (2017) with the loss function from Carlini & Wagner (2017a)), all with $\epsilon = 0 . 3$ . The results appear in Table 8. For each model, we report the worst-case and average-case error rate over all black-box attacks.
|
| 449 |
+
|
| 450 |
+
Ensemble Adversarial Training significantly increases robustness to black-box attacks, except for architecture B, which we previously found to not suffer from the same overfitting phenomenon that affects the other adversarially trained networks. Nevertheless, model $\mathrm { B _ { a d v - e n s } }$ achieves slightly better robustness to white-box and black-box attacks than $\mathrm { \Delta B _ { a d v } }$ . In the majority of cases, we find that using a single pre-trained model produces good results, but that the extra diversity of including three pre-trained models can sometimes increase robustness even further. Our experiments confirm our conjecture that robustness to black-box attacks generalizes across models. Indeed, we find that when training with three external models, we attain very good robustness against attacks initiated from models with the same architecture (as evidenced by the average error on our attack suite), but also increased robustness to attacks initiated from the fourth holdout model
|
| 451 |
+
|
| 452 |
+
# D TRANSFERABILITY OF RANDOMIZED SINGLE-STEP PERTURBATIONS.
|
| 453 |
+
|
| 454 |
+
In Section 4.1, we introduced the $\mathbb { R } { + } \mathbb { S }$ tep-LL attack, an extension of the Step-LL method that prepends the attack with a small random perturbation. In Table 9, we evaluate the transferability of $\mathrm { R } +$ Step-LL adversarial examples on ImageNet. We find that the randomized variant produces perturbations that transfer at a much lower rate (see Table 1 for the deterministic variant).
|
| 455 |
+
|
| 456 |
+
Table 9: Error rates $( \mathbf { i n \ } \% )$ of randomized single-step attacks transferred between models on ImageNet. We use $\mathrm { R } +$ Step-LL with $\epsilon = 1 6 / 2 5 6 , \alpha = \epsilon / 2$ for 10,000 random test set samples. The white-box attack always outperforms black-box attacks.
|
| 457 |
+
|
| 458 |
+
<table><tr><td colspan="6">Source</td></tr><tr><td>Target</td><td>v4</td><td>v3</td><td>v3adv</td><td>IRv2</td><td>IRv2ady</td></tr><tr><td>v4</td><td>70.5</td><td>37.2</td><td>23.2</td><td>34.0</td><td>24.6</td></tr><tr><td>v3</td><td>42.6</td><td>80.0</td><td>26.7</td><td>38.5</td><td>27.6</td></tr><tr><td>v3ady</td><td>31.4</td><td>30.7</td><td>64.8</td><td>30.4</td><td>34.0</td></tr><tr><td>IRv2</td><td>36.2</td><td>35.7</td><td>23.0</td><td>56.3</td><td>24.6</td></tr><tr><td>IRv2adv</td><td>26.8</td><td>26.3</td><td>25.2</td><td>26.9</td><td>37.5</td></tr></table>
|
| 459 |
+
|
| 460 |
+
<table><tr><td colspan="6">Source</td></tr><tr><td>Target</td><td>v4</td><td>v3</td><td>v3adv</td><td>IRv2</td><td>IRv2adv</td></tr><tr><td>v4</td><td>42.8</td><td>14.3</td><td>6.3</td><td>11.9</td><td>6.9</td></tr><tr><td>v3</td><td>18.0</td><td>57.1</td><td>8.0</td><td>15.6</td><td>8.6</td></tr><tr><td>v3ady</td><td>10.7</td><td>10.4</td><td>37.1</td><td>10.1</td><td>12.9</td></tr><tr><td>IRv2</td><td>12.8</td><td>13.6</td><td>6.1</td><td>29.3</td><td>7.0</td></tr><tr><td>IRv2adv</td><td>8.0</td><td>8.0</td><td>7.7</td><td>8.3</td><td>15.0</td></tr></table>
|
| 461 |
+
|
| 462 |
+
# E GRADIENT ALIGNED ADVERSARIAL SUBSPACES FOR THE $\ell _ { \infty }$ NORM
|
| 463 |
+
|
| 464 |
+
Tramer et al. (2017) consider the following task for a given model \` $h$ : for a (correctly classified) point $x$ , find $k$ orthogonal vectors $\{ r _ { 1 } , \ldots , r _ { k } \}$ such that $\lVert \boldsymbol { r } _ { i } \rVert _ { 2 } \leq \epsilon$ and all the $\boldsymbol { x } + \boldsymbol { r } _ { i }$ are adversarial (i.e., arg max $h ( x + r _ { i } ) \neq y _ { \mathrm { t r u e } } )$ . By linearizing the model’s loss function, this reduces to finding $k$ orthogonal vectors $r _ { i }$ that are maximally aligned with the model’s gradient $g = \nabla _ { x } L ( h ( x ) , \hat { y _ { \mathrm { t r u e } } } )$ . Tramer et al. (2017) left a construction for the\` $\ell _ { \infty }$ norm as an open problem.
|
| 465 |
+
|
| 466 |
+
We provide an optimal construction for the $\ell _ { \infty }$ norm, based on Regular Hadamard Matrices (Colbourn, 2010). Given the $\ell _ { \infty }$ constraint, we find orthogonal vectors $r _ { i }$ that are maximally aligned with the signed gradient, $\mathtt { s i g n } ( g )$ . We first prove an analog of (Tramer et al., 2017, Lemma 1). \`
|
| 467 |
+
|
| 468 |
+
Lemma 6. Let $v \in \{ - 1 , 1 \} ^ { d }$ and $\alpha \in ( 0 , 1 )$ . Suppose there are $k$ orthogonal vectors $r _ { 1 } , \ldots r _ { n } \in$ $\{ - 1 , 1 \} ^ { d }$ satisfying $v ^ { \top } r _ { i } \geq \alpha \cdot d .$ . Then $\alpha \leq { k ^ { - \frac { 1 } { 2 } } }$ .
|
| 469 |
+
|
| 470 |
+
Proof. Let $\begin{array} { r } { \hat { r _ { i } } = \frac { r _ { i } } { \Vert r _ { i } \Vert _ { 2 } } = \frac { r _ { i } } { \sqrt { d } } } \end{array}$ . Then, we have
|
| 471 |
+
|
| 472 |
+
$$
|
| 473 |
+
d = \| \boldsymbol { v } \| _ { 2 } ^ { 2 } \geq \sum _ { i = 1 } ^ { k } | \boldsymbol { v } ^ { \top } \hat { \boldsymbol { r _ { i } } } | ^ { 2 } = d ^ { - 1 } \sum _ { i = 1 } ^ { k } | \boldsymbol { v } ^ { \top } \boldsymbol { r _ { i } } | ^ { 2 } \geq d ^ { - 1 } \cdot k \cdot \left( { \boldsymbol { \alpha } } \cdot d \right) ^ { 2 } = k \cdot \alpha ^ { 2 } \cdot d \ ,
|
| 474 |
+
$$
|
| 475 |
+
|
| 476 |
+
from which we obtain $\alpha \leq k ^ { - { \frac { 1 } { 2 } } }$ .
|
| 477 |
+
|
| 478 |
+
This result bounds the number of orthogonal perturbations we can expect to find, for a given alignment with the signed gradient. As a warm-up consider the following trivial construction of $k$ orthogonal vectors in $\{ - 1 , 1 \} ^ { d }$ that are “somewhat” aligned with $\mathtt { s i g n } ( g )$ . We split $\mathtt { s i g n } ( g )$ into $k$ “chunks” of size $\frac { d } { k }$ and define $r _ { i }$ to be the vector that is equal to $\mathtt { s i g n } ( g )$ in the $i ^ { \mathrm { t h } }$ chunk and zero otherwise. We obtain $\begin{array} { r } { \mathrm { s i g n } ( g ) ^ { \top } r _ { i } = \frac { d } { k } } \end{array}$ , a factor $\sqrt { k }$ worse than the the bound in Lemma 6.
|
| 479 |
+
|
| 480 |
+
We now provide a construction that meets this upper bound. We make use of Regular Hadamard Matrices of order $k$ (Colbourn, 2010). These are square matrices $H _ { k }$ such that: (1) all entries of √ $H _ { k }$ are in $\{ - 1 , 1 \} ^ { k }$ ; (2) the rows of $H _ { k }$ are mutually orthogonal; (3) All row sums are equal to $\sqrt { k }$ .
|
| 481 |
+
|
| 482 |
+
The order of a Regular Hadamard Matrix is of the form $4 u ^ { 2 }$ for an integer $u$ . We use known constructions for $k \overset { \cdot } { \in } \{ 4 , 1 6 , 3 6 , 6 4 , 1 0 0 \}$ .
|
| 483 |
+
|
| 484 |
+
Lemma 7. Let $\boldsymbol { g } \in \mathbb { R } ^ { d }$ and $k$ be an integer for which a Regular Hadamard Matrix of order $k$ exists. Then, there is a randomized construction of $k$ orthogonal vectors $r _ { 1 } , . . . r _ { n } \in \{ - 1 , 1 \} ^ { d }$ , such that $s i g n ( g ) ^ { \top } r _ { i } = d \cdot k ^ { - 1 / 2 }$ . Moreover, $\mathbb { E } [ g ^ { \top } r _ { i } ] = k ^ { - 1 / 2 } \cdot \lVert g \rVert _ { 1 }$ .
|
| 485 |
+
|
| 486 |
+
Proof. We construct $k$ orthogonal vectors $r _ { 1 } , \ldots , r _ { k } \in \{ - 1 , 1 \} ^ { d }$ , where $r _ { i }$ is obtained by repeating the $\mathrm { i } ^ { \mathrm { t h } }$ row of $H _ { k } \ d / k$ times (for simplicity, we assume that $k$ divides $d$ . Otherwise we pad $r _ { i }$ with zeros). We then multiply each $r _ { i }$ component-wise with $\mathtt { s i g n } ( g )$ . By construction, the $k$ vectors $r _ { i } \in \{ - 1 , 1 \} ^ { d }$ are mutually orthogonal, and we have $\begin{array} { r } { \mathrm { s i g n } ( g ) ^ { \top } r _ { i } = \frac { d } { k } \cdot \sqrt { k } = d \cdot k ^ { - 1 / 2 } } \end{array}$ , which is tight according to Lemma 6.
|
| 487 |
+
|
| 488 |
+
As the weight of the gradient $g$ may not be uniformly distributed among its $d$ components, we apply our construction to a random permutation of the signed gradient. We then obtain
|
| 489 |
+
|
| 490 |
+
$$
|
| 491 |
+
\begin{array} { r l } & { \mathbb { E } [ g ^ { \top } \boldsymbol { r } _ { i } ] = \mathbb { E } \left[ \displaystyle \sum _ { j = 1 } ^ { d } \vert g ^ { ( j ) } \vert \cdot \mathsf { s i g n } ( g ^ { ( j ) } ) \cdot r _ { i } ^ { ( j ) } \right] } \\ & { \quad \quad = \displaystyle \sum _ { j = 1 } ^ { d } \vert g ^ { ( j ) } \vert \cdot \mathbb { E } \left[ \mathsf { s i g n } ( g ^ { ( j ) } ) \cdot r _ { i } ^ { ( j ) } \right] = k ^ { - 1 / 2 } \cdot \| g \| _ { 1 } . } \end{array}
|
| 492 |
+
$$
|
| 493 |
+
|
| 494 |
+
It can be shown that the bound in Lemma 7 can be attained if and only if the $r _ { i }$ are constructed from the rows of a Regular Hadamard Matrix (Colbourn, 2010). For general integers $k$ for which no such matrix exists, other combinatorial designs may be useful for achieving looser bounds.
|
| 495 |
+
|
| 496 |
+
# F ILLUSTRATIONS OF GRADIENT MASKING IN ADVERSARIAL TRAINING
|
| 497 |
+
|
| 498 |
+
In Section 3.3, we show that adversarial training introduces spurious curvature artifacts in the model’s loss function around data points. As a result, one-shot attack strategies based on first-order approximations of the model loss produce perturbations that are non-adversarial. In Figures 4 and 5 we show further illustrations of this phenomenon for the Inception ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ model trained on ImageNet by Kurakin et al. (2017b) as well as for the model $\mathbf { A } _ { \mathrm { a d v } }$ we trained on MNIST.
|
| 499 |
+
|
| 500 |
+

|
| 501 |
+
Figure 4: Additional illustrations of the local curvature artifacts introduced by adversarial training on ImageNet. We plot the loss of model ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ on samples of the form $x ^ { * } = \stackrel { \cdot } { x } + \epsilon _ { 1 } \cdot g + \epsilon _ { 2 } .$ · $g ^ { \perp }$ , where $g$ is the signed gradient of ${ \mathrm { v } } 3 _ { \mathrm { a d v } }$ and $g ^ { \perp }$ is an orthogonal adversarial direction, obtained from an Inception v4 model. The right-side plots are zoomed in versions of the left-side plots.
|
| 502 |
+
|
| 503 |
+

|
| 504 |
+
Figure 5: Illustrations of the local curvature artifacts introduced by adversarial training on MNIST. We plot the loss of model $\mathbf { A _ { \mathrm { a d v } } }$ on samples of the form $x ^ { * } = x + \epsilon _ { 1 } \cdot g + \epsilon _ { 2 } \cdot g ^ { \perp }$ , where $g$ is the signed gradient of model $\mathbf { A } _ { \mathrm { a d v } }$ and $g ^ { \perp }$ is an orthogonal adversarial direction, obtained from model B. The right-side plots are zoomed in versions of the left-side plots.
|
md/train/rkZzY-lCb/rkZzY-lCb.md
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FEAT2VEC: DENSE VECTOR REPRESENTATION OF DATA WITH ARBITRARY FEATURES
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Methods that calculate dense vector representations for features in unstructured data—such as words in a document—have proven to be very successful for knowledge representation. We study how to estimate dense representations when multiple feature types exist within a dataset for supervised learning where explicit labels are available, as well as for unsupervised learning where there are no labels. Feat2Vec calculates embeddings for data with multiple feature types enforcing that all different feature types exist in a common space. In the supervised case, we show that our method has advantages over recently proposed methods; such as enabling higher prediction accuracy, and providing a way to avoid the cold-start problem. In the unsupervised case, our experiments suggest that Feat2Vec significantly outperforms existing algorithms that do not leverage the structure of the data. We believe that we are the first to propose a method for learning unsupervised embeddings that leverage the structure of multiple feature types.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Informally, in machine learning a dense representation, or embedding of a vector $\vec { x } \in \mathbb { R } ^ { n }$ is another vector $\vec { y } \in \mathbb { R } ^ { r }$ that has much lower dimensionality $( r \ll n )$ than the original representation, and can be used to replace the original vector in downstream prediction tasks. Embeddings have multiple advantages, as they enable more efficient training (Mikolov et al., 2013), and unsupervised learning (Schnabel et al., 2015). For example, when applied to text, semantically similar words are mapped to nearby points.
|
| 12 |
+
|
| 13 |
+
We consider two kind of algorithms that use embeddings:
|
| 14 |
+
|
| 15 |
+
1. Unsupervised methods (sometimes referred as self-supervised methods) like Word2Vec (Mikolov et al., 2013), are designed to provide embeddings that are useful for a wide-array of predictions tasks. For example, the loss function of the continuous bag of words (CBOW) algorithm of Word2Vec is tuned to predict the next word of a sequence; however, in practice, the embeddings produced are mostly used for other tasks, such as analogy solving (Mikolov et al., 2013), or sentiment analysis (Le & Mikolov, 2014). In the context of this paper, we refer to the embeddings of an unsupervised method that can be used for a variety of auxiliary prediction tasks as general-purpose.
|
| 16 |
+
2. Supervised methods, like matrix factorization, produce embeddings that are highly tuned to a prediction task. These embeddings may be interpretable but do not usually generalize to other tasks. We refer to these embeddings as task-specific. Matrix factorization and Word2Vec are unable to calculate embeddings for items that are not available during training (“cold-start” problem). While recent work using n-gram features (Bojanowski et al., 2016) have addressed this limitation for supervised and unsupervised tasks, it can only be used for a single feature type—words.
|
| 17 |
+
|
| 18 |
+
In this paper we propose Feat2Vec as a novel method that allows calculating embeddings of arbitrary feature types from both supervised and unsupervised data. Our main contributions are:
|
| 19 |
+
|
| 20 |
+
• Unsupervised Feat2Vec. Existing general-purpose dense representation methods are largely restricted to one or two feature types. For example, the Word2Vec methods can only calculate embeddings for words, while follow-up work has enabled embeddings for both words and documents (Le & Mikolov, 2014). To our knowledge, Feat2Vec is the first algorithm that is able to calculate general-purpose embeddings that are not tuned for a single specific prediction task for arbitrary feature types.
|
| 21 |
+
|
| 22 |
+
• Supervised Feat2Vec. Task-specific methods can use arbitrary feature types, but are restricted in that embeddings must be calculated for each individual feature, while sometimes higher-level of abstractions may be desirable—for example, we may want to have embeddings of documents instead of simply words. This capability makes Supervised Feat2Vec extremely flexible. We demonstrate that our method can be used to calculate embeddings of unseen (cold-start) items when there is an alternative textual description.
|
| 23 |
+
|
| 24 |
+
# 2 PRELIMINARIES
|
| 25 |
+
|
| 26 |
+
Factorization Machine (Rendle, 2010) is one of the most successful methods for general-purpose factorization. Rendle (2010) formulated it as an extension to polynomial regression. Consider a degree-2 polynomial (quadratic) regression, where we want to predict a target variable $y$ from a vector of inputs ${ \vec { x } } \in \mathbb { R } ^ { n }$ :
|
| 27 |
+
|
| 28 |
+
$$
|
| 29 |
+
\hat { y } ( \vec { x } ; \vec { b } , \vec { w } ) = \omega \big ( b _ { 0 } + \sum _ { i } b _ { i } x _ { i } + \sum _ { i = 1 } ^ { n } \sum _ { j = i + 1 } ^ { n } w _ { i , j } \ x _ { i } x _ { j } \big )
|
| 30 |
+
$$
|
| 31 |
+
|
| 32 |
+
In words, $n$ is the total number of features, the term $b _ { 0 }$ is an intercept, $b _ { i }$ is the strength of the $i$ -th feature, and $w _ { i , j }$ is the interaction coefficient between the $i$ -th and $j$ -th feature. The function $\omega$ is an activation. Choices for $\omega$ include a linear link $\omega ( x ) = x ,$ ) for continuous outputs, or a logistic link $\begin{array} { r } { ( \omega ( x ) = \frac { \exp ( x ) } { \exp ( x ) + 1 } ) } \end{array}$ for binary outputs.
|
| 33 |
+
|
| 34 |
+
Factorization Machine replaces the two-way individual pairwise parameters $w _ { i , j }$ for each interaction with a vector of parameters $\vec { w } _ { i }$ for each feature. This is a rank- $r$ vector of latent factors—embeddings in the neural literature—that encode the interaction between features and replaces the quadratic regression model with the following:
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
{ \hat { y } } ( { \vec { x } } ; { \vec { b } } , { \vec { w } } ) = \omega { \big ( } b _ { 0 } + \sum _ { i } b _ { i } x _ { i } + \sum _ { i = 1 } ^ { n } \sum _ { j = i + 1 } ^ { n } ( x _ { i } { \vec { w _ { i } } } ) \cdot ( x _ { j } { \vec { w _ { j } } } ) { \big ) }
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
Intuitively, the dot product $( \cdot )$ returns a scalar that measures the (dis)similarity between the latent factors of features $x _ { i }$ and $x _ { j }$ . Polynomial regression has $n ^ { 2 }$ interaction parameters, and Factorization Machine has $n \times r$ . While setting $r \ll n$ makes the model less expressive, factorization will typically exploit features having some shared latent structure. Factorization Machine may dramatically reduce the number of parameters to estimate. Rendle (2010) shows that when the feature vector x consists only of two categorical features in one-hot encoding, Factorization Machine is equivalent to the popular Matrix Factorization algorithm (Koren et al., 2009).
|
| 41 |
+
|
| 42 |
+
# 3 FEAT2VEC
|
| 43 |
+
|
| 44 |
+
We now describe how Feat2Vec extends the Factorization Machine model by allowing grouping of features, and enabling arbitrary feature extraction functions $( \ S \ 3 . 1 )$ . We also report a supervised method to learning Feat2Vec (§ 3.2), as well as a novel unsupervised training procedure (§ 3.3).
|
| 45 |
+
|
| 46 |
+
# 3.1 MODEL
|
| 47 |
+
|
| 48 |
+
We propose a framework for extending factorization machine with neural methods, by introducing structure into the feature interactions. Specifically, we do this by defining feature groups, \~κ, where each group contains features of a particular type. Explicitly, $\dot { \vec { \kappa } }$ is a partition of the set of feature columns in a dataset and each set within the partition is a feature group. The embeddings of a feature group are then learned via a feature extraction function, $\phi _ { i }$ , defined for each feature group. Feat2Vec will then extract features from each feature group, and build $r$ latent factors from them. In Factorization Machine, all the feature embeddings interact with each other, while in Feat2Vec, the interactions only occur between different feature groups.
|
| 49 |
+
|
| 50 |
+
Formally, the addition of deep extraction methods yields the following statistical model:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
{ \hat { y } } ( { \vec { x } } , { \vec { b } } , { \vec { \phi } } ) = \omega \bigg ( b _ { 0 } + \sum _ { i = 1 } ^ { n } b _ { i } x _ { i } ~ + ~ \sum _ { i = 1 } ^ { | { \vec { \kappa } } | } \sum _ { j = i } ^ { | { \vec { \kappa } } | } \phi _ { i } ( { \vec { x } } _ { { \vec { \kappa } } _ { i } } ) \cdot \phi _ { j } ( { \vec { x } } _ { { \vec { \kappa } } _ { j } } ) \bigg )
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
In this notation, $\vec { x } _ { \vec { \kappa } _ { i } }$ is a subvector that contains all of the features that belong to the group ${ \vec { \kappa } } _ { i }$ . Thus, $x _ { \vec { \kappa } _ { i } } = [ x _ { j } : j \in \vec { \kappa } _ { i } ]$ . The intuition is that by grouping (sub-)features as a single entity, we can can reason on a higher level of abstraction. Instead of individual sub-features interacting among each other, the embeddings of feature groups interact with those of other groups. $\phi _ { i }$ is a feature extraction that inputs the $i$ -th feature group of the instance, and returns an $r$ -dimensional embedding. The feature extraction function $\phi _ { i }$ can allow for an arbitrary processing of its subfeatures. Across groups, entities interact with each other via the output of $\phi$ only.
|
| 57 |
+
|
| 58 |
+
As a concrete example of an application of this grouping/feature extraction, we might group the individual words of a document into a “document” feature group, and allow this document embedding to then interact with learned embeddings of other document metadata (such as author id). We might expect the extraction function $\phi$ for the words in a document to extract features that characterize the attributes of the document taken as a whole, rather than simply the sum of its individual words.
|
| 59 |
+
|
| 60 |
+
Figure 1 compares existing factorization methods with our novel model. In this example, Feat2Vec is using two feature groups: the first group only has a single feature which is projected to an embedding (just like a regular Factorization Machine); the second group has multiple features, which are together projected to a single embedding.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 1: Network architectures for factorization models. The white clouds $( \bigcirc )$ represent deep layers, for example a convolutional network for text features.
|
| 64 |
+
|
| 65 |
+
The simplest implementation for $\phi _ { i }$ is a linear fully-connected layer, where the output of the $r$ -th entry is:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\phi _ { i } \big ( \vec { x } _ { i } ; \vec { w } \big ) _ { r } = \sum _ { a = 1 } ^ { d _ { i } } w _ { r _ { a } } x _ { i _ { a } }
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Note that without loss of generality, we could define a model that is equivalent to a shallow Factorization Machine by allowing each feature group to be a singleton : $\vec { \kappa } \overset { \cdot } { = } \{ \{ x _ { 1 } \} , \{ x _ { 2 } \} \ldots \{ x _ { n } \} \}$ and the linear extraction function presented in Equation 4.
|
| 72 |
+
|
| 73 |
+
We can use Feat2Vec to both use large feature sets and overcome the cold-start problem. This is only possible when there is an alternative description of the item available (for example an image or a passage of text). In Figure 2, we show how we address this problem by treating the words as indexed features, but placed within a structured feature group $\kappa _ { w }$ , the group of word features. A feature extraction function $\phi$ acts on the features in $\kappa _ { w }$ , and the other features interact with the words only via the output of $\phi$ . Notice that this implies we can precompute and store the latent factors of the target task seen during training, so that predictions during inference can be sped-up. For example if we have two feature groups (e.g, a label and an item), first we compute the feature extraction function to the unseen items and their embeddings, and then we simply apply a dot product over the stored vectors of the labels.
|
| 74 |
+
|
| 75 |
+

|
| 76 |
+
Figure 2: Comparison of how factorization may use item descriptions features.
|
| 77 |
+
|
| 78 |
+
Figure 1c shows an approach of using neural networks within factorization machines that has been proposed multiple times (Dziugaite & Roy, 2015; Guo et al., 2017). It replaces the dot product of factors with a learned neural function, which has been shown to improve predictive accuracy for various tasks. In this case, fast inference for cold-start documents using pre-computed label embeddings is no longer possible. It needs to store the entire neural function that takes the embeddings as inputs. Another shortcoming of replacing the dot product with a neural function is that it would no longer be possible to interpret the embeddings as containing latent factors related to the target task; There may be highly complex mappings from the embeddings to the final output via this neural function. However, it would be straightforward to combine this approach with Feat2Vec. This is not explored in this work.
|
| 79 |
+
|
| 80 |
+
# 3.2 SUPERVISED LEARNING FROM DATA
|
| 81 |
+
|
| 82 |
+
We can learn the the parameters of a deep factorization model θ using training data by minimizing a loss function $\mathcal { L }$ :
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\arg \operatorname* { m i n } _ { \vec { \Theta } } \sum _ { x } \mathcal { L } \big ( y ( x ) , \hat { y } ( x ; \vec { \theta } ) \big ) + \gamma | | \Theta | | ^ { w }
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Here, $y ( x )$ is the true target value for $x$ obtained from training data, and ${ \hat { y } } ( x )$ is the one estimated by the model; the hyperparameter $\gamma$ controls the amount of regularization. For the labeling and classification tasks, we optimize the binary cross-entropy for $y \in \{ 0 , 1 \}$ :
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { L } ( y , \hat { y } ) = - \big ( y \log ( \hat { y } ) \big ) - ( 1 - y ) \log ( 1 - \hat { y } ) \big )
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
For the regression tasks where the target value is continuous, we optimize the mean squared error (MSE):
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { L } ( y , \hat { y } ) = ( y - \hat { y } ) ^ { 2 }
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
Neural models are typically learned using mini-batch updates, where the incremental descent is performed with respect to several instances at a time. For the implementation of this paper, we built our models using the Keras programming toolkit (Chollet et al., 2015), that is now part of Tensorflow (Abadi et al., 2015). It enables automatic differentiation, and is bundled with a generalpurpose optimization algorithm called ADAM (Kingma & Ba, 2014) that needs no tuning of gradient step sizes.
|
| 101 |
+
|
| 102 |
+
It is straightforward to optimize Equation 5 directly for multiclass or binary classification. However, when the number of labels is very large, it is common practice use a binary classifier and sample the negative examples (Dyer, 2014). For the multi-label classification tasks, we use Feat2Vec with a binary output. In this case we would have at least two feature groups—one of the feature groups is the label that we want to predict, and the other group(s) is the input from which we want to make the prediction. The output indicates whether the label is associated with the input $( y = + 1 )$ ), or not $( y = 0 )$ ). The datasets we use for our labeling experiments only contains positive labels, thus for each training example we sample a set of negative labels equal to the number of positive labels. It is typical to use one of the following sampling strategies according to the best validation error, in each case excluding the actual positive labels for each training example – (i) uniformly from all possible labels, or (ii) from the empirical distributions of positive labels. Other sampling strategies have been proposed (Rendle et al., 2009; Rendle & Freudenthaler, 2014).
|
| 103 |
+
|
| 104 |
+
# 3.3 UNSUPERVISED LEARNING FROM DATA
|
| 105 |
+
|
| 106 |
+
We now discuss how Feat2Vec can be used to learn embeddings in an unsupervised setting with no explicit target for prediction.
|
| 107 |
+
|
| 108 |
+
The training dataset for a Feat2Vec model consists of only the observed data. In natural language, these would be documents written by humans. Since Feat2Vec (Equation 3) requires positive and negative examples, we also need to supply unobserved data as negative examples. Consider a feature group $\vec { \mathsf { K } } _ { i }$ , that exists in very high dimensional space. For example, this could happen because we are modeling with one-hot encoding a categorical variable with large number of possible values. In such scenario, it is overwhelmingly costly to feed the model all negative labels, particularly if the model is fairly sparse.
|
| 109 |
+
|
| 110 |
+
A shortcut around this is a concept known as implicit sampling, where instead of using all of the possible negative labels, one simply samples a fixed number $( k )$ from the set of possible negative labels for each positively labelled record. Word2Vec makes use of an algorithm called Negative Sampling, that has little theoretical guarantees (Dyer, 2014). In short, their approach samples a negative observation from a noise distribution $\mathcal { Q } _ { w 2 v }$ , that is proportional to the empirical frequency of a word in the training data.
|
| 111 |
+
|
| 112 |
+
We introduce a new implicit sampling method that enables learning unsupervised embeddings for structured feature sets. We can learn the correlation of features within a dataset by imputing negative labels, simply by generating unobserved records as our negative samples. Unlike Word2Vec, we do not constraint features types to be words. Features groups can be individual columns in a data matrix, but they need not to be. By grouping subfeatures using the parameter $\boldsymbol { \mathsf { K } }$ in Equation 3, the model can reason on more abstract entities in the data. By entity, we mean a particular feature group value. For example, in our experiments on a movie dataset, we use a “genre” feature group, where we group non-mutually exclusive indicators for movie genres including comedy, action, and drama films.
|
| 113 |
+
|
| 114 |
+
We start with a dataset $S ^ { + }$ of records with |\~κ| feature groups. We then mark all observed records in the training set as positive examples. For each positive record, we generate $k$ negative labels using the following 2-step algorithm:
|
| 115 |
+
|
| 116 |
+
# Algorithm 1 Implicit sampling algorithm for unsupervised Feat2Vec: $\mathcal { Q }$
|
| 117 |
+
|
| 118 |
+
1: function FEAT2VEC SAMPLE(S+, k, α1, α2)
|
| 119 |
+
2: S − ← ∅
|
| 120 |
+
3: for \~x + ∈ S+ do
|
| 121 |
+
4: Draw a random feature group $\kappa _ { i } \sim \mathcal { Q } _ { 1 } ( \{ \mathrm { p a r a m s } ( \phi _ { i } ) \} _ { i = 1 } ^ { | \vec { \kappa } | } , \alpha _ { 1 } )$
|
| 122 |
+
5: for $j \in \{ 1 , \ldots , k \}$ do
|
| 123 |
+
6: \~x − ← \~x + $\triangleright$ set initially to be equal to the positive sample
|
| 124 |
+
7: Draw a random feature group value $\tilde { x } \sim \mathcal { Q } _ { 2 } ( \mathrm { X } _ { \kappa _ { i } , \alpha _ { 2 } } )$
|
| 125 |
+
8: $\begin{array} { l } { { { \vec { x } _ { \kappa _ { i } } ^ { - } \tilde { x } } } } \\ { { { S ^ { - } S ^ { - } + \{ \vec { x } ^ { - } \} } } } \end{array}$ $\triangleright$ substitute the $i$ -th feature type with the sampled one
|
| 126 |
+
9:
|
| 127 |
+
10: end for
|
| 128 |
+
11: end for
|
| 129 |
+
12: return $S ^ { - }$
|
| 130 |
+
13: end function
|
| 131 |
+
|
| 132 |
+
Explained in words, our negative sampling method for unsupervised learning iterates over all of the observations of the training dataset. For each observation ${ \bar { x } } ^ { + }$ , it randomly selects the $i$ -th feature group from a noise distribution $\mathcal { Q } _ { 1 } ( \cdot )$ . Then, it creates a negative observation that is identical to ${ \vec { x } } ^ { + }$ , except that its $i$ -th feature group is replaced by a value sampled from a noise distribution $\mathcal { Q } _ { 2 } ( \cdot )$ . In our application, we use the same class of noise distributions (flattened multinomial) for both levels of sampling, but this need not necessarily be the case.
|
| 133 |
+
|
| 134 |
+
We now describe the two noise distributions that we use. We use $P _ { \mathcal { Q } } ( x )$ to denote the probability of $x$ under a distribution $\mathcal { Q }$ .
|
| 135 |
+
|
| 136 |
+
Sampling Feature Groups. The function params calculates the complexity of a feature extraction function $\phi _ { i }$ . To sample a feature group, we choose a feature group $\kappa _ { i }$ from a multinomial distribution with probabilities proportional a feature’s complexity. By complexity, we mean the number of parameters we need to learn that are associated with a particular feature group. This choice places more weight on features that have more parameters and thus are going to require more training iterations to properly learn. The sampling probabilities of each feature group are:
|
| 137 |
+
|
| 138 |
+
$$
|
| 139 |
+
P _ { \mathcal { Q } _ { 1 } } ( \kappa _ { i } | \operatorname { p a r a m s } ( \phi _ { i } ) \} _ { i = 1 } ^ { | \sharp | } , \alpha _ { 1 } ) = \frac { \operatorname { p a r a m s } ( \phi _ { i } ) ^ { \alpha _ { 1 } } } { \sum _ { j = 1 } ^ { | \sharp | } \operatorname { p a r a m s } ( \phi _ { j } ) ^ { \alpha _ { 1 } } } , \quad \alpha _ { 1 } \in [ 0 , 1 ]
|
| 140 |
+
$$
|
| 141 |
+
|
| 142 |
+
For categorical variables using a linear fully-connected layer, the complexity is simply proportional to the number of categories in the feature group. However, if we have multiple intermediate layers for some feature extraction functions (e.g., convolutional layers), these parameters should also be counted towards a feature group’s complexity. The hyper-parameter $\alpha _ { 1 }$ helps flatten the distribution. When $\alpha _ { 1 } = 0$ , the feature groups are sampled uniformly, and when $\alpha _ { 1 } = 1$ , they are sampled proportional to their complexity. Figure A.1 in the Appendix provides a visualization of how the feature sampling rate varies with the hyperparameter for features with differing levels of complexity.
|
| 143 |
+
|
| 144 |
+
Sampling Feature Group Values. To sample a value from within a feature groups $\kappa _ { i }$ , we use a similar strategy to Word2Vec and use the empirical distribution of values:
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
P _ { \mathcal Q _ { 2 } } ( x | \mathrm X _ { \kappa _ { i } } , \alpha _ { 2 } ) = \frac { \mathrm { c o u n t } ( x ) ^ { \alpha _ { 2 } } } { \sum _ { x _ { \kappa _ { i } } ^ { \prime } \in S ^ { + } } \mathrm { c o u n t } ( x _ { \kappa _ { i } } ^ { \prime } ) ^ { \alpha _ { 2 } } } , \quad \alpha _ { 2 } \in [ 0 , 1 ]
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
Here, $\operatorname { c o u n t } ( x )$ is the number of times a feature group value $x$ appeared in the training dataset $S ^ { + }$ , and $\alpha _ { 2 }$ is again a flattening hyperparameter.
|
| 151 |
+
|
| 152 |
+
This method will sometimes by chance generate negatively labeled samples that do exist in our sample of observed records. The literature offers two possibilities: in the Negative Sampling that Word2Vec follows, the duplicate negative samples are simply ignored (Dyer, 2014). Alternatively, it is possible to account for the probability of random negative labels that are identical to positively labeled data using Noise Contrastive Estimation (NCE) (Gutmann & Hyvarinen, 2010). ¨
|
| 153 |
+
|
| 154 |
+
# 3.3.1 THE LOSS FUNCTION FOR UNSUPERVISED LEARNING
|
| 155 |
+
|
| 156 |
+
For our unsupervised learning of embeddings, we optimize a NCE loss function, to adjust the structural statistical model $\hat { y } = p ( y = 1 | \vec { x } , \vec { \phi } , \Theta )$ , expressed in Equation 3 to account for the possibility of random negative labels that appear identical to positively labeled data. θ here represents the parameters learned in during training (i.e. the $b _ { i }$ terms and parameters associated with the extraction functions $\phi _ { i }$ in Equation 3). Since we only deal with a dichotomous label, indicating a positive or negative sample, for unsupervised learning, we restrict our attention to usage of Equation 3 with $\omega$ as a logistic link function.
|
| 157 |
+
|
| 158 |
+
An additional burden of NCE is that we need to calculate a partition function $Z _ { \vec { x } }$ for each unique record type $\vec { x }$ in the data that transforms the probability $\hat { y }$ of a positive or negative label into a wellbehaved distribution that integrates to 1. Normally, this would introduce an astronomical amount of computation and greatly increase the complexity of the model. As a work-around, we appeal to the work of Mnih & Teh (2012), who showed that in the context of language models that setting the $Z _ { \vec { x } } = 1$ in advance effectively does not change the performance of the model. The intuition is that if the underlying model has enough free parameters that it will effectively learn the probabilities itself. Thus, it does not over/under predict the probabilities on average (since that will result in penalties on the loss function).
|
| 159 |
+
|
| 160 |
+
Written explicitly, the new structural probability model is:
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
\tilde { p } ( Y = 1 | \vec { x } , \vec { \phi } , \mathbf { \Theta } \Theta ) = \frac { \exp \bigl ( s ( \vec { x } , \vec { \phi } , \mathbf { \Theta } \Theta ) \bigr ) } { \exp ( s ( \vec { x } , \vec { \phi } , \mathbf { \Theta } \Theta ) \bigr ) + P _ { \mathcal { Q } } ( \vec { x } | \alpha _ { 1 } , \alpha _ { 2 } ) }
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
where $s ( . )$ denotes the score of a record $\vec { x }$ given parameter values/extraction functions:
|
| 167 |
+
|
| 168 |
+
$$
|
| 169 |
+
s ( \vec { x } , \vec { \phi } , \Theta ) = b _ { 0 } + \sum _ { i = 1 } ^ { n } b _ { i } x _ { i } + \sum _ { i = 1 } ^ { | \vec { \kappa } | } \sum _ { j = i } ^ { | \vec { \kappa } | } \phi _ { i } ( \vec { x } _ { \vec { \kappa } _ { i } } ) \cdot \phi _ { j } ( \vec { x } _ { \vec { \kappa } _ { j } } )
|
| 170 |
+
$$
|
| 171 |
+
|
| 172 |
+
and $P _ { \mathcal { Q } } ( . )$ denotes the total probability of a record $\vec { x _ { i } }$ being drawn from our negative sampling algorithm, conditional on the positively labeled record ${ \vec { x } } ^ { + }$ the negative sample is drawn for:
|
| 173 |
+
|
| 174 |
+
$$
|
| 175 |
+
P _ { \mathcal { Q } } ( \vec { x } | \alpha _ { 1 } , \alpha _ { 2 } , \mathrm { X } , \vec { x } ^ { + } ) = P _ { \mathcal { Q } _ { 2 } } ( \vec { x } _ { \bf { \kappa } _ { i } } | \mathrm { X } _ { \bf { \kappa } _ { i } } , \alpha _ { 2 } ) P _ { \mathcal { Q } _ { 1 } } ( \kappa _ { i } | \mathrm { p a r a m s } ( \phi _ { i } ) \rbrace _ { i = 1 } ^ { n } , \alpha _ { 1 } )
|
| 176 |
+
$$
|
| 177 |
+
|
| 178 |
+
Our loss function $L$ optimizes $\theta$ , the parameters of the feature extraction functions $\vec { \phi }$ , while accounting for the probability of negative samples.
|
| 179 |
+
|
| 180 |
+
$$
|
| 181 |
+
L ( S ) = \arg \operatorname* { m i n } _ { \Theta } \frac { 1 } { | S ^ { + } | } \sum _ { \vec { x } ^ { + } \in S ^ { + } } \Big ( \log ( \tilde { p } ( y = 1 | \vec { x } ^ { + } , \vec { \phi } , \Theta ) ) \ + \sum _ { \vec { x } ^ { - } \sim \mathcal { Q } ( \cdot | \vec { x } ^ { + } ) } ^ { k } \log ( \tilde { p } ( y = 0 | \vec { x } ^ { - } , \vec { \phi } , \Theta ) ) \Big )
|
| 182 |
+
$$
|
| 183 |
+
|
| 184 |
+
Feat2Vec has interesting theoretical properties. For example, it is well known that Factorization Machines can be used as a multi-label classifier: with at least two features, one can use one of the feature as the target label, and the other as the input feature to make a prediction. In such setting, the output indicates whether the label is associated with the input $( y = + 1 )$ ), or not $( y = 0 )$ ), and therefore the input can be associated with more than one label. With $n$ feature types, Feat2Vec is equivalent to optimizing a convex combination of the loss functions from $n$ individual Factorization Machines. In other words, it optimizes $n$ multi-label classifiers, where each classifier is optimized for a different target (i.e.,a specific feature group). We show the proof of this in the Appendix 1.
|
| 185 |
+
|
| 186 |
+
# 4 EMPIRICAL RESULTS
|
| 187 |
+
|
| 188 |
+
# 4.1 SUPERVISED EMBEDDINGS
|
| 189 |
+
|
| 190 |
+
We now address our working hypotheses for evaluating supervised embeddings. For all our experiments we define a development set and a single test set which is $10 \%$ of the dataset, and a part of the development set is used for early stopping or validating hyper-parameters. Since these datasets are large and require significant time to train on an Nvidia K80 GPU cluster, we report results on only a single training-test split. For the multi-label classification task in 4.1.1 we predict a probability for each document-label pair and use an evaluation metric called Area Under the Curve (AUC) of the Receiver Operating Characteristic (ROC). Since we only observe positive labels, for each positive label in the test set we sample negative labels according to the label frequency. This ensures that if a model merely predicts the labels according to their popularity, it would have an AUC of 0.5. A caveat of our evaluation strategy is that we could be underestimating the performance of our models—there is a small probability that the sampled negatives labels are false negatives. However, since we apply the same evaluation strategy consistently across our methods and baselines, the relative difference of the AUC is meaningful. We choose the AUC as a metric because it is popular for both classification and ranking problems. For the regression task in 4.1.2, we use mean squared error (MSE) as the evaluation metric. In preliminary experiments we noticed that regularization slows down convergence with no gains in prediction accuracy, so we avoid overfitting only by using early stopping. We share most of the code for the experiments online1 for reproducibility.
|
| 191 |
+
|
| 192 |
+
For our feature extraction function $\phi$ for text, we use a Convolutional Neural Network (CNN) that has been shown to be effective for natural language tasks (Kalchbrenner et al., 2014; Weston et al., 2014). In Appendix B we describe this network and its hyper-parameters. Instead of tuning the hyper-parameters, we follow previously published guidelines (Zhang & Wallace, 2015).
|
| 193 |
+
|
| 194 |
+
# 4.1.1 IS Feat2Vec EFFECTIVE FOR COLD-START PREDICTIONS?
|
| 195 |
+
|
| 196 |
+
We compare Feat2Vec with an extension of matrix factorization that can generalize to unseen items for text documents, Collaborative Topic Regression (CTR– Wang & Blei (2011)), a method with an open-source Python implementation2. We evaluate them on the CiteULike dataset which consists of pairs of scientific articles and the users who have added them to their personal libraries, and it contains 16,980 unique articles and 5,551 unique users. We use the models to predict users who may have added a given article to their library. We compare the performance of Feat2Vec with CTR using pre-defined cross-validation splits3. We use $1 \%$ of the training set for early stopping.
|
| 197 |
+
|
| 198 |
+
Table 1: Yelp rating prediction
|
| 199 |
+
|
| 200 |
+
<table><tr><td></td><td>MSE</td><td>Improvement over Matrix Factorization</td></tr><tr><td>Matrix Factorization</td><td>1.561</td><td>=</td></tr><tr><td>Feat2Vec</td><td>0.480</td><td>69.2 %</td></tr><tr><td>DeepCoNN</td><td>1.441</td><td>19.6 %</td></tr></table>
|
| 201 |
+
|
| 202 |
+
For CTR we use the hyper-parameters reported by the authors as best, except for $r$ which we found had a significant impact on training time . We only consider $r \in \{ 5 , 1 0 , 1 5 \}$ and choose the value which gives the best performance for CTR (details in Appendix A.2). On the warm-start condition, CTR has an AUC of 0.9356; however, it shows significant degradation in performance for unseen documents and it only performs slightly better than random chance with an AUC of 0.5047. On the other hand, Feat2Vec achieves AUC of 0.9401 on the warm-start condition, and it only degrades to 0.9124 on unseen documents. Feat2Vec can also be trained over ten times faster, since it can leverage GPUs.4 We also note that we have not tuned the architecture or hyper-parameters of the feature extraction function $\phi$ and greater improvements are possible by optimizing them.
|
| 203 |
+
|
| 204 |
+
# 4.1.2 COMPARISON WITH ALTERNATIVE CNN-BASED TEXT FACTORIZATION
|
| 205 |
+
|
| 206 |
+
We now compare with a method called DeepCoNN, a deep network specifically designed for incorporating text into matrix factorization (Zheng et al., 2017)—which reportedly, is the state of the art for predicting customer ratings when textual reviews are available. For Feat2Vec we use the same feature extraction function (see Appendix B.1 for details) used by DeepCoNN. We evaluate on the Yelp dataset5, which consists of 4.7 million reviews of restaurants. For each user-item pair, DeepCoNN concatenates the text from all reviews for that item and all reviews by that user. The concatenated text is fed into a feature extraction function followed by a factorization machine. In contrast, for Feat2Vec, we build 3 feature groups: item identifiers (in this case, restaurants), users and review text.
|
| 207 |
+
|
| 208 |
+
Table 1 compares our methods to DeepCoNN’s published results because a public implementation is not available. We see that Feat2Vec provides a large performance increase when comparing the reported improvement, over Matrix Factorization, of the mean squared error. Our approach is more general, and we claim that it is also more efficient. Since DeepCoNN concatenates text, when the average reviews per user is $\bar { n _ { u } }$ and reviews per item is $\bar { n _ { i } }$ , each text is duplicated on average $\bar { n _ { i } } \times \bar { n _ { u } }$ times per training epoch. In contrast, for Feat2Vec each review is seen only once per epoch. Thus it can be 1-2 orders of magnitude more efficient for datasets where $\bar { n _ { i } } \times \bar { n _ { u } }$ is large.
|
| 209 |
+
|
| 210 |
+
# 4.2 GENERAL-PURPOSE EMBEDDINGS
|
| 211 |
+
|
| 212 |
+
# 4.2.1 DOES Feat2Vec ENABLE BETTER EMBEDDINGS?
|
| 213 |
+
|
| 214 |
+
Ex ante, it is unclear to us how to evaluate the performance of an unsupervised embedding algorithm, but we felt that a reasonable task would be a ranking task one might practically attempt using our datasets. This task will assess the similarity of trained embeddings using unseen records in a left-out dataset. In order to test the relative performance of our learned embeddings, we train our unsupervised Feat2Vec algorithm and compare its performance in a targeted ranking task to Word2Vec’s CBOW algorithm for learning embeddings. In our evaluation approach, we compare the cosine similarity of the embeddings of two entities where these entities are known to be associated with each other since they appear in the same observation in a test dataset. In particular, in the movie dataset we compare the similarity of movie directors to those of actors who were cast in the same film for a left-out set of films. For our educational dataset, we compare rankings of textbooks by evaluating the similarity of textbook and user embeddings. We evaluate the rankings according to their mean percentile rank (MPR):
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
M P R = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \frac { R _ { i } } { \operatorname* { m a x } R }
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
where $R _ { i }$ is the rank of the entity under our evaluation procedure for observation $i$ . This measures on average how well we rank actual entities. A score of 0 would indicate perfect performance (i.e. top rank every test sample given), so a lower value is better under this metric. See the appendix $\ S \mathrm { A } . 1$ for further details on the experimental setup.
|
| 221 |
+
|
| 222 |
+
# 4.2.2 DATASETS
|
| 223 |
+
|
| 224 |
+
Movies The Internet Movie Database (IMDB) is a publicly available dataset6 of information related to films, television programs and video games. Though in this paper, we focus only on data on its 465,136 movies. Table A.1 in the appendix $( \ S \mathrm { A } . 1 )$ summarizes the feature types we use. It contains information on writers, directors, and principal cast members attached to each film, along with metadata.
|
| 225 |
+
|
| 226 |
+
Education We use a dataset from an anonymized leading technology company that provides educational services. In this proprietary dataset, we have 57 million observations and 9 categorical feature types which include textbook identifier, user identifier, school identifier, and course the book is typically used with, along with other proprietary features. Here, each observation is an “interaction” a user had with a textbook.
|
| 227 |
+
|
| 228 |
+
# 4.2.3 RESULTS
|
| 229 |
+
|
| 230 |
+
After training, we use the cast members associated with the movies of the test set and attempt to predict the actual director the film was directed. We take the sum of the cast member embeddings, and rank the directors by cosine similarity of their embeddings to the summed cast member vector. If there is a cast member in the test dataset who did not appear in the training data, we exclude them from the summation. For the educational dataset, we simply use the user embedding directly to get the most similar textbooks.
|
| 231 |
+
|
| 232 |
+
Table 2 presents the results from our evaluation. Feat2Vec sizably outperforms CBOW in the MPR metric. In fact, Feat2Vec predicts the actual director $2 . 4 3 \%$ of the times, while CBOW only does so $1 . 2 6 \%$ of the time, making our approach almost 2 times better in terms of Top-1 Precision metric. We explore in greater detail the distribution of the rankings in the appendix in $\ S \mathrm { A } . 2$ .
|
| 233 |
+
|
| 234 |
+
Table 2: Mean percentile rank
|
| 235 |
+
|
| 236 |
+
<table><tr><td>Dataset</td><td>Feat2Vec</td><td>CBOW</td></tr><tr><td>IMDB</td><td>19.36%</td><td>24.15%</td></tr><tr><td>Educational</td><td>25.2%</td><td>29.2%</td></tr></table>
|
| 237 |
+
|
| 238 |
+
# 4.3 UNSUPERVISED Feat2Vec PERFORMANCE WITH CONTINUOUS INPUTS
|
| 239 |
+
|
| 240 |
+
We now focus on how well Feat2Vec performs on a real-valued feature with a complex feature extraction function. We expect this task to highlight Feat2Vec’s advantage over token-based embedding learning algorithms, such as Word2Vec, since our rating embedding extraction function will require embeddings of numerically similar ratings to be close , while Word2Vec will treat two differing ratings tokens as completely different entities. We evaluate the prediction of the real-valued rating of movies in the test dataset by choosing the IMDB rating embedding most similar7 to the embedding of the movie’s director, and compute the Root Mean Squared Error (RMSE) of the predicted rating in the test dataset. We also vary $\alpha _ { 1 }$ , the flattening hyperparameter for feature group sampling, to see what effect this hyperparameter has on our performance. Intuitively, a low $\alpha _ { 1 }$ will greatly improve the quality of the ratings embeddings learned, since it has relatively few parameters and is otherwise sampled infrequently. At the same time, with low $\alpha _ { 1 }$ the director feature will be sampled less since it is one of the most complex features to learn, so the learned director embeddings may be of poorer quality. Figure 3 displays the results of our experiment, benchmarked against the performance of Word2Vec’s CBOW algorithm in the prediction task. We also show as a baseline the RMSE of a random uniform variable over the range of possible ratings (0 to 10). As is evident from the plot, CBOW performs a bit better than a random prediction, but is also handily outperformed by Feat2Vec across all hyper-parameter settings. The algorithm’s performance does not seem very sensitive to the hyperparameter choice.
|
| 241 |
+
|
| 242 |
+

|
| 243 |
+
Figure 3: RMSE in Ratings Task as a Function of $\alpha _ { 1 }$
|
| 244 |
+
|
| 245 |
+
# 5 RELATION TO PRIOR WORK
|
| 246 |
+
|
| 247 |
+
The original Factorization Machine formulation has been extended for multiple contexts. For example, Field-Aware Factrorization Machine (Juan et al., 2016) allows different weights for some feature interactions, but does not allow feature groups or feature extraction functions like Feat2Vec does.
|
| 248 |
+
|
| 249 |
+
Algorithms that calculate continuous representations of entities other than words have been proposed for biological sequences (Abrahamsson & Plotkin, 2009), of vertices in network graphs (Perozzi et al., 2014) or in machine translation for embeddings of complete sentences (Kiros et al., 2015). Generative Adversarial Networks (Goodfellow et al., 2014)(GANs) have been used to produce unsupervised embeddings of images effective for classification (Radford et al., 2015) and for generating natural language (Press et al., 2017). To our knowledge, GANs have not been used for jointly embedding multiple feature types. Adversarial training could be an alternative to NCE for unsupervised learning, but we leave this for future study.
|
| 250 |
+
|
| 251 |
+
We recently discovered a promising direction for an algorithm still in development called StarSpace (Wu et al., 2017) with similar goals from ours. Even though they intend to be able to embed all types of features, at the time of the writing of this paper, their pre-print method was limited to only work for bag of words. While Feat2Vec can jointly learn embeddings for all feature values in a dataset, StarSpace samples a single arbitrary feature. Our preliminary experiments suggest that sampling a single feature does not produce embeddings that generalize well. Nonetheless, a limitation of our work is that we do not compare with StarSpace, which future work may decide to do.
|
| 252 |
+
|
| 253 |
+
# 6 CONCLUSION
|
| 254 |
+
|
| 255 |
+
Embeddings have proven useful in a wide variety of contexts, but they are typically built from datasets with a single feature type as in the case of Word2Vec, or tuned for a single prediction task as in the case of Factorization Machine. We believe Feat2Vec is an important step towards generalpurpose methods, because it decouples feature extraction from prediction for datasets with multiple feature types, it is general-purpose, and its embeddings are easily interpretable.
|
| 256 |
+
|
| 257 |
+
In the supervised setting, Feat2Vec is able to calculate embeddings for whole passages of texts, and we show experimental results outperforming an algorithm specifically designed for text—even when using the same feature extraction CNN. This suggests that the need for ad-hoc networks should be situated in relationship to the improvements over a general-purpose method.
|
| 258 |
+
|
| 259 |
+
In the unsupervised setting, Feat2Vec’s embeddings are able to capture relationships across features that can be twice as better as Word2Vec’s CBOW algorithm on some evaluation metrics. Feat2Vec exploits the structure of a datasets to learn embeddings in a way that is structurally more sensible than existing methods. The sampling method, and loss function that we use have interesting theoretical properties. To the extent of our knowledge, Unsupervised Feat2Vec is the first method able to calculate continuous representations of data with arbitrary feature types.
|
| 260 |
+
|
| 261 |
+
Future work could study how to reduce the amount of human knowledge our approach requires; for example by automatically grouping features into entities, or by automatically choosing a feature extraction function. These ideas can extend to our codebase that we make available 8. Overall, we evaluate supervised and unsupervised Feat2Vec on 2 datasets each. Though further experimentation is necessary, we believe that our results are an encouraging step towards general-purpose embedding models.
|
| 262 |
+
|
| 263 |
+
# REFERENCES
|
| 264 |
+
|
| 265 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit ´ Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, ´ Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
|
| 266 |
+
Erik Abrahamsson and Steven S Plotkin. Biovec: a program for biomolecule visualization with ellipsoidal coarse-graining. Journal of Molecular Graphics and Modelling, 28(2):140–145, 2009.
|
| 267 |
+
Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. arXiv preprint arXiv:1607.04606, 2016.
|
| 268 |
+
Franc¸ois Chollet et al. Keras. https://github.com/fchollet/keras, 2015.
|
| 269 |
+
Chris Dyer. Notes on noise contrastive estimation and negative sampling. arXiv preprint arXiv:1410.8251, 2014.
|
| 270 |
+
Gintare Karolina Dziugaite and Daniel M. Roy. Neural network matrix factorization. CoRR, abs/1511.06443, 2015. URL http://arxiv.org/abs/1511.06443.
|
| 271 |
+
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.
|
| 272 |
+
Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, and Xiuqiang He. Deepfm: A factorization-machine based neural network for ctr prediction. arXiv preprint arXiv:1703.04247, 2017.
|
| 273 |
+
Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle for unnor- ¨ malized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
|
| 274 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing humanlevel performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015.
|
| 275 |
+
Yuchin Juan, Yong Zhuang, Wei-Sheng Chin, and Chih-Jen Lin. Field-aware factorization machines for ctr prediction. In Proceedings of the 10th ACM Conference on Recommender Systems, pp. 43–50. ACM, 2016.
|
| 276 |
+
Nal Kalchbrenner, Edward Grefenstette, and Phil Blunsom. A convolutional neural network for modelling sentences. CoRR, abs/1404.2188, 2014. URL http://arxiv.org/abs/1404.2188.
|
| 277 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. Proceedings of the International Conference on Learning Representations (ICLR), abs/1412.6980, 2014. URL http://arxiv. org/abs/1412.6980.
|
| 278 |
+
Ryan Kiros, Yukun Zhu, Ruslan R Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In Advances in neural information processing systems, pp. 3294–3302, 2015.
|
| 279 |
+
Yehuda Koren, Robert Bell, and Chris Volinsky. Matrix Factorization Techniques for Recommender Systems. Computer, 42(8):30–37, August 2009. ISSN 0018-9162. URL http://dx.doi.org/10.1109/MC. 2009.263.
|
| 280 |
+
Quoc Le and Tomas Mikolov. Distributed representations of sentences and documents. In Proceedings of the 31st International Conference on Machine Learning (ICML-14), pp. 1188–1196, 2014.
|
| 281 |
+
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.
|
| 282 |
+
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013.
|
| 283 |
+
Andriy Mnih and Yee Whye Teh. A fast and simple algorithm for training neural probabilistic language models. In In Proceedings of the International Conference on Machine Learning, 2012.
|
| 284 |
+
Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’14, pp. 701–710, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-2956-9. doi: 10.1145/ 2623330.2623732. URL http://doi.acm.org/10.1145/2623330.2623732.
|
| 285 |
+
Ofir Press, Amir Bar, Ben Bogin, Jonathan Berant, and Lior Wolf. Language generation with recurrent generative adversarial networks without pre-training. arXiv preprint arXiv:1706.01399, 2017.
|
| 286 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
|
| 287 |
+
Steffen Rendle. Factorization machines. In Data Mining (ICDM), 2010 IEEE 10th International Conference on, pp. 995–1000. IEEE, 2010.
|
| 288 |
+
Steffen Rendle and Christoph Freudenthaler. Improving pairwise learning for item recommendation from implicit feedback. In Proceedings of the 7th ACM International Conference on Web Search and Data Mining, WSDM ’14, pp. 273–282, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-2351-2. doi: 10.1145/2556195.2556248. URL http://doi.acm.org/10.1145/2556195.2556248.
|
| 289 |
+
Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. Bpr: Bayesian personalized ranking from implicit feedback. In Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, UAI ’09, pp. 452–461, Arlington, Virginia, United States, 2009. AUAI Press. ISBN 978-0- 9749039-5-8. URL http://dl.acm.org/citation.cfm?id $= 1$ 1795114.1795167.
|
| 290 |
+
Tobias Schnabel, Igor Labutov, David M Mimno, and Thorsten Joachims. Evaluation methods for unsupervised word embeddings. In EMNLP, pp. 298–307, 2015.
|
| 291 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1): 1929–1958, 2014.
|
| 292 |
+
Chong Wang and David M Blei. Collaborative topic modeling for recommending scientific articles. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 448–456. ACM, 2011.
|
| 293 |
+
Jason Weston, Sumit Chopra, and Keith Adams. #tagspace: Semantic embeddings from hashtags. In Alessandro Moschitti, Bo Pang, and Walter Daelemans (eds.), Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, EMNLP 2014, October 25-29, 2014, Doha, Qatar, A meeting of SIGDAT, a Special Interest Group of the ACL, pp. 1822–1827. ACL, 2014. ISBN 978-1-937284-96-1. URL http://aclweb.org/anthology/D/D14/D14-1194.pdf.
|
| 294 |
+
Ledell Wu, Adam Fisch, Sumit Chopra, Keith Adams, Antoine Bordes, and Jason Weston. Starspace: Embed all the things! arXiv preprint arXiv:1709.03856, 2017.
|
| 295 |
+
Ye Zhang and Byron Wallace. A sensitivity analysis of (and practitioners’ guide to) convolutional neural networks for sentence classification. arXiv preprint arXiv:1510.03820, 2015.
|
| 296 |
+
Lei Zheng, Vahid Noroozi, and Philip S. Yu. Joint deep modeling of users and items using reviews for recommendation. In Proceedings of the Tenth ACM International Conference on Web Search and Data Mining, WSDM ’17, pp. 425–434, New York, NY, USA, 2017. ACM. ISBN 978-1-4503-4675-7. doi: 10.1145/3018661.3018665. URL http://doi.acm.org/10.1145/3018661.3018665.
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure A.1: Feature Sampling Probabilities as a Function of $\alpha _ { 1 }$
|
| 300 |
+
|
| 301 |
+
Table A.1: IMDB dataset features
|
| 302 |
+
|
| 303 |
+
<table><tr><td>Feature Type Name</td><td>Type</td><td># of feats.</td><td>Example for an instance</td></tr><tr><td>Runtime (minutes)</td><td>Real-valued</td><td>1</td><td>116</td></tr><tr><td>IMDB rating (0-10)</td><td>Real-valued</td><td>1</td><td>7.8</td></tr><tr><td># of IMDB rating votes</td><td>Real-valued</td><td>1</td><td>435,682</td></tr><tr><td>Is adult film?</td><td>Boolean</td><td>2</td><td>False</td></tr><tr><td>Movie releaes year</td><td>Categorical</td><td>271</td><td>2001</td></tr><tr><td>Movie title</td><td>Text</td><td>165,471</td><td>“Ocean's”,“Eleven”</td></tr><tr><td>Directors</td><td>Bag of categories</td><td>174,382</td><td>‘Steven Soderbergh”</td></tr><tr><td>Genres</td><td>Bag of categories</td><td>28</td><td>“Crime”,“Thriller”</td></tr><tr><td>Writers</td><td>Bag of categories</td><td>244,241</td><td>“George Johnson”,“Jack Russell"</td></tr><tr><td>Principal cast members (actors)</td><td>Bag of categories</td><td>1,104,280</td><td>“George Clooney”,“Brad Pitt”,“Julia Roberts”</td></tr></table>
|
| 304 |
+
|
| 305 |
+
# A APPENDIXES
|
| 306 |
+
|
| 307 |
+
# A.1 UNSUPERVISED RANKING EXPERIMENT DETAILS
|
| 308 |
+
|
| 309 |
+
For our evaluation, we define a testing set that was not used to tune the parameters of the model. For the IMDB dataset, we randomly select a $10 \%$ sample of the observations that contain a director that appears at least twice in the database 9. We do this to guarantee that the set of directors in the left-out dataset appear during training at least once, so that each respective algorithm can learn something about the characteristics of these directors. For the educational dataset, our testing set only has observations of textbooks and users that appear at least 10 times in training.
|
| 310 |
+
|
| 311 |
+
For both Feat2Vec and CBOW, we perform cross-validation on the loss function, by splitting the $10 \%$ of the training data randomly into a validation set, to determine the number of epochs to train, and then train the full training dataset with this number of epochs. 10 While regularization of the embeddings during training is possible, this did not dramatically change results, so we ignore this dimension of hyperparameters.
|
| 312 |
+
|
| 313 |
+
We rank left-out entity pairs in the test dataset using the ordinal ranking of the cosine similarity of target and input embeddings. For the IMDB dataset, the target is the director embedding, and the input embedding is the sum of the cast member embeddings. For the educational dataset, the target is the textbook embedding, and the input embedding is the user embedding.
|
| 314 |
+
|
| 315 |
+
For training Feat2Vec we set $\alpha _ { 1 } = \alpha _ { 2 } = 3 / 4$ in the IMDB dataset; and $\alpha _ { 1 } = 0$ and $\alpha _ { 2 } = 0 . 5$ for the educational. In each setting, $\alpha _ { 2 }$ is set to the same flattening hyperparameter we use for CBOW to negatively sample words in a document. We learn $r = 5 0$ dimensional embeddings under both algorithms.
|
| 316 |
+
|
| 317 |
+
Below we describe how CBOW is implemented on our datasets for unsupervised experiments and what extraction functions are used to represent features in the IMDB dataset.
|
| 318 |
+
|
| 319 |
+
Word2Vec For every observation in each of the datasets, we create a document that tokenizes the same information that we feed into Feat2Vec. We prepend each feature value by its feature name, and we remove spaces from within features. In Figure A.2 we show an example document. Some features may allow multiple values (e.g., multiple writers, directors). To feed these features into the models, for convenience, we constraint the number of values, by truncating each feature to no more than 10 levels (and sometimes less if reasonable). This results in retaining the full set of information for well over $9 5 \%$ of the values. We pad the sequences with a “null” category whenever necessary to maintain a fixed length. We do this consistently for both Word2Vec and Feat2Vec. We use the CBOW Word2Vec algorithm and set the context window to encompass all other tokens in a document during training, since the text in this application is unordered.
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
Figure A.2: Sample document for Word2Vec for the Ocean’s Eleven movie
|
| 323 |
+
|
| 324 |
+
Feat2Vec Feature representation in Feat2Vec requires a feature extraction function for each feature type. Here, we explain how we build these functions:
|
| 325 |
+
|
| 326 |
+
• Bag of categories, categorical, and boolean: For all of the categorical variables, we learn a unique $r$ -dimensional embedding for each entity using a linear fully-connected layer (Equation 4). We do not require one-hot encodings, and thus we allow multiple categories to be active; resulting in a single embedding for the group that is the sum of the embeddings of the subfeatures. This is ordering-invariant: the embedding of “Brad Pitt” would be the same when he appears in a movie as a principal cast member, regardless whether he was 1st or 2nd star. Though, if he were listed as a director it may result in a different embedding.
|
| 327 |
+
|
| 328 |
+
• Text: We preprocess the text by removing non alpha-numeric characters, stopwords, and stemming the remaining words. We then follow the same approach that we did for categorical variables, summing learned word embeddings to a “title embedding” before interacting. It would be easy to use more sophisticated methods (e.g, convolutions), but we felt this would not extract further information.
|
| 329 |
+
|
| 330 |
+
• Real-valued: For all real-valued features, we pass these features through a 3-layer feedforward fully connected neural network that outputs a vector of dimension $r$ , which we treat as the feature’s embedding. Each intermediate layer has $r$ units with $\mathtt { r e l u }$ activation functions. These real-valued features highlight one of the advantages of the Feat2Vec algorithm: using a numeric value as an input, Feat2Vec can learn a highly nonlinear relation mapping a real number to our high-dimensional embedding space. In contrast, Word2Vec would be unable to know ex ante that an IMDB rating of 5.5 is similar to 5.6.
|
| 331 |
+
|
| 332 |
+
# A.2 DISTRIBUTION OF IMDB DIRECTOR RANKINGS
|
| 333 |
+
|
| 334 |
+
Figure A.3 shows the full distribution of rankings of the IMDB dataset, rather than summary statistics, in the form of a Cumulative Distribution Function (CDF) of all rankings calculated in the test dataset. The graphic makes it apparent for the vast majority of the ranking space, the rank CDF of Feat2Vec is to the left of CBOW, indicating a greater probability of a lower ranking under Feat2Vec. This is not, however, the case at the upper tail of ranking space, where it appears CBOW is superior.
|
| 335 |
+
|
| 336 |
+
However, when we zoom-in on the absolute upper region of rankings (1 to 25), which might be a sensible length of ranks one might give as actual recommendatiosn, it is the case that up until rank 8 or so, Feat2Vec outperforms CBOW still. Intermediate rankings are still strong signals that our Feat2Vec algorithm is doing a better job of extracting information into embeddings, particularly those entities that appear sparsely in the training data and so are especially difficult to learn.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure A.3: Cumulative Distribution Function of Director Rankings (With Zoom-in to Top 25 Ranks)
|
| 340 |
+
|
| 341 |
+
# A.3 PROOF TO THEOREM 1
|
| 342 |
+
|
| 343 |
+
Theorem 1. The gradient for learning embeddings with Feat2Vec is a convex combination of the gradient from n targeted Factorization Machines for each feature in the data when each feature group is a singleton, where n is the total number of features in the dataset.
|
| 344 |
+
|
| 345 |
+
Proof. Let $S _ { \kappa _ { i } } ^ { + }$ denote the positively labeled records whose corresponding negative samples resample feature $\kappa _ { i }$ . For convenience, suppress the inclusion of learned parameters θ in the notation in this section while understanding the feature extraction functions $\vec { \phi }$ implicitly include these parameters. We can express the loss function $L ( . )$ , the binary cross-entropy of the data given the Feat2Vec model, as follows:
|
| 346 |
+
|
| 347 |
+
$$
|
| 348 |
+
\begin{array} { r l } { L ( S ^ { + } | \vec { \phi } ) = \displaystyle \frac { 1 } { | S ^ { + } | } \sum _ { \tau ^ { \prime } \in S ^ { + } } \Big ( \log ( \tilde { \rho } ( y | \vec { \phi } - 1 | \vec { \phi } , \vec { x } ^ { + } ) ) + \underbrace { \sum _ { \tau ^ { \prime } \in S ^ { + } } ^ { \vec { K } } \log ( | \vec { \rho } ( y = 0 | | \vec { \phi } , \vec { x } ^ { - } ) ) } _ { \tau ^ { \prime } - \tau < 2 ( | \vec { x } ^ { + } - \vec { x } ^ { + } | ) ^ { \tilde { \phi } } ( \vec { x } ^ { + } ) } \Big . } & { } \\ { = \frac { 1 } { | S ^ { + } | } \sum _ { \tau ^ { \prime } \in S ^ { + } } \Big ( \log ( \tilde { \rho } ( y | \vec { \phi } - 1 | \vec { \phi } , \vec { x } ^ { + } ) , \vec { x } ^ { + } + S _ { \tau , y } ^ { + } ) \rho ( \vec { x } ^ { + } \in S _ { \tau , x } ^ { + } ) ) } \\ { + \underbrace { \sum _ { \tau ^ { \prime } \in S ^ { + } } ^ { \vec { K } } \log ( \tilde { \rho } ( y = 0 | \vec { \phi } , \vec { x } ^ { - } , \vec { x } ^ { + } \in S _ { \tau , y } ^ { + } ) \rho ( \vec { x } ^ { + } \in S _ { \tau , x } ^ { + } ) ) } _ { \tau ^ { \prime } - \tau ^ { \prime } ( | \vec { x } ^ { + } | ) ^ { \tilde { \phi } } ( \vec { x } ^ { + } \in S _ { \tau , x } ^ { + } ) } \Big ) } & { } \\ - \displaystyle \frac { 1 } { | S ^ { + } | } \sum _ { \tau ^ { \prime } \in S ^ { + } } ^ { \vec { K } } \log ( \log ( \frac { e ^ { - i ( \tau ^ { + } \cdot \vec { \phi } ) } p | \vec { x } ^ { \top } \in S _ { \tau , y } ^ { + } } { e ^ { i ( \tau ^ { + } \cdot \vec { \phi } ) } + P _ { 0 } ( | \vec { x } ^ { + } | \vec { x } ^ { + } , \vec { x } ^ { + } \in S _ { \tau , x } ^ { + } ) } \\ + \underbrace \sum _ { \tau ^ { \prime } \in S ^ { + } } ^ \vec \end{array}
|
| 349 |
+
$$
|
| 350 |
+
|
| 351 |
+
Note now that $P _ { \mathcal { Q } } ( \vec { x } | \vec { x } ^ { + } , \vec { x } ^ { + } \in S _ { \kappa _ { i } } ^ { + } )$ is simply the probability of the record’s feature value $\vec { x } _ { f }$ under the second step noise distribution $\mathcal { Q } _ { 2 } ( \mathrm { X } _ { \mathrm { f } } , \alpha _ { 2 } )$ : $P _ { \mathcal { Q } } ( \vec { x } | \vec { x } ^ { + } , \vec { x } ^ { + } \in S _ { \kappa _ { i } } ^ { + } ) = P _ { \mathcal { Q } _ { 2 } } ( \vec { x } _ { f } )$
|
| 352 |
+
|
| 353 |
+
$$
|
| 354 |
+
\begin{array} { r l } & { = \displaystyle \frac { 1 } { | S ^ { + } | } \displaystyle \sum _ { i = 1 } ^ { n } \sum _ { \bar { x } ^ { + } \in S _ { \star _ { i } } ^ { + } } \Big ( \log ( \frac { e ^ { s ( \bar { x } ^ { + } , \bar { \phi } ) } p ( \bar { x } ^ { + } \in S _ { \kappa _ { i } } ^ { + } ) } { e ^ { s ( \bar { x } ^ { + } , \bar { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { \kappa _ { i } } ^ { + } ) } ) + \frac { k } { \bar { x } ^ { - } \sim Q ( \cdot | \vec { x } ^ { + } , i \in S _ { \star _ { i } } ^ { + } ) } \log ( \frac { P _ { Q _ { 2 } } ( \vec { x } _ { f } ^ { - } ) p ( \bar { x } ^ { + } \in S _ { \kappa _ { i } } ^ { + } ) } { e ^ { s ( \bar { x } ^ { - } , \bar { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { f } ^ { - } ) ) } \Big ) } \\ & { = \displaystyle \frac { 1 } { | S ^ { + } | } \displaystyle \sum _ { i = 1 } ^ { n } \sum _ { \bar { x } ^ { + } \in S _ { \star _ { i } } ^ { + } } \Big ( \log ( \frac { e ^ { s ( \bar { x } ^ { + } , \bar { \phi } ) } } { e ^ { s ( \bar { x } ^ { + } , \bar { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { \kappa _ { i } } ^ { + } ) } ) + \log ( p ( \bar { x } ^ { + } \in S _ { \kappa _ { i } } ^ { + } ) ^ { k + 1 } ) } \\ & { \quad + \left. \frac { k } { \bar { x } ^ { - } \sim Q ( \cdot | \vec { x } ^ { + } , \vec { x } ^ { + } \in S _ { \star _ { i } } ^ { + } ) } \log ( \frac { P _ { Q _ { 2 } } ( \vec { x } _ { f } ^ { - } ) } { e ^ { s ( \bar { x } ^ { - } , \bar { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { f } ^ { - } ) } ) \right) } \end{array}
|
| 355 |
+
$$
|
| 356 |
+
|
| 357 |
+
We now drop the term containing the probability of assignment to a feature group $p ( \vec { x } ^ { + } \in S _ { \kappa _ { i } } ^ { + }$ ) since it is outside of the learned model parameters $\vec { \phi }$ and fixed in advance:
|
| 358 |
+
|
| 359 |
+
$$
|
| 360 |
+
\begin{array} { c } \displaystyle \propto \displaystyle \frac { 1 } { | S ^ { + } | } \displaystyle \sum _ { i = 1 } ^ { n } \sum _ { \vec { x } ^ { + } \in S _ { \mathbf { * } _ { i } } ^ { + } } \left( \log ( \frac { e ^ { s ( \vec { x } ^ { + } , \vec { \phi } ) } } { e ^ { s ( \vec { x } ^ { + } , \vec { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { \mathbf { * } _ { i } } ^ { + } ) } ) + \displaystyle \sum _ { \vec { x } ^ { - } \sim Q ( \cdot , | \vec { x } ^ { + } , \vec { x } ^ { + } \in S _ { \mathbf { * } _ { i } } ^ { + } ) } ^ { k } \log ( \frac { P _ { Q _ { 2 } } ( \vec { x } _ { f } ^ { - } ) } { e ^ { s ( \vec { x } ^ { - } , \vec { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { f } ^ { - } ) } ) \right) \nonumber _ { \vec { x } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { + } \sim \mathbb { S } _ { \mathbf { \ * } ^ { - } \mathbb { S } _ { \mathbf { \ * } ^ { - } \mathbb { S } _ { \mathbf { \ * } ^ { - } \mathbb { S } _ { \mathcal \delta } } } } } } } } } } } } \\ \displaystyle \xrightarrow [ { \vec { x } ^ { + } | \to \infty } ] { n } p ( \vec { x } ^ { + } \in S _ { \mathbf { \star } _ { i } } ^ { + } ) E \Big [ \log ( \frac { e ^ { s ( \vec { x } ^ { + } , \vec { \phi } ) } } { e ^ { s ( \vec { x } ^ { + } , \vec { \phi } ) } + P _ { Q _ { 2 } } ( \vec { x } _ { \mathbf { \star } _ { i } } ^ { + } ) } ) + \sum _ { \vec { x } ^ { - } \sim Q ( \cdot , | \vec { x } ^ { + } , \vec { x } ^ { + } \in S _ { \mathbf { \star } _ { i } } ^ { + } ) } ^ { k } \ \end{array}
|
| 361 |
+
$$
|
| 362 |
+
|
| 363 |
+
Thus, the loss function is just a convex combination of the loss functions of the targeted classifiers for each of the $p$ features, and by extension so is the gradient since:
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\frac { \partial } { \partial \phi } \sum _ { i = 1 } ^ { n } p ( \vec { x } ^ { + } \in S _ { \mathrm { \bf { k } } _ { i } } ^ { + } ) E \Big [ L ( \vec { x } | \vec { \phi } , \mathrm { t a r g e t } = f ) \Big ] = \sum _ { i = 1 } ^ { n } p ( \vec { x } ^ { + } \in S _ { \mathrm { \bf { k } } _ { i } } ^ { + } ) \frac { \partial } { \partial \phi } E \Big [ L ( \vec { x } | \vec { \phi } , \mathrm { t a r g e t } = f ) \Big ]
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
Thus the algorithm will, at each step, learn a convex combination of the gradient for a targeted classifier on feature $f$ , with weights proportional to the feature group sampling probabilities in step 1 of
|
| 370 |
+
|
| 371 |
+
the sampling algorithm. Note that if feature groups are not singletons, the gradient from unsupervised Feat2Vec will analogously be a convex combination of $n$ gradients learned from supervised learning tasks on each of the $n$ feature groups. □
|
| 372 |
+
|
| 373 |
+
# B FEATURE EXTRACTION NETWORK FOR NATURAL LANGUAGE
|
| 374 |
+
|
| 375 |
+

|
| 376 |
+
Figure A.4: Feature extraction network used for labelling tasks. We use $\mathrm { f } { = } 1 0 0 0$ convolutional filters each of width 3 (words)
|
| 377 |
+
|
| 378 |
+
Here we describe the details of the feature extraction function $\phi$ used in our experiments for supervised tasks in $\ S 4 . 1$ . An overview of the network is given in Fig. A.4. We choose the most common words of each dataset to build a vocabulary of size $n$ , and convert the words of each document to a sequence of length $t$ of one-hot encodings of the input words. If the input text is shorter than $t$ , then we pad it with zeros; if the text is longer, we truncate it by discarding the trailing words. Therefore, for a vocabulary size $n$ , the input has dimensions $t \times n$ . These $t \times$ dimensional matrix is then passed through the following layers:
|
| 379 |
+
|
| 380 |
+
1. We use an embedding layer to assign a $d$ -dimensional vector to each word in the input passage of text. This is done through a $d \times n$ -dimensional lookup table, which results in an $t \times d$ matrix.
|
| 381 |
+
2. We extract features from the embeddings with functions called convolutional filters (LeCun et al., 1998) (also called feature maps). A convolutional filter is simply a matrix learned from an input. We learn $f$ filters that are applied on groups of $m$ adjacent word embeddings, thus each of our filters is a $d \times m$ matrix of learned parameters. Filters are applied by computing the element-wise dot product of the filter along a sliding window of the entire input. The resulting output for each filter is a vector of length $t - m + 1$ . We also apply a ReLU activation to the output of each filter.
|
| 382 |
+
3. Consider the case of inputs of different lengths. For very short texts, the output of the filters will be mostly zero since the input is zero-padded. To enforce learning from the features of the text, and not just its length we apply a function called 1-max pooling to the output of the filters: from the $t - m + 1$ output vector of each filter, we select the maximum value. This yields a vector of length $F$ , a representation of the passage which is independent of its length.
|
| 383 |
+
4. We learn higher-level features from the convolutional filters. For this, we use a fully connected layer with $p$ units and a ReLU activation,
|
| 384 |
+
5. During training (not in inference), we prevent the units from co-adapting too much with a dropout layer (Srivastava et al., 2014). Dropout is a form of regularization that for each mini-batch randomly drops a specified percentage of units.
|
| 385 |
+
6. the final embedding for $x _ { j }$ (that is used in the factorization) is computed by a dense layer with $r$ output units and an activation function, where $r$ is the embedding size of our indexable items.
|
| 386 |
+
|
| 387 |
+
We set the maximum vocabulary size $n$ to 100,000 words, and input embedding size $d$ to 50 for all experiments. We initialize the input word embeddings and the label embeddings using
|
| 388 |
+
|
| 389 |
+
Word2Vec(Mikolov et al., 2013) We have have not evaluated multiple architectures or hyperparameter settings and obtain good results on diverse datasets with the same architecture, which was designed followed recommendations from a large scale evaluation of CNN hyper parameters(Zhang & Wallace, 2015). We set the number of convolutional filters $f$ to 1,000, and the dropout rate to 0.1. The maximum sequence length $t$ was chosen according to the typical document length (350 words for CiteULike and 250 for Yelp). For the CTR dataset, because we use very small values of $r$ , due to the tendency of the ReLU units to‘die’ during training (output zero for all examples), which can have a significant impact, we used instead PReLU activations (He et al., 2015) for the final layer, since they do not suffer from this issue.
|
| 390 |
+
|
| 391 |
+
# B.1 FEATURE EXTRACTION FOR DEEPCONN COMPARISON
|
| 392 |
+
|
| 393 |
+
The CNN architecture used for DeepCoNN (Zheng et al., 2017) is similar to the previous section. It consists of a word embedding lookup table, convolutional layer, 1-max pooling and a fully connected layer. We use the hyper-parameters that the authors report as best - 100 convolution filters and 50 units for the fully connected layer. We set the word embedding size to 100, the vocabulary size to 100,000 and the maximum document length to 250.
|
| 394 |
+
|
| 395 |
+
# C HYPER-PARAMETERS FOR CTR
|
| 396 |
+
|
| 397 |
+
To compare Feat2Vec with Collaborative Topic Regression, we choose the embedding size $r \in$ $\{ 5 , 1 0 , { \bar { 1 } } 5 \}$ for which CTR performs best. The results are show in Table A.2.
|
| 398 |
+
|
| 399 |
+
Table A.2: Tuning embedding size for CTR
|
| 400 |
+
|
| 401 |
+
<table><tr><td></td><td>r=5</td><td>r=10</td><td>r=15</td><td>Time (mins.)</td></tr><tr><td>Matrix Fact.</td><td>0.8723</td><td>0.8911</td><td>0.9046</td><td>1</td></tr><tr><td>Feat2Vec</td><td>0.9081</td><td>0.9303</td><td>0.9401</td><td>133</td></tr><tr><td>C.T.R</td><td>0.8763</td><td>0.9234</td><td>0.9356</td><td>1425</td></tr></table>
|
md/train/rkaSvlnoG/rkaSvlnoG.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Unsupervised learning of the brain connectivity dynamic using residual D-net
|
| 2 |
+
|
| 3 |
+
Youngjoo $\mathbf { S e o ^ { 1 } }$ , Manuel Morante2,3, Yannis Kopsinis4,3 and Sergios Theodoridis5,2,3 1Signal Processing Laboratory 2, EPFL (Switzerland) 2Dept. of Informatics and Telecommunications, University of Athens (Greece) 3Computer Technology Institute & Press “Diophantus” (CTI), Patras (Greece) 4LIBRA MLI Ltd, Edinburgh (UK) 5IAASARS, National Observatory of Athens, GR-15236, Penteli (Greece) youngjoo.seo@epfl.ch, morante@cti.gr, kopsinis@ieee.org, stheodor@di.uoa.gr
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
In this paper, we propose a novel unsupervised learning method to learn the brain dynamics using a deep learning architecture named residual D-net. As it is often the case in medical research, in contrast to typical deep learning tasks, the size of the resting-state functional Magnetic Resonance Image (rs-fMRI) datasets for training is limited. Thus, the available data should be very efficiently used to learn the complex patterns underneath the brain connectivity dynamics. To address this issue, we use residual connections to alleviate the training complexity through recurrent multi-scale representation. We conduct two classification tasks to differentiate early and late stage Mild Cognitive Impairment (MCI) from Normal healthy Control (NC) subjects. The experiments verify that our proposed residual D-net indeed learns the brain connectivity dynamics, leading to significantly higher classification accuracy compared to previously published techniques.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Alzheimer’s Disease (AD) is the most common degenerative brain disease associated with dementia in elder people [1], and it is characterized by a progressive decline of memory, language and cognitive skills. The transition from cognitive health to dementia flows throw different stages, and it may require decades until the damage is noticeable [2].
|
| 12 |
+
|
| 13 |
+
Unfortunately, the precise biological mechanisms behind the AD remain unknown, to a large extent, and this makes the development of an effective treatment difficult. Moreover, the costs of Alzheimer’s care constitutes a substantial burden on families, which exacerbates through the evolution of the disease [3]. For these reasons, early detection is crucial to prevent, slow down and, hopefully, stop the development of the AD.
|
| 14 |
+
|
| 15 |
+
Towards this goal, several studies point out that an intermediate stage of cognitive brain dysfunction, referred as Mild Cognitive Impairment (MCI), is a potential precursor of AD [3] (especially with respect to memory problems, referred as amnesic MCI). Although the final transition from MCI to AD varies per individual, a recent systematic review of 32 available studies reported that at least 3 out 10 patients with MCI developed the AD over the period of five or more years.
|
| 16 |
+
|
| 17 |
+
During the early stages of the AD and MCI, the brain operates so that to allow the individuals to function normally by inducing abnormal neuronal activity, that compensates for the progressive loss of neurons. These fluctuations can be measured using rs-fMRI, which is a powerful non-invasive technique to examine the brain behavior. Therefore, the rs-fMRI provides valuable information that allows to study the brain connectivity dynamics and, potentially, to detect individuals with AD or MCI from healthy subjects.
|
| 18 |
+
|
| 19 |
+
Table 1: Demographics of the healthy control subjects (NC), patients with eMCI and patients with LMCI
|
| 20 |
+
|
| 21 |
+
<table><tr><td></td><td>NC</td><td>eMCI</td><td>LMCI</td></tr><tr><td>Number of Subjects</td><td>36</td><td>31</td><td>26</td></tr><tr><td>Male/Female</td><td>14/22</td><td>15/16</td><td>15/11</td></tr><tr><td>Number of Scans</td><td>100</td><td>100</td><td>77</td></tr><tr><td>Male/Female</td><td>37/63</td><td>58/42</td><td>41/36</td></tr><tr><td>Age (mean±SD)</td><td>72.7±4.5</td><td>72.4±3.8</td><td>74.3±3.4</td></tr></table>
|
| 22 |
+
|
| 23 |
+
Nowadays, several methods have been proposed to classify subjects with MCI from healthy subjects using fMRI data [4]. The most basic approach consists of a direct study of the mean Functional Connectivity (FC). For example, features from the FC matrix [5] or graph theoretical approach [6] are proposed to perform the classification task. However, two practical limitations restrict these approaches: first, the manual feature designing requires an extensive domain knowledge of the brain connectivity dynamics and, second, the limited number of the available data samples makes it difficult to find a proper model that will generalize in different datasets.
|
| 24 |
+
|
| 25 |
+
On the other hand, a more sophisticated approach is proposed in [7] to address these two problems: this method automatically learns the features from the data using a Deep Auto-Encoder (DAE) by avoiding potential human biases. Nevertheless, the DAE does not consider any information regarding the brain connectivity dynamics, which is crucial to understand the AD.
|
| 26 |
+
|
| 27 |
+
Accordingly, any alternative deep learning method must simultaneously consider the structure and the dynamics of the brain functional connectivity, for automatically extracting significant features from the data. However, since complex deep learning architectures usually require a large number of training samples, the lack of sufficient data constitutes the major practical limitation of such methods.
|
| 28 |
+
|
| 29 |
+
For all these reasons, in this paper, we introduce a recurrent multi-scale deep neuronal network, named residual D-net, to analyze the brain behavior. The main novelty of the presented architecture is that it allows us to unravel the brain connectivity dynamics, but, efficiently learning with a limited number of samples, which constitutes the most common scenario in practice.
|
| 30 |
+
|
| 31 |
+
Therefore, we applied our proposed residual D-net to learn the brain connectivity dynamics of our subjects. Then, we feed the learned brain dynamic features into a classifier to distinguish subjects with MCI from healthy individuals.
|
| 32 |
+
|
| 33 |
+
# 2 Materials and Preprocessing
|
| 34 |
+
|
| 35 |
+
In this study, we use a public rs-fMRI cohort from the Clinical Core of Alzheimer’s Disease Neuroimaging Initiative (ADNI)1, which has established a competitive collaboration among academia and industry investigation focused on the early identification and intervention of AD [8].
|
| 36 |
+
|
| 37 |
+
Among the different datasets of ADNI (including the latest studies ADNI go and ADNI 2), there are data sets referring to patient with early stage of Mild Cognitive Impairment (eMCI), and patients with an advanced stage of the condition referred as Late stage Mild Cognitive Impairment (LMCI). In this paper, we report studies for both datasets separately.
|
| 38 |
+
|
| 39 |
+
# 2.1 ADNI Cohorts
|
| 40 |
+
|
| 41 |
+
The final used cohort comprises 277 scans from 36 Normal healthy Control (NC) subjects, 31 patients with eMCI and 26 patients with LMCI (see Table (1)). We distinguish between scans and subjects because some subjects have several scans at different points; the same person has undergone the scan at different times. This consideration is crucial: otherwise, we can introduce potential bias that affects the accuracy of the method.
|
| 42 |
+
|
| 43 |
+
With respect to the data acquisition, all the rs-fMRI scans were collected at different medical centers using a 3 Tesla Philips scanners following the same acquisition protocol [9]: Repetition Time $\mathrm { ( T R ) = }$ $3 0 0 0 \mathrm { m s }$ , Echo Time $\mathrm { ( T E ) } = 3 0 ~ \mathrm { m s }$ , flip angle $= 8 0 ^ { \circ }$ , matrix size $6 4 \times 6 4$ , number of slices $= 4 8$ and voxel thickness $= 3 . 3 1 3 \ \mathrm { m m }$ . Each scan was performed during 7 minutes producing a total number of 140 brain volumes.
|
| 44 |
+
|
| 45 |
+
# 2.2 Preprocessing
|
| 46 |
+
|
| 47 |
+
The functional images were preprocessed using the Data Processing Assistant for Resting-State fMRI (DPARSF) toolbox2 and the SPM 12 package3 following standard preprocessing steps:
|
| 48 |
+
|
| 49 |
+
– First, we discarded the first 10 volumes of each scan to avoid T1 equilibrium effects and we applied a slice-timing correction to the slice collected at TR/2 to minimize T1 equilibrium errors across each TR.
|
| 50 |
+
|
| 51 |
+
– After correcting the acquisition time, we realigned each time-series using a six-parameter rigid-body spatial transformation to compensate for head movements [10]. During this step, we excluded any scanner that exhibited a movement or rotation in any direction bigger than $3 \mathrm { m m }$ or $3 ^ { \circ }$ respectively.
|
| 52 |
+
|
| 53 |
+
– Then, we normalized the corrected images over the Montreal Neurological Institute (MNI) space and resampled to $3 \mathrm { m m }$ isotropic voxels. The resulted images were detrended in time through a linear approximation and spatially smoothed using a Gaussian filtering with $\mathrm { F W H M } = 4 \mathrm { m m }$ .
|
| 54 |
+
|
| 55 |
+
– Finally, we removed the nuisance covariates of the white matter and the cerebrospinal fluid to avoid further effects and focused on the signal of the grey matter, and we band-pass filtered $( 0 . 0 1 { - } 0 . 0 8 \mathrm { H z } )$ the remaining signals to reduce the effects of motion and non-neuronal activity fluctuations.
|
| 56 |
+
|
| 57 |
+
# 2.3 Brain network analysis
|
| 58 |
+
|
| 59 |
+
In order to investigate the behavior of the brain functional connectivity, we labeled each brain volume into 116 Regions of Interest (ROIs), using the Automated Anatomical Labeling (AAL) atlas4. This atlas divides the brain into macroscopic brain structures: 45 ROIs for each hemisphere and 26 cerebellar ROIs. In this study, we excluded the 26 cerebellar ROIs, because theses areas are mainly related to motor and cognitive functional networks [11].
|
| 60 |
+
|
| 61 |
+
Then, we estimated a representative time course by averaging the intensity of all the voxel within each ROI, and we normalized the values in the range -1 to 1. Finally, we folded all the time courses into a matrix $\mathbf { R } \in \mathbb { R } ^ { 9 0 \times 1 3 0 }$ , where each row contains the time evolution of one specific ROI.
|
| 62 |
+
|
| 63 |
+
# 3 Proposed methods
|
| 64 |
+
|
| 65 |
+
In this paper, we propose a novel residual D-net framework to model the brain connectivity dynamics. First, the selective brain functional connectivity dynamics, used as input for the residual D-net is presented. Then, the details of residual D-net will be described.
|
| 66 |
+
|
| 67 |
+
# 3.1 Selective Brain Functional Connectivity Dynamics
|
| 68 |
+
|
| 69 |
+
In order to capture the brain connective dynamics in the rs-fMRI, we examine the time-varying functional connectivity (FC) variability via windowing correlation matrices [12], which provides a fair estimate of the natural dynamics of the functional brain connectivity.
|
| 70 |
+
|
| 71 |
+
However, our goal is to identify individuals that will potentially develop AD. Consequently, we restricted our study of the whole-brain dynamics to just a few areas that may suffer damage due to the AD, which, also, reduces the pattern complexity of the brain functional connectivity.
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 1: Residual D-net architecture
|
| 75 |
+
|
| 76 |
+
In this way, severals studies have pointed that certain brain areas are more likely to be affected by the AD. These areas are localized in the Frontal Lobe [13], the Hypocampus [14] and the Temporal Lobe [14], [15] . Therefore, we limited our study of the brain connectivity dynamics to 28 ROIs that are vulnerable to AD.
|
| 77 |
+
|
| 78 |
+
Thus, using this specific set of ROIs and following the method described in [12], for each scan $( \mathbf { R } _ { i } )$ , with $i = 1 , 2 , \dots , N$ , where $N$ is the total number of analyzed scans, we estimated the dynamic FC through a sliding window approach, and we computed each covariance matrix from a windowed segment of $\mathbf { R } _ { i }$ . We applied a tapered window created by convolving a rectangle ( $\mathrm { w i t h } = 1 0 \mathrm { T R s } { = } 3 0 )$ ) with a Gaussian $\sigma = 4 \mathrm { T R s } )$ ) and a sliding window in steps of 2 TRs, resulting in a total number of 56 windows.
|
| 79 |
+
|
| 80 |
+
Accordingly, the result of each scan contains a sequence of 56 covariance matrices that encode the connectivity dynamics of the studied ROIs. These sequential matrices comprise the FC dynamics of the $2 8 ~ \mathrm { R O I s }$ , and we will use them as an input to the proposed method. Figure (4.a) shows examples of input sequences of these covariance matrices.
|
| 81 |
+
|
| 82 |
+
# 3.2 Residual D-net
|
| 83 |
+
|
| 84 |
+
The proposed model needs to understand the dynamics of brain FC; that is, how the pattern within the covariance matrix changes along time. Furthermore, the model should be very efficient to learn the dynamics given a limited number of training data.
|
| 85 |
+
|
| 86 |
+
To address these issues, the proposed residual D-net has three major properties that allow the model to learn with relatively few training samples, while retaining its capacity to learn complex dynamics. Figure (1) shows the main architecture of the proposed residual D-net, which is formed by three main components: up residual block, down residual block (RES_U/D_Block) and a residual convolutional long short-term memory block (RES_cLSTM).
|
| 87 |
+
|
| 88 |
+
RES_U/D_Block: The residual network (resNet) [16] is a competitive deep architecture capable to produce a detailed decomposition of the input data. The residual connection in the resNet constrains the network to learn a residual representation, so that to facilitate the training. We exploit this property to learn complex patterns in the input, while keeping the training to be simple. In addition, we add an “average pooling” layer and “up convolution” layer, to express the multi-scale representation. The formulations of each down/up residual block can be expressed as follows:
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 2: Major component of the residual D-net: Donw/up Residual Block and Residual convLSTM Block
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { r l } & { x _ { t } ^ { l + 1 } = \mathrm { a v g p o o l } ( F _ { d } ^ { l } ( x _ { t } ^ { l } ) + x _ { t } ^ { l } ) , } \\ & { y _ { t } ^ { l + 1 } = F _ { u } ^ { l } ( [ \hat { y } _ { t } ^ { l } , z _ { t } ^ { l } ] ) + y _ { t } ^ { l } , } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $\boldsymbol { x } _ { t } ^ { l }$ and $y _ { t } ^ { l }$ are the inputs of the $l _ { t h }$ RES_D/U_Block, respectively. Each block has a bypass identity connection to fit the residual mapping from the input. We denote each convolutional layer in the block as $F _ { d } ^ { l } ( x _ { t } ^ { l } )$ and $F _ { u } ^ { l } ( y _ { t } ^ { l } )$ in Figure (2), which are composed of two $3 \times 3$ convolutional layers and we employ the exponential linear units (ELUs) [17] as the nonlinear activation function. The major difference lies in in their “up/down sampling" layer. In the RES_D_BLOCK, a average pooling layer is attached to down sample the input. In the RES_U_BLOCK, we use a up-conv layer for up-sampling $( \hat { y } _ { t } ^ { l } )$ the input and it is concatenated with $z _ { t } ^ { l }$ , which comes from the high resolution feature map in the upper RES_cLSTM Block.
|
| 98 |
+
|
| 99 |
+
RES_cLSTM Block: The convolutional LSTM [18] is a well-known Recurrent Neural Network (RNN) model, capable of capturing spatial-temporal features in a video sequence. As we described above, the brain dynamics is represented as a sequence of images. Thus, the use of a convolutional LSTM is fully justified by the nature of our task. Moreover, the use of the residual connection, together with the convolutional LSTM, facilitates the training, while retaining the spatial-temporal information. The connection was designed in a way similar to existing residual LSTM models [19, 20, 21] with two concatenated LSTM blocks with identity connection as shown in Figure (2). The formulation of the Residual Convolutional LSTM block can be expressed as follows:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\begin{array} { r l } & { z _ { t } ^ { l + 1 } = h _ { t } ^ { l _ { 2 } } + z _ { t } ^ { l } , } \\ & { ~ h _ { t } ^ { l _ { 2 } } = G ^ { l } ( z _ { t } ^ { l } , h _ { t - 1 } ^ { l _ { 1 } } , h _ { t - 1 } ^ { l _ { 2 } } ) . } \end{array}
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Here, $z _ { t } ^ { l }$ is the input of the $l _ { t h }$ RES_cLSTM Block and $h _ { t - 1 } ^ { l _ { 1 } } , h _ { t - 1 } ^ { l _ { 2 } }$ represents hidden states of the convolutional LSTM layer from previous $t - 1$ time step. The function $G ^ { l } ( z _ { t } ^ { l } , h _ { t - 1 } ^ { l _ { 1 } } , h _ { t - 1 } ^ { l _ { 2 } } )$ represents the $l _ { t h }$ two-layered convolutional LSTM that maps dynamics of the input pattern into the current hidden states $( \dot { H } _ { t } ^ { l } : [ h _ { t } ^ { l _ { 1 } } , h _ { t } ^ { l _ { 2 } } ] )$ . Similarly to the residual block, all convolutional layer uses $3 \times 3$ size filter.
|
| 106 |
+
|
| 107 |
+
Structure of residual D-net: Using the residual blocks as components, we build a 2-depth U-net architecture for multi-scale representation. The U-net framework [22] was developed for dealing with deep representative learning tasks with few training samples. We adopt the same framework to take advantage of the rich feature representation and the efficient learning scheme. In addition, we add a recurrent flow to capture the dynamic behavior, so that the architecture forms D-shape.
|
| 108 |
+
|
| 109 |
+
As shown in Figure (1), The input $x _ { t } ^ { l = 0 }$ comprises $2 8 \times 2 8$ images of the correlation map at $t$ time step. RES_D_Block decreases the input size by half and increases the feature map by two starting from the initial 16-feature map size. The feature maps are contracting until they reach the last RES_cLSTM block. These abstract embeddings $( z _ { t } ^ { l a s t } )$ are finally used later on for the classification. During the expansion path, the feature map from the middle-depth layer, $z _ { t } ^ { m i d d l e }$ , is concatenated via a skip-connection. This multi-scale way of training allows to learn the complex patterns of the input sequences and to capture the dynamic changes in the hidden state of the convolutional LSTM.
|
| 110 |
+
|
| 111 |
+

|
| 112 |
+
Figure 3: Training scheme of the (a) unsupervised pre-training and (b) supervised fine-tuning using the residual D-net.
|
| 113 |
+
|
| 114 |
+
# 3.3 Unsupervised pre-training and fine-tuning
|
| 115 |
+
|
| 116 |
+
First, we train our residual D-net with sequences of correlation maps by predicting a few steps ahead of the sequences. Given $T$ -time step input sequences, residual D-net predicts the output until next $2 T$ time points $( \tilde { x } _ { T + 1 , \dots , 2 T } )$ . By predicting the future steps, model can be trained unsupervised way [23], see Figure (3). We use mean square error $( M S E )$ of prediction as the loss, and the adam [24] optimizer for updating the parameter with learning rate 0.0005. In Figure (4.b), we can see an example of the predicted sequences, and it shows that unsupervised learning of the residual D-net learns the dynamic behavior of the human brain.
|
| 117 |
+
|
| 118 |
+
After unsupervised training, we take all the output of the last layer of RES_cLSTM block $( z _ { t } ^ { l a s t } )$ for classification task. During the classification learning, the parameters in the contracting path $( 2 \times ( \mathrm { R E S \_ D \_ B L O C K + R E S \_ c L S T M } ) )$ can be fine-tuned with concatenated softmax-classifier such as Figure (3.b). And the final decision will be made by averaging the result from classifier as follows:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
l o g i t = \frac { 1 } { T } \sum _ { t = 1 } ^ { N } \mathrm { s o f t m a x } ( w _ { c l } \times z _ { t } ^ { l a s t } + b _ { c l } ) .
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
Here, $w _ { c l }$ and $b _ { c l }$ are the softmax-classifier projection weights and bias, respectively. We use the binary cross-entropy as a loss function to fine-tune the architecture with a learning rate 0.00001. We found that involving unsupervised pre-training is crucial, in order to avoid over-fitting during the training of the networks, see Figure (5). After the fine-tuning, the classifier learns the differences between the two dynamic pattern in each class.
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
Figure 4: (a) shows the sequences of the dynamic functional connectivity that used for input, and (b) shows the target sequences to be predicted and (c) represents the sequences of the predictions from residual D-net.
|
| 128 |
+
|
| 129 |
+
# 4 Performance Evaluation
|
| 130 |
+
|
| 131 |
+
We conducted two classification experiments (NC vs. eMCI and NC vs. LMCI) to evaluate the proposed residual D-net and compare it with three baselines techniques. For this, we performed a five-fold subject-wise cross-validation to avoid using the same subject. Each validation set was used for selecting the optimal hyper-parameters for the classification model. The performance was measured by the total accuracy, precision, and recall on the test set.
|
| 132 |
+
|
| 133 |
+
Table 2: Values of the Accuracy (Acc), Precision (Pre) and Recall (Rec) for each five-fold subject-wise cross-validation for the eMCI dataset.
|
| 134 |
+
|
| 135 |
+
<table><tr><td></td><td colspan="3">SFC+SVM</td><td colspan="3">DFC+SVM</td><td colspan="3">DAE+HMM</td><td colspan="3">Res. D-net</td></tr><tr><td>CV</td><td>Acc</td><td>Pre</td><td>Rec</td><td>Acc</td><td>Pre</td><td>Rec</td><td>Acc</td><td>Pre</td><td>Rec</td><td>Acc</td><td>Pre</td><td>Rec</td></tr><tr><td>1</td><td>57.1</td><td>52.0</td><td>68.4</td><td>50.0</td><td>46.2</td><td>63.2</td><td>59.5</td><td>54.5</td><td>63.2</td><td>71.4</td><td>62.1</td><td>94.7</td></tr><tr><td>2</td><td>52.5</td><td>61.1</td><td>47.8</td><td>42.5</td><td>50.0</td><td>30.4</td><td>45.0</td><td>53.8</td><td>30.4</td><td>70.0</td><td>66.7</td><td>95.7</td></tr><tr><td>3</td><td>27.8</td><td>36.8</td><td>33.3</td><td>63.9</td><td>78.6</td><td>52.4</td><td>63.9</td><td>65.4</td><td>81.0</td><td>72.2</td><td>72.0</td><td>85.7</td></tr><tr><td>4</td><td>50.0</td><td>48.0</td><td>57.1</td><td>43.2</td><td>40.0</td><td>38.1</td><td>43.2</td><td>41.7</td><td>47.6</td><td>72.7</td><td>66.7</td><td>85.7</td></tr><tr><td>5</td><td>36.8</td><td>33.3</td><td>50.0</td><td>42.1</td><td>38.5</td><td>62.5</td><td>52.6</td><td>45.5</td><td>62.5</td><td>65.8</td><td>56.0</td><td>87.5</td></tr><tr><td>Total</td><td>45.5</td><td>45.9</td><td>51.0</td><td>48.0</td><td>48.0</td><td>48.0</td><td>52.5</td><td>52.3</td><td>56.0</td><td>70.5</td><td>64.7</td><td>90.0</td></tr></table>
|
| 136 |
+
|
| 137 |
+
Table 3: Values of the Accuracy (Acc), Precision (Pre) and Recall (Rec) for each five-fold subject-wise cross-validation for the LMCI dataset.
|
| 138 |
+
|
| 139 |
+
<table><tr><td></td><td colspan="3">SFC+SVM</td><td colspan="3">DFC+SVM</td><td colspan="3">DAE+HMM</td><td colspan="3">Res. D-net</td></tr><tr><td>CV</td><td>Acc</td><td>Pre</td><td>Rec</td><td>Acc</td><td>Pre</td><td>Rec</td><td>Acc</td><td>Pre</td><td>Rec</td><td>Acc</td><td>Pre</td><td>Rec</td></tr><tr><td>1</td><td>50.0</td><td>44.4</td><td>42.1</td><td>50.0</td><td>41.7</td><td>26.3</td><td>38.1</td><td>37.9</td><td>57.9</td><td>73.8</td><td>68.2</td><td>78.9</td></tr><tr><td>2</td><td>48.5</td><td>44.4</td><td>25.0</td><td>54.5</td><td>55.6</td><td>31.3</td><td>60.6</td><td>80.0</td><td>25.0</td><td>75.8</td><td>75.0</td><td>75.0</td></tr><tr><td>3</td><td>74.1</td><td>85.7</td><td>50.0</td><td>33.3</td><td>25.0</td><td>25.0</td><td>51.9</td><td>46.7</td><td>58.3</td><td>66.7</td><td>60.0</td><td>75.0</td></tr><tr><td>4</td><td>61.1</td><td>47.1</td><td>61.5</td><td>50.0</td><td>27.3</td><td>23.1</td><td>61.1</td><td>46.7</td><td>53.8</td><td>72.2</td><td>61.5</td><td>61.5</td></tr><tr><td>5</td><td>48.7</td><td>40.0</td><td>35.3</td><td>61.5</td><td>57.1</td><td>47.1</td><td>56.4</td><td>50.0</td><td>52.9</td><td>64.1</td><td>55.6</td><td>88.2</td></tr><tr><td>Total</td><td>55.4</td><td>48.5</td><td>41.6</td><td>50.8</td><td>41.4</td><td>31.2</td><td>53.1</td><td>46.3</td><td>49.4</td><td>70.6</td><td>63.4</td><td>76.6</td></tr></table>
|
| 140 |
+
|
| 141 |
+
# 4.1 Baselines
|
| 142 |
+
|
| 143 |
+
Static Functional Connectivity $( \mathbf { S F C } ) + \mathbf { S V M }$ : Zhang et al. [5] suggest five specific pairs of the Pearson’s correlation coefficients on each raw dataset $( \breve { \mathbf { R } } \in \mathbb { R } ^ { 9 0 \times 1 3 0 } ,$ ), assuming that the FC can be used to distinguish the MCI subjects from the NC. The authors explicitly selected these features after applying a two-sample T-test on 40 subjects.
|
| 144 |
+
|
| 145 |
+
In this paper, we further investigated twenty alternative coefficients using Fisher feature selection [25], and we fed the selected features to a linear Support Vector Machine (SVM) classifier to perform the classification task.
|
| 146 |
+
|
| 147 |
+
Dynamic Functional Connectivity $\mathbf { ( D F C ) } + \mathbf { S V M }$ : In this experiment, in order to consider the brain dynamics, we used a sliding rectangular window (width: 30 TRs) and a 5 TRs stride to estimate the functional connectivity maps $\Sigma ( w ) \breve { \in } \mathbb { R } ^ { 9 0 \times 9 0 }$ in each window $\mathbf { \chi } ^ { \prime } w = 1 , \dots , 2 0 )$ . Then, according to [26], we project our data into a $K \times 2 0$ -dimensional feature map and then, we selected the best 100 features using Fisher feature selection, and we measured the performance with a linear SVM classifier.
|
| 148 |
+
|
| 149 |
+
Deep Auto-Encoder $\mathbf { ( D A E ) } + \mathbf { H M M }$ : Suk et al. [7] propose an unsupervised feature learning using a DAE. First, they trained a four-layer DAE (hidden layers: 200-100-50-2) using as an input all the ROIs directly. Afterward, for each specific time instance, they converted the information of all the ROIs (a 116 real vector) into a 2-dimensional feature map. Then, they fit these 2-dimensional feature maps into two Hidden Markov Models (HMM) to model the NC and the MCI classes. Similarly, we implemented this method but using 6 hidden states with 2-mixtures of Gaussian HMM via the Baum-Welch algorithm.
|
| 150 |
+
|
| 151 |
+
# 4.2 Discussion and Results
|
| 152 |
+
|
| 153 |
+
As we discussed during the description of the experiment, we adopted a five-fold subject-wise crossvalidation, in order to ensure the reliability of the different methods. Table (2) and Table (3) show the results associated with the accuracy, precision and recall obtained for the different methods, for the eMCI and LMCI dataset respectively.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 5: Cross-entropy errors on the LMCI dataset obtained by the proposed method without pre-training (a) and with pre-training (b). The dot lines represent the actual loss errors obtained for each specific cross-validation sets, and the continuous line represents the mean value among all the cross-validation datasets.
|
| 157 |
+
|
| 158 |
+
The main conclusion is that all the baseline techniques turned out significantly inferior results. First, the inferior performance of $\mathrm { S F C } { + } \mathrm { S V M }$ is expected because it does not consider any brain dynamics. Moreover, a further analysis turned out that this method performed well on the training set, in contrast to the test set. This observation evidences that the method fails to generalize among different datasets.
|
| 159 |
+
|
| 160 |
+
On the other hand, although the $\mathrm { D F C + S V M }$ takes into account the time evolution of the FC, the method does not learn the relationships within the brain dynamics and, consequently, fails to perform the classification task.
|
| 161 |
+
|
| 162 |
+
Regarding to the $\mathrm { D A E + H M M }$ , the major limitation of this approach is that is not an end-to-end learning method. That is, although it incorporates an HMM that tries to model the dynamics, the DAE does not capture any information from the brain connectivity dynamics. Leading to a inferior performance.
|
| 163 |
+
|
| 164 |
+
In contrast, further analysis during the training and the pre-training have shown that our proposed method effectively learns the brain dynamics. Thus, Figure (4) shows the original and the predicted covariance matrices, which assembles the FC brain dynamics. Observe that our proposed approach captures and reproduces the true dynamics of the brain behavior.
|
| 165 |
+
|
| 166 |
+
This explains why the proposed method exhibits the best performance and it properly generalizes among the different cross-validation sets.
|
| 167 |
+
|
| 168 |
+
# Pre-training vs. Overfitting
|
| 169 |
+
|
| 170 |
+
Considering the limited number of samples of the studied datasets, the primary risk of our proposed method is that of overfitting. However, we faced this challenge by introducing the residual D-net architecture, and also by pre-training the model prior to the classification task.
|
| 171 |
+
|
| 172 |
+
Although we have already discussed the advantages the residual D-net architecture, we illustrate the benefits of the pre-training in Figure (5), where we plotted the loss errors for the LMCI dataset with and without pre-training.
|
| 173 |
+
|
| 174 |
+
Observe that the model overfits without pre-training (see Figure (5.a)); that is, we can not guarantee that the method had generalized correctly, making it impossible to establish any proper stopping criterion.
|
| 175 |
+
|
| 176 |
+
However, the behavior of the loss curves radically changes after pre-training the model (see Figure (5.b)). Now, the method has converged and we can define a proper stopping criterion.
|
| 177 |
+
|
| 178 |
+
Figure (5) only shows the results for the LMCI dataset, but we have observed the same effects in the eMCI dataset as well.
|
| 179 |
+
|
| 180 |
+
# 5 Conclusions
|
| 181 |
+
|
| 182 |
+
In this paper, we presented a new method named residual D-net to identify MCI from NC subjects. In contrast to the previous methods, proposed residual D-net can be efficiently trained with few number of training samples, while unravels the brain connectivity dynamics in unsupervised learning. Furthermore, the proposed pre-training approach robustifies the generalization performance of the proposed method and offers an adequate selection of a stopping criterion in practice.
|
| 183 |
+
|
| 184 |
+
# References
|
| 185 |
+
|
| 186 |
+
[1] Warren W. Barker, Cheryl A. Luis, Alice Kashuba, Mercy Luis, Dylan G. Harwood, David Loewenstein, Carol Waters, Pat Jimison, Eugene Shepherd, and Steven Sevush. Relative frequencies of Alzheimer disease, Lewy body, vascular and frontotemporal dementia, and hippocampal sclerosis in the State of Florida Brain Bank. Alzheimer Disease & Associated Disorders, 16(4):203–212, 2002.
|
| 187 |
+
[2] Robert S. Wilson, Eisuke Segawa, Patricia A. Boyle, Sophia E. Anagnos, Loren P. Hizel, and David A. Bennett. The natural history of cognitive decline in Alzheimer’s disease. Psychology and Aging, 27(4):1008–1017, 2012.
|
| 188 |
+
[3] Alzheimer’s Association. 2016 Alzheimer’s disease facts and figures. Alzheimer’s & Dementia, 12(4):459–509, 2016.
|
| 189 |
+
[4] Colin J Brown and Ghassan Hamarneh. Machine learning on human connectome data from mri. arXiv preprint arXiv:1611.08699, 2016.
|
| 190 |
+
[5] Xiaowei Zhang, Bin Hu, Xu Ma, and Linxin Xu. Resting-State Whole-Brain Functional Connectivity Networks for MCI Classification Using L2-Regularized Logistic Regression. IEEE Transactions on NanoBioscience, 14(2):237–247, March 2015.
|
| 191 |
+
[6] Ali Khazaee, Ata Ebrahimzadeh, and Abbas Babajani-Feremi. Application of advanced machine learning methods on resting-state fMRI network for identification of mild cognitive impairment and Alzheimer’s disease. Brain imaging and behavior, 10(3):799–817, 2016.
|
| 192 |
+
[7] Heung-Il Suk, Chong-Yaw Wee, Seong-Whan Lee, and Dinggang Shen. State-space model with deep learning for functional dynamics estimation in resting-state fMRI. NeuroImage, 129:292–307, 2016.
|
| 193 |
+
[8] Paul S. Aisen, Ronald C. Petersen, Michael C. Donohue, Anthony Gamst, Rema Raman, Ronald G. Thomas, Sarah Walter, John Q. Trojanowski, Leslie M. Shaw, Laurel A. Beckett, Clifford R. Jack, William Jagust, Arthur W. Toga, Andrew J. Saykin, John C. Morris, Robert C. Green, and Michael W. Weiner. Clinical core of the Alzheimer’s disease neuroimaging initiative: Progress and plans. Alzheimer’s & Dementia: The Journal of the Alzheimer’s Association, 6(3):239–246, 2010.
|
| 194 |
+
[9] Clifford R. Jack, Matt A. Bernstein, Nick C. Fox, Paul Thompson, Gene Alexander, Danielle Harvey, Bret Borowski, Paula J. Britson, Jennifer L. Whitwell, Chadwick Ward, et al. The Alzheimer’s disease neuroimaging initiative (ADNI): MRI methods. Journal of Magnetic Resonance Imaging, 27(4):685–691, 2008.
|
| 195 |
+
[10] Karl J Friston, Christopher D Frith, Richard SJ Frackowiak, and Robert Turner. Characterizing Dynamic Brain Responses with fMRI: A Multivariate Approach. NeuroImage, 2(2, Part A):166– 172, 1995.
|
| 196 |
+
[11] Frank A Middleton and Peter L Strick. Basal ganglia and cerebellar loops: motor and cognitive circuits. Brain research reviews, 31(2-3):236–250, 2000.
|
| 197 |
+
[12] Elena A. Allen, Eswar Damaraju, Sergey M. Plis, Erik B. Erhardt, Tom Eichele, and Vince D. Calhoun. Tracking Whole-Brain Connectivity Dynamics in the Resting State. Cerebral Cortex, 24(3):663–676, 2014.
|
| 198 |
+
[13] Randy L. Buckner, William M. Kelley, and Steven E. Petersen. Frontal cortex contributes to human memory formation. Nature Neuroscience, 2(4):311–314, 1999.
|
| 199 |
+
[14] Larry R. Squire, Craig E. L. Stark, and Robert E. Clark. The Medial Temporal Lobe. Annual Review of Neuroscience, 27(1):279–306, 2004.
|
| 200 |
+
[15] Memory and the hippocampus: A synthesis from findings with rats, monkeys, and humans. 99(2).
|
| 201 |
+
[16] 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, pages 770–778, 2016.
|
| 202 |
+
[17] Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
|
| 203 |
+
[18] SHI Xingjian, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In Advances in neural information processing systems, pages 802–810, 2015.
|
| 204 |
+
[19] Jaeyoung Kim, Mostafa El-Khamy, and Jungwon Lee. Residual lstm: Design of a deep recurrent architecture for distant speech recognition. arXiv preprint arXiv:1701.03360, 2017.
|
| 205 |
+
[20] Md Zahangir Alom, Mahmudul Hasan, Chris Yakopcic, Tarek M. Taha, and Vijayan K. Asari. Recurrent residual convolutional neural network based on u-net (R2U-Net) for medical image segmentation. arXiv preprint arXiv:1802.06955, 2018.
|
| 206 |
+
[21] Yiren Wang and Fei Tian. Recurrent residual learning for sequence classification. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 938–943, 2016.
|
| 207 |
+
[22] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.
|
| 208 |
+
[23] Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using LSTMs. In International conference on machine learning, pages 843–852, 2015.
|
| 209 |
+
[24] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 210 |
+
[25] Jason Weston, Sayan Mukherjee, Olivier Chapelle, Massimiliano Pontil, Tomaso Poggio, and Vladimir Vapnik. Feature selection for SVMs. In Advances in neural information processing systems, pages 668–674, 2001.
|
| 211 |
+
[26] Nora Leonardi, Jonas Richiardi, Markus Gschwind, Samanta Simioni, Jean-Marie Annoni, Myriam Schluep, Patrik Vuilleumier, and Dimitri Van De Ville. Principal components of functional connectivity: a new approach to study dynamic brain connectivity during rest. NeuroImage, 83:937–950, 2013.
|
md/train/rkaT3zWCZ/rkaT3zWCZ.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BUILDING GENERALIZABLE AGENTS WITH A REALISTIC AND RICH 3D ENVIRONMENT
|
| 2 |
+
|
| 3 |
+
Yi Wu
|
| 4 |
+
UC Berkeley
|
| 5 |
+
jxwuyi@gmail.com
|
| 6 |
+
|
| 7 |
+
Yuxin Wu & Georgia Gkioxari & Yuandong Tian Facebook AI Research {yuxinwu,gkioxari,yuandong}@fb.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Teaching an agent to navigate in an unseen 3D environment is a challenging task, even in the event of simulated environments. To generalize to unseen environments, an agent needs to be robust to low-level variations (e.g. color, texture, object changes), and also high-level variations (e.g. layout changes of the environment). To improve overall generalization, all types of variations in the environment have to be taken under consideration via different level of data augmentation steps. To this end, we propose House3D, a rich, extensible and efficient environment that contains 45,622 human-designed 3D scenes of visually realistic houses, ranging from single-room studios to multi-storied houses, equipped with a diverse set of fully labeled 3D objects, textures and scene layouts, based on the SUNCG dataset (Song et al., 2017). The diversity in House3D opens the door towards scene-level augmentation, while the label-rich nature of House3D enables us to inject pixel- & task-level augmentations such as domain randomization (Tobin et al., 2017) and multi-task training. Using a subset of houses in House3D, we show that reinforcement learning agents trained with an enhancement of different levels of augmentations perform much better in unseen environments than our baselines with raw RGB input by over $8 \%$ in terms of navigation success rate. House3D is publicly available at http://github.com/facebookresearch/House3D.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Recently, deep reinforcement learning has shown its strength on multiple games, such as Atari (Mnih et al., 2015) and Go (Silver et al., 2016), vastly overpowering human performance. Via the various reinforcement learning frameworks, different aspects of intelligence can be learned, including 3D understanding (DeepMind Lab (Beattie et al., 2016) and Malmo (Johnson et al., 2016)), real-time strategy decision (TorchCraft (Synnaeve et al., 2016) and ELF (Tian et al., 2017)), fast reaction (Atari (Bellemare et al., 2013)), long-term planning (Go, Chess), language and communications (ParlAI (Miller et al., 2017) and (Das et al., 2017b)).
|
| 16 |
+
|
| 17 |
+
A prominent issue in reinforcement learning is generalizability. Commonly, agents trained on a specific environment and for a specific task become highly specialized and fail to perform well on new environments. In the past, there have been efforts to address this issue. In particular, pixellevel variations are applied to the observation signals in order to increase the agent’s robustness to unseen environments (Beattie et al., 2016; Higgins et al., 2017; Tobin et al., 2017). Parametrized environments with varying levels of difficulty are used to yield scene variations but with similar visual observations (Pathak et al., 2017). Transfer learning is applied to similar tasks but with different rewards (Finn et al., 2017b).
|
| 18 |
+
|
| 19 |
+
Nevertheless, the aforementioned techniques study the problem in simplified environments which lack the diversity, richness and perception challenges of the real world. To this end, we propose a substantially more diverse environment, House3D, to train and test our agents. House3D is a virtual 3D environment consisting of thousands of indoor scenes equipped with a diverse set of scene types, layouts and objects. An overview of House3D is shown in Figure 1a. House3D leverages the SUNCG dataset (Song et al., 2017) which contains 45K human-designed real-world 3D house models, ranging from single studios to houses with gardens, in which objects are fully labeled with categories. We convert the SUNCG dataset to an environment, House3D, which is efficient and extensible for various tasks. In House3D, an agent can freely explore the space while perceiving a large number of objects under various visual appearances.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: An overview of House3D environment and RoomNav task. (a) We build an efficient and interactive environment upon the SUNCG dataset (Song et al., 2017) that contains 45K diverse indoor scenes, ranging from studios to two-storied houses with swimming pools and fitness rooms. All 3D objects are fully labeled into over 80 categories. Observations of agents in the environment have multiple modalities, including RGB images, Depth, Segmentation masks (from object category), top-down 2D view, etc. (b) We focus on the task of targeted navigation. Given a high-level description of a room concept, the agent explores the environment to reach the target room.
|
| 23 |
+
|
| 24 |
+
Based on House3D, we design a task called RoomNav: an agent starts at a random location in a house and is asked to navigate to a destination specified by a high-level semantic concept (e.g. kitchen), following simple rules (e.g. no object penetration), as shown in Figure 1b. We use gated-CNN and gated-LSTM policies trained with standard deep reinforcement learning methods, i.e. A3C (Mnih et al., 2016) and DDPG (Lillicrap et al., 2015), and report success rate on unseen environments over 5 concepts. We show that in order to achieve strong generalization capability, all-levels of augmentations are needed: pixel-level augmentation by domain randomization (Tobin et al., 2017) enhances the agent’s robustness to color variations; object-level augmentation forces the agent to learn multiple concepts (20 in number) simultaneously, and scene-level augmentation, where a diverse set of environments is used, enforce generalizability across diverse scenes, mitigating overfitting to particular scenes. Our final gated-LSTM agent achieves a success rate of $3 5 . { \bar { 8 } } \%$ on 50 unseen environments, $10 \%$ better than the baseline method $( 2 5 . 7 \% )$ .
|
| 25 |
+
|
| 26 |
+
The remaining of the paper is structured as follows. Section 2 summarizes relevant work. Section 3 describes our environment, House3D, in detail and section 4 describes the task, RoomNav. Section 5 describes our gated models and the applied algorithms to tackle RoomNav. Finally, experimental results are shown in Section 6.
|
| 27 |
+
|
| 28 |
+
# 2 RELATED WORK
|
| 29 |
+
|
| 30 |
+
Environments: Table 1 shows the comparison between House3D and most relevant prior works. There are other simulated environments which focus on different domains, such as OpenAI Gym (Brockman et al., 2016), ParlAI (Miller et al., 2017) for language communication as well as some strategic game environments (Synnaeve et al., 2016; Tian et al., 2017; Vinyals et al., 2017), etc. Most of these environments are pertinent to one particular aspect of intelligence, such as dialogue or a single type of game, which makes it hard to facilitate the study of more comprehensive problems. On the contrary, we focus on building a platform that intersects with multiple research directions, such as object and scene understanding, 3D navigation, embodied question answering (Das et al., 2017a), while allowing users to customize the level of complexity to their needs.
|
| 31 |
+
|
| 32 |
+
Table 1: A summary of popular environments. The attributes include 3D: 3D nature of the rendered objects, Realistic: resemblance to the real-world, Large-scale: a large set of environments, Fast: fast rendering speed and Customizable: flexibility to be customized to other applications.
|
| 33 |
+
|
| 34 |
+
<table><tr><td rowspan=1 colspan=1>Environment</td><td rowspan=1 colspan=1>3D</td><td rowspan=1 colspan=1>Realistic</td><td rowspan=1 colspan=1>Large-scale</td><td rowspan=1 colspan=1>Fast</td><td rowspan=1 colspan=1>Customizable</td></tr><tr><td rowspan=1 colspan=1>Atari (Bellemare et al., 2013)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>OpenAI Universe (Shi et al., 2017)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>.</td><td rowspan=1 colspan=1>.</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>·</td></tr><tr><td rowspan=1 colspan=1>Malmo (Johnson et al., 2016)</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>.</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>·</td></tr><tr><td rowspan=1 colspan=1>DeepMind Lab (Beattie et al., 2016)</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>·</td></tr><tr><td rowspan=1 colspan=1>VizDoom (Kempka et al., 2016)</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>·</td></tr><tr><td rowspan=1 colspan=1>AI2-THOR (Zhu et al., 2017)</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Stanford2D-3D (Armeni et al., 2016)</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Matterport3D (Chang et al.,2017)</td><td rowspan=1 colspan=1>.</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>House3D</td><td rowspan=1 colspan=1>.</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>·</td><td rowspan=1 colspan=1>.</td></tr></table>
|
| 35 |
+
|
| 36 |
+
We build on SUNCG (Song et al., 2017), a dataset that consists of thousands of diverse synthetic indoor scenes equipped with a variety of objects and layouts. Its visual diversity and rich content opens the path to the study of semantic generalization for reinforcement learning agents. Our platform decouples high-performance rendering from data I/O, and thus can use other publicly available 3D scene datasets as well. This includes Al2-THOR (Zhu et al., 2017), SceneNet RGB-D (McCormac et al., 2017), Stanford 3D (Armeni et al., 2016), Matterport 3D (Chang et al., 2017) and so on.
|
| 37 |
+
|
| 38 |
+
Concurrent works (Brodeur et al., 2017; Savva et al., 2017) also introduce similar platforms as House3D, indicating the interest for large-scale interactive and realistic 3D environments.
|
| 39 |
+
|
| 40 |
+
3D Navigation: There has been a prominent line of work on the task of navigation in real 3D scenes (Leonard & Durrant-Whyte, 1992). Classical approaches decompose the task into two subtasks by building a 3D map of the scene using SLAM and then planning in this map (Fox et al., 2005). More recently, end-to-end learning methods were introduced to predict robotic actions from raw pixel data (Levine et al., 2016). Some of the most recent works on navigation show the effectiveness of end-to-end learning. Gupta et al. (2017) learn to navigate via mapping and planning using shortest path supervision. Sadeghi & Levine (2017) teach an agent to fly using solely simulated data and deploy it in the real world. Dhiraj et al. (2017) collect a dataset of drones crashing into objects and train self-supervised agents on this data to avoid obstacles.
|
| 41 |
+
|
| 42 |
+
A number of recent works also use deep reinforcement learning for navigation in simulated 3D scenes. Mirowski et al. (2016); Jaderberg et al. (2016) improve an agent’s navigation ability in mazes by introducing auxiliary tasks. Parisotto & Salakhutdinov (2017) propose a new architecture which stores information of the environment on a 2D map. Karl Moritz Hermann & PhilBlunsom (2017) focus on the task of language grounding by navigating simple 3D scenes. However, these works only evaluate the agent’s generalization ability on pixel-level variations or small mazes. We argue that a much richer environment is crucial for evaluating semantic-level generalization.
|
| 43 |
+
|
| 44 |
+
Gated Modules: In our work, we focus on the task of RoomNav, where the goal is communicated to the agent as a high-level instruction selected from a set of predefined concepts. To modulate the behavior of the agent in RoomNav, we encode the instruction as an embedding vector which gates the visual signal. The idea of gated attention has been used in the past for language grounding (Chaplot et al., 2017), and transfer learning by language grounding (Narasimhan et al., 2017). Similar to those works, we use concept grounding as an attention mechanism. We believe that our gated reinforcement learning models serve as a strong baseline for the task of semantic based navigation in House3D. Furthermore, our empirical results allow us to draw conclusions on the models’ efficacy when training agents in a large-scale, diverse dataset with an emphasis on generalization.
|
| 45 |
+
|
| 46 |
+
Generalization: There is a recent trend in reinforcement learning focusing on the problem of generalization, ranging from learning to plan (Tamar et al., 2016), meta-learning (Duan et al., 2016; Finn et al., 2017a) to zero-shot learning (Andreas et al., 2016; Oh et al., 2017; Higgins et al., 2017).
|
| 47 |
+
|
| 48 |
+
However, these works either focus on over-simplified tasks or test on environments which are only slightly varied from the training ones. In contrast, we use a more diverse set of environments, each containing visually and structurally different observations, and show that the agent can work well in unseen scenes.
|
| 49 |
+
|
| 50 |
+
In this work, we show improved generalization performance in complex 3D scenes when using depth and segmentation masks on top of the raw visual input. This observation is similar to other works which use a diverse set of input modalities (Mirowski et al., 2016; Tai & Liu, 2016). Our result suggests that it can be possible to decouple real-world robotics from recognition via a vision API provided by an object detection or semantic segmentation system trained on the targeted real scenes. This opens the door towards bridging the gap between simulated environment and real-world (Tobin et al., 2017; Rusu et al., 2016; Christiano et al., 2016).
|
| 51 |
+
|
| 52 |
+
# 3 HOUSE3D: AN EXTENSIBLE ENVIRONMENT OF 45K 3D HOUSES
|
| 53 |
+
|
| 54 |
+
We propose House3D, an environment which closely resembles the real world and is rich in content and structure. An overview of House3D is shown in Figure 1a. House3D is developed to provide an efficient and flexible environment of thousands of indoor scenes and facilitates a variety of tasks, e.g. navigation, visual understanding, language grounding, concept learning etc. The environment along with a python API for easy use is available at http://github.com/facebookresearch/ House3D.
|
| 55 |
+
|
| 56 |
+
# 3.1 DATASET
|
| 57 |
+
|
| 58 |
+
The 3D scenes in House3D are sourced from the SUNCG dataset (Song et al., 2017), which consists of 45,622 human-designed 3D scenes ranging from single-room studios to multi-floor houses. The SUNCG dataset was designed to encourage research on large-scale 3D object recognition problems and thus carries a variety of objects, scene layouts and structures. On average, there are 8.9 rooms and 1.3 floors per scene There is a diverse set of room and object types in each scene. In total, there are over 20 different room types, such as bedroom, living room, kitchen, bathroom etc., with over 80 different object categories. In total, the SUNCG dataset contains 404,508 different rooms and 5,697,217 object instances drawn from 2644 unique object meshes.
|
| 59 |
+
|
| 60 |
+
# 3.2 ANNOTATIONS
|
| 61 |
+
|
| 62 |
+
Each scene in SUNCG is fully annotated with 3D coordinates and its room and object types (e.g. bedroom, shoe cabinet, etc). This allows for a detailed mapping from each 3D location to an object instance (or None at free space) and the room type.
|
| 63 |
+
|
| 64 |
+
At every time step an agent has access to the following signals: a) the visual RGB signal of its current first person view, b) semantic/instance segmentation masks for all the objects visible in its current view, and c) depth information. For different tasks, these signals might serve for different purposes, e.g., as a feature plane or an auxiliary target. Based on the existing annotations, House3D offers more information, e.g., top-down 2D occupancy maps, connectivity analysis and shortest paths between two points.
|
| 65 |
+
|
| 66 |
+
# 3.3 RENDERER
|
| 67 |
+
|
| 68 |
+
To build a realistic 3D environment, we develop a renderer for the SUNCG scenes. The renderer is based on OpenGL, it can run on both Linux and MacOS, and provides RGB images, semantic segmentation masks, instance segmentation masks and depth maps.
|
| 69 |
+
|
| 70 |
+
As highlighted above, the environment needs to be efficient in order to be used for large-scale reinforcement learning. On a NVIDIA Tesla M40 GPU, our implementation can render $1 2 0 \times 9 0$ -sized frames at over 600 fps, while multiple renderers can run in parallel on one or more GPUs. When rendering multiple houses simultaneously, one M40 GPU can be fully utilized to render at a total of 1800 fps. The default simple physics adds a small overhead to the rendering. The high throughput of our implementation enables efficient learning for a variety of interactive tasks, such as on-policy reinforcement learning.
|
| 71 |
+
|
| 72 |
+
# 3.4 INTERACTION
|
| 73 |
+
|
| 74 |
+
In House3D, an agent can live in any location within a 3D scene, as long as it does not collide with object instances (including walls) within a small range, i.e. robot’s radius. Doors, gates and arches are considered passage ways, meaning that an agent can walk through those structures freely. These default design choices add negligible run-time overhead. Note that more complex interaction rules can be incorporated (e.g. manipulation) within House3D using our flexible API, which we leave for future work.
|
| 75 |
+
|
| 76 |
+
# 4 ROOMNAV: A BENCHMARK TASK FOR CONCEPT-DRIVEN NAVIGATION
|
| 77 |
+
|
| 78 |
+
Consider the task of concept-driven navigation as shown in Figure 1b. A human may give a high level instruction to the robot, for example, “Go to the kitchen”, so that one can later ask the robot to turn on the oven. The robot needs to behave appropriately conditioned on the house it is located in and the goal, e.g. the semantic concept “kitchen”. In addition, we want the agent to generalize, i.e. to perform well in unseen environments, that is new houses with different layouts and furniture locations.
|
| 79 |
+
|
| 80 |
+
To study the aforementioned abilities of an agent, we develop a benchmark task, Concept-Driven Navigation (RoomNav), based on House3D. We define the goal to be of the form $^ { 6 6 } \mathrm { g o }$ to $\mathrm { \nabla { X ^ { \prime } { } ^ { * } } }$ , where X denotes a pre-defined room type or object type, which is a semantic concept that an agent needs to interpret from a variety of scenes of distinct visual appearances. To ensure fast experimentation cycles, we perform experiments on a subset of House3D. We manually select 270 houses suitable for a navigation task and split them into a small set (20 houses), a large set (200 houses) and a test set (50 houses), where the test set is used to evaluate the generalization of the trained agents.
|
| 81 |
+
|
| 82 |
+
Task Formulation: Suppose we have a set of episodic environments $\mathcal { E } ~ = ~ \{ E _ { 1 } , . . , E _ { n } \}$ and a set of semantic concepts $\bar { \mathcal { T } } = \{ I _ { 1 } , . . , I _ { m } \}$ . During each episode, the agent is interacting with one environment $E \in { \mathcal { E } }$ and is given a concept $I \in \mathcal { T }$ . In the beginning of an episode, the agent is randomly placed somewhere in $E$ . At each time step $t$ , the agent receives a visual signal $X _ { t }$ from $E$ via its first person view sensor. Let $s _ { t } = \{ X _ { 1 } , . . , X _ { t } , I \}$ denote the state of the agent at time $t$ . The agent needs to propose an action $a _ { t }$ to navigate and rotate its sensor given $s _ { t }$ . The environment returns a reward signal $r _ { t }$ and terminates when the agent succeeds in finding the destination, or reaches a maximum number of steps.
|
| 83 |
+
|
| 84 |
+
The objective of this task is to learn an optimal policy $\pi ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } , I )$ that leads to the target defined by $I$ . We train the agent on a set ${ \mathcal { E } } _ { \operatorname { t r a i n } }$ . We evaluate the policy on a disjoint set of environments ${ \mathcal { E } } _ { \mathrm { t e s t } }$ ( $\mathcal { E } _ { \mathrm { t e s t } } \cap \mathcal { E } _ { \mathrm { t r a i n } } = \emptyset ,$ ). For more details see the Appendix.
|
| 85 |
+
|
| 86 |
+
Environment Statistics: The selected 270 houses are manually verified for navigation; they are well connected, contain desired concepts, and are large enough for exploration. We split them into 3 disjoint sets, denoted by $\mathcal { E } _ { s m a l l }$ , $\mathcal { E } _ { l a r g e }$ and $\mathcal { E } _ { t e s t }$ respectively. For the semantic concepts, we select the five most common room types: kitchen, living room, dining room, bedroom and bathroom. Note that this set can be extended to include objects or even subareas within rooms.
|
| 87 |
+
|
| 88 |
+
Observations: We utilize three different kinds of visual input signals for $X _ { t }$ , including (1) raw pixel values; (2) semantic segmentation mask of the pixel input; and (3) depth information, and experiment with different combinations of them. We encode each concept $I$ as a one-hot vector representation.
|
| 89 |
+
|
| 90 |
+
Action Space: Similar to existing navigation works, we define a fixed set of actions, here 12 in number including different scales of rotations and movements. Due to the complexity of the indoor scenes, we also explore a continuous action space similar to (Lowe et al., 2017), which in effect allows the agent to move with different velocities. For more details see the Appendix. In all cases, if the agent hits an obstacle it remains still.
|
| 91 |
+
|
| 92 |
+
Success Measure and Reward Function: To declare success, we want to ensure that the agent identifies the target room by its unique properties (e.g. presence of appropriate objects in the room such as pan and knives for kitchen and bed for bedroom) instead of merely reaching there by luck. An episode is considered successful if both of the following two criteria are satisfied: (1) the agent is located inside the target room; (2) the agent consecutively sees a designated object category associated with that target room type for at least 2 time steps. We assume that an agent sees an object if there are at least $4 \%$ of pixels in $X _ { t }$ belonging to that object.
|
| 93 |
+
|
| 94 |
+
For the reward function, ideally two signals suffice to reflect the task requirement: (1) a collision penalty when hitting obstacles; and (2) a success reward when completing the task. However, these basic signals make it too difficult for an RL agent to learn, as the positive reward is too sparse. To provide additional supervision during training, we resort to an informative reward shaping: we compute the approximate shortest distance from the target room to each location in the house and adopt the difference of shortest distances between the agent’s movement as an additional reward signal. Note that our ultimate goal is to learn a policy that could generalize to unseen houses. Our strong reward shaping supervises the agent at training and is not available to the agent at test time. We empirically observe that stronger reward shaping leads to better performances on both training and testing.
|
| 95 |
+
|
| 96 |
+
# 5 GATED-ATTENTION NETWORKS FOR MULTI-TARGET LEARNING
|
| 97 |
+
|
| 98 |
+
The RoomNav task can be considered as a multi-target learning problem: the policy needs to condition on both the input $s _ { t }$ and the target concept $I$ . For policy representations which incorporate the target $I$ , we propose two baseline models with a gated-attention architecture, similar to Dhingra et al. (2016) and Chaplot et al. (2017): a gated-CNN network for continuous actions and a gatedLSTM network for discrete actions. We train the gated-CNN policy using the deep deterministic policy gradient (DDPG) (Lillicrap et al., 2015), while the gated-LSTM policy is trained using the asynchronous advantage actor-critic algorithm (A3C) (Mnih et al., 2016).
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 2: Overview of our proposed models. Bottom part demonstrates the gated-LSTM model for discrete action while the top part shows the gated-CNN model for continuous action. The “Gated Fusion” module denotes the gated-attention architecture.
|
| 102 |
+
|
| 103 |
+
# 5.1 DDPG WITH GATED-CNN POLICY
|
| 104 |
+
|
| 105 |
+
# 5.1.1 DEEP DETERMINISTIC POLICY GRADIENT
|
| 106 |
+
|
| 107 |
+
Suppose we have a deterministic policy $\mu ( s _ { t } | \boldsymbol { \theta } )$ (actor) and the Q-function $Q ( s _ { t } , a | \theta )$ (critic) both parametrized by $\theta$ . DDPG optimizes the policy $\mu ( s _ { t } | \boldsymbol { \theta } )$ by maximizing $\begin{array} { r l r } { L _ { \mu } ( \theta ) } & { { } = } & { \bar { \mathbb { E } _ { s _ { t } } } \left[ Q ( s _ { t } , \mu ( s _ { t } | \theta ) | \theta ) \right] } \end{array}$ , and updates the $\mathrm { Q }$ -function by minimizing $\begin{array} { r l } { L _ { Q } ( \theta ) } & { { } = } \end{array}$ $\mathbb { E } \left[ ( Q ( s _ { t } , a _ { t } | \theta ) - \gamma Q ( s _ { t + 1 } , \mu ( s _ { t + 1 } | \theta ) | \theta ) - r _ { t } ) ^ { 2 } \right]$ .
|
| 108 |
+
|
| 109 |
+
Here, we use a shared network for both actor and critic with the final loss function $L _ { \mathrm { D D P G } } ( \theta ) =$ $- L _ { \mu } ( \theta ) + \alpha _ { \mathrm { D D P G } } L _ { Q } ( \theta )$ , where $\alpha _ { \mathrm { D D P G } }$ is a constant balancing the two objectives.
|
| 110 |
+
|
| 111 |
+
# 5.1.2 GATED-CNN FOR CONTINUOUS POLICY
|
| 112 |
+
|
| 113 |
+
State Encoding: Given state $s _ { t }$ , we first stack the most recent $k$ frames $\begin{array} { r l } { X } & { { } = } \end{array}$ $[ X _ { t } , X _ { t - 1 } , \ldots , X _ { t - k + 1 } ]$ channel-wise and apply a convolutional neural network to derive an image representation $x ~ = ~ f _ { \mathrm { c n n } } ( X | \theta ) ~ \in ~ \mathbb { R } ^ { d _ { X } }$ . We convert the target $I$ into an embedding vector $\dot { y ^ { \cdot } } = \bar { f } _ { \mathrm { e m b e d } } ( I | \theta ) \in \mathbb { R } ^ { d _ { I } }$ . Subsequently, we apply a fusion module $M ( x , y | \theta )$ to derive the final encoding $h _ { s } = M ( x , y | \theta )$ .
|
| 114 |
+
|
| 115 |
+
Gated-Attention for Feature Fusion: For the fusion module $M ( x , y | \theta )$ , the straightforward version is concatenation, namely $M _ { \mathrm { c a t } } ( x , y | \cdot ) = [ x , y ]$ . In our case, $x$ is always a high-dimensional feature vector (i.e., image feature) while $y$ is a simple low-dimensional conditioning vector (e.g., instruction). Thus, simple concatenation may result in optimization difficulties. For this reason, we propose to use a gated-attention mechanism. Suppose $x \in \mathbb { R } ^ { d _ { x } }$ and $\boldsymbol { y } \in \mathbb { R } ^ { d _ { \boldsymbol { y } } }$ where $d _ { y } ~ < ~ d _ { x }$ . First, we transform $y$ to $y ^ { \prime } \in \mathbb { R } ^ { d _ { X } }$ via an MLP, namely $y ^ { \prime } ~ = ~ f _ { \mathrm { m l p } } ( y | \theta )$ , and then perform a Hadamard (pointwise) product between $x$ and sigmoid $( y ^ { \prime } )$ , which leads to our final gated fusion module $M ( x , y | \theta ) = x \odot$ sigmoid $\left( f _ { \mathrm { m l p } } ( y | \theta ) \right)$ . This gated fusion module could also be interpreted as an attention mechanism over the feature vector which could help better shape the feature representation.
|
| 116 |
+
|
| 117 |
+
Policy Representation: For the policy, we apply a MLP layer on the state representation $h _ { s }$ , followed by a softmax operator (for bounded velocity) to produce the continuous action. Moreover, in order to produce a stochastic policy for both better exploration and higher robustness, we apply the Gumbel-Softmax trick (Jang et al., 2016), resulting in the final policy $\mu ( s _ { t } | \theta ) =$ Gumbel-Softmax ${ \bf \zeta } ^ { \prime } f _ { \mathrm { m l p } } ( h _ { s } | \boldsymbol { \theta } ) )$ . Note that since we add randomness to $\mu ( s _ { t } | \boldsymbol { \theta } )$ , our DDPG formulation can also be interpreted as the SVG(0) algorithm (Heess et al., 2015).
|
| 118 |
+
|
| 119 |
+
Q-function: The Q-function $Q ( s , a )$ conditions on both state $s$ and action $a$ . We again apply a gated fusion module to the feature vector $x$ and the action vector $a$ to derive a hidden representation $h _ { Q } = M ( x , a | \theta )$ . We eventually apply another MLP to $h _ { Q }$ to produce the final value $Q ( s , a )$ .
|
| 120 |
+
|
| 121 |
+
A model demonstration is shown in the top part of Fig. 2, where each block has its own parameters.
|
| 122 |
+
|
| 123 |
+
5.2 A3C WITH GATED-LSTM POLICY
|
| 124 |
+
|
| 125 |
+
# 5.2.1 ASYNCHRONOUS ADVANTAGE ACTOR-CRITIC
|
| 126 |
+
|
| 127 |
+
Suppose we have a discrete policy $\pi ( \boldsymbol { a } ; \boldsymbol { s } | \boldsymbol { \theta } )$ and a value function $v ( s | \theta )$ . A3C optimizes the policy by minimizing the loss function $\begin{array} { r } { L _ { \mathrm { p g } } ( \theta ) = - \mathbb { E } _ { s _ { t } , a _ { t } , r _ { t } } \left[ \sum _ { t = 1 } ^ { T } ( R _ { t } - v ( s _ { t } ) ) \log \pi ( a _ { t } ; s _ { t } | \theta ) \right] } \end{array}$ , where $R _ { t }$ is the discounted accumulative reward defined by $\begin{array} { r } { R _ { t } = \sum _ { i = 0 } ^ { T - t } \gamma ^ { i } r _ { t + i } + v ( s _ { T + 1 } ) } \end{array}$ . The value function is updated by minimizing the loss $L _ { v } ( \theta ) = \mathbb { E } _ { s _ { t } , r _ { t } } [ ( R _ { t } - v ( s _ { t } ) ) ^ { 2 } ]$ .
|
| 128 |
+
|
| 129 |
+
Finally the overall loss function for A3C is $L _ { \mathrm { A 3 C } } ( \theta ) = L _ { \mathrm { p g } } ( \theta ) + \alpha _ { \mathrm { A 3 C } } L _ { v } ( \theta )$ where $\alpha _ { \mathrm { A } 3 \mathrm { C } }$ is a constant coefficient.
|
| 130 |
+
|
| 131 |
+
# 5.2.2 GATED-LSTM NETWORK FOR DISCRETE POLICY
|
| 132 |
+
|
| 133 |
+
State Encoding: Given state $s _ { t }$ , we first apply a CNN module to extract image feature $x _ { t }$ for each input frame $X _ { t }$ . For the target, we apply a gated fusion module to derive a state representation $h _ { t } = { \bar { M } } ( x _ { t } , I | \theta )$ at each time step $t$ . Then, we concatenate $h _ { t }$ with the target $I$ and the result is fed into the LSTM module (Hochreiter & Schmidhuber, 1997) to obtain a sequence of LSTM outputs $\{ o _ { t } \} _ { t }$ , so that the LSTM module has direct access to the target other than the attended visual feature.
|
| 134 |
+
|
| 135 |
+
Policy and Value Function: For each time step $t$ , we concatenate the state vector $h _ { t }$ with the output of the LSTM $o _ { t }$ to obtain a joint hidden vector $h _ { \mathrm { j o i n t } } = [ h _ { t } , o _ { t } ]$ . Then we apply two MLPs to $h _ { \mathrm { j o i n t } }$ to obtain the policy distribution $\pi ( a ; s _ { t } | \theta )$ as well as the value function $v ( s _ { t } | \theta )$ .
|
| 136 |
+
|
| 137 |
+
A visualization of the model is in the bottom part of Fig. 2. The parameters of CNN modules are shared across time.
|
| 138 |
+
|
| 139 |
+
# 6 EXPERIMENTAL RESULTS
|
| 140 |
+
|
| 141 |
+
We report experimental results for our models on the task of RoomNav. We first compare models with discrete and continuous action spaces with different input modalities. Then we explain our observations and show that techniques targeting different levels of augmentation improve the success rate of navigation in the test set. Moreover, these techniques are complementary to each other.
|
| 142 |
+
|
| 143 |
+
Setup. We train our baseline models on multiple experimental settings. We use two training datasets. The small set $\mathcal { E } _ { \mathrm { s m a l l } }$ contains 20 houses and the large set $\mathcal { E } _ { \mathrm { l a r g e } }$ contains 200 houses. A held-out dataset ${ \mathcal { E } } _ { \mathrm { t e s t } }$ is used for test, which contains 50 houses.
|
| 144 |
+
|
| 145 |
+
We mainly focus on success rate on the test set, i.e, how the agent generalizes. For reference, we also report the training performance. The agent fails if it failed to find the concept within 100 steps1. All success rate evaluations use a fixed random seed for a fair comparison. For each model, we run 2000 evaluation episodes on $\mathcal { E } _ { \mathrm { s m a l l } }$ and ${ \mathcal { E } } _ { \mathrm { t e s t } }$ , and 5000 evaluation episodes on $\mathcal { E } _ { \mathrm { l a r g e } }$ to measure overall success rates.
|
| 146 |
+
|
| 147 |
+
We use gated-CNN and gated-LSTM to denote the networks with gated-attention, and concat-CNN and concat-LSTM for models with simple concatenation. We also experiment with different visual signals to the agents, including RGB image (RGB Only), RGB image with depth information $( \mathrm { R G B + D e p t h } _ { \it . }$ ) and semantics mask with depth information (Mask+Depth). The input image resolution is $1 2 0 \times 9 0$ to preserve image details.
|
| 148 |
+
|
| 149 |
+
During each simulated episode, we randomly select a house from the environment set and randomly pick an applicable target from the house to instruct the agent. During training, we add an entropy bonus term for both models2 in addition to the original loss function. For evaluation, we keep the final model for DDPG due to its stable learning curve, while for A3C, we take the model with the highest training success rate. We use Pytorch (Paszke et al., 2017) and Adam (Kingma & Ba, 2014). See Appendix for more experiment details.
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 3: Overall performance of various models trained on (a) ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ (20 houses) with different input signals: RGB Only, RGB $+$ Depth and Mask+Depth; (b) $\mathcal { E } _ { \mathrm { l a r g e } }$ (200 houses) with input signals: RGB $+$ Depth and Mask $^ +$ Depth. In each group, the bars from left to right correspond to gated-LSTM, concat-LSTM, gated-CNN, concat-CNN and random policy respectively.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 4: Pixel-level Augmentation: Test performances of various models trained with different input signals, including RGB $^ +$ Depth on $\mathcal { E } _ { \mathrm { s m a l l } }$ , RGB with Domain Randomization on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ , Mask+Depth on $\mathcal { E } _ { \mathrm { s m a l l } }$ , Mask $^ +$ Depth on $\mathcal { E } _ { \mathrm { l a r g e } }$ . In each group, the bars represent gated-LSTM, concat-LSTM, gated-CNN and concat-CNN from left to right.
|
| 156 |
+
|
| 157 |
+
6.1 BASELINES: MODELS WITH RGB SIGNALS ON $\mathcal { E } _ { \mathrm { S M A L L } }$
|
| 158 |
+
|
| 159 |
+
As shown in the bottom part of Fig. 3a, on $\mathcal { E } _ { \mathrm { s m a l l } }$ , the test success rate for models trained on RGB features is unsatisfactory. We observe obvious overfitting behavior: the test performance is drastically worse than training. In particular, the gated-LSTM models achieve even lower success rate than concat-LSTM models, despite the fact that they have much better training performance. In this case, the learning algorithm picks up spurious color patterns in the environments as the guidance towards the goal, which is inapplicable to unseen environments.
|
| 160 |
+
|
| 161 |
+
In both training and test, we find that depth information improves the performance thus we use it in the following experiments and omit Depth for conciseness.
|
| 162 |
+
|
| 163 |
+
# 6.2 TECHNIQUES FOR DIFFERENT LEVELS OF AUGMENTATION
|
| 164 |
+
|
| 165 |
+
Augmentation is a standard technique to improve generalization. However, for complicated tasks, augmentation needs to be taken care at different levels. In this section, we categorize augmentation techniques into 3 levels: (1) pixel-level augmentation: changing the colors and textures; (2) tasklevel augmentation: joint learning for multiple tasks; (3) scene-level augmentation: training on more environments. We analyze the generalization performance with all techniques and conclude that these techniques are complementary and that the best test performance is obtained by combining these techniques together.
|
| 166 |
+
|
| 167 |
+
Pixel-level Augmentation: We use domain randomization (Tobin et al., 2017), by reassigning each object in the scene a random color but keeping the textures. This breaks the spurious color correlations and pushes the agent to learn a better representation.
|
| 168 |
+
|
| 169 |
+
We explore domain randomization by generating an additional 180 houses with random object coloring from $\mathcal { E } _ { \mathrm { s m a l l } }$ , which leads to a total of 200 houses. We evaluate the test success rate of various models under different training settings, e.g., RGB, RGB with domain randomization (D.R.) or mask signal. The results are shown in Fig. 4. Interestingly, we noticed that domain randomization yields very similar performance as mask signal on $\mathcal { E } _ { \mathrm { s m a l l } }$ .
|
| 170 |
+
|
| 171 |
+
One shortcoming of domain randomization is that it requires substantially more training samples and thus suffers from high sample complexity. Thanks to the rich labels in House3D, we instead could use segmentation mask as an input feature plane, which encodes semantic information and is independent of the object color. This helps train generalizable agent with much fewer training samples. On the other hand, an agent trained with domain randomization can operate with RGB input only, without segmentation mask output from a vision subsystem. In the current context, we simply assume adopting segmentation mask input as the technique for pixel-level augmentation.
|
| 172 |
+
|
| 173 |
+
Task-level Augmentation: We explore task-level augmentation by adding related auxiliary targets during training (Fig. 5). Specifically, in addition to the 5 room types as auxiliary targets, we selected
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 5: Task-Level Augmentation: Test performances of LSTM models trained with and without auxiliary targets on both ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ and $\mathcal { E } _ { \mathrm { l a r g e } }$ . In each group, the bars represent gated-LSTM $+ \mathrm { \ R G B }$ , concat-LSTM $^ +$ RGB, gated-LSTM $^ +$ Mask and concat-LSTM $^ +$ Mask from left to right.
|
| 177 |
+
|
| 178 |
+
15 object concepts (e.g., chair, table, cabinet, etc. See a full list of object concepts in appendix.).
|
| 179 |
+
We train A3C agents with different input signals on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ and evaluate their test performances.
|
| 180 |
+
|
| 181 |
+
We found that auxiliary targets significantly reduce overfitting and increases the generalizability of models with RGB inputs. Because of this effect, gated attention model, which has high model capacity, becomes much more effective on RGB signal when trained with more targets. On the other hand, with mask input, the agent does not need to learn to differentiate the objects, therefore auxiliary targets do not help that much for more complicated models like gated attention models.
|
| 182 |
+
|
| 183 |
+
Scene-level Augmentation: We could further boost the generalization performance by augmenting the training set with more diverse set of houses, i.e, $\mathcal { E } _ { \mathrm { l a r g e } }$ that contain 200 different houses. This is also a benefit from House3D.
|
| 184 |
+
|
| 185 |
+
For visual signals, we focus on feature combinations like “RGB $^ +$ Depth” and “M $\mathrm { a s k + D e }$ pth”. Note that for training efficiency, segmentation mask is a surrogate feature to approximate ${ } ^ { 6 6 } { \mathrm { R G B } } +$ domain randomization” as it shows similar results in the small set. Both train and test results are summarized in Fig. 3b.
|
| 186 |
+
|
| 187 |
+
On a semantically diverse dataset $\mathcal { E } _ { \mathrm { l a r g e } }$ , the overfitting issue is largely resolved. We see drops in the training performance and improve on the generalization. After training on a large number of environments, every model now has a much smaller gap between its training and test performance. This is in particularly true for the models using RGB signal, which suffers from overfitting issues on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ . Notably, on large dataset, LSTM models generally perform better than CNN models due to its high model capacity.
|
| 188 |
+
|
| 189 |
+
In addition, similar behavior was also observed during our experiments with techniques for pixellevel augmentation (Fig. 4) and task-level augmentation (Fig. 5). In all the experiments, all the models consistently achieves better generalization performances when trained on $\mathcal { E } _ { \mathrm { l a r g e } }$ , which again emphasizes the benefits of House3D.
|
| 190 |
+
|
| 191 |
+
The overall best success rate is achieved by gated-attention architecture with semantic signals. It is better than both RGB channels by over $8 \%$ and the counterpart trained on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ in terms of generalization metric. This means that pixel-level augmentation (e.g., domain randomization and/or segmentation mask) and scene-level augmentation (e.g., using diverse dataset) can improve the performance. Moreover, their effects are complementary.
|
| 192 |
+
|
| 193 |
+
A diverse environment like $\mathcal { E } _ { \mathrm { l a r g e } }$ also enables the model of larger capacity to work better. For example, LSTMs considerably outperform the simpler reactive models, i.e., CNNs with recent 5 frames as state input. We believe this is due to the larger scale and the high complexity of the training set, which makes it almost impossible for an agent to “remember” the optimal actions for every scenario. Instead, an agent needs to develop high-level abstractions (e.g., high-level exploration strategy, memory, etc). These are helpful induction biases that could lead to a more generalizable model.
|
| 194 |
+
|
| 195 |
+
Lastly, we also analyze the detailed success rate with respect to each target room in appendix.
|
| 196 |
+
|
| 197 |
+
# 7 CONCLUSION
|
| 198 |
+
|
| 199 |
+
In this paper, we propose a new environment, House3D, which contains 45K houses with a diverse set of objects and natural layouts resembling the real-world.
|
| 200 |
+
|
| 201 |
+
In House3D, we teach an agent to accomplish semantic goals. We define RoomNav, in which an agent needs to understand a given semantic concept, interpret the comprehensive visual signal, navigate to the target, and most importantly, succeed in a new unseen environment. We note that generalization to unseen environments was rarely studied in previous works.
|
| 202 |
+
|
| 203 |
+
To this end, we quantify the effect of various levels of augmentations, all facilitated by House3D by the means of domain randomization, multi-target training and the diversity of the environment. We resort to well established RL techniques equipped with gating to encode the task at hand. The final performance on unseen environments is much higher than baseline methods by over $8 \%$ . We hope House3D as well as our training techniques can benefit the whole RL community for building generalizable agents.
|
| 204 |
+
|
| 205 |
+
# REFERENCES
|
| 206 |
+
|
| 207 |
+
Jacob Andreas, Dan Klein, and Sergey Levine. Modular multitask reinforcement learning with policy sketches. arXiv preprint arXiv:1611.01796, 2016.
|
| 208 |
+
Iro Armeni, Ozan Sener, Amir R. Zamir, Helen Jiang, Ioannis Brilakis, Martin Fischer, and Silvio Savarese. 3D semantic parsing of large-scale indoor spaces. CVPR, 2016.
|
| 209 |
+
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.
|
| 210 |
+
Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
|
| 211 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI gym. arXiv preprint arXiv:1606.01540, 2016.
|
| 212 |
+
Simon Brodeur, Ethan Perez, Ankesh Anand, Florian Golemo, Luca Celotti, Florian Strub Strub, Jean Rouat, Hugo Larochelle, and Aaron Courville Courville. HoME: a household multimodal environment. arXiv 1711.11017, 2017.
|
| 213 |
+
Angel Chang, Angela Dai, Thomas Funkhouser, Maciej Halber, Matthias Niessner, Manolis Savva, Shuran Song, Andy Zeng, and Yinda Zhang. Matterport3d: Learning from RGB-D data in indoor environments. International Conference on 3D Vision (3DV), 2017.
|
| 214 |
+
Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-attention architectures for task-oriented language grounding. arXiv preprint arXiv:1706.07230, 2017.
|
| 215 |
+
Paul Christiano, Zain Shah, Igor Mordatch, Jonas Schneider, Trevor Blackwell, Joshua Tobin, Pieter Abbeel, and Wojciech Zaremba. Transfer from simulation to real world through learning deep inverse dynamics model. arXiv preprint arXiv:1610.03518, 2016.
|
| 216 |
+
Abhishek Das, Samyak Datta, Georgia Gkioxari, Stefan Lee, Devi Parikh, and Dhruv Batra. Embodied Question Answering. arXiv preprint arXiv:1711.11543, 2017a.
|
| 217 |
+
Abhishek Das, Satwik Kottur, Stefan Lee, Jos M.F. Moura, and Dhruv Batra. Learning cooperative visual dialog agents with deep reinforcement learning. ICCV, 2017b.
|
| 218 |
+
Bhuwan Dhingra, Hanxiao Liu, Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Gated-attention readers for text comprehension. arXiv preprint arXiv:1606.01549, 2016.
|
| 219 |
+
Gandhi Dhiraj, Pinto Lerrel, and Gupta Abhinav. Learning to fly by crashing. IROS, 2017.
|
| 220 |
+
Yan Duan, John Schulman, Xi Chen, Peter L Bartlett, Ilya Sutskever, and Pieter Abbeel. RL2: Fast reinforcement learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016.
|
| 221 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017a.
|
| 222 |
+
|
| 223 |
+
Chelsea Finn, Tianhe Yu, Justin Fu, Pieter Abbeel, and Sergey Levine. Generalizing skills with semi-supervised reinforcement learning. ICLR, 2017b.
|
| 224 |
+
|
| 225 |
+
Dieter Fox, Sebastian Thrun, and Wolfram Burgard. Probabilistic Robotics. MIT press, 2005.
|
| 226 |
+
|
| 227 |
+
Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. CVPR, 2017.
|
| 228 |
+
|
| 229 |
+
Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pp. 2944–2952, 2015.
|
| 230 |
+
|
| 231 |
+
Irina Higgins, Arka Pal, Andrei A Rusu, Loic Matthey, Christopher P Burgess, Alexander Pritzel, Matthew Botvinick, Charles Blundell, and Alexander Lerchner. Darla: Improving zero-shot transfer in reinforcement learning. arXiv preprint arXiv:1707.08475, 2017.
|
| 232 |
+
|
| 233 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8):1735–1780, 1997.
|
| 234 |
+
|
| 235 |
+
Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
|
| 236 |
+
|
| 237 |
+
Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with Gumbel-Softmax. arXiv preprint arXiv:1611.01144, 2016.
|
| 238 |
+
|
| 239 |
+
Matthew Johnson, Katja Hofmann, Tim Hutton, and David Bignell. The Malmo platform for artificial intelligence experimentation. In IJCAI, pp. 4246–4247, 2016.
|
| 240 |
+
|
| 241 |
+
Simon Green Fumin Wang Ryan Faulkner Hubert Soyer David Szepesvari Wojciech Marian Czarnecki Max Jaderberg Denis Teplyashin Marcus Wainwright Chris Apps Demis Hassabis Karl Moritz Hermann, Felix Hill and PhilBlunsom. Grounded language learning in a simulated 3d world. In arXiv 1706.06551. 2017.
|
| 242 |
+
|
| 243 |
+
Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. Vizdoom: A ´ doom-based AI research platform for visual reinforcement learning. In Computational Intelligence and Games (CIG), 2016 IEEE Conference on, pp. 1–8. IEEE, 2016.
|
| 244 |
+
|
| 245 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 246 |
+
|
| 247 |
+
John J. Leonard and Hugh F. Durrant-Whyte. Directed Sonar Sensing for Mobile Robot Navigation. Kluwer Academic Publishers, Norwell, MA, USA, 1992. ISBN 0792392426.
|
| 248 |
+
|
| 249 |
+
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. JMLR, 2016.
|
| 250 |
+
|
| 251 |
+
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.
|
| 252 |
+
|
| 253 |
+
Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. arXiv preprint arXiv:1706.02275, 2017.
|
| 254 |
+
|
| 255 |
+
John McCormac, Ankur Handa, Stefan Leutenegger, and Andrew J Davison. SceneNet RGB-D: Can 5m synthetic images beat generic ImageNet pre-training on indoor segmentation? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2678–2687, 2017.
|
| 256 |
+
|
| 257 |
+
Alexander H Miller, Will Feng, Adam Fisch, Jiasen Lu, Dhruv Batra, Antoine Bordes, Devi Parikh, and Jason Weston. Parlai: A dialog research software platform. arXiv preprint arXiv:1705.06476, 2017.
|
| 258 |
+
|
| 259 |
+
Piotr Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andy Ballard, Andrea Banino, Misha Denil, Ross Goroshin, Laurent Sifre, Koray Kavukcuoglu, et al. Learning to navigate in complex environments. arXiv preprint arXiv:1611.03673, 2016.
|
| 260 |
+
|
| 261 |
+
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.
|
| 262 |
+
|
| 263 |
+
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.
|
| 264 |
+
Karthik Narasimhan, Regina Barzilay, and Tommi Jaakkola. Deep transfer in reinforcement learning by language grounding. arXiv preprint arXiv:1708.00133, 2017.
|
| 265 |
+
Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-shot task generalization with multi-task deep reinforcement learning. arXiv preprint arXiv:1706.05064, 2017.
|
| 266 |
+
Emilio Parisotto and Ruslan Salakhutdinov. Neural map: Structured memory for deep reinforcement learning. arXiv preprint arXiv:1702.08360, 2017.
|
| 267 |
+
Adam Paszke, Sam Gross, and Soumith Chintala. Pytorch, 2017. URL http://pytorch.org/.
|
| 268 |
+
Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by selfsupervised prediction. ICML, 2017.
|
| 269 |
+
Andrei A Rusu, Matej Vecerik, Thomas Rothorl, Nicolas Heess, Razvan Pascanu, and Raia Hadsell. Sim-to-real ¨ robot learning from pixels with progressive nets. arXiv preprint arXiv:1610.04286, 2016.
|
| 270 |
+
Fereshteh Sadeghi and Sergey Levine. CAD2RL: Real single-image flight without a single real image. RSS, 2017.
|
| 271 |
+
Manolis Savva, Angel X. Chang, Alexey Dosovitskiy, Thomas Funkhouser, and Vladlen Koltun. MINOS: Multimodal indoor simulator for navigation in complex environments. arXiv:1712.03931, 2017.
|
| 272 |
+
Tianlin Shi, Andrej Karpathy, Linxi Fan, Jonathan Hernandez, and Percy Liang. World of Bits: An opendomain platform for web-based agents. In International Conference on Machine Learning, pp. 3135–3144, 2017.
|
| 273 |
+
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.
|
| 274 |
+
Shuran Song, Fisher Yu, Andy Zeng, Angel X Chang, Manolis Savva, and Thomas Funkhouser. Semantic scene completion from a single depth image. CVPR, 2017.
|
| 275 |
+
Gabriel Synnaeve, Nantas Nardelli, Alex Auvolat, Soumith Chintala, Timothee Lacroix, Zeming Lin, Florian ´ Richoux, and Nicolas Usunier. Torchcraft: a library for machine learning research on real-time strategy games. arXiv preprint arXiv:1611.00625, 2016.
|
| 276 |
+
Lei Tai and Ming Liu. Towards cognitive exploration through deep reinforcement learning for mobile robots. arXiv preprint arXiv:1610.01733, 2016.
|
| 277 |
+
Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In Advances in Neural Information Processing Systems, pp. 2154–2162, 2016.
|
| 278 |
+
Yuandong Tian, Qucheng Gong, Wenling Shang, Yuxin Wu, and Larry Zitnick. ELF: An extensive, lightweight and flexible research platform for real-time strategy games. arXiv preprint arXiv:1707.01067, 2017.
|
| 279 |
+
Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. arXiv preprint arXiv:1703.06907, 2017.
|
| 280 |
+
Oriol Vinyals, Timo Ewalds, Sergey Bartunov, Petko Georgiev, Alexander Sasha Vezhnevets, Michelle Yeo, Alireza Makhzani, Heinrich Kuttler, John Agapiou, Julian Schrittwieser, et al. Starcraft ii: A new challenge ¨ for reinforcement learning. arXiv preprint arXiv:1708.04782, 2017.
|
| 281 |
+
Yuke Zhu, Roozbeh Mottaghi, Eric Kolve, Joseph J Lim, Abhinav Gupta, Li Fei-Fei, and Ali Farhadi. Targetdriven visual navigation in indoor scenes using deep reinforcement learning. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 3357–3364. IEEE, 2017.
|
| 282 |
+
|
| 283 |
+
Table 2: Statistics of the selected environment sets for RoomNav. RoomType% denotes the percentage of houses containing at least one target room of type RoomType.
|
| 284 |
+
|
| 285 |
+
<table><tr><td></td><td>3</td><td>avg.#targets</td><td>kitchen%</td><td>dining room %</td><td> living room%</td><td>bedroom%</td><td>bathroom%</td></tr><tr><td>Esmall</td><td>20</td><td>3.9</td><td>0.95</td><td>0.60</td><td>0.60</td><td>0.95</td><td>0.80</td></tr><tr><td>Elarge</td><td>200</td><td>3.7</td><td>1.00</td><td>0.35</td><td>0.63</td><td>0.94</td><td>0.80</td></tr><tr><td>Etest</td><td>50</td><td>3.7</td><td>1.00</td><td>0.48</td><td>0.58</td><td>0.94</td><td>0.70</td></tr></table>
|
| 286 |
+
|
| 287 |
+
<table><tr><td></td><td>test succ.</td><td>kitchen%</td><td>dining room %</td><td>living room%</td><td>bedroom%</td><td>bathroom%</td></tr><tr><td> gated-LSTM</td><td>35.8</td><td>37.9</td><td>50.4</td><td>48.0</td><td>33.5</td><td>21.2</td></tr><tr><td>gated-CNN</td><td>29.7</td><td>31.6</td><td>42.5</td><td>54.3</td><td>27.6</td><td>17.4</td></tr></table>
|
| 288 |
+
|
| 289 |
+
Table 3: Detailed test success rates for gated-CNN model and gated-LSTM model with “Mask+Depth” as input signal across different instruction concepts.
|
| 290 |
+
|
| 291 |
+
# A ROOMNAV TASK DETAILS
|
| 292 |
+
|
| 293 |
+
# A.1 STATISTICS OF SELECTED HOUSE SETS
|
| 294 |
+
|
| 295 |
+
We show the statistics of the selected three set of houses in Table 2.
|
| 296 |
+
|
| 297 |
+
In addition to these 5 houses, we also pick another 15 object concepts in our mid-level generalization experiment as auxiliary targets. The object concepts are: shower, sofa, toilet, bed, plant, television, table-and-chair, chair, table, kitchen-set, bathtub, vehicle, pool, kitchen-cabinet, curtain.
|
| 298 |
+
|
| 299 |
+
Detailed Specifications: The location information of an agent can be represented by 4 real numbers: the 3D location $( x , y , z )$ and the rotation degree $\rho$ of its first person view sensor, which indicates the front direction of the agent. Note that in RoomNav, the agent is not allowed to change its height $z$ , hence the overall degree of freedom is 3.
|
| 300 |
+
|
| 301 |
+
An action can be in the form of a triple $\boldsymbol { a } = ( \delta _ { x } , \delta _ { y } , \delta _ { \rho } )$ . After taking the action $a$ , the agent will move to a new 3D location $( x + \delta _ { x } , y + \delta _ { y } , z )$ with a new rotation $\rho + \delta _ { \rho }$ . The physics in House3D will detect collisions with objects under action $a$ and in RoomNav, the agent will remain still in case of a collision. We also restrict the velocity of the agent such that $| \delta _ { x } | , | \delta _ { y } | \leq 0 . 5$ and $| \delta _ { \rho } | \leq 3 0$ to ensure a smooth movement.
|
| 302 |
+
|
| 303 |
+
Continuous Action: A continuous action $a$ consists of two parts $a = [ m , r ]$ where $m = ( m _ { 1 } , \dots , m _ { 4 } )$ is for movement and $r = ( r _ { 1 } , r _ { 2 } )$ is for rotation. Since the velocity of the agent should be bounded, we require $m$ , $r$ to be a valid probability distribution. Suppose the original location of robot is $( x , y , z )$ and the angle of camera is $\rho$ , then after executing $a$ , the new 3D location will be $( x + ( m _ { 1 } - m _ { 2 } ) * 0 . 5 , y + ( m _ { 3 } - m _ { 4 } ) * 0 . 5 , z )$ and the new angle is $\rho + \left( r _ { 1 } - r _ { 2 } \right) * 3 0$ .
|
| 304 |
+
|
| 305 |
+
Discrete Action: We define 12 different action triples in the form of $a _ { i } = ( \delta _ { x } , \delta _ { y } , \delta _ { \rho } )$ satisfying the velocity constraints. There are 8 actions for movement: left, forward, right with two scales and two diagonal directions; and 4 actions for rotation: clockwise and counter-clockwise with two scales. In the discrete action setting, we do not allow the agent to move and rotate simultaneously.
|
| 306 |
+
|
| 307 |
+
Reward Details: In addition to the reward shaping of difference of shortest distances, we have the following rewards. When hitting an obstacle, the agent receives a penalty of 0.3. In the case of success, the winning reward is $+ 1 0$ . In order to encourage exploration (or to prevent eternal rotation), we add a time penalty of 0.1 to the agent for each time step outside the target room. Note that since we restrict the velocity of the agent, the difference of shortest path after an action will be no more than $0 . 5 \times \sqrt { 2 } \approx 0 . 7$ .
|
| 308 |
+
|
| 309 |
+
# B EXPERIMENT DETAILS
|
| 310 |
+
|
| 311 |
+
# B.1 NETWORK ARCHITECTURES
|
| 312 |
+
|
| 313 |
+
We apply a batch normalization layer after each layer in the CNN module. The activation function used is ReLU. The embedding dimension of concept instruction is 25.
|
| 314 |
+
|
| 315 |
+
Gated-CNN: In the CNN part, we have 4 convolution layers of 64, 64, 128, 128 channels perspective and with kernel size 5 and stride 2, as well as a fully-connected layer of 512 units. We use a linear layer to transform the concept embedding to a 512-dimension vector for gated fusion. The MLP for policy has two hidden layers of 128 and 64 units, and the MLP for Q-function has a single hidden layer of 64 units.
|
| 316 |
+
|
| 317 |
+
Gated-LSTM: In the CNN module, we have 4 convolution layers of 64, 64, 128, 128 channels each and with kernel size 5 and stride 2, as well as a fully-connected layer of 256 units. We use a linear layer to convert the concept embedding to a 256-dimension vector. The LSTM module has 256 hidden dimensions. The MLP module for policy contains two layers of 128 and 64 hidden units, and the MLP for value function has two hidden layers of 64 and 32 units.
|
| 318 |
+
|
| 319 |
+
# B.2 TRAINING PARAMETERS
|
| 320 |
+
|
| 321 |
+
We normalize each channel of the input frame to $[ 0 , 1 ]$ before feeding it into the neural network. Each of the training procedures includes a weight decay of $1 0 ^ { \div 5 }$ and a discounted factor $\gamma = 0 . 9 5$ .
|
| 322 |
+
|
| 323 |
+
DDPG: We stack $k = 5$ recent frames and use learning rate $1 0 ^ { 4 }$ with batch size 128. We choose $\alpha _ { \mathrm { D D P G } } = 1 0 0$ for all the settings except for the case with input signal of $\mathrm { \mathrm { } ^ { 6 6 } R G B + I }$ Depth” on $\mathcal { E } _ { \mathrm { l a r g e } }$ , where we choose $\alpha _ { \mathrm { D D P G } } =$ 10. We use an entropy bonus term with coefficient 0.001 on $\mathcal { E } _ { \mathrm { s m a l l } }$ and 0.01 on $\mathcal { E } _ { \mathrm { l a r g e } }$ . We use exponential average to update the target network with rate 0.001. A training update is performed every 10 time steps. The replay buffer size is $7 \times \mathrm { \overline { { 1 0 } } ^ { 5 } }$ . We run training for 80000 episodes in all. We use a linear exploration strategy in the first 30000 episodes.
|
| 324 |
+
|
| 325 |
+
A3C: We clip the reward to the range $[ - 1 , 1 ]$ and use a learning rate $1 e - 3$ with batch size 64. We launch 120 processes on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ and 200 on $\mathcal { E } _ { \mathrm { l a r g e } }$ . During training we estimate the discounted accumulative rewards and back-propagate through time for every 30 time steps unrolled. We perform a gradient clipping of 1.0 and decay the learning rate by a factor of 1.5 when the difference of KL-divergence becomes larger than 0.01. For training on $\mathcal { E } _ { \mathrm { s m a l l } }$ , we use a entropy bonus term with coefficient 0.1; while on $\mathcal { E } _ { \mathrm { l a r g e } }$ , the coefficient is 0.05. αA3C is 1.0. We perform $1 0 ^ { 5 }$ training updates and keep the best model with the highest training success rate.
|
| 326 |
+
|
| 327 |
+
# B.3 GENERALIZATION OVER DIFFERENT CONCEPTS
|
| 328 |
+
|
| 329 |
+
We illustrate in Table 3 the detailed test success rates of our models trained on ${ \mathcal { E } } _ { \operatorname { t r a i n } }$ with respect to each of the 5 concepts. Note that both models have similar behaviour across concepts. In particular, “dining room” and “living room” are the easiest while “bathroom” is the hardest. We suspect that this is because dining room and living room are often with large room space and have the best connectivity to other places. By contrast, bathroom is often very small and harder to find in big houses.
|
| 330 |
+
|
| 331 |
+
Lastly, we also experiment with adding auxiliary tasks of predicting the current room type during training. We found this does not help the training performance nor the test performance. We believe it is because our reward shaping has already provided strong supervision signals.
|
| 332 |
+
|
| 333 |
+
# B.4 AVERAGE STEPS TOWARDS SUCCESS
|
| 334 |
+
|
| 335 |
+
We also measure the number of steps required for an agent in RoomNav. For all the successful episodes, we evaluate the averaged number of steps towards the final target. The numbers are shown in Table 4. A random agent can only succeed when it’s initially spawned very close to the target, and therefore have very small number of steps towards target. Our trained agents, on the other hand, can explore in the environment and reach the target after resonable number of steps. Generally, our DDPG models takes fewer steps than our A3C models thanks to their continuous action space. But in all the settings, the number of steps required for a success is still far less than 100, namely the horizon length.
|
| 336 |
+
|
| 337 |
+
<table><tr><td></td><td>random</td><td>concat-LSTM</td><td>gated-LSTM</td><td>concat-CNN</td><td>gated-CNN</td></tr><tr><td colspan="6">Avg. #steps towards targets on &small with different input signals</td></tr><tr><td>RGB+Depth (train)</td><td>14.2</td><td>35.9</td><td>41.0</td><td>31.7</td><td>33.8</td></tr><tr><td>RGB+Depth (test)</td><td>13.3</td><td>27.1</td><td>29.8</td><td>26.1</td><td>25.3</td></tr><tr><td>Mask+Depth (train)</td><td>14.2</td><td>38.4</td><td>40.9</td><td>34.9</td><td>36.6</td></tr><tr><td>Mask+Depth (test)</td><td>13.3</td><td>31.9</td><td>34.3</td><td>26.2</td><td>30.4</td></tr><tr><td colspan="6">Avg. #steps towards targets on Elarge with different input signals</td></tr><tr><td>RGB+Depth (train)</td><td>16.0</td><td>36.4</td><td>35.6</td><td>31.0</td><td>32.4</td></tr><tr><td>RGB+Depth (test)</td><td>13.3</td><td>34.0</td><td>33.8</td><td>24.4</td><td>25.7</td></tr><tr><td>Mask+Depth (train)</td><td>16.0</td><td>40.1</td><td>38.8</td><td>34.6</td><td>36.2</td></tr><tr><td>Mask+Depth (test)</td><td>13.3</td><td>34.8</td><td>34.3</td><td>30.6</td><td>30.9</td></tr></table>
|
| 338 |
+
|
| 339 |
+
Table 4: Averaged number of steps towards the target in all success trials for all the evaluated models with various input signals and different environments.
|
md/train/rkaqxm-0b/rkaqxm-0b.md
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEURAL COMPOSITIONAL DENOTATIONAL SEMANTICS FOR QUESTION ANSWERING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Answering compositional questions requiring multi-step reasoning is challenging for current models. We introduce an end-to-end differentiable model for interpreting questions, which is inspired by formal approaches to semantics. Each span of text is represented by a denotation in a knowledge graph, together with a vector that captures ungrounded aspects of meaning. Learned composition modules recursively combine constituents, culminating in a grounding for the complete sentence which is an answer to the question. For example, to interpret not green, the model will represent green as a set of entities, not as a trainable ungrounded vector, and then use this vector to parametrize a composition function to perform a complement operation. For each sentence, we build a parse chart subsuming all possible parses, allowing the model to jointly learn both the composition operators and output structure by gradient descent. We show the model can learn to represent a variety of challenging semantic operators, such as quantifiers, negation, disjunctions and composed relations on a synthetic question answering task. The model also generalizes well to longer sentences than seen in its training data, in contrast to LSTM and RelNet baselines. We will release our code.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Compositionality is a mechanism by which the meanings of complex expressions are systematically determined from the meanings of their parts, and has been widely assumed in the study of both natural languages (Montague, 1973), as well as programming and logical languages, as a means for allowing speakers to generalize to understanding an infinite number of sentences. Popular neural network approaches to question answering use a restricted form of compositionality, typically encoding a sentence word-by-word from left-to-right, and finally executing the complete sentence encoding against a knowledge source (Perez et al., 2017). Such models can fail to generalize from training sentences in surprising ways. Inspired by linguistic theories of compositional semantics, we instead build a latent tree of interpretable expressions over a sentence, recursively combining constituents using a small set of neural modules. When tested on longer questions than are found in the training data, we find that our model achieves higher performance than baselines using LSTMs and RelNets.
|
| 12 |
+
|
| 13 |
+
Our approach resembles Montague semantics, in which a tree of interpretable expressions is built over the sentence, with nodes combined by a small set of composition functions. However, both the structure of the sentence and the neural modules that handle composition are learned by end-to-end gradient descent. To achieve this, we define the parametric form of small set of neural modules, and then build a parse chart over each sentence subsuming all possible trees. Each node in the chart represents a span of text with a distribution over groundings (in terms of booleans and knowledge base nodes and edges), as well as a vector representing aspects of the meaning that have not yet been grounded. The representation for a node is built by taking a weighted sum over different ways of building the node (similarly to Maillard et al. (2017)).
|
| 14 |
+
|
| 15 |
+
Typical neural network approaches to grounded question answering first encode a question from left-to-right with a recurrent neural network (RNNs), and then evaluate the encoding against an encoding of the knowledge source (for example, a knowledge base or image) (Santoro et al., 2017). In contrast to classical approaches to compositionality, constituents of complex expressions are not given explicit interpretations in isolation. For example, in Which cubes are large or green?, an RNN encoder will not explicitly build an interpretation for the expression large or green. We show that such approaches can generalize poorly when tested on more complex sentences than they were trained on. In contrast, our approach imposes strong independence assumptions that give a linguistically motivated inductive bias. In particular, it enforces that phrases are interpreted independently of surrounding words, allowing the model to generalize naturally to interpreting phrases in different contexts. In the previous example, large or green will be represented as a particular set of entities in a knowledge graph, and be intersected with the set of entities represented by the cubes node.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: A correct parse for a question given the knowledge graph on the right, using our model. We show the type for each node, and its denotation in terms of the knowledge graph. The words or and not are represented by vectors, which parameterize composition modules. The denotation for the complete question represents the answer to the question. Nodes here have types $E$ for sets of entities, $R$ for relations, $V$ for ungrounded vectors, $E V$ for a combination of entities and a vector, and $\phi$ for semantically vacuous nodes. While we show only one parse tree here, our model builds a parse chart subsuming all trees.
|
| 19 |
+
|
| 20 |
+
Another perspective on our work is as a method for learning the layouts of Neural Module Networks (NMNs) (Andreas et al., 2016b). Work on NMNs has focused on how to construct the structure of the network, variously using rules, parsers and reinforcement learning (Andreas et al., 2016a; Hu et al., 2017). Our end-to-end differentiable model jointly learns structures and modules by gradient descent.
|
| 21 |
+
|
| 22 |
+
# 2 MODEL OVERVIEW
|
| 23 |
+
|
| 24 |
+
Our task is to answer a question $q = w _ { 1 \ldots | q | }$ , with respect to a Knowledge Graph (KG) consisting of nodes $\mathcal { E }$ (representing entities) and labelled directed edges $\mathcal { R }$ (representing relationship between entities). In our task, answers are either booleans, or specific subsets of nodes from the KG.
|
| 25 |
+
|
| 26 |
+
Our model builds a parse for the sentence, in which phrases are grounded in the KG, and a small set of composition modules are used to combine phrases, resulting in a grounding for the complete question sentence that answers the question. For example, in Figure 1, the phrases not and cylindrical are interpreted as a function word and an entity set, and then not cylindrical is interpreted by computing the complement of the entity set. The node at the root of the parse tree is the answer to the question.
|
| 27 |
+
|
| 28 |
+
We describe a compositional neural model that answers such questions by:
|
| 29 |
+
|
| 30 |
+
1. Grounding individual tokens in a Knowledge Graph. Tokens can either be grounded as particular sets of entities and relations in the KG, as ungrounded vectors, or marked as being semantically vacuous. For each word, we learn parameters that are used to compute a distribution over semantic types and corresponding denotations in a KG (§ 4.1).
|
| 31 |
+
2. Combining representations for adjacent phrases into representations for larger phrases, using trainable neural composition modules $( \ S 3 . 2 )$ . This produces a denotation for the phrase.
|
| 32 |
+
3. Assigning a binary-tree structure to the question sentence, which determines how words are grounded, and which phrases are combined using which modules. We build a parse chart subsuming all possible structures, and train a parsing model to increase the likelihood of structures leading to the correct answer to questions. Different parses leading to a denotation for a phrase of type $t$ are merged into an expected denotation, allowing dynamic programming $( \ S 4 )$ .
|
| 33 |
+
4. Answering the question, with the most likely grounding of the phrase spanning the sentence.
|
| 34 |
+
|
| 35 |
+
# 3 COMPOSITIONAL SEMANTICS
|
| 36 |
+
|
| 37 |
+
# 3.1 SEMANTIC TYPES
|
| 38 |
+
|
| 39 |
+
Our model classifies spans of text into different semantic types to represent their meaning as explicit denotations or ungrounded vectors. All phrases are assigned a distribution over semantic types. The semantic type determines how a phrase is grounded, and which composition modules can be used to combine it with other phrases. A phrase spanning $w _ { i \ldots j }$ has a denotation $[ [ w _ { i . . j } ] ] _ { K G } ^ { t }$ for each semantic type $t$ J K. For example, in Figure 1, red thing corresponds to a set of entities, left corresponds to a set of relations, and not is treated as an ungrounded vector.
|
| 40 |
+
|
| 41 |
+
The semantic types we define can be classified into the three different categories. Below we describe these semantic types and their corresponding representations.
|
| 42 |
+
|
| 43 |
+
Grounded Semantic Types: Spans of text that can be fully grounded in the KG.
|
| 44 |
+
|
| 45 |
+
1. Entity $\mathbf { ( E ) }$ : Spans of text that can be grounded to a set of entities in the KG, for example: red sphere or large cube. $\mathbf { E }$ -type span grounding is represented as a soft-attention value for each entity, $[ p _ { e _ { 1 } } , \dotsc , p _ { e _ { | \varepsilon | } } ]$ , where $0 \leq p _ { e _ { i } } \leq 1$ . This can be viewed as a soft version of a logical set-valued denotation, which we refer to as a ‘soft entity set’.
|
| 46 |
+
|
| 47 |
+
2. Relation $\mathbf { ( R ) }$ : Spans of text that can be grounded to a set of relations from the KG, for example: left of or not right of or above. R-type span grounding is represented by a soft adjacency matrix $A \in \mathbb { R } ^ { | \mathcal { E } | \times | \mathcal { E } | }$ where $A _ { i j } = 1$ denotes a directed edge from $e _ { i } \to e _ { j }$ .
|
| 48 |
+
|
| 49 |
+
3. Truth (T): Spans of text that can be interpreted as having a True/False denotation, for example: Is anything red?, $I s$ one ball green and are no cubes red? T-type span grounding is represented using a real-value $p _ { t r u e }$ , $0 \leq p _ { t r u e } \leq 1$ , that denotes the probability of the span being True.
|
| 50 |
+
|
| 51 |
+
Ungrounded Semantic Types: Spans of text whose meaning cannot be grounded in the KG.
|
| 52 |
+
|
| 53 |
+
1. Vector (V): This type is used for spans representing functions that cannot yet be grounded in the KG, for example words such as and or every. These spans are represented using 4 different real-valued vectors $v _ { 1 } \in \mathbb { R } ^ { 2 } , v _ { 2 } \in \mathbb { R } ^ { 3 } , v _ { 3 } \in \mathbb { R } ^ { 4 } , v _ { 4 } \in \mathbb { R } ^ { 5 }$ that are used to parameterize different composition modules described below in $\ S 3 . 2$ .
|
| 54 |
+
|
| 55 |
+
2. Vacuous $( \phi )$ : Spans that are considered semantically vacuous, but are necessary syntactically, e.g. of in left of a cube. During composition, these nodes act as identity functions.
|
| 56 |
+
|
| 57 |
+
Partially-Grounded Semantic Types: Spans of text that can only be partially grounded in the knowledge graph, such as and red or are four spheres. Here, we represent the span by a combination of a grounding and vectors, representing grounded and ungrounded aspects of meaning respectively. The grounded component of the representation will typically combine with another fully grounded representation, and the ungrounded vectors will parameterize the composition module. We define 3 semantic types of this kind: EV, RV and TV, corresponding to the combination of entities, relations and boolean groundings with an ungrounded vector. Here, the word represented by the vectors can be viewed as a binary function, one of whose arguments has been supplied.
|
| 58 |
+
|
| 59 |
+
# 3.2 COMPOSITION MODULES
|
| 60 |
+
|
| 61 |
+
Next, we describe how we compose phrase representations (from $\ S 3 . 1 )$ to create representations for larger phrases. We define a small number of generic composition modules, that take as input two constituents of text with their corresponding semantic representations (grounded representations and ungrounded vectors), and outputs the semantic type and corresponding representation of the larger constituent. The composition modules are parameterized by the trainable word vectors.
|
| 62 |
+
|
| 63 |
+
These can be divided into several categories:
|
| 64 |
+
|
| 65 |
+
Composition modules resulting in fully grounded denotations: Described in Figure 2.
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\begin{array} { r l } & { \quad \ ' \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \cup _ { e _ { i } } = \sigma \Bigl ( \mathbf { v _ { 1 } } \cdot \left[ \begin{array} { l } { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} \right] \Bigr ) } \\ & { \underset { \ @ \ @ } { \mathsf { V } } \quad \mathsf { c y l i n d r i c a l } } \\ & { \underset { \bigodot \updownarrow } { \mathsf { C y l i n d r i c a l } } } \end{array}
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
$\mathbf { E } + \mathbf { E } \mathbf { E }$ : This module performs a function on a pair of soft entity sets, parameterized by the model’s global parameter vector $[ w _ { 1 } , w _ { 2 } , b ]$ to produce a new soft entity set. The composition function for a single entity’s resulting attention value is shown. Such a composition module can be used to interpret compound nouns and entity appositions. For example, the composition module shown above learns to output the intersection of two entity sets.
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { r } { \begin{array} { c } { \bullet _ { \boxtimes \mathbf { E } } ^ { \cup } } \\ { \hfill \phantom { \sum } _ { \begin{array} { c } { \prime } \\ { \prime } \\ { \mathbf { E } } \\ { \mathbf { E } } \end{array} } \setminus \begin{array} { r } { p _ { e _ { i } } = \sigma \left( \mathbf { v _ { 2 } } \cdot \left[ \begin{array} { l } { p _ { e _ { i } } ^ { L } } \\ { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} \right] \right.} \\ { \vdots \hfill \mathrm { ~ s u r ~ o r ~ p u r p 1 e } } \\ { \mathbf { \bigoplus } _ { \mathbf { 0 } } \mathbf { E } } \end{array} } \end{array} } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
$\mathbf { V } + \mathbf { E } \mathbf { E }$ : This module performs a function on a soft entity set, parameterized by a word vector, to produce a new soft entity set. For example, the word not learns to take the complement of a set of entities. The entity attention representation of the resulting span is computed by using the indicated function that takes the $\boldsymbol { v } _ { 1 } \in \mathbb { R } ^ { 2 }$ vector of the $\mathbf { V }$ constituent as a parameter argument and the entity attention vector of the $\mathbf { E }$ constituent as a function argument.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
|
| 83 |
+
$\mathbf { E V + E E }$ : This module combines two soft entity sets into a third set, parameterized by the $v _ { 2 }$ word vector. This composition function is similar to a linear threshold unit and is capable of modeling various mathematical operations such as logical conjunctions, disjunctions, differences etc. for different values of $v _ { 2 }$ . For example, the word or learns to model set union.
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array}{c} \begin{array} { r l } & { \overline { { \mathrm { I } \mathrm { \tiny ~ T r u e } } } } \\ & { \qquad \boldsymbol { \Bigg / } ^ { \mathsf { T } } \setminus \underbrace { p _ { t r u e } } _ { \mathsf { E } } = \sigma ( v _ { 3 } ^ { 1 } \Bigg [ \sum _ { e _ { i } } \sigma ( [ v _ { 3 } ^ { 3 } ] \cdot [ \begin{array} { l } { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} ] } \end{array} ) ] + v _ { 3 } ^ { 2 } ) \\ & { \qquad \mathsf { V } } \\ & { \textsf { s } \underset { \ @ \boldsymbol { \Psi } } { \mathsf { a n y t h i n g ~ c y l } } \mathrm { i n d r ~ i c a l } } \\ & { \qquad \boldsymbol { \Theta } \stackrel { \qquad } { \Pi } \overleftrightarrow { \boldsymbol { \Psi } } \big \square } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
$\mathbf { R } + \mathbf { E } \mathbf { E }$ : This module composes a set of relations (represented as a single soft adjacency matrix) and a soft entity set to produce an output soft entity set. The composition function uses the adjacency matrix representation of the $\mathbf { R }$ -span and the soft entity set representation of the E-span.
|
| 90 |
+
|
| 91 |
+
$\mathbf { V } + \mathbf { E } \mathbf { T }$ : This module maps a soft entity set onto a soft boolean, parameterized by word vector $( v _ { 3 } )$ . The module counts whether a sufficient number of elements are in (or out) of the set. For example, the word any should test if a set is non-empty.
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { r l } & { \underbrace { \overline { { \left[ \mathsf { F a l s e } \right] } } } _ { \displaystyle { \int } } \mathsf { T } _ { \mathrm { \normalfont ~ \ " ~ \ " ~ } } p _ { t r u e } = \sigma \left( v _ { 4 } ^ { 1 } \left[ \sum _ { e _ { i } } \sigma \left( \begin{array} { c } { \left[ v _ { 4 } ^ { 3 } \right] } \\ { v _ { 4 } ^ { 4 } } \\ { \left[ v _ { 5 } ^ { 5 } \right] } \end{array} \cdot \left[ \begin{array} { c } { p _ { e _ { i } } ^ { L } } \\ { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} \right] \right) \right] + v _ { 4 } ^ { 5 } \right) } \\ & { \vdots \begin{array} { l } { \mathsf { E V } } \\ { \mathrm { e v e r y ~ c y ~ l ~ i n d e r ~ \quad ~ b ~ l ~ u e } } \\ { \bigoplus } \end{array} } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
$\mathbf { E V + E } \mathbf { T }$ : This module combines two soft entity sets into a soft boolean, which is useful for modelling generalized quantifiers. For example, in is every cylinder blue, the module can use the inner sigmoid to test if an element $e _ { i }$ is in the set of cylinders $( p _ { e _ { i } } ^ { L } \approx 1 )$ ) but not in the set of blue things $( p _ { e _ { i } } ^ { R } \approx 0 )$ ), and then use the outer sigmoid to return a value close to 1 if the sum of elements matching this property is close to 0.
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\begin{array} { c } { { { \underbrace { \left[ \mathsf { F a l s e } \right] } } _ { \displaystyle { \mathsf { T } } } _ { \displaystyle { \mathrm { s } } _ { t r u e } } = \sigma \left( \mathbf { v } _ { 2 } \cdot \left[ \begin{array} { l } { p _ { t r u e } ^ { L } } \\ { p _ { t r u e } ^ { R } } \\ { 1 } \end{array} \right] \right) } } \\ { { { \mathsf { T } } } } \\ { { { \mathsf { Z } } \mathsf { b a l l s ~ r e d ~ a n d ~ } } } \\ { { { \underbrace { \left[ \mathsf { F a l s e } \right] \ @ { \mathsf { o D } } } } _ { \displaystyle { \left[ \mathsf { T r u e } \right] } } \in { \mathsf { S l u e } } } } \end{array}
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
|
| 105 |
+
$\mathbf { T V } + \mathbf { T } \mathbf { T }$ : This module maps a pair of soft booleans into a soft boolean using the $v _ { 2 }$ word vector to parameterize the composition function. Similar to $\mathbf { E V + E } \mathbf { E }$ , this module facilitates modeling a range of boolean set operations. Using the same functional form for different composition functions, allows our model to use the same ungrounded word vector $\left( v _ { 2 } \right)$ for compositions that are semantically analogous.
|
| 106 |
+
|
| 107 |
+
$\mathbf { R } \mathbf { V } + \mathbf { R } \mathbf { R }$ : This module composes a pair of soft set of relations to a produce an output soft set of relations. For example, the relations left and above are composed by the word $o r$ to produce a set of relations such that entities $e _ { i }$ and $e _ { j }$ are related if either of the two relations exists between them. The functional form for this composition is similar to $\mathbf { E V + E } \mathbf { E }$ and $\mathbf { T V } + \mathbf { T } \mathbf { T }$ modules.
|
| 108 |
+
|
| 109 |
+
Figure 2: Composition Modules that compose two constituent span representations into the representation for the combined larger span, using the indicated equations.
|
| 110 |
+
|
| 111 |
+
Composition with $\phi$ -typed nodes: Phrases with type $\phi$ are treated as being semantically transparent identity functions. Phrases of any other type can combined with these with no change to their type or representation.
|
| 112 |
+
|
| 113 |
+
Composition modules resulting in partially grounded denotations: We define several simple modules that combine fully grounded phrases with ungrounded phrases, by deterministically taking the union of the representations, giving phrases with partially grounded representations $( \ S \ 3 . 1 )$ . These modules are useful for when words act as binary functions; here they combine with their first argument. For example, in Figure 1, or and not cylindrical combine to make a phrase containing both the vectors for or and the entity set for not cylindrical.
|
| 114 |
+
|
| 115 |
+
# 4 PARSING MODEL
|
| 116 |
+
|
| 117 |
+
Here, we describe how our model classifies question tokens into different semantic type spans and compute their representations $( \ S 4 . 1 )$ , recursively uses the composition modules defined above to parse the question appropriately into a soft latent tree that provides the answer $( \ S 4 . 2 )$ . The model is trained end-to-end using only question-answer supervision $( \ S 4 . 3 )$ .
|
| 118 |
+
|
| 119 |
+
# 4.1 LEXICAL REPRESENTATION ASSIGNMENT
|
| 120 |
+
|
| 121 |
+
Each token in the question sentence is assigned a distribution over the semantic types, and given a grounding for each type. Tokens can only be assigned the E, R, V, and $\phi$ semantic types. For example, the token cylindrical in the question in Fig. 1 is assigned a distribution over the 4 semantic types (one shown) and for the $\mathbf { E }$ type, the representation computed is the set of cylindrical entities.
|
| 122 |
+
|
| 123 |
+
Semantic Type Distribution for Tokens: To compute the semantic type distribution, our model represents each word $w$ in the word vocabulary $\nu$ , and each semantic type $t$ using an embedding vector; $v _ { w } , v _ { t } \in \mathbb { R } ^ { d }$ . The semantic type distribution is assigned with a softmax:
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
p ( t | w _ { i } ) \propto \exp ( v _ { t } \cdot v _ { w _ { i } } )
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
Grounding for Tokens: For each of the four semantic type assignments for question tokens, we need to compute/assign their corresponding representations.
|
| 130 |
+
|
| 131 |
+
1. E-Type Representation: Each entity $e \in { \mathcal { E } }$ , is represented using an embedding vector $v _ { e } \in \mathbb { R } ^ { d }$ based on the concatenation of vectors for its properties. For each token $w$ , we use its word vector to find the probability of each entity being part of the $\mathbf { E }$ -Type grounding:
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
p _ { e _ { i } } ^ { w } = \sigma ( v _ { e _ { i } } \cdot v _ { w } ) ~ \forall e _ { i } \in \mathcal { E }
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
For example, in Fig. 1, the word red will be grounded as all the red entities.
|
| 138 |
+
|
| 139 |
+
2. R-Type Representation: Each relation $r \in \mathcal { R }$ , is represented using an embedding vector $v _ { r } \in \mathbb { R } ^ { d }$ . For each token $w _ { i }$ in the question, we first compute a distribution over relations it could refer to, and then use this distribution to compute the expected adjacency matrix that forms the $\mathbf { R }$ -type representation for this token.
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
p ( r | w _ { i } ) \propto \exp ( v _ { r } \cdot v _ { w _ { i } } )
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
A ^ { w _ { i } } = \sum _ { r \in \mathcal { R } } p ( r | w _ { i } ) \cdot A _ { r }
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
For example, the word left in Fig. 1 is grounded as the subset of edges with the label ‘left’.
|
| 150 |
+
|
| 151 |
+
3. V-Type Representation: For each word $w \in \mathcal { V }$ , we learn four vectors $v _ { 1 } \in \mathbb { R } ^ { 2 } , v _ { 2 } \in$ $\mathbb { R } ^ { 3 } , \tilde { v _ { 3 } } \in \mathbb { R } ^ { \bar { 4 } } , v _ { 4 } \in \mathbb { R } ^ { 5 }$ , and use these as the representation for words with the $\mathbf { V }$ -Type.
|
| 152 |
+
|
| 153 |
+
4. $\phi$ -Type Representation: This type is used for semantically vacuous words, which do not require a representation.
|
| 154 |
+
|
| 155 |
+
# 4.2 PARSING QUESTIONS
|
| 156 |
+
|
| 157 |
+
To learn the correct structure for applying composition modules, we use a simple parsing model. We build a parse-chart over the question encompassing all possible trees by applying all composition modules, similar to a standard CRF-based PCFG parser using the CKY algorithm. Each node in the parse-chart, for each span $w _ { i \ldots j }$ of the question, is represented as a distribution over different semantic types with their corresponding representations. This distribution is computed by weighing the different ways of composing the span’s constituents.
|
| 158 |
+
|
| 159 |
+
Phrase Semantic Type Potential: Each node in the parse-chart is associated with a potential value $\psi ( i , j , t )$ , that is the score assigned by the model to the t semantic type for the $w _ { i \ldots j }$ span. This is computed from all possible ways to form the span $w _ { i \ldots j }$ with type t. For a particular composition of span $w _ { i \dots k }$ of type $\mathbf { t _ { 1 } }$ and $w _ { k + 1 \ldots j }$ of type $\mathbf { t _ { 2 } }$ , using the $\mathbf { t _ { 1 } } + \mathbf { t _ { 2 } } \mathbf { t }$ module, the score is:
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\psi ( i , j , k , t _ { 1 } + t _ { 2 } t ) = [ \psi ( i , k , t _ { 1 } ) \cdot \psi ( k + 1 , j , t _ { 2 } ) \cdot \exp ( \sum _ { x } f _ { x } ^ { ( t _ { 1 } + t _ { 2 } t ) } ( i , j , k | q ) ) ]
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
where, $f _ { x } ^ { ( t _ { 1 } + t _ { 2 } t ) } ( i , j , k | q )$ are six feature functions; a trainable weight for each word per module in the vocabulary, that correspond to: $f _ { 1 }$ : word that appears before the start of the span $w _ { i - 1 }$ ; $f _ { 2 }$ : first word in the span $w _ { i }$ ; $f _ { 3 }$ : last word in the left constituent $w _ { k }$ ; $f _ { 4 }$ : first word in the right constituent $w _ { k + 1 }$ ; $f _ { 5 }$ : last word in the right constituent $w _ { j }$ ; and $f _ { 6 }$ : word that appears after the span $w _ { j + 1 }$ .
|
| 166 |
+
|
| 167 |
+
The token semantic type potential of $w _ { i }$ , $\psi ( i , i , i , t _ { 1 } + t _ { 2 } t )$ , is the same as $p ( t | w _ { i } )$ (Eq. 1).
|
| 168 |
+
|
| 169 |
+
The final t-type potential of $w _ { i \ldots j }$ is computed by summing over scores from all possible compositions:
|
| 170 |
+
|
| 171 |
+
$$
|
| 172 |
+
\psi ( i , j , t ) = \sum _ { k = i } ^ { j - 1 } \sum _ { \stackrel { \scriptstyle ( t _ { 1 } + t _ { 2 } \to t ) } { \scriptstyle \in \mathrm { M o d u l e s } } } \psi ( i , j , k , t _ { 1 } + t _ { 2 } \to t )
|
| 173 |
+
$$
|
| 174 |
+
|
| 175 |
+
Combining Phrase Representations: To compute the span $w _ { i \ldots j }$ ’s denotation with type t, $[ [ w _ { i . . j } ] ] _ { K G } ^ { t }$ , we compute an expected output representation from all possible compositions.
|
| 176 |
+
|
| 177 |
+
$$
|
| 178 |
+
[ w _ { i \cdot . . j } ] _ { K G } ^ { t } = \frac { 1 } { \psi ( i , j , t ) } \sum _ { \stackrel { k = i } { \epsilon \mathrm { \bf ~ ( } t _ { 1 } + t _ { 2 } t \mathrm { \bf ~ ) } } } ^ { j - 1 } \psi ( i , j , k , t _ { 1 } + t _ { 2 } t ) \ast [ [ w _ { i \cdot . . k . . j } ] ] _ { K G } ^ { t _ { 1 } + t _ { 2 } t }
|
| 179 |
+
$$
|
| 180 |
+
|
| 181 |
+
where resulti $[ [ w _ { i . . j } ] ] _ { K G } ^ { t }$ , is the t-type repre composition of ationwith pan usi $w _ { i \ldots j }$ , e $\mathbb { [ } w _ { i \dots k \dots j } ] _ { K G } ^ { t _ { 1 } + t _ { 2 } t }$ is the representationcomposition module. $w _ { i , k }$ $w _ { k + 1 \ldots j }$ $\mathbf { t _ { 1 } } ~ + ~ \mathbf { t _ { 2 } } ~ ~ \mathbf { t }$
|
| 182 |
+
|
| 183 |
+
Answer Grounding: By recursively computing the phrase semantic-type potentials and representations, we can infer the semantic type distribution of the complete question sentence (Eq. 8) and the resulting grounding for different semantic type $t$ , $[ [ w _ { 1 . . | q | } ] ] _ { K G } ^ { t }$ .
|
| 184 |
+
|
| 185 |
+
$$
|
| 186 |
+
p ( t | q ) \propto \psi ( 1 , | q | , t )
|
| 187 |
+
$$
|
| 188 |
+
|
| 189 |
+
The answer-type (boolean or subset of entities) for the question is computed using:
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
t ^ { * } = \underset { t \in \mathbf { T } , \mathbf { E } } { \mathrm { a r g m a x } } \ p ( t | q )
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
The corresponding grounding is $[ [ w _ { 1 . . | q | } ] ] _ { K G } ^ { t ^ { * } }$ , which answers the question.
|
| 196 |
+
|
| 197 |
+
# 4.3 TRAINING OBJECTIVE
|
| 198 |
+
|
| 199 |
+
Given a dataset D of (question, answer, knowledge-graph) tuples, {qi, ai, KGi}i=|D|i=1 , we train our model to maximize the log-likelihood of the correct answers. Answers are either booleans, or specific subsets of entities from the KG. We denote the semantic type of the answer as $a _ { t }$ . If the answer is boolean, $a \in \{ 0 , 1 \}$ , otherwise is a subset of entities from the KG, i.e. $a = \{ e _ { j } \}$ . The model’s answer to a question is found by taking its representation of the complete question, containing a distribution over types and the representation for each type. We maximize the following objective:
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\begin{array} { r l } & { \hat { \mathbf { \xi } } = \displaystyle \sum _ { i } \log p ( \boldsymbol { a } ^ { i } | \mathbf { q } ^ { i } , \mathbf { K G } ^ { i } ) \quad \quad \quad \quad ( 1 0 ) } \\ & { = \displaystyle \sum _ { i } \left[ \underbrace { \left( 1 _ { a _ { i } ^ { i } = \mathbf { r } } \left[ \log ( p _ { t r u e } ) ^ { a ^ { i } } ( 1 - p _ { t r u e } ) ^ { ( 1 - a ^ { i } ) } \right] \right) } _ { e _ { j } ^ { i } \in a ^ { i } } + \left( \frac { 1 _ { a _ { i } ^ { i } = \mathbf { E } } } { | \mathcal { E } ^ { i } | } \left[ \log \prod _ { e _ { j } ^ { i } \in a ^ { i } } p _ { e _ { j } ^ { i } } \prod _ { e _ { j } ^ { i } } ( 1 - p _ { e _ { j } ^ { i } } ) \right] \right) \right] } \end{array}
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
We also add $L _ { 2 }$ -regularization for the scalar parsing features introduced in $\ S 4 . 2$ .
|
| 206 |
+
|
| 207 |
+
# 5 DATASET
|
| 208 |
+
|
| 209 |
+
We generate a dataset of question-answers based on the CLEVR dataset (Johnson et al., 2017), which contains knowledge graphs containing attribute information of objects and relations between them.
|
| 210 |
+
|
| 211 |
+
We generate a new set of questions for this data, as existing questions contain some biases that can be exploited by models (Johnson et al. (2017) found that many spatial relation questions can be answered only using absolute spatial information and many long questions can be answered correctly without performing all steps of reasoning), and many questions are over 40 words long, which is intractable given that the size of our computation graph is cubic in the question length. Future work should explore scaling our approach to longer questions. We generate 75K questions for training and 37.5K for validation.
|
| 212 |
+
|
| 213 |
+
Our question set tests various challenging semantic operators. These include conjunctions (e.g. Is anything red or is anything large?), negations (e.g. What is not spherical?), counts (e.g. Are five spheres green?), quantifiers (e.g. Is every red thing cylindrical?), and relations (e.g. What is left of and above a cube?). We employ some simple tests to remove trivial biases from the dataset.
|
| 214 |
+
|
| 215 |
+
We create two test sets: one drawn from the same distribution as the training data (37.5K), and another containing longer questions than the training data (22.5K).
|
| 216 |
+
|
| 217 |
+
Our COMPLEX QUESTIONS test set contains the same words and constructions, but chained into longer questions. For example, it contains questions such as What is a cube that is right of a metallic thing that is beneath a blue thing? and Are two red things that are above a sphere metallic?. These questions require more multi-step reasoning to solve.
|
| 218 |
+
|
| 219 |
+
# 6 EXPERIMENTS
|
| 220 |
+
|
| 221 |
+
In this section we describe our experimentation setting, the baseline models we compare to, and the various experiments demonstrating the ability of our model to answer compositional questions referring to KG and its ability to generalize to unseen longer questions and new attribute combinations.
|
| 222 |
+
|
| 223 |
+
# 6.1 EXPERIMENTATION SETTING
|
| 224 |
+
|
| 225 |
+
Here we describe the training details of our model and the baseline models.
|
| 226 |
+
|
| 227 |
+
Representing Entities: Each entity in the CLEVR dataset consists of 4 attributes. For each attribute-value, we learn an embedding vector and concatenate the 4-embedding vectors to form the representation for the entity.
|
| 228 |
+
|
| 229 |
+
Training Details: Training the model is complicated by the large number of poor local minima, as the model needs to learn both good syntactic structures and the complex semantics of neural modules.
|
| 230 |
+
|
| 231 |
+
To simplify training, we use Curriculum Learning (Bengio et al., 2009) to pre-train the model on an easier subset of questions. We use a 2-step schedule where we first train our model on simple attribute match (What is a red sphere?), attribute existence (Is anything blue?) and boolean composition $I s$ anything green and is anything purple?) questions and in the second step on all questions jointly.
|
| 232 |
+
|
| 233 |
+
Table 1: Results for Short Questions: Performance of our model compared to baseline models on the Short Questions test set. The LSTM (NO KG) has accuracy close to chance, showing that the questions lack trivial biases.Our model almost perfectly solves all questions showing its ability to learn challenging semantic operators, and parse questions only using weak end-to-end supervision.
|
| 234 |
+
|
| 235 |
+
<table><tr><td>Model</td><td>Boolean Questions</td><td>Entity Set Questions</td><td>Relation Questions</td><td>Overall</td></tr><tr><td>LSTM (No KG)</td><td>50.7</td><td>14.4</td><td>17.5</td><td>27.2</td></tr><tr><td>LSTM (NO RELATION)</td><td>88.5</td><td>99.9</td><td>15.7</td><td>84.9</td></tr><tr><td>RELATION NETWORK</td><td>85.6</td><td>89.7</td><td>97.6</td><td>89.4</td></tr><tr><td>Our Model</td><td>99.9</td><td>100</td><td>100.0</td><td>99.9</td></tr></table>
|
| 236 |
+
|
| 237 |
+
We tune the hyper-parameters using validation accuracy. We train using SGD with learning rate of 0.5 and mini-batch size of 4, regularization constant of 0.3. When assigning the semantic type distribution to the words at the leaves, we add a small positive bias of $+ 1$ for $\phi$ -type and a small negative bias of $- 1$ for the $\mathbf { E }$ -type score before the softmax. Our trainable parameters are: question word embeddings (64-dimensional), relation embeddings (64-dimensional), entity attribute-value embeddings (16-dimensional), four vectors per word for $\mathbf { V }$ -type representations, six scalar feature scores per module per word for the parsing model, and the global parameter vector for the $\mathbf { E + E { } E }$ module.
|
| 238 |
+
|
| 239 |
+
Baseline Models: We use three baseline models for comparison. A simple LSTM (NO KG) model that encodes the question using an LSTM network and answers questions without access to the KG. Another LSTM based model, LSTM (NO RELATION), that has access only to the entities of the KG but not the relationship information between them. Finally, we train a RELATION NETWORK (Santoro et al., 2017) augmented model, which achieved state-of-the-art performance on the CLEVR dataset using image state descriptions. Details about the baseline models are given in the Appendix section.
|
| 240 |
+
|
| 241 |
+
# 6.2 EXPERIMENTS
|
| 242 |
+
|
| 243 |
+
Short Questions Performance: In Table 1, we see that our model is able to perfectly answer all the questions in the test set. This demonstrates our model can learn challenging semantic operators using composition modules, as well as learn to parse the questions from only using weak endto-end supervision. The RELATION NETWORK also achieves good performance, particularly on questions involving relations, but is weaker than our model on some question types. The LSTM (NO RELATION) model also achieves good performance on questions not involving relations, which are out of scope for the model.
|
| 244 |
+
|
| 245 |
+
Complex Question Performance: Table 2 shows results on complex questions, which are constructed by combining components of shorter questions. We use the same models as in Table 1, which were trained and developed only on shorter questions. Answering longer questions requires complex multi-hop reasoning, and the ability to generalize from the language seen in its training data to new types of questions. Results show that all baselines achieve close to random performance on this task, despite high accuracy for shorter questions. This shows the challenges in generalizing RNN encoders beyond their training data. In contrast, the strong inductive bias from our model structure allows the model to generalize to complex questions much more easily than RNN encoders.
|
| 246 |
+
|
| 247 |
+
Generalization to Unseen Attribute Combination: We also measure how well models generalize to unseen attribute combinations in knowledge graphs (using the COGENT subset of CLEVR). For example, the test set contains ‘blue spheres’ that are not found in the training set. None of the models showed a significant reduction in performance in this setting.
|
| 248 |
+
|
| 249 |
+
Error Analysis: Analyzing the errors of our model, we find that most errors are due to incorrect assignments of structure, rather than semantic errors from the modules. For example, in the question Are four red spheres beneath a metallic thing small?, our model produces a parse where it composes metallic thing small into a single node instead of composing red spheres beneath a metallic thing into a single node. Future work should use more sophisticated parsing models.
|
| 250 |
+
|
| 251 |
+
<table><tr><td>Model</td><td>Non-Relation Questions</td><td>Relation Questions</td><td>Overall</td></tr><tr><td>LSTM (NO KG)</td><td>46.0</td><td>39.6</td><td>41.4</td></tr><tr><td>LSTM(NO RELATION)</td><td>62.2</td><td>49.2</td><td>52.2</td></tr><tr><td>RELATION NETWORK</td><td>51.1</td><td>38.9</td><td>41.5</td></tr><tr><td>Our Model</td><td>81.8</td><td>85.4</td><td>84.6</td></tr></table>
|
| 252 |
+
|
| 253 |
+
Table 2: Results for Complex Questions: All baseline models fail to generalize to questions requiring longer chains of reasoning than seen during training. Our model substantially outperforms the baselines, showing its ability to perform complex multi-hop reasoning, and generalize from its training data. Analysis suggests that most errors from our model are due to assigning incorrect structures, not mistakes by the composition modules.
|
| 254 |
+
|
| 255 |
+
# 7 RELATED WORK
|
| 256 |
+
|
| 257 |
+
Many approaches have been proposed to perform question-answering against structured knowledge sources. Semantic parsing models have attempted to learn structures over pre-defined discrete operators, to produce logical forms that can be executed to answer the question. Early work trained using gold-standard logical forms (Zettlemoyer & Collins, 2005; Kwiatkowski et al., 2010), whereas later efforts have only used answers to questions (Liang et al., 2011; Krishnamurthy & Kollar, 2013; Pasupat & Liang, 2015). A key difference is that our model must learn semantic operators from data, which may be necessary to model the fuzzy interpretations of some function words like many or few.
|
| 258 |
+
|
| 259 |
+
Another similar line of work is neural program induction models, such as Neural Programmer (Neelakantan et al., 2016) and Neural Symbolic Machine (Liang et al., 2017). These models learn to produce programs composed of predefined operators using weak supervision to answer questions against semi-structured tables.
|
| 260 |
+
|
| 261 |
+
Neural module networks have recently been proposed for learning semantic operators (Andreas et al., 2016b) for question answering. This model assumes that the structure of the semantic parse is given, and must only learn a set of operators. Dynamic Neural Module Networks (D-NMN) extend this approach by selecting from a small set of candidate module structures (Andreas et al., 2016a). In contrast, our approach learns a model over all possible structures for interpreting a question.
|
| 262 |
+
|
| 263 |
+
Our work is most similar to the most recently proposed N2NMN (Hu et al., 2017) model, an end-toend version of D-NMN. This model learns both semantic operators and the layout in which to compose them. However, optimizing the layouts requires reinforcement learning, which is challenging due to the high variance of policy gradients, whereas our approach is end-to-end differentiable.
|
| 264 |
+
|
| 265 |
+
# 8 CONCLUSION
|
| 266 |
+
|
| 267 |
+
We have introduced a model for answering questions requiring compositional reasoning that combines ideas from compositional semantics with end-to-end learning of composition operators and structure. We demonstrated that the model is able to learn a number of complex composition operators from end task supervision, and have shown that the linguistically motivated inductive bias imposed by the structure of the model allows it to generalize well beyond its training data. Future work should explore scaling the model to other question answering tasks.
|
| 268 |
+
|
| 269 |
+
# REFERENCES
|
| 270 |
+
|
| 271 |
+
Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Learning to compose neural networks for question answering. In HLT-NAACL, 2016a.
|
| 272 |
+
|
| 273 |
+
Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In CVPR, pp. 39–48, 2016b.
|
| 274 |
+
|
| 275 |
+
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.
|
| 276 |
+
|
| 277 |
+
Ronghang Hu, Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Kate Saenko. Learning to reason: End-to-end module networks for visual question answering. CoRR, abs/1704.05526, 2017.
|
| 278 |
+
|
| 279 |
+
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 CVPR, July 2017.
|
| 280 |
+
|
| 281 |
+
Jayant Krishnamurthy and Thomas Kollar. Jointly learning to parse and perceive: Connecting natural language to the physical world. TACL, 1:193–206, 2013.
|
| 282 |
+
|
| 283 |
+
Tom Kwiatkowski, Luke S. Zettlemoyer, Sharon Goldwater, and Mark Steedman. Inducing probabilistic ccg grammars from logical form with higher-order unification. In EMNLP, 2010.
|
| 284 |
+
|
| 285 |
+
Chen Liang, Jonathan Berant, Quoc Le, Kenneth D. Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. In ACL, 2017.
|
| 286 |
+
|
| 287 |
+
Percy Liang, Michael I Jordan, and Dan Klein. Learning dependency-based compositional semantics. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pp. 590–599. Association for Computational Linguistics, 2011.
|
| 288 |
+
|
| 289 |
+
Jean Maillard, Stephen Clark, and Dani Yogatama. Jointly learning sentence embeddings and syntax with unsupervised tree-lstms. CoRR, abs/1705.09189, 2017. URL http://arxiv.org/abs/ 1705.09189.
|
| 290 |
+
|
| 291 |
+
Richard Montague. The proper treatment of quantification in ordinary English. In K. J. J. Hintikka, J. Moravcsic, and P. Suppes (eds.), Approaches to Natural Language, pp. 221–242. Reidel, Dordrecht, 1973.
|
| 292 |
+
|
| 293 |
+
Arvind Neelakantan, Quoc V. Le, Mart´ın Abadi, Andrew McCallum, and Dario Amodei. Learning a natural language interface with neural programmer. CoRR, abs/1611.08945, 2016.
|
| 294 |
+
|
| 295 |
+
Panupong Pasupat and Percy Liang. Compositional semantic parsing on semi-structured tables. In ACL, 2015.
|
| 296 |
+
|
| 297 |
+
Ethan Perez, Harm de Vries, Florian Strub, Vincent Dumoulin, and Aaron C. Courville. Learning visual reasoning without strong priors. CoRR, abs/1707.03017, 2017. URL http://arxiv. org/abs/1707.03017.
|
| 298 |
+
|
| 299 |
+
Adam Santoro, David Raposo, David G. T. Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy P. Lillicrap. A simple neural network module for relational reasoning. CoRR, abs/1706.01427, 2017. URL http://arxiv.org/abs/1706.01427.
|
| 300 |
+
|
| 301 |
+
Luke S Zettlemoyer and Michael Collins. Learning to map sentences to logical form: Structured classification with probabilistic categorial grammars. UAI, 2005.
|
| 302 |
+
|
| 303 |
+
# APPENDIX
|
| 304 |
+
|
| 305 |
+
BASELINE MODELS
|
| 306 |
+
|
| 307 |
+
LSTM (NO KG)
|
| 308 |
+
|
| 309 |
+
We use a LSTM network to encode the question as a vector $q$ . We also define three other parameter vectors, $t , e$ and $b$ that are used to predict the answer-type $P ( \bar { a } = \mathbf { T } ) = \sigma ( \boldsymbol { q } \cdot \boldsymbol { t } )$ , entity attention value $p _ { e _ { i } } = \sigma ( q \cdot e )$ , and the probability of the answer being True $p _ { t r u e } = \sigma ( q \cdot b )$ .
|
| 310 |
+
|
| 311 |
+
LSTM (NO RELATION)
|
| 312 |
+
|
| 313 |
+
Similar to LSTM (NO RELATION), the question is encoded using a LSTM network as vector $q$ . Similar to our model, we learn entity attribute-value embeddings and represent each entity as the concatenation of the 4 attribute-value embeddings, $\boldsymbol { v } _ { e _ { i } }$ . Similar to LSTM (NO RELATION), we also define the $t$ parameter vector to predict the answer-type. The entity-attention values are predicted as $p _ { e _ { i } } = \sigma ( v _ { e _ { i } } \cdot q )$ . To predict the probability of the boolean-type answer being true, we first add the entity representations to form $b { \bar { \mathbf { \theta } } } = \sum _ { e _ { i } } v _ { e _ { i } }$ , then make the prediction as $p _ { t r u e } = \sigma ( q \cdot b )$ .
|
| 314 |
+
|
| 315 |
+
# RELATION NETWORK AUGMENTED MODEL
|
| 316 |
+
|
| 317 |
+
The original formulation of the relation network module is as follows:
|
| 318 |
+
|
| 319 |
+
$$
|
| 320 |
+
R N ( q , K G ) = f _ { \phi } \left( \sum _ { i , j } g _ { \theta } ( e _ { i } , e _ { j } , q ) \right)
|
| 321 |
+
$$
|
| 322 |
+
|
| 323 |
+
where $e _ { i } , e _ { j }$ are the representations of the entities and $q$ is the question representation from an LSTM network. The output of the Relation Network module is a scalar score value for the elements in the answer vocabulary. Since our dataset contains entity-set valued answers, we modified the module in the following manner.
|
| 324 |
+
|
| 325 |
+
We concatenate the object pair representations with the representations of the pair of directed relationships between them1. We then use the Relation Network module to produce an output representation for each entity in the KB, in the following manner:
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
R N _ { e _ { i } } = f _ { \phi } \Bigg ( \sum _ { j } g _ { \theta } ( e _ { i } , e _ { j } , r _ { i j } ^ { 1 } , r _ { i j } ^ { 2 } , q ) \Bigg )
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
Similar to the LSTM baselines, we define a parameter vector $t$ to predict the answer-type as:
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
P ( a = \mathbf { T } ) = \sigma ( q \cdot t )
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
P ( a = \mathbf { E } ) = 1 - P ( a = \mathbf { T } )
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
To predict the probability of the boolean type answer being true, we define a parameter vector $b$ and predict as following:
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
p _ { t r u e } = \sigma \bigg ( b \cdot \sum _ { e _ { i } } R N _ { e _ { i } } \bigg )
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
To predict the entity-attention values, we use a separate attribute-embedding matrix to first generate the output representation for each entity, $e _ { i } ^ { o u t }$ , then predict the output attention values as follows:
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
p _ { e _ { i } } = \sigma \bigg ( R N _ { e _ { i } } \cdot e _ { i } ^ { o u t } \bigg )
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
We tried other architectures as well, but this modification provided the best performance on the validation set. We also tuned the hyper-parameters and found the setting from Santoro et al. (2017) to work the best based on validation accuracy. We used a different 2-step curriculum to train the RELATION NETWORK module, in which we replace the Boolean questions with the relation questions in the first-schedule and jointly train on all questions in the subsequent schedule.
|
md/train/rkcQFMZRb/rkcQFMZRb.md
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR
|
| 2 |
+
|
| 3 |
+
Johannes Ballé∗ jballe@google.com
|
| 4 |
+
|
| 5 |
+
David Minnen∗ dminnen@google.com
|
| 6 |
+
|
| 7 |
+
Saurabh Singh∗ saurabhsingh@google.com
|
| 8 |
+
|
| 9 |
+
Sung Jin Hwang∗ sjhwang@google.com
|
| 10 |
+
|
| 11 |
+
Nick Johnston∗nickj@google.com
|
| 12 |
+
|
| 13 |
+
∗Google Mountain View, CA 94043, USA
|
| 14 |
+
|
| 15 |
+
# ABSTRACT
|
| 16 |
+
|
| 17 |
+
We describe an end-to-end trainable model for image compression based on variational autoencoders. The model incorporates a hyperprior to effectively capture spatial dependencies in the latent representation. This hyperprior relates to side information, a concept universal to virtually all modern image codecs, but largely unexplored in image compression using artificial neural networks (ANNs). Unlike existing autoencoder compression methods, our model trains a complex prior jointly with the underlying autoencoder. We demonstrate that this model leads to state-of-the-art image compression when measuring visual quality using the popular MS-SSIM index, and yields rate–distortion performance surpassing published ANN-based methods when evaluated using a more traditional metric based on squared error (PSNR). Furthermore, we provide a qualitative comparison of models trained for different distortion metrics.
|
| 18 |
+
|
| 19 |
+
# 1 INTRODUCTION
|
| 20 |
+
|
| 21 |
+
Recent machine learning methods for lossy image compression have generated significant interest in both the machine learning and image processing communities (e.g., Ballé et al., 2017; Theis et al., 2017; Toderici et al., 2017; Rippel and Bourdev, 2017). Like all lossy compression methods, they operate on a simple principle: an image, typically modeled as a vector of pixel intensities $_ { \textbf { \em x } }$ , is quantized, reducing the amount of information required to store or transmit it, but introducing error at the same time. Typically, it is not the pixel intensitites that are quantized directly. Rather, an alternative (latent) representation of the image is found, a vector in some other space $\textbf { { y } }$ , and quantization takes place in this representation, yielding a discrete-valued vector $\hat { y }$ . Because it is discrete, it can be losslessly compressed using entropy coding methods, such as arithmetic coding (Rissanen and Langdon, 1981), to create a bitstream which is sent over the channel. Entropy coding relies on a prior probability model of the quantized representation, which is known to both encoder and decoder (the entropy model).
|
| 22 |
+
|
| 23 |
+
In the class of ANN-based methods for image compression mentioned above, the entropy model used to compress the latent representation is typically represented as a joint, or even fully factorized, distribution $p _ { \hat { \pmb { y } } } ( \hat { \pmb { y } } )$ . Note that we need to distinguish between the actual marginal distribution of the latent representation $m ( \hat { \pmb y } )$ , and the entropy model $p _ { \hat { \pmb { y } } } ( \hat { \pmb { y } } )$ . While the entropy model is typically assumed to have some parametric form, with parameters fitted to the data, the marginal is an unknown distribution arising from both the distribution of images that are encoded, and the method which is used to infer the alternative representation $\textbf { { y } }$ . The smallest average code length an encoder–decoder pair can achieve, using $p _ { \hat { \mathbf { \it y } } }$ as their shared entropy model, is given by the Shannon cross entropy between the two distributions:
|
| 24 |
+
|
| 25 |
+
$$
|
| 26 |
+
R = \mathbb { E } _ { \hat { \pmb { y } } \sim m } [ - \log _ { 2 } p _ { \hat { \pmb { y } } } ( \hat { \pmb { y } } ) ] .
|
| 27 |
+
$$
|
| 28 |
+
|
| 29 |
+
Note that this entropy is minimized if the model distribution is identical to the marginal. This implies that, for instance, using a fully factorized entropy model, when statistical dependencies exist in the actual distribution of the latent representation, will lead to suboptimal compression performance.
|
| 30 |
+
|
| 31 |
+
One way conventional compression methods increase their compression performance is by transmitting side information: additional bits of information sent from the encoder to the decoder, which signal modifications to the entropy model intended to reduce the mismatch. This is feasible because the marginal for a particular image typically varies significantly from the marginal for the ensemble of images the compression model was designed for. In this scheme, the hope is that the amount of side information sent is smaller, on average, than the reduction of code length achieved in eq. (1) by matching $p _ { \hat { \mathbf { \it y } } }$ more closely to the marginal for a particular image. For instance, JPEG (1992) models images as independent fixed-size blocks of $8 \times 8$ pixels. However, some image structure, such as large homogeneous regions, can be more efficiently represented by considering larger blocks at a time. For this reason, more recent methods such as HEVC (2013) partition an image into variablesize blocks, convey the partition structure to the decoder as side information, and then compress the block representations using that partitioning. That is, the entropy model for JPEG is always factorized into groups of 64 elements, whereas the factorization is variable for HEVC. The HEVC decoder needs to decode the side information first, so that it can use the correct entropy model to decode the block representations. Since the encoder is free to select a partitioning that optimizes the entropy model for each image, this scheme can be used to achieve more efficient compression.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Left: representation of a transform coding model as a generative Bayesian model, and a corresponding variational inference model. Nodes represent random variables or parameters, and arrows indicate conditional dependence between them. Right: diagram showing the operational structure of the compression model. Arrows indicate the flow of data, and boxes represent transformations of the data. Boxes labeled $\textit { u } | \textit { Q }$ represent either addition of uniform noise applied during training (producing vectors labeled with a tilde), or quantization and arithmetic coding/decoding during testing (producing vectors labeled with a hat).
|
| 35 |
+
|
| 36 |
+
In conventional compression methods, the structure of this side information is hand-designed. In contrast, the model we present in this paper essentially learns a latent representation of the entropy model, in the same way that the underlying compression model learns a representation of the image. Because our model is optimized end-to-end, it minimizes the total expected code length by learning to balance the amount of side information with the expected improvement of the entropy model. This is done by expressing the problem formally in terms of variational autoencoders (VAEs), probabilistic generative models augmented with approximate inference models (Kingma and Welling, 2014). Ballé et al. (2017) and Theis et al. (2017) previously noted that some autoencoder-based compression methods are formally equivalent to VAEs, where the entropy model, as described above, corresponds to the prior on the latent representation. Here, we use this formalism to show that side information can be viewed as a prior on the parameters of the entropy model, making them hyperpriors of the latent representation.
|
| 37 |
+
|
| 38 |
+
Specifically, we extend the model presented in Ballé et al. (2017), which has a fully factorized prior, with a hyperprior that captures the fact that spatially neighboring elements of the latent representation tend to vary together in their scales. We demonstrate that the extended model leads to state-ofthe-art image compression performance when measured using the MS-SSIM quality index (Wang, Simoncelli, et al., 2003). Furthermore, it provides significantly better rate–distortion performance compared to other ANN-based methods when measured using peak signal-to-noise ratio (PSNR), a metric based on mean squared error. Finally, we present a qualitative comparison of the effects of training the same model class using different distortion losses.
|
| 39 |
+
|
| 40 |
+
# 2 COMPRESSION WITH VARIATIONAL MODELS
|
| 41 |
+
|
| 42 |
+
In the transform coding approach to image compression (Goyal, 2001), the encoder transforms the image vector $_ { \textbf { \em x } }$ using a parametric analysis transform $g _ { a } ( { \pmb x } ; \phi _ { g } )$ into a latent representation $\textbf { { y } }$ , which is then quantized to form $\hat { y }$ . Because $\hat { y }$ is discrete-valued, it can be losslessly compressed using entropy coding techniques such as arithmetic coding (Rissanen and Langdon, 1981) and transmitted as a sequence of bits. On the other side, the decoder recovers $\hat { y }$ from the compressed signal, and subjects it to a parametric synthesis transform $g _ { s } ( \hat { y } ; \pmb { \theta } _ { g } )$ to recover the reconstructed image $\hat { \pmb x }$ . In the context of this paper, we think of the transforms $g _ { a }$ and $g _ { s }$ as generic parameterized functions, such as artificial neural networks (ANNs), rather than linear transforms as in traditional compression methods. The parameters $\theta _ { g }$ and $\phi _ { g }$ then encapsulate the weights of the neurons, etc. (refer to section 4 for details).
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
Figure 2: Left: an image from the Kodak dataset. Middle left: visualization of a subset of the latent representation $\textbf { { y } }$ of that image, learned by our factorized-prior model. Note that there is clearly visible structure around edges and textured regions, indicating that a dependency structure exists in the marginal which is not represented in the factorized prior. Middle right: standard deviations $\hat { \pmb { \sigma } }$ of the latents as predicted by the model augmented with a hyperprior. Right: latents $\textbf { { y } }$ divided elementwise by their standard deviation. Note how this reduces the apparent structure, indicating that the structure is captured by the new prior.
|
| 46 |
+
|
| 47 |
+
The quantization introduces error, which is tolerated in the context of lossy compression, giving rise to a rate–distortion optimization problem. Rate is the expected code length (bit rate) of the compressed representation: assuming the entropy coding technique is operating efficiently, this can again be written as a cross entropy:
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
R = \mathbb { E } _ { { \pmb x } \sim p _ { \pmb x } } \left[ - \log _ { 2 } p _ { \hat { \pmb y } } \big ( Q ( g _ { a } ( { \pmb x } ; \phi _ { g } ) ) \big ) \right] ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $Q$ represents the quantization function, and $p _ { \hat { \pmb { y } } }$ is the entropy model, as described in the introduction. In this context, the marginal distribution of the latent representation arises from the (unknown) image distribution $p _ { \pmb { x } }$ and the properties of the analysis transform. Distortion is the expected difference between the reconstruction $\hat { \pmb x }$ and the original image $_ { \textbf { \em x } }$ , as measured by a norm or perceptual metric. The coarseness of the quantization, or alternatively, the warping of the representation implied by the analysis and synthesis transforms, affects both rate and distortion, leading to a trade-off, where a higher rate allows for a lower distortion, and vice versa. Various compression methods can be viewed as minimizing a weighted sum of these two quantities. Formally, we can parameterize the problem by $\lambda$ , a weight on the distortion term. Different applications require different trade-offs, and hence different values of $\lambda$ .
|
| 54 |
+
|
| 55 |
+
In order to be able to use gradient descent methods to optimize the performance of the model over the parameters of the transforms $\wp _ { g }$ and $\phi _ { g , \ l }$ ), the problem needs to be relaxed, because due to the quantization, gradients with respect to $\phi _ { g }$ are zero almost everywhere. Approximations that have been investigated include substituting the gradient of the quantizer (Theis et al., 2017), and substituting additive uniform noise for the quantizer itself during training (Ballé et al., 2016b). Here, we follow the latter method, which switches back to actual quantization when applying the model as a compression method. We denote the quantities derived from this approximation with a tilde, as opposed to a hat; for instance, $\tilde { y }$ represents the “noisy” representation, and $\hat { y }$ the quantized representation.
|
| 56 |
+
|
| 57 |
+
The optimization problem can be formally represented as a variational autoencoder (Kingma and Welling, 2014); that is, a probabilistic generative model of the image combined with an approximate inference model (figure 1). The synthesis transform is linked to the generative model (“generating” a reconstructed image from the latent representation), and the analysis transform to the inference model (“inferring” the latent representation from the source image). In variational inference, the goal is to approximate the true posterior $p _ { \tilde { \pmb { y } } | \pmb { x } } ( \tilde { \pmb { y } } \mid \pmb { x } )$ , which is assumed intractable, with a parametric variational density $q ( \tilde { \textbf { \mathscr { y } } } \mid x )$ by minimizing the expectation of their Kullback–Leibler (KL) divergence over the data distribution $p _ { \pmb { x } }$ :
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\mathbb { E } _ { \alpha \sim p _ { \alpha } } D _ { \mathrm { K L } } [ q \mathbin { \lVert } p _ { \tilde { y } \rVert x } ] = \mathbb { E } _ { \alpha \sim p _ { \alpha } } \mathbb { E } _ { \tilde { y } \sim q } \left[ \log q ( \tilde { y } + \overbrace { x } ) ^ { * } \underbrace { \log p _ { \alpha | \tilde { y } } ( x \mathbin { \lvert } \tilde { y } ) } _ { \mathrm { V o } \mathbin { \lvert } \tilde { y } \rvert } \underbrace { - \log p _ { \tilde { y } } ( \tilde { y } ) } _ { \mathrm { V o } \mathbin { \lvert } \tilde { y } \rvert } \right] + \mathrm { c o n s t . }
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
By matching the parametric density functions to the transform coding framework, we can appreciate that the minimization of the $\mathrm { K L }$ divergence is equivalent to optimizing the compression model for rate–distortion performance. We have indicated here that the first term will evaluate to zero, and the second and third term correspond to the weighted distortion and the bit rate, respectively. Let’s take a closer look at each of the terms.
|
| 64 |
+
|
| 65 |
+
First, the mechanism of “inference” is computing the the analysis transform of the image and adding uniform noise (as a stand-in for quantization), thus:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { l l l } { q ( \pmb { \tilde { y } } \mid \pmb { x } , \phi _ { g } ) } & { = } & { \displaystyle \prod _ { i } { \mathcal U } \big ( \tilde { y } _ { i } \mid y _ { i } - \frac { 1 } { 2 } , y _ { i } + \frac { 1 } { 2 } \big ) } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\mathcal { U }$ denotes a uniform distribution centered on $y _ { i }$ . Since the width of the uniform distribution is constant (equal to one), the first term in the KL divergence technically evaluates to zero, and can be dropped from the loss function.
|
| 72 |
+
|
| 73 |
+
For the sake of argument, assume for a moment that the likelihood is given by:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { r l r } { p _ { x | \tilde { y } } ( x \mid \tilde { y } , \pmb { \theta } _ { g } ) } & { = } & { \mathcal { N } \big ( x \mid \tilde { x } , ( 2 \lambda ) ^ { - 1 } \mathbf { 1 } \big ) } \\ & { } & { \mathrm { w i t h } \tilde { x } = g _ { s } ( \tilde { y } ; \pmb { \theta } _ { g } ) . } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
The log likelihood then works out to be the squared difference between $_ { \textbf { \em x } }$ and $\tilde { \pmb x }$ , the output of the synthesis transform, weighted by $\lambda$ . Minimizing the second term in the KL divergence is thus equivalent to minimizing the expected distortion of the reconstructed image. A squared error loss is equivalent to choosing a Gaussian distribution; other distortion metrics may have an equivalent distribution, but this is not guaranteed, as not all metrics necessarily correspond to a normalized density function.
|
| 80 |
+
|
| 81 |
+
The third term in the KL divergence is easily seen to be identical to the cross entropy between the marginal $m ( \tilde { \pmb { y } } ) = \mathbb { E } _ { { \pmb { x } } \sim p _ { \pmb { x } } } q ( \tilde { \pmb { y } } \mid { \pmb x } )$ and the prior $p _ { \tilde { \pmb { y } } } ( \tilde { \pmb { y } } )$ . It reflects the cost of encoding $\tilde { y }$ , as produced by the inference model, assuming $p _ { \tilde { \mathbf { \mathcal { Y } } } }$ as the entropy model. Note that this term represents a differential cross entropy, as opposed to a Shannon (discrete) entropy as in eq. (2), due to the uniform noise approximation. Under the given assumptions, however, they are close approximations of each other (for an empirical evaluation of this approximation, see Ballé et al., 2017). Similarly to Ballé et al. (2017), we model the prior using a non-parametric, fully factorized density model (refer to appendix 6.1 for details):
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
p _ { \tilde { \pmb { y } } | \psi } ( \tilde { \pmb { y } } \mid \psi ) = \prod _ { i } \left( p _ { y _ { i } | \psi ^ { ( i ) } } \left( \psi ^ { ( i ) } \right) * \mathcal { U } \left( - \textstyle \frac { 1 } { 2 } , \textstyle \frac { 1 } { 2 } \right) \right) ( \tilde { y } _ { i } )
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where the vectors $\psi ^ { ( i ) }$ encapsulate the parameters of each univariate distribution $p _ { y _ { i } | \psi ^ { ( i ) } }$ (we denote all these parameters collectively as $\psi$ ). Note that we convolve each non-parametric density with a standard uniform density. This is to enable a better match of the prior to the marginal – for more details, see appendix 6.2. As a shorthand, we refer to this case as the factorized-prior model.
|
| 88 |
+
|
| 89 |
+
The center panel in figure 2 visualizes a subset of the quantized responses $( \hat { y } )$ of a compression model trained in this way. Visually, it is clear that the choice of a factorized distribution is a stark simplification: non-zero responses are highly clustered in areas of high contrast; i.e., around edges, or within textured regions. This implies a probabilistic coupling between the responses, which is not represented in models with a fully factorized prior. We would expect a better model fit and, consequently, a better compression performance, if the model captured these dependencies. Introducing a hyperprior is an elegant way of achieving this.
|
| 90 |
+
|
| 91 |
+

|
| 92 |
+
Figure 3: As in figure 1, but extended with a hyperprior.
|
| 93 |
+
|
| 94 |
+
# 3 INTRODUCTION OF A SCALE HYPERPRIOR
|
| 95 |
+
|
| 96 |
+
As evident from the center panel of figure 2, there are significant spatial dependencies among the elements of $\hat { y }$ . Notably, their scales appear coupled spatially. A standard way to model dependencies between a set of target variables is to introduce latent variables conditioned on which the target variables are assumed to be independent (Bishop, 1999). We introduce an additional set of random variables $\tilde { z }$ to capture the spatial dependencies and propose to extend the model as follows (figure 3).
|
| 97 |
+
|
| 98 |
+
Each element $\tilde { y } _ { i }$ is now modeled as a zero-mean Gaussian with its own standard deviation $\sigma _ { i }$ , where the standard deviations are predicted by applying a parametric transform $h _ { s }$ to $\tilde { z }$ (as above, we convolve each Gaussian density with a standard uniform; see appendix 6.2):
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
p _ { \tilde { \pmb { y } } | \tilde { \pmb { z } } } ( \tilde { \pmb { y } } \mid \tilde { \pmb { z } } , \pmb { \theta } _ { h } ) = \prod _ { i } \Bigl ( \mathcal { N } \bigl ( 0 , \tilde { \sigma } _ { i } ^ { 2 } \bigr ) \ast \mathcal { U } \bigl ( - \textstyle { \frac { 1 } { 2 } } , \frac { 1 } { 2 } \bigr ) \Bigr ) ( \tilde { y } _ { i } )
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
We extend the inference model simply by stacking another parametric transform $h _ { a }$ on top of $\textbf { { y } }$ , effectively creating a single joint factorized variational posterior, as follows:
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\begin{array} { l c l } { { q ( \tilde { y } , \tilde { z } \mid x , \phi _ { g } , \phi _ { h } ) } } & { { = } } & { { \displaystyle { \prod _ { i } \mathcal U \big ( \tilde { y } _ { i } \mid y _ { i } - \frac { 1 } { 2 } , y _ { i } + \frac { 1 } { 2 } \big ) \cdot \prod _ { j } \mathcal U \big ( \tilde { z } _ { j } \mid z _ { j } - \frac { 1 } { 2 } , z _ { j } + \frac { 1 } { 2 } \big ) } } } \\ { { } } & { { } } & { { \mathrm { w i t h } ~ y = g _ { a } ( { \bf x } ; \phi _ { g } ) , z = h _ { a } ( y ; \phi _ { h } ) . } } \end{array}
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
This follows the intuition that the responses $\textbf { { y } }$ should be sufficient to estimate the spatial distribution of the standard deviations. As we have no prior beliefs about the hyperprior, we now model $\tilde { z }$ using the non-parametric, fully factorized density model previously used for $\tilde { y }$ (appendix 6.1):
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\begin{array} { r c l } { p _ { \tilde { z } | \psi } ( \tilde { z } \mid \psi ) } & { = } & { \displaystyle \prod _ { i } \left( p _ { z _ { i } | \psi ^ { ( i ) } } \left( \psi ^ { ( i ) } \right) * \mathcal { U } \left( - \frac { 1 } { 2 } , \frac { 1 } { 2 } \right) \right) ( \tilde { z } _ { i } ) , } \end{array}
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
where the vectors $\psi ^ { ( i ) }$ encapsulate the parameters of each univariate distribution $p _ { z _ { i } | \psi ^ { ( i ) } }$ (collectively denoted as $\psi$ ). The loss function of this model works out to be:
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\begin{array} { r l } & { \mathbb { E } _ { \alpha \sim p _ { \alpha } } D _ { \mathrm { K L } } \big [ q \bigm \lVert p _ { \tilde { y } , \tilde { z } | x } \big ] = \mathbb { E } _ { \alpha \sim p _ { \alpha } } \mathbb { E } _ { \tilde { y } , \tilde { z } \sim q } \Big [ \log q ( \tilde { y } , \tilde { z } \mid x ) - \log p _ { \alpha | \tilde { y } } ( x \mid \tilde { y } ) } \\ & { \qquad \quad - \log p _ { \tilde { y } | \tilde { z } } ( \tilde { y } \mid \tilde { z } ) - \log p _ { \tilde { z } } ( \tilde { z } ) \Big ] + \mathrm { c o n s t . } } \end{array}
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
Again, the first term is zero, since $q$ is a product of uniform densities of unit width. The second term (the likelihood) encapsulates the distortion, as before. The third and fourth term represent the cross entropies encoding $\tilde { y }$ and $\tilde { z }$ , respectively. In analogy to traditional transform coding, the fourth term can be seen as representing side information.
|
| 123 |
+
|
| 124 |
+
The right-hand panel in figure 3 illustrates how the model is used as a compression method. The encoder subjects the input image $_ { \textbf { \em x } }$ to $g _ { a }$ , yielding the responses $\textbf { { y } }$ with spatially varying standard deviations. The responses are fed into $h _ { a }$ , summarizing the distribution of standard deviations in $z , \ z$ is then quantized, compressed, and transmitted as side information. The encoder then uses the quantized vector $\hat { z }$ to estimate $\hat { \pmb { \sigma } }$ , the spatial distribution of standard deviations, and uses it to compress and transmit the quantized image representation $\hat { y }$ . The decoder first recovers $\hat { z }$ from the compressed signal. It then uses $h _ { s }$ to obtain $\hat { \pmb { \sigma } }$ , which provides it with the correct probability estimates to successfully recover $\hat { y }$ as well. It then feeds $\hat { y }$ into $g _ { s }$ to obtain the reconstructed image.
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
Figure 4: Network architecture of the hyperprior model. The left side shows an image autoencoder architecture, the right side corresponds to the autoencoder implementing the hyperprior. The factorized-prior model uses the identical architecture for the analysis and synthesis transforms $g _ { a }$ and $g _ { s }$ . Q represents quantization, and AE, AD represent arithmetic encoder and arithmetic decoder, respectively. Convolution parameters are denoted as: number of filters $\times$ kernel support height $\times$ kernel support width / down- or upsampling stride, where $\uparrow$ indicates upsampling and $\downarrow$ downsampling. $N$ and $M$ were chosen dependent on $\lambda$ , with $N = 1 2 8$ and $M = 1 9 2$ for the 5 lower values, and $N = 1 9 2$ and $M = 3 2 0$ for the 3 higher values.
|
| 128 |
+
|
| 129 |
+
# 4 EXPERIMENTS
|
| 130 |
+
|
| 131 |
+
To compare the compression performance of our proposed models, we conducted a number of experiments using the Tensorflow framework.
|
| 132 |
+
|
| 133 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 134 |
+
|
| 135 |
+
We set up the transforms $g _ { a } , g _ { s } , h _ { a }$ , and $h _ { s }$ as alternating compositions of linear and nonlinear functions, as is common in artificial neural networks (figure 4). Specifically, $g _ { a }$ and $g _ { s }$ are composed of convolutions and GDN/IGDN nonlinearities, which implement local divisive normalization, a type of transformation that has been shown to be particularly suitable for density modeling and compression of images (Ballé et al., 2016a; Ballé et al., 2017).1 $h _ { a }$ and $h _ { s }$ are composed of convolutions and rectifiers (rectified linear units). To make the hyperprior model and the factorized-prior model comparable, we chose identical architectures for $g _ { a }$ and $g _ { s }$ , as shown in figure 4.
|
| 136 |
+
|
| 137 |
+
To maintain translation invariance across the model, all elements of $_ z$ with the same channel index are assumed to follow the same univariate distribution. This allows the model to be used with arbitrary image sizes. Arithmetic coding is implemented using a simple non-adaptive binary arithmetic coder. Each element of $\hat { y }$ and $\hat { z }$ is independently converted to its representation as a binary integer and arithmetically encoded from the most significant to the least significant bit. Since the spatial distribution of standard deviations $( \hat { \sigma } )$ is known to the decoder by the time decoding of $\hat { y }$ is attempted, the arithmetic coder does not need to handle conditional dependencies. It also does not need to be separately trained, since the binary probabilities needed for encoding are a direct function of the probability mass functions of $\hat { y }$ and $\hat { z }$ , and the probability mass functions in turn are direct functions of their “noisy” counterparts $\tilde { y } , \tilde { z }$ by design (Ballé et al., 2017). This is particulary important for $\hat { y }$ . Since the prior is conditioned on $\hat { \pmb { \sigma } }$ , the probability mass functions $p _ { \hat { y } _ { i } }$ need to be constructed “on the fly” during decoding of an image:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
p _ { \hat { y } _ { i } } ( \hat { y } _ { i } \mid \hat { \sigma } _ { i } ) = p _ { \tilde { y } _ { i } } ( \hat { y } _ { i } \mid \hat { \sigma } _ { i } ) = \left( \mathcal { N } ( 0 , \hat { \sigma } _ { i } ) \ast \mathcal { U } \big ( - \textstyle \frac { 1 } { 2 } , \textstyle \frac { 1 } { 2 } \big ) \right) ( \hat { y } _ { i } ) = \int _ { \hat { y } _ { i } - 1 / 2 } ^ { \hat { y } _ { i } + 1 / 2 } \mathcal { N } ( y \mid 0 , \hat { \sigma } _ { i } ) \mathrm { d } y ,
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
which can be evaluated in closed form.
|
| 144 |
+
|
| 145 |
+
The models were trained on a body of color JPEG images with heights/widths between 3000 and 5000 pixels, comprising approximately 1 million images scraped from the world wide web. Images with excessive saturation were screened out to reduce the number of non-photographic images. To reduce existing compression artifacts, the images were further downsampled by a randomized factor, such that the minimum of their height and width equaled between 640 and 1200 pixels. Then, randomly placed $2 5 6 \times 2 5 6$ pixel crops of these downsampled images were extracted. Minibatches of 8 of these crops at a time were used to perform stochastic gradient descent using the Adam algorithm (Kingma and Ba, 2015) with a learning rate of $1 0 ^ { - 4 }$ . Common machine learning techniques such as batch normalization or learning rate decay were found to have no beneficial effect (this may be due to the local normalization properties of GDN, which contain global normalization as a special case).
|
| 146 |
+
|
| 147 |
+
With this setup, we trained a total of 32 separate models: half of the models with a hyperprior and half without; half of the models with mean squared error as the distortion metric (as described in the previous section), and half on the MS-SSIM distortion index (Wang, Simoncelli, et al., 2003); finally, each of these combinations with 8 different values of $\lambda$ in order to cover a range of rate– distortion tradeoffs.
|
| 148 |
+
|
| 149 |
+
# 4.2 EXPERIMENTAL RESULTS
|
| 150 |
+
|
| 151 |
+
We evaluate the compression performance of all models on the publicly available Kodak dataset (Eastman Kodak, 1993). Summarized rate–distortion curves are shown in figure 5. Results for individual images, as well as summarized comparisons to a wider range of existing methods are provided in appendices 6.5 and 6.7. We quantify image distortion using peak signal-to-noise ratio (PSNR) and MS-SSIM. Each curve represents the rate–distortion tradeoffs for a given set of models, across different values of $\lambda$ . Since MS-SSIM yields values between 0 (worst) and 1 (best), and most of the compared methods achieve values well above 0.9, we converted the quantity to decibels in order to improve legibility.
|
| 152 |
+
|
| 153 |
+
Interestingly, but maybe not surprisingly, results differ substantially depending on which distortion metric is used in the loss function during training. When measuring distortion in PSNR (figure 5, top), both our models perform poorly if they have been optimized for MS-SSIM. However, when optimized for squared error, the model with the factorized prior outperforms existing conventional codecs such as JPEG, as well as other ANN-based methods which have been trained for squared error (Theis et al., 2017; Ballé et al., 2017). Note that other published ANN-based methods not shown here underperform compared to the ones that are shown, or have not made their data available to us. Our factorized prior model does not outperform BPG (Bellard, 2014), an encapsulation of HEVC (2013) targeted at still image compression. When training our hyperprior model for squared error, we get close to BPG performance, with better results at higher bit rates than lower ones, but still substantially outperforming all published ANN-based methods.
|
| 154 |
+
|
| 155 |
+
When measuring distortion using MS-SSIM (figure 5, bottom), conventional codecs such as JPEG and BPG end up at the lower end of the performance ranking. This is not surprising, since these methods have been optimized for squared error (with hand-selected constraints intended to ensure that squared error optimization doesn’t go against visual quality). To the best of our knowledge, the state of the art for compression performance in terms of MS-SSIM is Rippel and Bourdev (2017). Surprisingly, it is matched (with better performance at high bit rates, and slightly worse performance at low bit rates) by our factorized prior model, even though their model is conceptually much more complex (due to its multiscale architecture, GAN loss, and context-adaptive entropy model). The hyperprior model adds further gains across all rate–distortion tradeoffs, consistently surpassing the state of the art.
|
| 156 |
+
|
| 157 |
+
With the results differing so heavily depending on which training loss is used, one has to wonder if there are any qualitative differences in the image reconstructions. When comparing images compressed to similar bit rates by models optimized with an MS-SSIM distortion loss compared to a squared loss, we find that the overall fidelity in terms of how much detail is preserved appears similar. However, the spatial distribution of detail changes substantially. MS-SSIM, like its predecessor SSIM (Wang, Bovik, et al., 2004), is a metric designed to model human visual contrast perception. Compared to squared loss, it has the effect of attenuating the error in image regions with high contrast, and boosting the error in regions with low contrast, because the human visibility threshold varies with local contrast. This behavior yields good results for images containing textures with different local contrast (refer to examples provided in appendix 6.7). However, more frequently than expected, it can also produce results inconsistent with human expectations: for the image we show in figure 6, the compression model trained for MS-SSIM assigns more detail to the grass (low contrast), and removes detail from the text on the side of the airplane (high contrast). Because semantic relevance is often assigned to high-contrast areas (such as text, or salient objects), the squared-error optimized models produce subjectively better reconstructions in these cases. It is important to note that neither distortion metric is sophisticated enough to capture image semantics, which makes the choice of distortion loss a difficult one.
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 5: Rate–distortion curves aggregated over the Kodak dataset. The top plot shows peak signalto-noise ratios as a function of bit rate $( 1 0 \log _ { 1 0 } { \frac { 2 5 5 ^ { 2 } } { d } }$ , with $d$ representing mean squared error), the bottom plot shows MS-SSIM values converted to decibels $( - 1 0 \log _ { 1 0 } ( 1 - d )$ , where $d$ is the MSSSIM value in the range between zero and one). We observe that matching the training loss to the metric used for evaluation is crucial to optimize performance. Our hyperprior model trained on squared error outperforms all other ANN-based methods in terms of PSNR, and approximates HEVC performance. In terms of MS-SSIM, the hyperprior model consistently outperforms conventional codecs as well as Rippel and Bourdev (2017), the current state-of-the-art model for that metric. Note that the PSNR plot aggregates curves over equal values of $\lambda$ , and the MS-SSIM plot aggregates over equal rates (with interpolation), in order to provide a fair comparison to both stateof-the-art methods. Refer to figures 11 and 12 in the appendix for full-page RD curves that include a wider range of compression methods.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 6: The visual artifacts generated at low bit rates depend on the training loss. The top figure (0.1864 bpp, $\mathrm { P S N R } { = } 2 7 . 9 9$ , MS-SSIM=0.9803) was generated by the hyperprior model using an MS-SSIM loss, while the bottom figure (0.1932 bpp, PSNR $= 3 2 . 2 6$ , MS-SSIM=0.9713) was trained using squared loss.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 7: Amount of side information (encoding $\hat { z }$ ) as a function of total bit rate (encoding $\hat { y }$ and $\hat { z }$ ), for the hyperprior model optimized for squared error, averaged over the Kodak set, and normalized per pixel. Only a small fraction of the total bit rate is used for encoding $\hat { z }$ .
|
| 167 |
+
|
| 168 |
+
Prior work on ANN-based image compression has shown that extending the transform coding concept from linear to nonlinear transforms fundamentally improves the qualitative nature of compression artifacts (Ballé et al., 2017). It appears that nonlinear transforms with higher computational capacity adapt better to the statistics of natural images, imitating properties of the data distribution better than linear transforms. When comparing image reconstructions visually between models with or without the hyperprior, we find no changes to the qualitative nature of the artifacts. Rather, the hyperprior model simply tends to produce image reconstructions with improved detail and a lower bit rate than the corresponding model with a factorized prior.
|
| 169 |
+
|
| 170 |
+
Figure 7 shows how much of the total bit rate the hyperprior model uses as side information. The amount of side information grows with the total bit rate, but stays far below 0.1 bpp, even for the highest total bit rates. Still, the resulting improvement of the prior enables the performance gains over the factorized-prior model shown in figure 5. Note that the architecture of the models does not explicitly constrain the bit rates in any way. The illustrated trade-off in allocating bits for encoding $\hat { z }$ vs. $\hat { y }$ is simply the result of optimizing the loss function given in eq. (10).
|
| 171 |
+
|
| 172 |
+
# 5 DISCUSSION
|
| 173 |
+
|
| 174 |
+
We implement a variational image compression model, conceptually identical to the model presented by Ballé et al. (2017), and augment it with a more powerful entropy model by introducing a hyperprior on the local scale parameters of the latent representation. The hyperprior is trained end-to-end with the rest of the model.
|
| 175 |
+
|
| 176 |
+
Like all recent image compression methods based on ANNs, our method can be directly optimized for distortion losses that are more complex than pixel-wise losses such as mean squared error. As one of the first studies in this emerging field, we examine the effect of optimizing for one of the most popular perceptual metrics, MS-SSIM, and compare it to optimizing for squared loss. Note that Ballé et al. (2016b) compare models trained for different metrics, but their results are limited by the choice of transforms. Figure 6 demonstrates that the results can show significant variation in terms of visual quality, depending on image content, which implies that unless human rating experiments are conducted to provide more reliable data, it is wise to compare methods based on more than a single type of metric.
|
| 177 |
+
|
| 178 |
+
Santurkar et al. (2017) formulate their compression method in a hybrid VAE-GAN framework, adopting a stepwise training scheme where a decoder is first trained using an adversarial loss. It is then fixed, and an encoder is trained to minimize the reconstruction error. Rippel and Bourdev (2017) also employ an adversarial approach, but use a weighted combination of an MS-SSIM and an adversarial loss. Baig and Torresani (2017) propose a compression scheme based on colorization, where color channels are predicted from the the luminance channel by making use of some model specific side information. The luminance channel is compressed using a traditional method. The proposed method exhibits significant color distortions at low bit rates, and is limited by the compression method used for the luminance channel.
|
| 179 |
+
|
| 180 |
+
An early exploration of hierarchical generative models for compression of small images is found in Gregor et al. (2016). However, the aspect of quantization is not thoroughly considered, and hence, no actual compression method is designed. Theis et al. (2017) approach the problem of generating gradient descent directions for quantization functions by replacing their (unhelpful) gradient with the identity function, and derive a differentiable upper bound for the discrete rate term. Ballé et al. (2016b) instead replace the quantizer with additive uniform noise during training, and the discrete rate term with a differential entropy. While this method doesn’t offer a bound for the approximation, it establishes a direct relationship between the discrete and continuous prior distributions $p _ { \hat { \mathbf { \it y } } }$ and $p _ { \tilde { \mathbf { \mathcal { Y } } } }$ , which enables direct evaluation of the discrete prior as a function of the latents $\hat { z }$ as in eq. (11), and hence makes use of a hyperprior feasible in practice. The quality of the approximation is verified empirically by Ballé et al. (2017).
|
| 181 |
+
|
| 182 |
+
Wainwright and Simoncelli (2000) observe that linear filter responses (i.e., wavelet coefficients obtained by filtering an image) follow heavy-tailed marginal distributions, but can be represented as conditionally Gaussian when groups of neighboring coefficients are linked by a common scale multiplier. That is, the distributions of the filter responses can be modeled as Gaussian scale mixtures. Lyu and Simoncelli (2009) extend this model from spatially localized groups of wavelet coefficients to a global image model. Our model can be seen as a further extension of this, where the filter responses are replaced with responses of a nonlinear transform, and an approximate inference model is added. Theis et al. (2017) directly use Gaussian scale mixtures, but in the form of a fully factorized prior. In the presented form, our variational model is perhaps most closely related to ladder VAEs (Sønderby et al., 2016). However, we choose different parametric forms to accommodate the approximation of the quantization and entropy coding process.
|
| 183 |
+
|
| 184 |
+
In classical transform coding methods, compression researchers have exploited statistical dependency in the latent variables (e.g., DCT or wavelet coefficients) by carefully hand-engineering entropy codes modeling the dependencies in the quantized regime (Taubman and Marcellin, 2002). This presents a much more difficult engineering problem than relying on a fully factorized entropy model; transitioning to nonlinear transforms whose parameters are determined through training (and thus may be different for each re-training) only complicates the problem. Toderici et al. (2017) model images directly with a binarized latent representation, which technically removes the need for a separate entropy coding step. However, this corresponds to a very inflexible entropy model (a uniform prior on a binary representation, with no trainable parameters). The model apparently compensates for this by using higher capacity transforms (e.g., based on recurrent networks). Johnston et al. (2017) improve the method by designing an adaptive entropy model. However, this entropy model is not included in the rate term while training the transforms, and hence no feedback (in terms of gradients) is returned from the entropy model back to the transforms during training. This breaks the paradigm of end-to-end optimization, and may stand in the way of better compression performance. Similarly, Rippel and Bourdev (2017) use a hand-designed energy function without trainable parameters as the prior for training the autoencoder, and design an adaptive entropy model post hoc. The fact that our factorized prior model matches the performance of their method, when optimized on the same metric, may point towards this disconnect. Ágústsson et al. (2017) extend the fully-factorized prior model by proposing to do vector quantization over small subtensors of the latent representation, which effectively relaxes the factorization. They train their method end-to-end.
|
| 185 |
+
|
| 186 |
+
All of the models presented here make use of GDN, a type of nonlinearity implementing local normalization. As part of a Gaussianizing transformation, GDN has been shown to be more efficient, in terms of number of parameters, at removing statistical dependencies in image data, than pointwise nonlinearities (Ballé et al., 2016a). Furthermore, there has been a long history of generative models, starting with independent component analysis (Cardoso, 2003), which can successfully recover factorized representations just by maximizing likelihood assuming a fully factorized prior. Despite these facts, we observe that significant dependencies between neighboring elements remain in the latent representation of our compression models (figure 2), even though we took care not to impose constraints on the transforms which might reduce their capacity to factorize the representation (refer to appendix 6.3 for details). We attribute this to the fact that the rate–distortion loss, unlike a maximum likelihood loss, trades off the rate term against expected distortion. It is easy to see that for increasing values of $\lambda$ , the rate term containing the factorized prior becomes less and less important. Hence, it is questionable whether rate–distortion optimality implies full independence of the representation, at least for arbitrary values of $\lambda$ .
|
| 187 |
+
|
| 188 |
+
Regardless of this, the fact that the hyperprior models consistently outperform models with a factorized prior illustrate that it is important for any compression method to reduce mismatch between the prior and the marginal, as in eq. (2). Our model, when trained on the appropriate loss, has the capacity to surpass the state of the art on MS-SSIM, but does not quite reach the performance of a heavily optimized traditional method such as BPG on PSNR (while outperforming all other methods based on ANNs). This discrepancy may indicate that methods based on ANNs have not yet reached the expressive power of traditional methods. As such, the introduction of a hyperprior – or, in traditional terms, side information – is an elegant way of introducing more flexible priors, and a big step in the right direction.
|
| 189 |
+
|
| 190 |
+
# REFERENCES
|
| 191 |
+
|
| 192 |
+
Ágústsson, Eiríkur Þór et al. (2017). “Soft-to-Hard Vector Quantization for End-to-End Learning Compressible Representations”. In: Advances in Neural Information Processing Systems 30, pp. 1141–1151.
|
| 193 |
+
Asuni, N. and A. Giachetti (2014). “TESTIMAGES: A large-scale archive for testing visual devices and basic image processing algorithms”. In: Proc. of STAG: Smart Tools and Apps for Graphics.
|
| 194 |
+
Baig, Mohammad Haris and Lorenzo Torresani (2017). “Multiple hypothesis colorization and its application to image compression”. In: Computer Vision and Image Understanding 164. DOI: 10.1016/j.cviu.2017.01.010.
|
| 195 |
+
Ballé, Johannes, Valero Laparra, and Eero P. Simoncelli (2016a). “Density Modeling of Images Using a Generalized Normalization Transformation”. In: arXiv e-prints. Presented at the 4th Int. Conf. on Learning Representations. arXiv: 1511.06281. (2016b). “End-to-end optimization of nonlinear transform codes for perceptual quality”. In: Picture Coding Symposium (PCS), 2016. DOI: 10.1109/PCS.2016.7906310. arXiv: 1607. 05006. (2017). “End-to-end Optimized Image Compression”. In: arXiv e-prints. Presented at the 5th Int. Conf. on Learning Representations. arXiv: 1611.01704.
|
| 196 |
+
Bellard, Fabrice (2014). BPG Image Format. Accessed: 2017-01-30. URL: http://bellard. org/bpg/.
|
| 197 |
+
Bishop, Christopher M. (1999). “Latent variable models”. In: Learning in Graphical Models. MIT Press, pp. 371–403.
|
| 198 |
+
Cardoso, Jean-François (2003). “Dependence, Correlation and Gaussianity in Independent Component Analysis”. In: Journal of Machine Learning Research 4, pp. 1177–1203.
|
| 199 |
+
Eastman Kodak (1993). Kodak Lossless True Color Image Suite (PhotoCD PCD0992). URL: http: //r0k.us/graphics/kodak/.
|
| 200 |
+
Goyal, Vivek K. (2001). “Theoretical Foundations of Transform Coding”. In: IEEE Signal Processing Magazine 18.5. DOI: 10.1109/79.952802.
|
| 201 |
+
Gregor, Karol et al. (2016). “Towards Conceptual Compression”. In: Advances in Neural Information Processing Systems 29, pp. 3549–3557.
|
| 202 |
+
HEVC (2013). ITU-R Rec. H.265 & ISO/IEC 23008-2: High Efficiency Video Coding.
|
| 203 |
+
JPEG (1992). ITU-R Rec. T.81 & ISO/IEC 10918-1: Digital compression and coding of continuoustone still images.
|
| 204 |
+
Johnston, Nick et al. (2017). “Improved Lossy Image Compression with Priming and Spatially Adaptive Bit Rates for Recurrent Networks”. In: arXiv e-prints. arXiv: 1703.10114.
|
| 205 |
+
Kingma, Diederik P. and Jimmy Ba (2015). “Adam: A Method for Stochastic Optimization”. In: arXiv e-prints. Presented at the 3rd Int. Conf. on Learning Representations. arXiv: 1412.6980.
|
| 206 |
+
Kingma, Diederik P. and Max Welling (2014). “Auto-Encoding Variational Bayes”. In: arXiv eprints. Presented at the 2nd Int. Conf. on Learning Representations. arXiv: 1312.6114.
|
| 207 |
+
Lyu, Siwei and Eero P. Simoncelli (2009). “Modeling Multiscale Subbands of Photographic Images with Fields of Gaussian Scale Mixtures”. In: IEEE Transactions on Pattern Analysis and Machine Intelligence 31.4. DOI: 10.1109/TPAMI.2008.107.
|
| 208 |
+
Rippel, Oren and Lubomir Bourdev (2017). “Real-Time Adaptive Image Compression”. In: Proc. of Machine Learning Research. Vol. 70, pp. 2922–2930.
|
| 209 |
+
Rissanen, Jorma and Glen G. Langdon Jr. (1981). “Universal modeling and coding”. In: IEEE Transactions on Information Theory 27.1. DOI: 10.1109/TIT.1981.1056282.
|
| 210 |
+
Santurkar, Shibani, David Budden, and Nir Shavit (2017). “Generative Compression”. In: arXiv e-prints. arXiv: 1703.01467.
|
| 211 |
+
Sønderby, Casper Kaae et al. (2016). “Ladder variational autoencoders”. In: Advances in Neural Information Processing Systems 29, pp. 3738–3746.
|
| 212 |
+
Taubman, David S. and Michael W. Marcellin (2002). JPEG 2000 – Image Compression Fundamentals, Standards and Practice. Kluwer.
|
| 213 |
+
Theis, Lucas et al. (2017). “Lossy Image Compression with Compressive Autoencoders”. In: arXiv e-prints. Presented at the 5th Int. Conf. on Learning Representations. arXiv: 1703.00395.
|
| 214 |
+
Toderici, George et al. (2017). “Full Resolution Image Compression with Recurrent Neural Networks”. In: 2017 IEEE Conf. on Computer Vision and Pattern Recognition (CVPR). DOI: 10. 1109/CVPR.2017.577. arXiv: 1608.05148.
|
| 215 |
+
Wainwright, Martin J. and Eero P. Simoncelli (2000). “Scale Mixtures of Gaussians and the Statistics of Natural Images”. In: Advances in Neural Information Processing Systems 12, pp. 855–861.
|
| 216 |
+
Wang, Zhou, Alan Conrad Bovik, et al. (2004). “Image Quality Assessment: From Error Visibility to Structural Similarity”. In: IEEE Transactions on Image Processing 13.4. DOI: 10.1109/TIP. 2003.819861.
|
| 217 |
+
Wang, Zhou, Eero P. Simoncelli, and Alan Conrad Bovik (2003). “Multi-Scale Structural Similarity for Image Quality Assessment”. In: Conf. Rec. of the 37th Asilomar Conf. on Signals, Systems and Computers. DOI: 10.1109/ACSSC.2003.1292216.
|
| 218 |
+
|
| 219 |
+

|
| 220 |
+
Figure 8: A fit of the non-parametric model $p$ (with $K = 3$ ) to a Gaussian mixture distribution. Gray plots illustrate convergence of the model. The non-parametric model is able to produce a good fit to the ground truth density.
|
| 221 |
+
|
| 222 |
+
# 6 APPENDIX
|
| 223 |
+
|
| 224 |
+
# 6.1 UNIVARIATE NON-PARAMETRIC DENSITY MODEL
|
| 225 |
+
|
| 226 |
+
Ballé et al. (2017) use a non-parametric piecewise linear density model to represent each factor of the fully factorized prior. By increasing the number of samples per unit interval, it can in principle be used to model any univariate density with arbitrary precision. However, it has two practical problems: The range of values with non-zero probability must be finite and known ahead of time, and its implementation is non-trivial with existing automatic differentiation frameworks, both due to numerical issues with normalizing the density and the fact that it typically relies on discrete operations such as array indexing. For the compression models presented in this paper, we instead use the following model based on the cumulative.
|
| 227 |
+
|
| 228 |
+
We define a density $p : \mathbb { R } \to \mathbb { R } ^ { + }$ using its cumulative $c : \mathbb { R } [ 0 , 1 ]$ by satisfying the following constraints:
|
| 229 |
+
|
| 230 |
+
$$
|
| 231 |
+
c ( - \infty ) = 0 ; \quad c ( \infty ) = 1 ; \quad p ( x ) = \frac { \partial c ( x ) } { \partial x } \geq 0
|
| 232 |
+
$$
|
| 233 |
+
|
| 234 |
+
Note that the monotonicity constraint of the cumulative is established by requiring the density function $p$ to be non-negative. Suppose the cumulative is a composition of functions. Then the density can be written using the chain rule of calculus:
|
| 235 |
+
|
| 236 |
+
$$
|
| 237 |
+
\begin{array} { l } { { c = f _ { K } \circ f _ { K - 1 } \cdot \cdot \cdot f _ { 1 } } } \\ { { p = f _ { K } ^ { \prime } \cdot f _ { K - 1 } ^ { \prime } \cdot \cdot \cdot f _ { 1 } ^ { \prime } } } \end{array}
|
| 238 |
+
$$
|
| 239 |
+
|
| 240 |
+
where we write the derivative of $f _ { k }$ as $f _ { k } ^ { \prime }$ . We’ll allow the $f _ { k }$ to be vector functions:
|
| 241 |
+
|
| 242 |
+
$$
|
| 243 |
+
f _ { k } : \mathbb { R } ^ { d _ { k } } \mathbb { R } ^ { r _ { k } }
|
| 244 |
+
$$
|
| 245 |
+
|
| 246 |
+
In general, the $f _ { k } ^ { \prime }$ are Jacobian matrices, and the dots are matrix multiplications. To ensure $p ( x )$ is univariate, the domain of $f _ { 1 }$ and the range of $f _ { K }$ need to be one dimensional $d _ { 1 } = r _ { K } = 1$ ).
|
| 247 |
+
|
| 248 |
+
To guarantee that $p ( x )$ is a density, we just need $f _ { K }$ to map to the range between 0 and 1, and ensure that $p ( x ) \geq 0$ . To do that, we require all the Jacobian elements to be non-negative. Then the matrix product computing $p ( x )$ is non-negative as well, and we have defined a valid density.
|
| 249 |
+
|
| 250 |
+
An effective choice of $f _ { k }$ is the following (as a shorthand, we define tanh, sigmoid, and softplus as elementwise functions, when applied to vectors or matrices):
|
| 251 |
+
|
| 252 |
+
$$
|
| 253 |
+
\begin{array} { r l } & { f _ { k } ( { \pmb x } ) = g _ { k } \big ( { \pmb H } ^ { ( k ) } { \pmb x } + { \pmb b } ^ { ( k ) } \big ) \qquad { \qquad } { 1 \leq k < K } } \\ & { f _ { K } ( { \pmb x } ) = \mathrm { s i g m o i d } \big ( { \pmb H } ^ { ( K ) } { \pmb x } + { \pmb b } ^ { ( K ) } \big ) } \end{array}
|
| 254 |
+
$$
|
| 255 |
+
|
| 256 |
+
where $H ^ { ( k ) }$ are matrices, $\smash { \boldsymbol { b } ^ { ( k ) } }$ are vectors, and $g _ { k }$ are nonlinearities defined as
|
| 257 |
+
|
| 258 |
+
$$
|
| 259 |
+
g _ { k } ( { \pmb x } ) = { \pmb x } + { \pmb a } ^ { ( k ) } \odot \operatorname { t a n h } ( { \pmb x } )
|
| 260 |
+
$$
|
| 261 |
+
|
| 262 |
+
where $\mathbf { \pmb { a } } ^ { ( k ) }$ is a vector and $\odot$ denotes elementwise multiplication. The rationale behind this particular nonlinearity is that it allows to expand or contract the space near $x = 0$ . $\mathbf { \pmb { a } } ^ { ( k ) }$ controls the rate of expansion (when positive) or contraction (when negative). If $\mathbf { \pmb { a } } ^ { ( k ) }$ were fixed to a positive value, “peaks” in the density would become easier to model than “troughs”.
|
| 263 |
+
|
| 264 |
+
The derivatives work out as follows:
|
| 265 |
+
|
| 266 |
+
$$
|
| 267 |
+
\begin{array} { r l r } & { f _ { k } ^ { \prime } ( \pmb { x } ) = \mathrm { d i a g } g _ { k } ^ { \prime } \big ( \pmb { H } ^ { ( k ) } \pmb { x } + \pmb { b } ^ { ( k ) } \big ) \cdot \pmb { H } ^ { ( k ) } \qquad } & { 1 \leq k < K , \mathrm { w i t h } } \\ & { g _ { k } ^ { \prime } ( \pmb { x } ) = 1 + \pmb { a } ^ { ( k ) } \odot \mathrm { t a n h } ^ { \prime } ( \pmb { x } ) } & { \mathrm { a n d } } \\ & { f _ { K } ^ { \prime } ( \pmb { x } ) = \mathrm { s i g m o i d } ^ { \prime } \big ( \pmb { H } ^ { ( K ) } \pmb { x } + \pmb { b } ^ { ( K ) } \big ) \cdot \pmb { H } ^ { ( K ) } } & \end{array}
|
| 268 |
+
$$
|
| 269 |
+
|
| 270 |
+
For the derivatives to be non-negative, we need to constrain $H ^ { ( k ) }$ to have all non-negative elements, and the elements of $\mathbf { \pmb { a } } ^ { ( k ) }$ to be lower bounded by $- 1$ . This is easily done by reparameterization:
|
| 271 |
+
|
| 272 |
+
$$
|
| 273 |
+
\begin{array} { r l } & { H ^ { ( k ) } = \mathrm { s o f t p l u s } \big ( \hat { H } ^ { ( k ) } \big ) } \\ & { a ^ { ( k ) } = \mathrm { t a n h } \big ( \hat { \mathbf { a } } ^ { ( k ) } \big ) } \end{array}
|
| 274 |
+
$$
|
| 275 |
+
|
| 276 |
+
where the quantities with the hat are the actual parameters. A plot of a fit of this model to a “toy” mixture density is provided in figure 8. As a special case, setting $K = 1$ yields a logistic distribution:
|
| 277 |
+
|
| 278 |
+
$$
|
| 279 |
+
\begin{array} { l c l } { { c ( x ) = \displaystyle \mathrm { s i g m o i d } \big ( h x + b \big ) } } \\ { { p ( x ) = \displaystyle \frac { h } { 2 } \cdot \displaystyle \frac { 1 } { 1 + \cosh ( h x + b ) } } } \end{array}
|
| 280 |
+
$$
|
| 281 |
+
|
| 282 |
+
It may seem odd to define a density function as an explicit derivative; however, in an automatic differentiation framework, this operation is very easy to implement, and the resulting density function is normalized by construction. We have found the model to fit well to arbitrary densities, and perform just as well as the piecewise linear model in the context of compression models. For all experiments in this paper, we used $K = 4$ , with the dimensionalities $r _ { 1 } = r _ { 2 } = r _ { 3 } = 3$ . Each univariate density model is associated with its own set of parameters $\mathbf { \pmb { a } } ^ { ( k ) }$ , $\smash { \pmb { b } ^ { ( k ) } }$ , $H ^ { ( k ) }$ (which, together, form $\psi ^ { ( i ) } .$ ).
|
| 283 |
+
|
| 284 |
+
# 6.2 MODELING PRIORS WITH ADDED UNIFORM NOISE
|
| 285 |
+
|
| 286 |
+
We model both the prior $p _ { \tilde { y } | \tilde { z } }$ and the hyperprior $p _ { \tilde { z } }$ using densities that are convolved with a standard uniform density function. This is to ensure that the priors have enough flexibility to match the variational posterior $q$ . To see this, consider that in some cases, it is beneficial in terms of rate– distortion performance for the model to “disable” part of the latent representation, leading to a lower effective dimensionality than the model architecture has been set up for. For simplicity of notation, let’s assume that the variational posterior and the prior have just one dimension which has collapsed. In this case, $g _ { a }$ converges to always producing a constant value for the corresponding dimensions:
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
y = g _ { a } ( \pmb { x } ) = c , { \mathrm { ~ i n d e p e n d e n t ~ o f ~ } } \pmb { x } .
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
When this happens, the marginal distribution of that element during training is a uniform density centered on $c$ , due to the added uniform noise, and the variational posterior matches it exactly:
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\begin{array} { r } { m ( \tilde { y } ) = q ( \tilde { y } \mid \pmb { x } ) = \mathcal { U } \big ( \tilde { y } \mid c - \frac { 1 } { 2 } , c + \frac { 1 } { 2 } \big ) . } \end{array}
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
The cross entropy of this element is given by:
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
\mathbb { E } _ { \tilde { y } \sim m } [ - \log _ { 2 } p _ { \tilde { y } } ] .
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
This entropy should evaluate to zero bits, as the quantized representation is deterministic (and hence, no information needs to be transmitted). For the cross entropy to evaluate to zero, however, the prior needs to be flexible enough to assume the shape of the posterior – a unit-width uniform density.
|
| 305 |
+
|
| 306 |
+

|
| 307 |
+
Figure 9: Fitting the density model described in the previous section to a uniform distribution, with and without convolving the model with a uniform density. Gray plots illustrate convergence of the model. While $p$ itself assumes smoothness and thus fails to find an adequate fit to the uniform with its steep edges, the augmented model fits almost perfectly.
|
| 308 |
+
|
| 309 |
+
Due to its infinitely steep edges, the uniform distribution is a corner case for not only the Gaussian density model, but also the non-parametric model described in appendix 6.1. To fix this, we incorporate the added noise directly into the prior/hyperprior by convolving the underlying density model $p$ with a standard uniform:
|
| 310 |
+
|
| 311 |
+
$$
|
| 312 |
+
\begin{array} { l } { { \displaystyle p _ { \tilde { y } } ( \tilde { y } ) = \left( p * \mathcal { U } \big ( - \frac 1 2 , \frac 1 2 \big ) \right) ( \tilde { y } ) } } \\ { { \displaystyle \qquad = \int _ { - \infty } ^ { \infty } p ( y ) \mathcal { U } \big ( \tilde { y } - y \mid - \frac 1 2 , \frac 1 2 \big ) \mathrm { d } y } } \\ { { \displaystyle \qquad = \int _ { \tilde { y } - \frac 1 2 } ^ { \tilde { y } + \frac 1 2 } p ( y ) \mathrm { d } y } } \\ { { \displaystyle \qquad = c \big ( \tilde { y } + \frac 1 2 \big ) - c \big ( \tilde { y } - \frac 1 2 \big ) , } } \end{array}
|
| 313 |
+
$$
|
| 314 |
+
|
| 315 |
+
where $c$ is the cumulative of the underlying density model. Now, whatever the underlying density $p$ is, letting its scale go towards zero makes $p _ { \tilde { y } }$ approach a unit-width uniform density. Since the non-parametric model is defined via its cumulative, and the cumulative of a Gaussian is available in most computational frameworks, this solution is easy to implement in practice.
|
| 316 |
+
|
| 317 |
+
# 6.3 MODEL CAPACITY
|
| 318 |
+
|
| 319 |
+
Our results seem to indicate that a certain degree of statistical dependency in the latent image representation $\textbf { { y } }$ is preferred by the rate–distortion objective, and that the hyperprior model performs better by embracing this. However, it is possible that dependencies remain simply because the analysis
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
Figure 10: Rate–distortion curves for factorized-prior models only differing in their transform capacity (number of filters at each transform layer $N$ ). Note that performance gains with increased number of filters stagnates as a $\lambda$ -dependent saturation point is reached. For example, moving from 64 to 128 filters makes a significant difference at $0 . 5 \mathrm { b p p }$ , while moving from 128 to 192 only yields a negligible gain, and there is no benefit in going up to 256.
|
| 323 |
+
|
| 324 |
+
<table><tr><td rowspan="2">CPU N</td><td colspan="2">Kodak</td><td colspan="2">Tecnick</td><td rowspan="2">GPU N</td><td colspan="2">Kodak</td><td colspan="2">Tecnick</td></tr><tr><td>encode</td><td>decode</td><td>encode</td><td>decode</td><td>encode</td><td>decode</td><td>encode</td><td>decode</td></tr><tr><td>128</td><td>331.54</td><td>334.21</td><td>1003.73</td><td>1085.56</td><td>128</td><td>242.12</td><td>338.09</td><td>491.88</td><td>799.16</td></tr><tr><td>192</td><td>551.22</td><td>576.34</td><td>1852.10</td><td>1971.85</td><td>192</td><td>310.01</td><td>385.64</td><td>630.02</td><td>1018.35</td></tr></table>
|
| 325 |
+
|
| 326 |
+
Table 1: Average encoding and decoding runtimes for the proposed model in milliseconds.
|
| 327 |
+
|
| 328 |
+
and synthesis transforms $g _ { a }$ and $g _ { s }$ do not have enough capacity to factorize the image representation, or because the training algorithm did not succeed in finding the global optimum. Although it is impossible to fully control for this, we attempted to minimize the chances that capacity limitations in the transforms lead to the wrong conclusions, by carefully selecting the number of filters across layers of the transforms (as given by $N$ and $M$ in figure 4).
|
| 329 |
+
|
| 330 |
+
We established in previous experiments that, for a given $\lambda$ , there exist a certain number of filters per layer at which performance saturates, and no gains can be achieved by further increasing it (figure 10; note that for these experiments, we set $N = M$ ). The optimal number of filters increases with $\lambda$ , indicating that models with higher bit rates require higher transform capacities. Based on these previous experiments, we attempted to choose values close to the point of saturation, or a little higher, in order to control for capacity limitations while minimizing training time. Additionally, we found that allowing a somewhat wider bottleneck $M > N$ helps to achieve comparable performance with overall lower $N$ , and we used this when choosing the model architectures.
|
| 331 |
+
|
| 332 |
+
# 6.4 COMPUTATIONAL COMPLEXITY
|
| 333 |
+
|
| 334 |
+
Table 1 lists encoding and decoding times of our method for a Python and TensorFlow implementation, for CPU as well as GPU and different number of filters per layer $( N )$ , averaged over the Kodak and Tecnick datasets. Note that no performance optimization was attempted. In particular, we did not optimize the metaparameter choices (number of filters, layers, etc.) for computational complexity. Rather, we chose the number of filters high enough to rule out bottlenecks in the transforms, as described in the previous section. Only the arithmetic coding was implemented as a customized operator in $\mathrm { C } { + } { + }$ . Thus, these measurements represent proof that the method is feasible, but their utility for meaningful comparisons with other methods is limited. The average increase in runtime for the hyperprior model compared to the factorized-prior model was between $20 \%$ and $50 \%$ .
|
| 335 |
+
|
| 336 |
+
# 6.5 PERFORMANCE COMPARISONS FOR THE KODAK IMAGE SET
|
| 337 |
+
|
| 338 |
+
The plots in figures 11 and 12 show the same results as figure 5, but provide comparisons to a wider array of compression methods. Note that the method to aggregate rate–distortion points across images differs between the PSNR and MS-SSIM plots: in the latter, we interpolate the RD curves for each image (as shown in appendix 6.7) using cubic splines at a predefined set of bit rates, and then average across equal bit rates. In the former, no interpolation was used, averaging rate and distortion measurements across equal values of $\lambda$ . As noted by Ballé et al. (2017), directly comparing RD curves with different methods of aggregation can give misleading results. Because of this, we match our aggregation method to the data available for the current state of the art ( $\lambda$ -aggregation for HEVC and PSNR, and rate aggregation for Rippel and Bourdev (2017) and MS-SSIM). Ultimately, a comparison based on individual images, as provided in section 6.7, should be considered more reliable; however, data on individual images for Rippel and Bourdev (2017) has not been available.
|
| 339 |
+
|
| 340 |
+
# 6.6 PERFORMANCE COMPARISONS FOR THE TECNICK IMAGE SET
|
| 341 |
+
|
| 342 |
+
For the sake of completeness, the plots in figures 13 and 14 show results over the Tecnick dataset (Asuni and Giachetti, 2014). Rate and distortion measurements were averaged across equal values of $\lambda$ for both PSNR and MS-SSIM plots.
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 11: Rate–distortion curves for PSNR covering a wide range of conventional and ANN-based compression methods. We see that our hyperprior model (blue squares) outperforms most conventional codecs (JPEG, JPEG 2000, and WebP) as well as all ANN-based methods by a wide margin.
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
RD curves averaged over Kodak (MS-SSIM)
|
| 349 |
+
Figure 12: Rate–distortion curves for MS-SSIM covering a wide range of conventional and ANNbased compression methods. When trained on MS-SSIM, our hyperprior model outperforms Rippel and Bourdev (2017), the current state of the art, consistently across all bit rates. Note that even when trained using squared loss, our hyperprior model (blue squares) yields higher MS-SSIM scores than all of the conventional methods.
|
| 350 |
+
|
| 351 |
+

|
| 352 |
+
Figure 13: Rate–distortion curves for PSNR covering a wide range of conventional and ANN-based compression methods. Results are qualitatively similar to the results on Kodak.
|
| 353 |
+
|
| 354 |
+

|
| 355 |
+
Figure 14: Rate–distortion curves for MS-SSIM covering a wide range of conventional and ANNbased compression methods. Results are qualitatively similar to the results on Kodak.
|
| 356 |
+
|
| 357 |
+

|
| 358 |
+
Figure 15: Results for Kodak image 01: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 359 |
+
|
| 360 |
+

|
| 361 |
+
Kodak image 2
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure 16: Results for Kodak image 02: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 365 |
+
|
| 366 |
+

|
| 367 |
+
Figure 17: Results for Kodak image 03: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
Figure 18: Results for Kodak image 04: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 19: Results for Kodak image 05: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 374 |
+
|
| 375 |
+

|
| 376 |
+
|
| 377 |
+

|
| 378 |
+
|
| 379 |
+
Figure 20: Results for Kodak image 06: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 21: Results for Kodak image 07: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 383 |
+
|
| 384 |
+

|
| 385 |
+
Figure 22: Results for Kodak image 08: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
Figure 23: Results for Kodak image 09: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 389 |
+
|
| 390 |
+

|
| 391 |
+
Figure 24: Results for Kodak image 10: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 392 |
+
|
| 393 |
+

|
| 394 |
+
|
| 395 |
+

|
| 396 |
+
Kodak image 11
|
| 397 |
+
Figure 25: Results for Kodak image 11: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 398 |
+
|
| 399 |
+

|
| 400 |
+
Figure 26: Results for Kodak image 12: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 401 |
+
|
| 402 |
+

|
| 403 |
+
|
| 404 |
+

|
| 405 |
+
|
| 406 |
+
Figure 27: Results for Kodak image 13: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 407 |
+
|
| 408 |
+

|
| 409 |
+
Figure 28: Results for Kodak image 14: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 410 |
+
|
| 411 |
+

|
| 412 |
+
Figure 29: Results for Kodak image 15: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 413 |
+
|
| 414 |
+

|
| 415 |
+
Figure 30: Results for Kodak image 16: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 416 |
+
|
| 417 |
+

|
| 418 |
+
Figure 31: Results for Kodak image 17: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 419 |
+
|
| 420 |
+

|
| 421 |
+
|
| 422 |
+
Figure 32: Results for Kodak image 18: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 423 |
+
|
| 424 |
+

|
| 425 |
+
Figure 33: Results for Kodak image 19: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 426 |
+
|
| 427 |
+

|
| 428 |
+
Figure 34: Results for Kodak image 20: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 429 |
+
|
| 430 |
+

|
| 431 |
+
|
| 432 |
+

|
| 433 |
+
Figure 35: Results for Kodak image 21: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 434 |
+
|
| 435 |
+

|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
Kodak image 22
|
| 439 |
+
Figure 36: Results for Kodak image 22: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
Figure 37: Results for Kodak image 23: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
| 443 |
+
|
| 444 |
+

|
| 445 |
+
Figure 38: Results for Kodak image 24: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
|
md/train/rkcya1ZAW/rkcya1ZAW.md
ADDED
|
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CONTINUOUS-TIME FLOWS FOR EFFICIENT INFERENCE AND DENSITY ESTIMATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Two fundamental problems in unsupervised learning are efficient inference for latent-variable models and robust density estimation based on large amounts of unlabeled data. For efficient inference, normalizing flows have been recently developed to approximate a target distribution arbitrarily well. In practice, however, normalizing flows only consist of a finite number of deterministic transformations, and thus they possess no guarantee on the approximation accuracy. For density estimation, the generative adversarial network (GAN) has been advanced as an appealing model, due to its often excellent performance in generating samples. In this paper, we propose the concept of continuous-time flows (CTFs), a family of diffusion-based methods that are able to asymptotically approach a target distribution. Distinct from normalizing flows and GANs, CTFs can be adopted to achieve the above two goals in one framework, with theoretical guarantees. Our framework includes distilling knowledge from a CTF for efficient inference, and learning an explicit energy-based distribution with CTFs for density estimation. Experiments on various tasks demonstrate promising performance of the proposed CTF framework, compared to related techniques.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Efficient inference and robust density estimation are two important goals in unsupervised learning. In fact, inference and density estimation can be unified from the perspective of learning desired target distributions. In inference problems, one is given an unnormalized distribution (e.g., the posterior distribution), and the goal is to learn a distribution that is close to the unnormalized distribution. In density estimation, one tries to learn an unknown data distribution given samples from it. It is also helpful to make a distinction between two types of representations for learning distributions: explicit and implicit methods (Mohamed & Lakshminarayanan, 2017). Explicit methods provide a prescribed parametric form for the distribution, while implicit methods learn a stochastic procedure to directly generate samples from the unknown distribution.
|
| 12 |
+
|
| 13 |
+
Existing deep generative models can easily be identified from this taxonomy. For example, the standard variational autoencoder (VAE) (Kingma & Welling, 2014; Rezende et al., 2014) is an important example of an explicit inference method. Within the inference arm (encoder) of a VAE, recent research has focused on improving the accuracy of the approximation to the posterior distribution on latent variables (codes) using normalizing flow (Rezende & Mohamed, 2015). Normalizing flow is particularly interesting due to its ability to approximate the posterior distribution arbitrarily well, while maintaining explicit parametric forms. On the other hand, Stein VAE (Feng et al., 2017; Pu et al., 2017b) is an implicit inference method, as it only learns to draw samples to approximate posteriors, without assuming an explicit form for the distribution.. For density estimation on observed data, the generative adversarial network (GAN) can be regarded as an implicit density estimation method (Ranganath et al., 2016; Huszár, 2017; Mohamed & Lakshminarayanan, 2017), in the sense that one may sample from the distribution (regarded as a representation of the unknown distribution), but an explicit form for the distribution is not estimated. GAN has recently been augmented by Flow-GAN (Grover et al., 2017) to incorporate a likelihood term for explicit density estimation. Further, there also are some works trying to perform inference within the implicit density estimation framework, e.g., the real-valued non-volume preserving (real NVP) transformations algorithm (Dinh et al., 2017) was proposed as a tractable yet expressive approach to model high-dimensional data.
|
| 14 |
+
|
| 15 |
+
Some aforementioned methods rely on the concept of flows. A flow defines a series of transformations for a random variable (RV), such that the distribution of the RV evolves from a simple distribution to a more complex distribution. When the sequence of transformations are indexed on a discrete-time domain (e.g., indexed with integers) with a finite number of transformations, this method is referred to as a normalizing flow (Rezende & Mohamed, 2015). Various efficient implementations of normalizing flows have been proposed, such as the planar, radial (Rezende & Mohamed, 2015), Householder (Tomczak & Welling, 2016), and inverse autoregressive flows (Kingma et al., 2016). One theoretical limitation of existing normalizing flows is that there is no guarantee on the approximation accuracy due to the finite number of transformations.
|
| 16 |
+
|
| 17 |
+
By contrast, little work has explored the applicability of continuous-time flows (CTFs) in deep generative models, where a sequence of transformations are indexed on a continuous-time domain (e.g., indexed with real numbers). There are at least two reasons encouraging research in this direction: $i ,$ ) CTFs are more general than traditional normalizing flows in terms of modeling flexibility, due to the intrinsic infinite number of transformations; $i i$ ) CTFs are more theoretically grounded, in the sense that they are guaranteed to approach a target distribution asymptotically (details provided in Section 2.2). Unfortunately, these advantages also bring challenges for efficient learning, in that: i) it is difficult to optimize over the variational lower bound in the inference framework, due to the extra randomness introduced in CTFs; ii) it is difficult to design algorithms for efficient learning of CTF-based models, due to the induced infinite number of transformations.
|
| 18 |
+
|
| 19 |
+
In this paper, we propose efficient ways to apply CTFs for the two motivating tasks. Based on the CTF, our framework learns to drawn samples directly from desired distributions (e.g., the unknown posterior and data distributions) for both inference and density estimation tasks. In addition, we are able to learn an explicit form of the unknown data distribution for density estimation∗. This shares a similar flavor as Wang & Liu (2017); Feng et al. (2017). Specifically, $i$ ) for efficient inference, we first show that optimizing the variational lower bound with CTFs can be achieved by decomposing the optimization problem into a sequence of sub-optimization problems, based on a variational formulation of the Fokker-Planck equations from statistical physics (Jordan et al., 1998). Based on this decomposition, we derive bounds on the approximation errors when applying numerical methods to solve a CTF. For computational efficiency, we generalize ideas from Gershman & Goodman (2014) to distill knowledge of a CTF into an efficient inference network; $\ddot { u }$ ) for density estimation, we propose to use a flexible Gibbsian-style distribution (implemented by a deep neural network) to model an unknown data distribution, whose samples can be drawn by learning a stochastic generator with our CTF framework. The Gibbsian-style data distribution and the stochastic generator are learned alternatively, leading to a learning procedure that is connected to the GAN framework (Goodfellow et al., 2014), but that yields an explicit distribution for the data. We conduct a number of experiments on real datasets, demonstrating excellent performance of the proposed framework, relative to existing representative approaches.
|
| 20 |
+
|
| 21 |
+
# 2 PRELIMINARIES
|
| 22 |
+
|
| 23 |
+
We first review related techniques of performing efficient inference and density estimation in the machine learning literature. We then introduce the general concept of continuous-time flows.
|
| 24 |
+
|
| 25 |
+
# 2.1 EFFICIENT INFERENCE AND DENSITY ESTIMATION
|
| 26 |
+
|
| 27 |
+
Efficient inference with normalizing flows Consider a probabilistic generative model with observation $\mathbf { x } \in \mathbb { R } ^ { D }$ and latent variable $\textbf { z } \in \mathbb { R } ^ { L }$ such that $\mathbf { x } \mid \mathbf { z } \sim p _ { \pmb { \theta } } ( \mathbf { x } \mid \mathbf { z } )$ with $\mathbf { z } \sim p ( \mathbf { z } )$ . For efficient inference of $\mathbf { z }$ , the VAE (Kingma & Welling, 2014) introduces the concept of an inference network (recognition model or encoder), $q _ { \phi } ( \mathbf { z } \mid \mathbf { x } )$ , as a variational distribution in the VB framework. An inference network is typically a stochastic (nonlinear) mapping from the input $\mathbf { x }$ to the latent $\mathbf { z }$ , with associated parameters $\phi$ . For example, one of the simplest inference networks is defined as $\begin{array} { r } { q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) = \mathcal { N } ( \bar { \mathbf { z } } ; \mu _ { \phi } ( \mathbf { x } ) , \mathrm { d i a g } ( \sigma _ { \phi } ^ { 2 } ( \mathbf { x } ) ) ) } \end{array}$ , where the mean function $\mu _ { \phi } ( \mathbf { x } )$ and the standardderivation function $\sigma _ { \phi } ( \mathbf { x } )$ are specified via deep neural networks parameterized by $\phi$ . Parameters are learned by minimizing the evidence lower bound (ELBO), i.e., the KL divergence between $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$
|
| 28 |
+
|
| 29 |
+
and $q _ { \phi } ( \mathbf { z } \mid \mathbf { x } )$ $\mathbf { \cdot } ) \colon \mathrm { K L } \left( q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) \| p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \right) \triangleq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) } \left[ \log q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) - \log p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \right]$ , via stochastic gradient descent (Bottou, 2012).
|
| 30 |
+
|
| 31 |
+
One limitation of the VAE framework is that $q _ { \phi } ( \mathbf { z } \mid \mathbf { x } )$ is often restricted to simple distributions for feasibility, e.g., the normal distribution discussed above, and thus the gap between $q _ { \phi } ( \mathbf { z } \mid \mathbf { x } )$ and $p _ { \pmb { \theta } } ( \mathbf { z } | \mathbf { x } )$ is typically large for complicated posterior distributions. Normalizing flows is a recently proposed VB-based technique designed to mitigate this problem (Rezende & Mohamed, 2015). The idea is to augment $\mathbf { z }$ via a sequence of deterministic invertible transformations $\{ \mathcal { T } _ { k } : \mathbb { R } ^ { L } \to \mathbb { R } ^ { \dot { L } } \} _ { k = 1 } ^ { K }$ , such that: $\mathbf { z } _ { 0 } \sim q _ { \phi } ( \cdot | \mathbf { x } ) , \mathbf { z } _ { 1 } = \mathcal { T } _ { 1 } ( \mathbf { z } _ { 0 } ) , \cdot \cdot \cdot , \mathbf { z } _ { K } = \mathcal { T } _ { K } ( \mathbf { z } _ { K - 1 } )$ .
|
| 32 |
+
|
| 33 |
+
Note the transformations $\{ \mathcal { T } _ { k } \}$ are typically endowed with different parameters, and we absorb them into $\phi$ . Because the transformations are deterministic, the distribution of $\mathbf { z } _ { K }$ can be written as $\begin{array} { r } { q ( \mathbf { z } _ { K } ) = q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) \prod _ { k = 1 } ^ { K } \left| \operatorname* { d e t } \frac { \partial { \mathcal T } _ { k } } { \partial \mathbf { z } _ { k } } \right| ^ { - 1 } } \end{array}$ via the change of variable formula. As a result, the ELBO for normalizing flows becomes:
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
\begin{array} { l } { \displaystyle \mathrm { K L } \left( q _ { \phi } ( \mathbf { z } _ { K } \mid \mathbf { x } ) \| p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \right) = } \\ { \displaystyle \mathbb { E } _ { q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) } \left[ \log q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) \right] - \mathbb { E } _ { q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) } \left[ \log p _ { \theta } ( \mathbf { x } , \mathbf { z } _ { K } ) \right] - \mathbb { E } _ { q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) } \left[ \sum _ { k = 1 } ^ { K } \log \left| \mathrm { d e t } \frac { \partial T _ { k } } { \partial \mathbf { z } _ { k } } \right| \right] . } \end{array}
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
Typically, transformations $\mathcal { T } _ { k }$ of a simple parametric form are employed to make the computations tractable (Rezende & Mohamed, 2015). Our method for inference generalizes these discrete-time transformation to continuous-time transformations, ensuring convergence of the transformations to the target distribution.
|
| 40 |
+
|
| 41 |
+
Density estimation overview There exist implicit and explicit density-estimation methods. Implicit density models such as GAN provide a flexible way to draw samples directly from unknown data distributions (via a deep neural network (DNN) called a generator with stochastic inputs) without explicitly modeling their density forms; whereas explicit models such as the pixel RNN/CNN (van den Oord et al., 2016) define and learn explicit forms of the unknown data distributions. This gives the advantage that the likelihood for a test data point can be explicitly evaluated. However, the generation of samples is typically time-consuming due to the sequential generation nature.
|
| 42 |
+
|
| 43 |
+
Similar to Wang & Liu (2017), our CTF-based approach in Section 4 provides an alternative way for this problem, by simultaneously learning an explicit Gibbsian-style data distribution (estimated density) and a generator whose generated samples match the learned Gibbsian distribution. This not only gives us the advantage of explicit density modeling but also provides an efficient way to generate samples.
|
| 44 |
+
|
| 45 |
+
# 2.2 CONTINUOUS-TIME FLOWS
|
| 46 |
+
|
| 47 |
+
We notice two potential limitations with traditional normalizing flows: i) given specified transformations $\{ \mathcal { T } _ { k } \}$ , there is no guarantee that the distribution of $\mathbf { z } _ { K }$ could exactly match $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$ ; ii) the randomness is only introduced in $\mathbf { z } _ { 0 }$ (from the inference network), limiting the representation power. We specify CTFs where the transformations are indexed by real numbers, thus they could be considered as consisting of an infinite number of transformations. Further, we consider stochastic flows where randomness is injected in a continuous-time manner. In fact, the concept of CTFs (such as the Hamiltonian flow) has been introduced in Rezende & Mohamed (2015), without further development on efficient inference.
|
| 48 |
+
|
| 49 |
+
We consider a flow on $\mathbb { R } ^ { L }$ , defined as the mapping† $\mathcal { T } : \mathbb { R } ^ { L } \times \mathbb { R } \to \mathbb { R } ^ { L }$ such that‡ we have $\boldsymbol { \mathcal { T } } ( \mathbf { Z } , 0 ) = \mathbf { z }$ and $\mathcal { T } ( \mathcal { T } ( \mathbf { Z } , t ) , s ) = \mathcal { T } ( \mathbf { Z } , s + t )$ , for all $\mathbf { Z } \in \mathbb { R } ^ { L }$ and $s , t \in \mathbb { R }$ . A typical example of this family is defined as $\mathcal { T } ( \mathbf { Z } , t ) = \mathbf { Z } _ { t }$ , where $\mathbf { Z } _ { t }$ is driven by a diffusion of the form:
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\mathrm { d } \mathbf { Z } _ { t } = F ( \mathbf { Z } _ { t } ) \mathrm { d } t + V ( \mathbf { Z } _ { t } ) \mathrm { d } { \mathcal { W } } .
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
Here ${ \cal F } : \mathbb { R } ^ { L } \mathbb { R } ^ { L }$ , $V ~ : ~ \mathbb { R } ^ { L \times L } ~ \to ~ \mathbb { R } ^ { L }$ are called the drift term and diffusion term, respectively; $\mathcal { W }$ is the standard $L$ -dimensional Brownian motion. In the context of inference, we seek to make the stationary distribution of $\mathbf { Z } _ { t }$ approach $p _ { \pmb { \theta } } ( \mathbf { z } | \mathbf { x } )$ . One solution for this is to set $\begin{array} { r } { F ( \mathbf { Z } _ { t } ) = \frac { 1 } { 2 } \nabla _ { \mathbf { z } } \log p _ { \theta } ( \mathbf { x } , \mathbf { z } \stackrel { . } { = } \mathbf { Z } _ { t } ) } \end{array}$ and $V ( \mathbf { Z } _ { t } ) = \mathbf { I } _ { L }$ with $\mathbf { I } _ { L }$ the $L \times L$ identity matrix. The resulting diffusion is called Langevin dynamics Welling & Teh (2011). Denoting the distribution of $\mathbf { Z } _ { t }$ as $\rho _ { t }$ , it is well known Risken (1989) that $\rho _ { t }$ is characterized by the Fokker-Planck (FP) equation:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\frac { \partial \rho _ { t } } { \partial t } = - \nabla _ { \mathbf { z } } \cdot \left( \rho _ { t } F ( \mathbf { Z } _ { t } ) \right) + \nabla _ { \mathbf { z } } \nabla _ { \mathbf { z } } \colon \left( \rho _ { t } V ( \mathbf { Z } _ { t } ) V ^ { \top } ( \mathbf { Z } _ { t } ) \right) ~ ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
where $\mathbf { a } \cdot \mathbf { b } \triangleq \mathbf { a } ^ { \intercal } \mathbf { b }$ for vectors $\mathbf { a }$ and $\mathbf { b }$ , $\mathbf { A } : \mathbf { B } \triangleq \operatorname { t r a c e } ( \mathbf { A } ^ { \intercal } \mathbf { B } )$ for matrices $\mathbf { A }$ and $\mathbf { B }$
|
| 62 |
+
|
| 63 |
+
For simplicity, we consider the flow defined by the Langevin dynamics specified above, though our results generalize to other stochastic flows Dorogovtsev & Nishchenko (2014). In the following, we specify the ELBO under a CTF, which can then be readily solved by a discretized numerical scheme, based on the results from Jordan et al. (1998). An approximation error bound for the scheme is also derived. We defer proofs of our theoretical results to the Supplementary Material (SM) for conciseness.
|
| 64 |
+
|
| 65 |
+
# 3 CONTINUOUS-TIME FLOWS FOR INFERENCE
|
| 66 |
+
|
| 67 |
+
We first give an overview of our CTF-based method for efficient inference. We adopt the VAE/normalizing-flow framework with an encoder-decoder structure. An important difference is that instead of feeding data to an encoder and sampling a latent representation in the output as in VAE, we concatenate the data with independent noise as input and directly generate output samples§. These output samples are then driven by the CTF to approach the true posterior distribution. In the learning process, the implicit transformations from the CTF are sequentially distilled into the inference network by amortized learning, making the inference network flexible enough to represent the true posterior distribution. In the following subsections, we specify our framework in detail.
|
| 68 |
+
|
| 69 |
+
# 3.1 THE VARIATIONAL LOWER BOUND AND DISCRETIZED APPROXIMATION
|
| 70 |
+
|
| 71 |
+
We first incorporate CTF into the normalizing-flow framework by writing out the corresponding ELBO. Note that there are two steps in the inference process. First, an initial $\mathbf { z } _ { 0 }$ is drawn from the inference network $q _ { \phi } ( \cdot | { \bf x } )$ ; second, $\mathbf { z } _ { 0 }$ is evolved via a diffusion such as (2) for time $T$ (via the transformation ${ \bf Z } _ { T } = \mathcal { T } ( { \bf z } _ { 0 } , T ) )$ . Consequently, the ELBO for CTF can be written as
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathcal { F } ( \mathbf { x } ) = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) } \mathbb { E } _ { \rho _ { T } } \left[ \log \rho _ { T } - \log p _ { \theta } ( \mathbf { x } , \mathbf { Z } _ { T } ) + \log \left| \operatorname* { d e t } \frac { \partial \mathbf { Z } _ { T } } { \partial \mathbf { z } _ { 0 } } \right| \right] \triangleq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) } \left[ \mathcal { F } _ { 1 } ( \mathbf { x } , \mathbf { z } _ { 0 } ) \right] \ .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Note the term $\mathcal { F } _ { 1 } ( \mathbf { x } , \mathbf { z } _ { 0 } )$ is intractable to calculate, in that $i$ ) $\rho _ { T }$ does not have an explicit form; $i i$ ) the Jacobian $\frac { \partial \mathbf { Z } _ { T } } { \partial \mathbf { z } _ { 0 } }$ is generally infeasible. In the following, we propose an approximate solution for problem i). Learning by avoiding problem $\romannumeral 2$ ) is presented in Section 3.2 via amortization.
|
| 78 |
+
|
| 79 |
+
For problem $i$ ), a reformulation of the results from Jordan et al. (1998) leads to a nice way to approximate $\rho _ { t }$ in Lemma 1. Note in practice we adopt an implicit method which uses samples to approximate the solution in Lemma 1 for feasibility, detailed in (6).
|
| 80 |
+
|
| 81 |
+
Lemma 1. Assume that $\log p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } ) \leq C _ { 1 }$ is infinitely differentiable, and $\| \nabla _ { \mathbf { z } } \log p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } ) \| \leq$ $C _ { 2 } \left( 1 + C _ { 1 } - \log p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \right) ( \forall \mathbf { x } , \mathbf { z } )$ for some constants $\left\{ C _ { 1 } , C _ { 2 } \right\}$ . Let $T = h K$ ( $h$ is the stepsize in discretization and $K$ is the number of transformations), $\rho _ { 0 } \triangleq q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ , and $\{ \tilde { \rho } _ { k } \} _ { k = 1 } ^ { K }$ be the solution of the functional optimization problem:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\tilde { \rho } _ { k } = \arg \operatorname* { m i n } _ { \rho \in { \mathcal { K } } } K L \left( \rho \| p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \right) + \frac { 1 } { 2 h } W _ { 2 } ^ { 2 } \left( \tilde { \rho } _ { k - 1 } , \rho \right) ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $\begin{array} { r } { W _ { 2 } ^ { 2 } \left( \mu _ { 1 } , \mu _ { 2 } \right) \triangleq \operatorname* { i n f } _ { p \in \mathcal { P } ( \mu _ { 1 } , \mu _ { 2 } ) } \int \left\| \mathbf { x } - \mathbf { y } \right\| _ { 2 } ^ { 2 } p ( \mathrm { d } \mathbf { x } , \mathrm { d } \mathbf { y } ) , \mathrm { ~ } } \end{array}$ $W _ { 2 } \left( \mu _ { 1 } , \mu _ { 2 } \right)$ is the 2nd-order Wasserstein distance, with $\mathcal { P } ( \mu _ { 1 } , \mu _ { 2 } )$ being the space of joint distributions on $\{ \mu _ { 1 } , \mu _ { 2 } \}$ . $\kappa$ is the space of probability distributions with the finite 2nd-order moment. Then $\tilde { \rho } _ { K }$ converges to $\rho _ { T }$ in the limit of $h 0$ , i.e., $\mathrm { l i m } _ { h 0 } \tilde { \rho } _ { K } = \rho _ { T }$ , where $\rho _ { T }$ is the solution of the FP equation (3) at time $T$ .
|
| 88 |
+
|
| 89 |
+
Lemma 1 reveals an interesting way to compute $\rho _ { T }$ via a sequence of functional optimization problems. By comparing it with the objective of the traditional normalizing flow, which minimizes the KL-divergence between $\rho _ { K }$ and $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$ , at each sub-optimization-problem in Lemma 1, it minimizes the KL-divergence between $\tilde { \rho } _ { k }$ and $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$ , plus a regularization term as the Wasserstein distance between $\tilde { \rho } _ { k - 1 }$ and $\tilde { \rho } _ { k }$ . The extra Wasserstein-distance term arises naturally due to the fact that the Langevin diffusion can be explained as a gradient flow whose geometry is equipped with the Wasserstein distance (Otto, 1998). From another point of view, it is known that the Wasserstein distance is a better metric for probability distributions than the KL-divergence, especially in the case of non-overlapping domains (Arjovsky & Bottou, 2017; Arjovsky et al., 2017). By using the Wasserstein term as a regularizer, the CTF alleviates the issue in non-overlapping domains by introducing the Brownian-motion (noise) term in the evolution (2). This relates to the idea in (Arjovsky & Bottou, 2017), in which noise is added in parameter updates to alleviate the intrinsic drawback of the KL-divergence metric.
|
| 90 |
+
|
| 91 |
+
The optimization problem in Lemma 1 is difficult to deal with directly. In practice, we instead approximate the discretization in an equivalent way by simulation from the CTF. Starting from $\mathbf { z } _ { 0 }$ $\mathbf { z } _ { k }$ $( k = 0 , \cdots , K - 1 )$ is fed into a transformation $\mathcal { T } _ { k }$ (specified below), resulting in ${ \mathbf z } _ { k + 1 }$ whose distribution coincides with $\tilde { \rho } _ { k + 1 }$ in Lemma 1. The discretization procedure is illustrated in Figure 1. We must specify the transformations $\mathcal { T } _ { k }$ . For each $k$ , let $t = h k$ ; we can conclude from Lemma 1 that $\operatorname* { l i m } _ { h \to 0 } \tilde { \rho } _ { k } = \rho _ { t }$ . From FP theory, $\rho _ { t }$ is obtained by solving the diffusion (2) with initial condition ${ \bf Z } _ { 0 } = { \bf z } _ { 0 }$ . It is thus reasonable to specify the transformation $\mathcal { T } _ { k }$ as the $k$ -th step of a numerical integrator for (2). Specifically, we specify $\mathcal { T } _ { k }$ as a stochastic transformation:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
{ \bf z } _ { k } = { \mathcal T } _ { k } ( { \bf z } _ { k - 1 } ) \triangleq { \bf z } _ { k - 1 } + { \cal F } ( { \bf z } _ { k - 1 } ) h + V ( { \bf z } _ { k - 1 } ) \zeta _ { k } ,
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $\mathsf { \Sigma } \xi _ { k } \sim \mathcal { N } ( \mathbf { 0 } , h \mathbf { I } _ { L } )$ is drawn from an isotropic normal. Note the transformation defined here is stochastic, thus we only get samples from $\tilde { \rho } _ { K }$ at the end. A natural way to approximate $\tilde { \rho } _ { K }$ is to use the empirical sample distribution, i.e., $\begin{array} { r } { \tilde { \rho } _ { K } \approx \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \delta _ { { \bf z } _ { k } } \triangleq \bar { \rho } _ { T } } \end{array}$ with $\delta _ { \mathbf { z } }$ a point mass at $\mathbf { z }$ Afterwards, $\tilde { \rho } _ { K }$ (thus $\bar { \rho } _ { T }$ ) will be used to approximate the true $\rho _ { T }$ from (3).
|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
Figure 1: Discretized approximation (right) of a continuous-time flow (left). Densities $\{ \tilde { \rho } _ { k } \}$ of $\left\{ { \bf z } _ { k } \right\}$ evolve via transformations $\{ \mathcal { T } _ { k } \}$ , with $\tilde { \rho } _ { k } \to \rho _ { h k }$ when $h 0$ for each $k$ due to Lemma 1.
|
| 101 |
+
|
| 102 |
+
Note that we use the simple sample averaging for the convenience of analysis, and the approximation for $\rho _ { T }$ is not necessarily optimal. Better approximation can be obtained by assigning more weights to the more recent samples. However, this leads to more challenges in theoretical analysis, an interesting future direction to pursue. In the following, we study how well $\bar { \rho } _ { T }$ approximates $\rho _ { T }$ . Following literature on numerical approximation for Itô diffusions (Vollmer et al., 2016; Chen et al., 2015), we consider a 1-Lipschitz test function $\psi : \mathbb { R } ^ { L } \mathbb { R }$ , and use the mean square error (MSE) bound to measure the closeness of $\bar { \rho } _ { T }$ and $\rho _ { T }$ , defined as: $\begin{array} { r } { \mathbf { M S E } ( \bar { \rho } _ { T } , \rho _ { T } ; \psi ) \triangleq \mathbb { E } \left( \int \psi ( \mathbf { z } ) ( \tilde { \rho } _ { T } - \rho _ { T } ) ( \mathbf { z } ) \mathrm { d } \mathbf { z } \right) ^ { 2 } } \end{array}$ , where the expectation is taken over all the randomness in the construction of $\tilde { \rho } _ { T }$ . Note that our goal is related but different from the standard setup as in Vollmer et al. (2016); Chen et al. (2015), which studies the closeness of $\bar { \rho } _ { T }$ to $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$ . We need to adopt the assumptions from Vollmer et al. (2016); Chen et al. (2015), which are described in the Supplementary Material (SM). The assumptions are somewhat involved but essentially require coefficients of the diffusion (2) to be well-behaved. We derive the following bound for the MSE of the sampled approximation, $\bar { \rho } _ { T }$ , and the true distribution.
|
| 103 |
+
|
| 104 |
+
Theorem 2. Under Assumption $^ { l }$ in the SM, assume that $\begin{array} { r } { \int \rho _ { T } ( \mathbf { z } ) p _ { \pmb \theta } ^ { - 1 } ( \mathbf { x } , \mathbf { z } ) \mathrm { d } \mathbf { z } < \infty } \end{array}$ and there exists a constant C such tha t dW 22 (ρT ,pθ(x,z))dt ≥ CW 22 (ρT , pθ(x, z)), the MSE is bounded as
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
M S E ( \bar { \rho } _ { T } , \rho _ { T } ; \psi ) = O \left( \frac { 1 } { h K } + h ^ { 2 } + e ^ { - 2 C h K } \right) .
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
The last assumption in Theorem 2 requires $\rho _ { T }$ to evolve fast through the FP equation, which is a standard assumption used to establish convergence to equilibrium for FP equations (Bolley et al., 2012). The MSE bound consists of three terms, the first two terms come from numerical approximation of the continuous-time diffusion, whereas the third term comes from the convergence bound of the FP equation in terms of the Wasserstein distance (Bolley et al., 2012). When the time $T = h K$ is large enough, the third term may be ignored due to its exponential-decay rate. Moreover, in the infinite-time limit, the bound endows a bias proportional to $h$ ; this, however, can be removed by adopting a decreasing-step-size scheme in the numerical method, as in standard stochastic gradient MCMC methods (Teh et al., 2016; Chen et al., 2015).
|
| 111 |
+
|
| 112 |
+
Remark 3. To examine the optimal bound in Theorem 2, we drop out the term $e ^ { - 2 C h K }$ in the long-time case (when hK is large enough) for simplicity because it is in a much lower order term than the other terms. The optimal MSE bound (over h) decreases at a rate of $O \left( K ^ { - 2 / 3 } \right)$ , meaning that $O \left( \epsilon ^ { - 3 / 2 } \right)$ steps of transformations in Figure 1 (right) are needed to reach an $\epsilon$ -accurate approximation, i.e., $M S E \leq \epsilon .$ . This is computationally expensive. An efficient way for inference is thus imperative, developed in the next section.
|
| 113 |
+
|
| 114 |
+
# 3.2 EFFICIENT INFERENCE VIA AMORTIZATION
|
| 115 |
+
|
| 116 |
+
Even though we approximate $\rho _ { T }$ with $\bar { \rho } _ { T }$ , it is still infeasible to directly apply it to the ELBO in (4) as $\bar { \rho } _ { T }$ is discrete. To deal with this problem, we adopt the idea of “amortized learning” (Gershman $\&$ Goodman, 2014) for efficient inference. The main idea is to optimize the two sets of parameters $\phi$ and $\pmb { \theta }$ alternatively, based on different but related objective functions.
|
| 117 |
+
|
| 118 |
+
Updating $\phi$ To explain the idea, first note that the ELBO can be equivalently written as
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
\mathcal { F } ( \mathbf { x } ) = \mathbb { E } _ { \rho _ { 0 } \triangleq q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } ) } \mathbb { E } _ { \rho _ { T } } \left[ \log \rho _ { 0 } - \log p _ { \theta } ( \mathbf { x } , \mathbf { Z } _ { T } ) \right] .
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
When $\rho _ { 0 } = \rho _ { T }$ , it is easy to see that: $\begin{array} { r } { \mathcal { F } ( \mathbf { x } ) = \mathbb { E } _ { \rho _ { 0 } } \left[ \log \rho _ { 0 } - \log p _ { \theta } ( \mathbf { Z } _ { T } | \mathbf { x } ) \right] + \log p ( \mathbf { x } ) = \log p ( \mathbf { x } ) . } \end{array}$ which essentially makes the gap between $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ and $p _ { \pmb { \theta } } ( \mathbf { Z } _ { T } \mid \mathbf { x } )$ vanished. As a result, our goal is to learn $\phi$ such that $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ approaches $p _ { \pmb { \theta } } ( \mathbf { Z } _ { T } \mid \mathbf { x } )$ . As mentioned previously, we will learn an implicit distribution of $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ (i.e., learn how to draw samples from $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ instead of its explicit form), as it allows us to chose a candidate distribution from a much larger distribution space, compared to explicitly defining $q _ { \phi } ^ { \bullet }$ . Consequently, $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ is implemented by a stochastic generator (a DNN parameterized by $\phi$ ) $Q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } , \omega )$ with input as the concatenation of $\mathbf { x }$ and $\omega$ , where $\omega$ is a sample from an isotropic Gaussian distribution $q _ { 0 } ( \omega )$ . Our goal is now translated to update the parameter $\phi$ of $Q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } , \omega )$ to $\phi ^ { \prime }$ such that the distribution of $\{ \mathbf { z } _ { 0 } ^ { \prime } = Q _ { \phi ^ { \prime } } ( \mathbf { z } _ { 0 } ^ { \prime } \mid \mathbf { x } , \omega ) \}$ with $\omega \sim q _ { 0 } ( \omega )$ matches that of $\mathbf { z } _ { 1 }$ in the original generating process with $\phi$ in Figure 1. In this way, the generating process of $\mathbf { z } _ { 1 }$ via $\mathcal { T } _ { 1 }$ is distilled into the parameterized generator $Q _ { \phi } ( \cdot )$ , eliminating the need to do a specific transformation via $\mathcal { T } _ { 1 }$ in testing, and thus is very efficient. Specifically, we update $\phi ^ { \prime }$ such that
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\phi ^ { \prime } = \arg \operatorname* { m i n } _ { \phi } \mathcal { D } \left( \{ \mathbf { z } _ { 0 } ^ { \prime ( i ) } \} , \{ \mathbf { z } _ { 1 } ^ { ( i ) } \} \right) ,
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
where $\{ \mathbf { z } _ { 0 } ^ { \prime ( i ) } \} _ { i = 1 } ^ { S }$ are a set of samples generated from $q _ { \phi ^ { \prime } } ( \mathbf { z } _ { 0 } ^ { \prime } \mid \mathbf { x } )$ via $Q _ { \phi } ( \cdot )$ , and $\{ \mathbf { z } _ { 1 } ^ { ( i ) } \} _ { i = 1 } ^ { S }$ are samples drawn by $\omega ^ { i } \sim q _ { 0 } ( \omega ) , \tilde { \mathbf { z } } _ { 0 } ^ { i } = Q _ { \phi } ( \cdot | \mathbf { x } , \omega ^ { i } ) , \mathbf { z } _ { 1 } ^ { ( i ) } \sim \mathcal { T } _ { 1 } ( \tilde { \mathbf { z } } _ { 0 } ^ { i } ) ; \mathcal { D } ( \cdot , \cdot )$ is a metric between samples such as the simple Euclidean distance or the more advanced Wasserstein distance (Arjovsky et al., 2017). The optimization is done by applying standard stochastic gradient descent (SGD). We call this procedure distilling knowledge from $\mathcal { T } _ { 1 }$ to $Q _ { \phi } ( \cdot )$ .
|
| 131 |
+
|
| 132 |
+
After distilling knowledge from $\mathcal { T } _ { 1 }$ , we apply the same procedure for other transformations $\mathcal { T } _ { k } ( k > 1 )$ sequentially. The final inference network, represented by $q _ { \phi } ( \cdot | { \bf x } )$ , can then well approximate the continuous-time flows, e.g., the distribution of ${ \bf z } _ { 0 } \sim q _ { \phi } ( { \bf \cdot } | { \bf \dot { x } } )$ is close to $\rho _ { T }$ from the CTF. This concept is illustrated in Figure 2. According to Theorem 2, the number of updates for $\phi$ in training is still bounded by $O ( \epsilon ^ { - 3 / 2 } )$ for an $\epsilon$ -accurate MSE, however, inference in testing is significantly boosted since we do not need to simulate a long-time transformations as shown in Figure 1 (right).
|
| 133 |
+
|
| 134 |
+
Updating $\pmb { \theta }$ Given $\phi , \theta$ can be updated by simply optimizing the ELBO in (7), where $\rho _ { T }$ is approximated by $\bar { \rho } _ { T }$ from the discretized CTF. Specifically, the expectation w.r.t. $\rho _ { T }$ in (7) is approximated by a sample average from:
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\begin{array} { r } { { \bf z } _ { 0 } \sim q _ { \phi } ( { \bf z } _ { 0 } \mid { \bf x } ) , { \bf z } _ { 1 } \sim { \mathcal T } _ { 1 } ( { \bf z } _ { 0 } ) , { \bf z } _ { 2 } \sim { \mathcal T } _ { 2 } ( { \bf z } _ { 1 } ) , \cdots , { \bf z } _ { K } \sim { \mathcal T } _ { K } ( { \bf z } _ { K - 1 } ) . } \end{array}
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 2: Amortized learning of continuous-time flows for VAEs. From left to right: the initial architecture with $K$ -step transformations; For each step $k$ , $q _ { \phi } ( \cdot )$ is trained to match the distributin of $\mathbf { z } _ { k }$ in CTFs; In the end, the CTF is distilled into $q _ { \phi } ( \cdot )$ .
|
| 142 |
+
|
| 143 |
+
To sum up, there are three main steps in learning a CTF-based VAE:
|
| 144 |
+
|
| 145 |
+
1. Generate a sample path $\left( { \bf z } _ { 0 } , \cdots , { \bf z } _ { K } \right)$ according to $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ and the discretized flow with transformations $\{ \mathcal { T } _ { k } \}$ ;
|
| 146 |
+
2. Update $\phi$ according to (8);
|
| 147 |
+
3. Optimize $\pmb \theta$ by minimizing the ELBO (7) with the generated sample path.
|
| 148 |
+
|
| 149 |
+
In testing, we use only the finally learned $q _ { \phi } ( \mathbf { z } _ { 0 } \mid \mathbf { x } )$ for inference (into which the CTF has been distilled), and hence testing is like the standard VAE. Since the discretized-CTF model is essentially a Markov chain, we call our model Markov-chain-based VAE (MacVAE).
|
| 150 |
+
|
| 151 |
+
# 4 CONTINUOUS TIME FLOWS FOR EXPLICIT DENSITY ESTIMATION
|
| 152 |
+
|
| 153 |
+
We describe how to apply the proposed CTF framework to density estimation of the observed data. We assume that the density of the observation $\mathbf { x }$ is characterized by a parametric Gibbsian-style probability model $\begin{array} { r } { p _ { \pmb \theta } ( \mathbf x ) = \frac { 1 } { \mathcal Z ( \pmb \theta ) } \tilde { p } _ { \pmb \theta } ( \mathbf x ) \triangleq \frac { 1 } { \mathcal Z ( \pmb \theta ) } e ^ { U ( \mathbf x ; \pmb \theta ) } } \end{array}$ , where $\tilde { p } _ { \pmb { \theta } } ( \mathbf { x } )$ is an unnormalized version of $p _ { \pmb { \theta } } ( \mathbf { x } )$ with parameter $\pmb \theta$ , $U ( \mathbf { x } ; \pmb { \theta } ) \triangleq \log \tilde { p } \pmb { \theta } ( \mathbf { x } )$ is called the energy function (Zhao et al., 2017), and $\begin{array} { r } { \mathcal { Z } ( \pmb { \theta } ) \triangleq \int \tilde { p } _ { \pmb { \theta } } ( \mathbf { x } ) \mathrm { d } \mathbf { x } } \end{array}$ is the normalizer. Note this form of distributions constitutes a very large class of distributions as long as the capacity of the energy function is large enough. This can be easily achieved by adopting a DNN to implement $U ( \mathbf { x } ; \pmb { \theta } )$ , the setting we considered in this paper. Note our model can be placed in between existing implicit and explicit density estimation methods, because we model the data density with an explicit distribution form up to an intractable normalizer. Such distributions have been proved to be useful in real applications, e.g., Haarnoja et al. (2017) used them to model policies in deep reinforcement learning.
|
| 154 |
+
|
| 155 |
+
Our goal is to learn $\pmb { \theta }$ given observations $\{ { \mathbf { x } } _ { i } \} _ { i = 1 } ^ { N }$ , which can be achieved via the standard maximum likelihood estimator (MLE):
|
| 156 |
+
|
| 157 |
+
$$
|
| 158 |
+
\pmb \theta = \arg \operatorname* { m a x } _ { \pmb { \theta } } \sum _ { i = 1 } ^ { N } \log p _ { \pmb { \theta } } ( \mathbf { x } _ { i } ) \triangleq \arg \operatorname* { m a x } _ { \pmb { \theta } } \mathcal { M } ( \{ \mathbf { x } _ { i } \} ; \pmb { \theta } )
|
| 159 |
+
$$
|
| 160 |
+
|
| 161 |
+
This is usually optimized via SGD, with the following gradient formula:
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\frac { \partial \mathcal { M } ( \{ { \bf x } _ { i } \} ; \mathbf { \boldsymbol { \theta } } ) } { \partial \mathbf { \boldsymbol { \theta } } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \frac { \partial U ( { \bf x } _ { i } ; \mathbf { \boldsymbol { \theta } } ) } { \partial \mathbf { \boldsymbol { \theta } } } - \mathbb { E } _ { p _ { \boldsymbol { \theta } } ( \mathbf { x } ) } \left[ \frac { \partial U ( \mathbf { x } ; \mathbf { \boldsymbol { \theta } } ) } { \partial \mathbf { \boldsymbol { \theta } } } \right]
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
<table><tr><td>Igorithm1 CTFs for generative models at the k-th iteration. D(·,:)is the same as (8). Input: parameters from last step 0(k-1),Φ(k-1) Output: updated parameters 0(k),𝜙(k)</td></tr><tr><td>1. Generate samples {X1,s}𝑠=1 via a discretized CTF: x0,s ~ q(k-1)(x0), X1,s ~ T1(x0,s); S 2. Update the generator by minimizing ({xo,s}S=1 are generated with the updated parameter (k):</td></tr><tr><td>(k) = arg minD({x1,s},{x6,s}) .</td></tr><tr><td>? 3. Update the energy-based model 0k by maximum likelihood, with gradient as (9) except replacing Ex~pe(x) with Ex~q(x);</td></tr></table>
|
| 168 |
+
|
| 169 |
+
The gradient formula requires an integration over the model distribution $p _ { \pmb { \theta } } ( \mathbf { x } )$ , which can be approximated by Monte Carlo integration with samples. The sampling problem has been well studied for some particular energy-based distributions, for example, via contrastive divergence in restricted Boltzmann machines (Hinton, 2002). However, this does not fit into our setting directly. Here we adopt the idea of CTFs and propose to use a DNN guided by a CTF, which we call a generator, to generate approximate samples from the original model $p _ { \pmb { \theta } } ( \mathbf { x } )$ . Specifically, we require that samples from the generator should well approximate the target $p _ { \pmb { \theta } } ( \mathbf { x } )$ . This can be done by adopting the CTF idea above, i.e., distilling knowledge of a CTF (which approaches $p _ { \pmb { \theta } } ( \mathbf { x } ) )$ to the generator. In testing, instead of generating samples from $p _ { \pmb { \theta } } ( \mathbf { x } )$ via MCMC (which is complicated and time consuming), we generate samples from the generator directly. Furthermore, when evaluating the likelihood for test data, the unknown constant $\mathcal { Z } ( \pmb \theta )$ of $p _ { \pmb { \theta } } ( \mathbf { x } )$ can also be approximated by Monte Carlo integration with samples drawn from the generator.
|
| 170 |
+
|
| 171 |
+
On the right side of (9), the first term is a model fit to observed data, and the (negative) second term is a model fit to synthetic data drawn from $p _ { \pmb { \theta } ( \mathbf { x } ) }$ ; this is similar to the critic/discriminator in GANs (Arjovsky et al., 2017), but derived directly from the MLE. More connections are discussed below.
|
| 172 |
+
|
| 173 |
+
# 4.1 LEARNING VIA AMORTIZATION
|
| 174 |
+
|
| 175 |
+
Our goal is to learn a generator whose generated samples match those from the original model $p _ { \pmb { \theta } } ( \mathbf { x } )$ , by adopting the amortization idea with CTF in the inference section above. Similar to inference, the generator is learned implicitly. However, we also learn an explicit density model for the data by SGD, with samples from the implicit generator to estimate gradients in (9). Note that in this case, the CTF is performed directly on the data space, instead of on latentvariable space as in previous sections. Specifically, the sampling procedure from the generator plus a continuoustime-flow transformation are written as:
|
| 176 |
+
|
| 177 |
+
$$
|
| 178 |
+
\mathbf { x } _ { 0 } \sim q _ { \phi } ( \mathbf { x } _ { 0 } ) , \mathbf { x } _ { T } \sim { \mathcal { T } } ( \mathbf { x } _ { 0 } , T ) .
|
| 179 |
+
$$
|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
Figure 3: Learning a generator with CTF. The goal is to match the samples $\mathbf { x } _ { \mathrm { 0 } }$ from $q _ { \phi }$ to those after a CTF $\left( { { \bf { x } } _ { T } } \right)$ , or equivalently samples from $p _ { \pmb { \theta } }$ .
|
| 183 |
+
|
| 184 |
+
Here $\tau ( \cdot , \cdot )$ is the continuous-time flow; a sample $\mathbf { x } _ { \mathrm { 0 } }$ from $q _ { \phi } ( \cdot )$ is implemented by a deep neural network (generator) $G _ { \phi } ( \omega )$ with input $\omega \sim q _ { 0 } ( \omega )$ , where $q _ { 0 }$ is a simple distribution for a noise random variable, e.g., the standard isotropic normal distribution. The procedure is illustrated in Figure 3. Note the CTF cannot be replaced by standard normalizing flow (Rezende & Mohamed, 2015) in this model, because there is no objective function to guide the update of parameters in normalizing flows, which is not necessary for CTFs.
|
| 185 |
+
|
| 186 |
+
Specifically, denote the parameters in the $k$ -th step of our algorithm with subscript “ $( k ) ^ { \prime }$ . For efficient sample generation, in the $k$ -th step, we again adopt the amortization idea from Section 3.2 to update $\phi ^ { ( k ^ { - 1 ) } }$ of the generator network $G _ { \phi } ( \cdot )$ , such that samples from the updated generator match those from the current generator followed by a one-step transformation $\mathcal { T } _ { 1 } ( \cdot )$ . After that, $\pmb \theta$ is updated by drawing samples from $q _ { \phi } ( \cdot )$ to estimate the expectation in (9). The detailed algorithm is presented in Algorithm 1.
|
| 187 |
+
|
| 188 |
+
# 4.2 CONNECTIONS TO WASSERSTEIN GAN (WGAN) AND MLE
|
| 189 |
+
|
| 190 |
+
There is an interesting relation between our model and the WGAN framework (Arjovsky et al., 2017). To see this, let $p _ { r }$ be the data distribution. Substituting $p _ { \pmb { \theta } } ( \mathbf { x } )$ with $q _ { \phi } ( \mathbf { x } )$ for the expectation in the gradient formula (9) and integrating out $\pmb { \theta }$ , we have that our objective is
|
| 191 |
+
|
| 192 |
+
$$
|
| 193 |
+
\operatorname* { m a x } \mathbb { E } _ { \mathbf { x } \sim p _ { r } } \left[ U ( \mathbf { x } ; \pmb { \theta } ) \right] - \mathbb { E } _ { \mathbf { x } \sim q _ { \phi } } \left[ U ( \mathbf { x } ; \pmb { \theta } ) \right]
|
| 194 |
+
$$
|
| 195 |
+
|
| 196 |
+
The objective is an instance of the general integral probability metrics (Arjovsky & Bottou, 2017). When $U$ is chosen to be 1-Lipschitz functions, it recovers WGAN. This connection motivates us to introduce weight clipping (Arjovsky et al., 2017) or alternative regularizers (Gulrajani et al., 2017) when updating $\pmb \theta$ for a better theoretical property. For this reason, we call our model Markov-chainbased GAN (MacGAN).
|
| 197 |
+
|
| 198 |
+
Furthermore, it can be shown by Jensen’s inequality that the MLE is bounded by (detailed derivations are provided in Section C of the SM)
|
| 199 |
+
|
| 200 |
+
$$
|
| 201 |
+
\operatorname* { m a x } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log p _ { \theta } ( \mathbf { x } _ { i } ) \leq \operatorname* { m a x } \mathbb { E } _ { \mathbf { x } \sim p _ { r } } \left[ U ( \mathbf { x } ; \theta ) \right] - \mathbb { E } _ { \mathbf { x } \sim q _ { \phi } } \left[ U ( \mathbf { x } ; \theta ) \right] - \mathbb { E } _ { \mathbf { x } \sim q _ { \phi } } \left[ \log q _ { \phi } \right] .
|
| 202 |
+
$$
|
| 203 |
+
|
| 204 |
+
By inspecting (10) and (11), it is clear that: $i$ ) when learning the energy-based model parameters $\pmb \theta$ , the objective can be interpreted as maximizing an upper bound of the MLE shown in (11); $i i )$ ) when optimizing the parameter $\phi$ of the inference network, we adopt the amortized learning procedure presented in Algorithm 1, whose objective is $\operatorname* { m i n } _ { \phi } \operatorname { K L } \left( q _ { \phi } \| p _ { \theta } \right)$ , coinciding with the last two terms in (11). In other words, both $\pmb \theta$ and $\phi$ are optimized by maximizing the same upper bound of the MLE, guaranteeing convergence of the algorithm. Particularly, we can conclude that
|
| 205 |
+
|
| 206 |
+
Proposition 4. The optimal solution of MacGAN is the maximum likelihood estimator.
|
| 207 |
+
|
| 208 |
+
Note another difference between MacGAN and standard GAN framework is the way of learning the generator $q _ { \phi }$ . We adopt the amortization idea, which directly guides $q _ { \phi }$ to approach $p _ { \pmb { \theta } }$ ; whereas in GAN, the generator is optimized via a min-max procedure to make it approach the empirical data distribution $p _ { r }$ . By explicitly learning $p _ { \pmb { \theta } }$ , MacGAN is able to evaluate likelihood for test data (at least up to a constant).
|
| 209 |
+
|
| 210 |
+
# 5 RELATED WORK
|
| 211 |
+
|
| 212 |
+
Our framework extends the idea of normalizing flows (Rezende & Mohamed, 2015) to continuoustime flows, by developing theoretical properties on the convergence behavior. Inference based on CTFs has been studied in Salimans et al. (2015) based on the auxiliary-variable technique. However, Salimans et al. (2015) directly uses discrete approximations for the flow, and the approximation accuracy is unclear. Moreover, the inference network requires simulating a long Markov chain for the auxiliary model, thus is less efficient than ours. Finally, the inference network is implemented as a parametric distribution (e.g., the Gaussian distribution), limiting the representation power, a common setting in existing auxiliary-variable based models (Tran et al., 2016). The idea of amortization (Gershman & Goodman, 2014) has recently been explored in various research topics for Bayesian inference such as in variational inference (Kingma & Welling, 2014; Rezende et al., 2014) and Markov chain Monte Carlo (Wang & Liu, 2017; Li et al., 2017; Pu et al., 2017a). Both Wang & Liu (2017) and $\mathrm { P u }$ et al. (2017a) extend the idea of Stein variational gradient descent (Liu & Wang, 2016) with amortized inference for a GAN-based and a VAE-based model, respectively, which resemble our proposed MacVAE and MacGAN in concept. Li et al. (2017) applies amortization to distill knowledge from MCMC to learn a student network. The ideas in Li et al. (2017) are similar to ours, but the motivation and underlying theory are different from that developed here.
|
| 213 |
+
|
| 214 |
+
# 6 EXPERIMENTS
|
| 215 |
+
|
| 216 |
+
We conduct experiments to test our CTF-based framework for efficient inference and density estimation described above, and compared them with related methods. The implementation is based on the excellent code for SteinGANk Wang & Liu (2017), where we adopt their default parameter setting.
|
| 217 |
+
|
| 218 |
+

|
| 219 |
+
Figure 4: Knowledge distillation from the CTF (left) and ELBO versus epochs on MNIST (right). VAE with 80-layer NF is not included because it has much more parameters.
|
| 220 |
+
|
| 221 |
+
The discretization stepsize $h$ is robust as long as it is set in a reasonable range, e.g., we set it the same as the stepsize in SGD.
|
| 222 |
+
|
| 223 |
+
# 6.1 CTFS FOR INFERENCE
|
| 224 |
+
|
| 225 |
+
Synthetic experiment We examine our amortized learning framework with a toy experiment. Following Rezende & Mohamed (2015), we use MacVAE to approximate samples from a two dimensional distribution on $\mathbf { z } = \{ \mathbf { z } _ { 1 } , \mathbf { z } _ { 2 } \}$ : $p ( \mathbf { z } ) \propto e ^ { - U ( \mathbf { z } ) }$ with $\begin{array} { r } { U ( \mathbf { z } ) \triangleq \frac { 1 } { 2 } ( \frac { \Vert \mathbf { z } \Vert - 2 } { 0 . 4 } ) ^ { 2 } - \ln ( e ^ { - \frac { 1 } { 2 } [ \frac { \mathbf { z } _ { 1 } - 2 } { 0 . 6 } ] ^ { 2 } } + } \end{array}$ $e ^ { - \frac { 1 } { 2 } [ \frac { { \bf z } _ { 1 } + 2 } { 0 . 6 } ] ^ { 2 } } )$ . The inference network $q _ { \phi }$ is defined to be a 2-layer MLP with isotropic normal random variables as input. Figure 4 (top) plots the densities estimated with the samples from transformations $\{ \mathcal { T } _ { K = 1 0 0 } \}$ (before optimizing $\phi$ ), as well as with samples generated directly from $q _ { \phi }$ (after optimizing $\phi )$ ). It is clear that the amortized learning is able to distill knowledge from the CTF to the inference network.
|
| 226 |
+
|
| 227 |
+
MacVAE on MNIST Following Rezende & Mohamed (2015); Tomczak & Welling (2016), we define the inference network as a deep neural network with two fully connected layers of size 300 with softplus activation functions. We compare MacVAE with the standard VAE and the VAE with normalizing flow, where testing ELBOs are reported (Section D.1 of the SM describes how to calculate the ELBO). We do not compare with other state-of-the-art methods such as the inverse autoregressive flow (Kingma et al., 2016), because they typically endowed more complicated inference networks (with more parameters), unfair for comparison. We use the same inference network architecture for all the models. Figure 4 (bottom) plots the testing ELBO versus training epochs. MacVAE outperforms VAE and normalizing flows with a better ELBO (around -85.62).
|
| 228 |
+
|
| 229 |
+
# 6.2 CTFS FOR DENSITY ESTIMATION
|
| 230 |
+
|
| 231 |
+
We test MacGAN on three datasets: MNIST, CIFAR-10 and CelabA. Following GAN-related methods, the model is evaluated by observing its ability to draw samples from the learned data distribution. Inspiring by Wang $\&$ Liu (2017), we define a parametric form of the energy-based model as $p _ { \theta } ( \mathbf { x } ) \propto \mathrm { e x p } \{ - \| \mathbf { x } - \mathrm { D E C } _ { \theta } \left( \mathrm { E N C } _ { \theta } ( \mathbf { x } ) \right) \| ^ { 2 } \}$ , where $\operatorname { E N C } _ { \theta } ( \cdot )$ and $\operatorname { D E C } _ { \pmb { \theta } } ( \cdot )$ are encoder and decoder defined by using deep convolutional neural networks and deconvolutional neural networks, respectively, parameterized by $\pmb \theta$ . For simplicity, we adopt the popular DCGAN architecture (Radford et al., 2016) for the encoder and decoder. The generator $G _ { \phi }$ is defined as a 3-layer convolutional neural network with the ReLU activation function (except for the top layer which uses tanh as the activation function, see SM D for details). Following Wang & Liu (2017), the stepsizes are set to (me−e)×lrm 50 , where e indexes the epoch, me is the total number of epochs, lr = 1e-4 when updating θ, and $l _ { r } = 1 { \mathrm e } { - } 3$ when updating $\phi$ . The stepsize in $\mathcal { L } _ { 1 }$ is set to 1e-3.
|
| 232 |
+
|
| 233 |
+
We compare MacGAN with DCGAN (Radford et al., 2016), the improved WGAN (WGAN-I) (Gulrajani et al., 2017) and SteinGAN (Wang & Liu, 2017). We plot images generated with MacGAN and its most related method SteinGAN in Figure 5 for CelebA and CIFAR-10 datasets. More results are provided in SM Section D. We observe that visually MacGAN is able to generate clear-looking images. Following Wang & Liu (2017), we also plot the images generated by a random walk in the $\omega$ space in Figure 5.
|
| 234 |
+
|
| 235 |
+

|
| 236 |
+
Figure 5: Generated images for CIFAR-10 (top) and CelebA (middle) datasets with MacGAN (left) and SteinGAN (right). The bottom are images generated by a random walk on the $\omega$ space for the generator of MacGAN, i.e., $\omega _ { t } = \omega _ { t - 1 } + 0 . 0 3 \times \mathrm { r a n d } ( [ - 1 , 1 ] )$ .
|
| 237 |
+
|
| 238 |
+
Qualitatively evaluating a GAN-like model is challenging. We follow literature and use the inception score (Salimans et al., 2016) to measure the quantity of the generated images. Figure 6 plots inception scores versus training epochs for different models. MacGAN obtains competitive inception scores with the popular DCGAN model. Quantitatively, we get a final inception score of 6.49 for MacGAN, compared to 6.35 for SteinGAN, 6.25 for WGAN-I and 6.58 for DCGAN.
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 6: Inception score versus epochs for different models.
|
| 242 |
+
|
| 243 |
+
# 7 CONCLUSION
|
| 244 |
+
|
| 245 |
+
We study the problem of applying CTFs for efficient inference and explicit density estimation in deep generative models, two important tasks in unsupervised machine learning. Compared to discrete-time normalized flows, CTFs are more general and flexible due to the fact that their stationary distributions can be controlled without extra flow parameters. We develop theory on the approximation accuracy when adopting a CTF to approximate a target distribution. We apply CTFs on two classes of deep generative models, a variational autoencoder for efficient inference, and a GAN-like density estimator for explicit density estimation and efficient data generation. Experiments show encouraging results of our framework in both models compared to existing techniques. One interesting direction of future work is to explore more efficient learning algorithms for the proposed CTF-based framework.
|
| 246 |
+
|
| 247 |
+
# REFERENCES
|
| 248 |
+
|
| 249 |
+
M. Arjovsky and L. Bottou. Towards principled methods for training generative adversarial networks. In ICLR, 2017.
|
| 250 |
+
M. Arjovsky, S. Chintala, and L. Bottou. Wasserstein GAN. Technical Report arXiv:1701.07875, March 2017.
|
| 251 |
+
F. Bolley, I. Gentil, and A. Guillin. Convergence to equilibrium in wasserstein distance for fokker–planck equations. Journal of Functional Analysis, 263(8):2430–2457, 2012.
|
| 252 |
+
L. Bottou. Stochastic gradient descent tricks. Technical report, Microsoft Research, Redmond, WA, 2012.
|
| 253 |
+
C. Chen, N. Ding, and L. Carin. On the convergence of stochastic gradient MCMC algorithms with high-order integrators. In NIPS, 2015.
|
| 254 |
+
Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. ICLR, 2017.
|
| 255 |
+
A. A. Dorogovtsev and I. I. Nishchenko. An analysis of stochastic flows. Communications on Stochastic Analysis, 8(3):331–342, 2014.
|
| 256 |
+
Y. Feng, D. Wang, and Q. Liu. Learning to draw samples with amortized Stein variational gradient descent. In UAI, 2017.
|
| 257 |
+
S. J. Gershman and N. D. Goodman. Amortized inference in probabilistic reasoning. In Annual Conference of the Cognitive Science Society, 2014.
|
| 258 |
+
C. R. Givens and R. M. Shortt. A class of wasserstein metrics for probability distributions. Michigan Math. J., 31, 1984.
|
| 259 |
+
I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In NIPS, 2014.
|
| 260 |
+
A. Grover, M. Dhar, and S. Ermon. Flow-GAN: Bridging implicit and prescribed learning in generative models. Technical Report arXiv:1705.08868, 2017.
|
| 261 |
+
I. Gulrajani, F. Ahmed, M. Arjovsky, V. Dumoulin, and A. Courville. Improved training of Wasserstein GAN. Technical Report arXiv:1704.00028, March 2017.
|
| 262 |
+
T. Haarnoja, H. Tang, P. Abbeel, and S. Levine. Reinforcement learning with deep energy-based policies. In ICML, 2017.
|
| 263 |
+
G. E. Hinton. Training products of experts by minimizing contrastive divergence. Neural Computation, 14(8):1771–1800, 2002.
|
| 264 |
+
F. Huszár. Variational inference using implicit distributions. Technical Report arXiv:1702.08235, 2017.
|
| 265 |
+
R. Jordan, D. Kinderlehrer, and F. Otto. The variational formulation of the Fokker-Planck equation. SIAM J. MATH. ANAL., 29(1):1–17, 1998.
|
| 266 |
+
D. Kingma, T. P. Salimans, and M. Welling. Improving variational inference with inverse autoregressive flow. In NIPS, 2016.
|
| 267 |
+
D. P. Kingma and M. Welling. Auto-encoding variational Bayes. In ICLR, 2014.
|
| 268 |
+
Y. Li, R. E. Turner, and Q. Liu. Approximate inference with amortised MCMC. Technical Report arXiv:1702.08343, 2017.
|
| 269 |
+
Q. Liu and D. Wang. Stein variational gradient descent: A general purpose Bayesian inference algorithm. In NIPS, 2016.
|
| 270 |
+
J. C. Mattingly, A. M. Stuart, and M. V. Tretyakov. Construction of numerical time-average and stationary measures via Poisson equations. SIAM Journal on Numerical Analysis, 48(2):552–577, 2010.
|
| 271 |
+
S. Mohamed and B. Lakshminarayanan. Learning in implicit generative models. Technical Report arXiv:1610.03483, 2017.
|
| 272 |
+
F. Otto. Dynamics of Labyrinthine pattern formation in magnetic fluids: A mean-field theory. Arch. Rational Mech. Anal., pp. 63–103, 1998.
|
| 273 |
+
Y. Pu, Z. Gan, R. Henao, C. Li, S. Han, and L. Carin. Stein variational autoencoder. Technical Report arXiv:1704.05155, 2017a.
|
| 274 |
+
Y. Pu, Z. Gan, R. Henao, C. Li, S. Han, and L. Carin. Vae learning via stein variational gradient descent. In NIPS, 2017b.
|
| 275 |
+
A. Radford, L. Metz, and S. Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. Technical Report arXiv:1511.06434, January 2016.
|
| 276 |
+
R. Ranganath, J. Altosaar, D. Tran, and D. M. Blei. Operator variational inference. In NIPS, 2016.
|
| 277 |
+
D. J. Rezende and S. Mohamed. Variational inference with normalizing flows. In ICML, 2015.
|
| 278 |
+
D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
|
| 279 |
+
H. Risken. The Fokker-Planck equation. Springer-Verlag, New York, 1989.
|
| 280 |
+
T. Salimans, D. P. Kingma, and M. Welling. Markov chain Monte Carlo and variational inference: Bridging the gap. In ICML, 2015.
|
| 281 |
+
T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen. Improved techniques for training GANs. Technical Report arXiv:1606.03498, June 2016.
|
| 282 |
+
Y. W. Teh, A. H. Thiery, and S. J. Vollmer. Consistency and fluctuations for stochastic gradient Langevin dynamics. JMLR, 17(1):193–225, 2016.
|
| 283 |
+
J. M. Tomczak and M. Welling. Improving variational auto-encoders using Householder flow. Technical Report arXiv:1611.09630, November 2016.
|
| 284 |
+
D. Tran, R. Ranganath, and D. M. Blei. The variational gaussian process. In ICLR, 2016.
|
| 285 |
+
A. van den Oord, N. Kalchbrenner, and K. Kavukcuoglu. Pixel recurrent neural networks. In ICML, 2016.
|
| 286 |
+
S. J. Vollmer, K. C. Zygalakis, and Y. W. Teh. (exploration of the (Non-)asymptotic bias and variance of stochastic gradient Langevin dynamics. JMLR, 1:1–48, 2016.
|
| 287 |
+
D. Wang and Q. Liu. Learning to draw samples: With application to amortized MLE for generative adversarial learning. In ICLR workshop, 2017.
|
| 288 |
+
M. Welling and Y. W. Teh. Bayesian learning via stochastic gradient Langevin dynamics. In ICML, 2011.
|
| 289 |
+
J. Zhao, M. Mathieu, and Y. LeCun. Energy-based generative adversarial networks. In ICLR, 2017.
|
| 290 |
+
|
| 291 |
+
# SUPPLEMENTARY MATERIAL FOR: CONTINUOUS-TIME FLOWS FOR EFFICIENT INFERENCE AND DENSITY ESTIMATION
|
| 292 |
+
|
| 293 |
+
# A ASSUMPTIONS OF THEOREM 2
|
| 294 |
+
|
| 295 |
+
First, let us define the infinitesimal generator of the diffusion (2). Formally, the generator $\mathcal { L }$ of the diffusion (2) is defined for any compactly supported twice differentiable function $\breve { f } : \mathbf { R } ^ { L } \mathbf { R }$ , such that,
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
\mathcal { L } f ( \mathbf { Z } _ { t } ) \triangleq \operatorname* { l i m } _ { h 0 ^ { + } } \frac { \mathbb { E } [ f ( \mathbf { Z } _ { t + h } ) ] - f ( \mathbf { Z } _ { t } ) } { h } = ( F ( \mathbf { Z } _ { t } ) \cdot \nabla + \frac { 1 } { 2 } ( G ( \mathbf { Z } _ { t } ) G ( \mathbf { Z } _ { t } ) ^ { T } ) \colon \nabla \nabla ^ { T } ) f ( \mathbf { Z } _ { t } ) ,
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
where ${ \mathbf { a } } \cdot { \mathbf { b } } \triangleq { \mathbf { a } } ^ { T }$ b, $\mathbf { A } : \mathbf { B } \triangleq { \mathrm { t r } } ( \mathbf { A } ^ { T } \mathbf { B } )$ , $h \to 0 ^ { + }$ means $h$ approaches zero along the positive real axis.
|
| 302 |
+
|
| 303 |
+
Given an ergodic diffusion (2) with an invariant measure $\rho ( \mathbf { Z } )$ , the posterior average is defined as: $\begin{array} { r } { \bar { \psi } \triangleq \int \psi ( \mathbf { Z } ) \rho ( \mathbf { Z } ) \mathrm { d } \mathbf { Z } } \end{array}$ for some test function $\psi ( \mathbf { Z } )$ of interest. For a given numerical method with generated samples $( \mathbf { z } _ { k } ) _ { k = 1 } ^ { K }$ , we use the sample average $\hat { \psi }$ defined as $\begin{array} { r } { \hat { \psi } _ { K } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \psi ( \mathbf { z } _ { k } ) } \end{array}$ to approximate $\bar { \psi }$ . We define a functional $\tilde { \psi }$ that solves the following Poisson Equation:
|
| 304 |
+
|
| 305 |
+
$$
|
| 306 |
+
\mathcal { L } \tilde { \psi } ( \mathbf { z } _ { k } ) = \psi ( \mathbf { z } _ { k } ) - \bar { \psi }
|
| 307 |
+
$$
|
| 308 |
+
|
| 309 |
+
We make the following assumptions on $\tilde { \psi }$
|
| 310 |
+
|
| 311 |
+
Assumption 1. $\tilde { \psi }$ exists, and its up to 4rd-order derivatives, $\mathcal { D } ^ { k } \tilde { \psi }$ , are bounded by a function $\nu$ , i.e., $\lVert \mathcal { D } ^ { k } \tilde { \psi } \rVert \leq C _ { k } \mathcal { V } ^ { p _ { k } }$ for $k = ( 0 , 1 , 2 , 3 , 4 )$ , $C _ { k } , p _ { k } > 0$ . Furthermore, the expectation of $\nu$ on $\left\{ { \bf z } _ { k } \right\}$ is bounded: $\mathrm { s u p } _ { l } \mathbb { E } \mathcal { V } ^ { p } ( { \mathbf { z } } _ { k } ) < \infty$ , and $\nu$ is smooth such that $\begin{array} { r } { \operatorname* { s u p } _ { s \in ( 0 , 1 ) } \mathcal { V } ^ { p } \left( s \mathbf { z } + \left( 1 - s \right) \mathbf { y } \right) \leq } \end{array}$ $C \left( \mathcal { V } ^ { p } \left( \mathbf { z } \right) + \mathcal { V } ^ { p } \left( \mathbf { y } \right) \right)$ , $\forall \mathbf { z } , \mathbf { y } , p \leq \operatorname* { m a x } \{ 2 p _ { k } \}$ for some $C > 0$ .
|
| 312 |
+
|
| 313 |
+
# B PROOFS FOR SECTION 3
|
| 314 |
+
|
| 315 |
+
Sketch Proof of Lemma $^ { l }$ . First note that (5) in Lemma 1 corresponds to eq.13 in Jordan et al. (1998), where $F ( p )$ in Jordan et al. (1998) is in the form of $\mathrm { K L } ( \rho \| p _ { \pm } ( \bar { \bf x } , { \bf z } ) )$ in our setting.
|
| 316 |
+
|
| 317 |
+
Proposition 4.1 in Jordan et al. (1998) then proves that (5) has a unique solution. Theorem 5.1 in Jordan et al. (1998) then guarantees that the solution of (5) approach the solution of the Fokker-Planck equation in (3), which is $\rho _ { T }$ in the limit of $h 0$ .
|
| 318 |
+
|
| 319 |
+
Since this is true for each $k$ (thus each $t$ in $\rho _ { t }$ ), we conclude that $\tilde { \rho } _ { k } = \rho _ { h k }$ in the limit of $h 0$ .
|
| 320 |
+
|
| 321 |
+
To prove Theorem 2, we first need a convergence result about convergence to equilibrium in Wasserstein distance for Fokker-Planck equations, which is presented in Bolley et al. (2012). Putting in our setting, we can get the following lemma based on Corollary 2.4 in Bolley et al. (2012).
|
| 322 |
+
|
| 323 |
+
Lemma 5 (Bolley et al. (2012)). Let $\rho _ { T }$ be the solution of the $F P$ equation (3) at time $T$ , $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$ be the joint posterior distribution given x. Assume that $\begin{array} { r } { \int \rho _ { T } ( \mathbf { z } ) p _ { \pmb \theta } ^ { - 1 } ( \mathbf { x } , \mathbf { z } ) \mathrm { d } \mathbf { z } < \infty } \end{array}$ and there exists $a$ constant $C$ such tha t dW 22 (ρT ,pθ(x,z)) ≥ CW 22 (ρT , pθ(x, z)). Then
|
| 324 |
+
|
| 325 |
+
$$
|
| 326 |
+
W _ { 2 } \left( \rho _ { T } , p ( { \bf x } , { \bf z } ) \right) \leq W _ { 2 } \left( \rho _ { 0 } , p ( { \bf x } , { \bf z } ) \right) e ^ { - C T } .
|
| 327 |
+
$$
|
| 328 |
+
|
| 329 |
+
We further need to borrow convergence results from Mattingly et al. (2010); Vollmer et al. (2016); Chen et al. (2015) to characterize error bounds of a numerical integrator for the diffusion (2). Specifically, the goal is to evaluate the posterior average of a test function $\psi ( \mathbf { z } )$ , defined as $\bar { \psi }$ , $\begin{array} { r } { \int \psi ( \mathbf { z } ) p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \mathrm { d } \mathbf { z } } \end{array}$ . When using a numerical integrator to solve (2) to get samples $\{ \mathbf { z } _ { k } \} _ { k = 1 } ^ { K }$ , the sample average $\begin{array} { r } { \hat { \psi } _ { K } \triangleq \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \psi ( \mathbf { z } _ { k } ) } \end{array}$ k=1 is used to approximate the posterior average. The accuracy is characterized by the mean square error (MSE) defined as: $\mathbb { E } \left( \hat { \psi } _ { K } - \bar { \psi } \right) ^ { 2 }$ . Lemma 6 derives the bound for the MSE.
|
| 330 |
+
|
| 331 |
+
Lemma 6 (Vollmer et al. (2016)). Under Assumption $^ { l }$ , and for a 1st-order numerical intergrator, the MSE is bounded, for a constant $C$ independent of $h$ and $K$ , by
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
\mathbb { E } \left( \hat { \psi } _ { K } - \bar { \psi } \right) ^ { 2 } \leq C \left( \frac { 1 } { h K } + h ^ { 2 } \right) ~ .
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
Furthermore, except for the 2nd-order Wasserstein distance defined in Lemma 1, we define the 1st-order Wasserstein distance between two probability measures $\mu _ { 1 }$ and $\mu _ { 2 }$ as
|
| 338 |
+
|
| 339 |
+
$$
|
| 340 |
+
W _ { 1 } \left( \mu _ { 1 } , \mu _ { 2 } \right) \triangleq \operatorname* { i n f } _ { p \in { \mathscr P } \left( \mu _ { 1 } , \mu _ { 2 } \right) } \int \| { \mathbf x } - { \mathbf y } \| _ { 2 } p ( \mathrm { d } { \mathbf x } , \mathrm { d } { \mathbf y } ) .
|
| 341 |
+
$$
|
| 342 |
+
|
| 343 |
+
According to the Kantorovich-Rubinstein duality Arjovsky et al. (2017), $W _ { 1 } ( \mu _ { 1 } , \mu _ { 2 } )$ is equivalently represented as
|
| 344 |
+
|
| 345 |
+
$$
|
| 346 |
+
W _ { 1 } \left( \mu _ { 1 } , \mu _ { 2 } \right) = \underset { f \in \mathcal { L } _ { 1 } } { \operatorname* { s u p } } \ \mathbb { E } _ { \mathbf { z } \sim \mu _ { 1 } } \left[ f ( \mathbf { z } ) \right] - \mathbb { E } _ { \mathbf { z } \sim \mu _ { 2 } } \left[ f ( \mathbf { z } ) \right] \ ,
|
| 347 |
+
$$
|
| 348 |
+
|
| 349 |
+
where $\mathcal { L } _ { 1 }$ is the space of 1-Lipschitz functions $f : \mathbb { R } ^ { L } \mathbb { R }$ .
|
| 350 |
+
|
| 351 |
+
We have the following relation between $W _ { 1 } ( \mu _ { 1 } , \mu _ { 2 } )$ and $W _ { 2 } ( \mu _ { 1 } , \mu _ { 2 } )$ .
|
| 352 |
+
|
| 353 |
+
Lemma 7 (Givens & Shortt (1984)). We have for any two distributions $\mu _ { 1 }$ and $\mu _ { 2 }$ that $W _ { 1 } ( \mu _ { 1 } , \mu _ { 2 } ) \leq$ $W _ { 2 } ( \mu _ { 1 } , \mu _ { 2 } )$ .
|
| 354 |
+
|
| 355 |
+
Now it is ready to prove Theorem 2.
|
| 356 |
+
|
| 357 |
+
Proof of Theorem 2. The idea is to simply decompose the MSE into two parts, with one part charactering the MSE of the numerical method, the other part charactering the MSE of $\rho _ { T }$ and $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } )$ , which consequentially can be bounded using Lemma 5 above.
|
| 358 |
+
|
| 359 |
+
Specifically, we have
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
\begin{array} { r l } & { \quad \mathrm { M S E ~ } \left( \left( \frac { 1 } { N } , \frac { 1 } { N } , \rho _ { t } , \eta _ { t } , \phi , z ( \phi ) \right) + \mathbb { E } \left( \int \sqrt { \phi } \eta \mathrm { d } \rho z \mathrm { d } \rho z \mathrm { d } \rho z \right) \right) ^ { - 1 } } \\ & { = \mathbb { E } \left( \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \sqrt { \alpha _ { i } ( z ) } \exp \left( \int \phi ( \mathrm { d } \rho z ) \mathrm { d } z \mathrm { d } z \right) \right) ^ { - 1 } } \\ & { \quad \times \mathbb { E } \left( \left( \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \sqrt { \alpha _ { i } ( z ) } - \int \psi ( \mathrm { d } \rho \eta ) \mathrm { d } \rho z \mathrm { d } \rho z \right) \right) ^ { - 1 } \left( \int \sqrt { \phi } \eta \mathrm { d } \rho z \mathrm { d } \rho z \mathrm { d } \rho z \mathrm { d } \rho z \mathrm { d } \rho z \right) ^ { - 1 } \int \mathrm { d } \rho \mathrm { d } \rho \mathrm { d } \rho \mathrm { d } \rho z \mathrm { d } \rho z \mathrm { d } \mathrm { d } \rho z \mathrm { d } \mathrm { d } \rho z \right) ^ { - 1 } } \\ & { \quad \times \mathbb { E } \left( \left( \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \sqrt { \alpha _ { i } ( z ) } - \int \psi ( \mathrm { d } \rho z ) \mathrm { d } \rho z \mathrm { d } z \mathrm { d } \mathrm { d } \rho z \right) ^ { 2 } \right) ^ { - 1 } \left( \int \sqrt { \phi } \eta \mathrm { d } \rho z \mathrm { d } z \mathrm { d } \rho z \mathrm { d } \mathrm { d } \rho z \right) ^ { - 1 } \int \psi \mathrm { d } \eta \mathrm { d } \rho \mathrm { d } \rho \mathrm { d } \rho z \mathrm { d } \mathrm { d } \mathrm { d } \rho z \mathrm { d } \mathrm { d } \mathrm { d } \mathrm { \rho } \mathrm { \rho } \Bigg ) ^ { - 1 } } \\ & { \quad \times \mathbb { E } \left( \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \exp \left( - \int \psi ( \mathrm { d } \rho z ) \mathrm { d } \rho z \mathrm { d } \rho z \right) \right) ^ { - 1 } + \mathbb { E } \left( \int \eta \mathrm { d } \rho z \mathrm { d } \rho z \mathrm { d } \mathrm { d } \rho z \right) } \\ & \quad \times \mathbb { E } \left( \frac { 1 } \end{array}
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
where “(1)” follows by the fact that $\begin{array} { r } { \mathbb { E } \left( \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \psi ( \mathbf { z } _ { k } ) - \int \psi ( \mathbf { z } ) p _ { \theta } ( \mathbf { x } , \mathbf { z } ) \mathrm { d } \mathbf { z } \right) = 0 } \end{array}$ Chen et al. (2015); “(2)” follows by the definition of $W _ { 1 } ( \mu _ { 1 } , \mu _ { 2 } )$ in (14) and the 1-Lipschitz assumption of the test function $\psi$ ; “(3)” follows by Lemma 7; “(4)” follows by Lemma 5 and Lemma 6. □
|
| 366 |
+
|
| 367 |
+
# C CONNECTION TO WGAN
|
| 368 |
+
|
| 369 |
+
We derive the upper bound of the maximum likelihood estimator, which connects MacGAN to WGAN. Let $p _ { r }$ be the data distribution, rewrite our maximum likelihood objective as
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
\operatorname* { m a x } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log p _ { \theta } ( \mathbf { x } _ { i } ) = \operatorname* { m a x } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \bigg ( U ( \mathbf { x } _ { i } ; \theta ) - \log \int e ^ { U ( \mathbf { x } ; \theta ) } \mathrm { d } \mathbf { x } \bigg ) \enspace .
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
The above maximum likelihood estimator can be bounded with Jensen’s inequality as:
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\begin{array} { r l } & { \displaystyle \operatorname* { m a x } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log p _ { \theta } ( \mathbf { x } _ { i } ) \leq \operatorname* { m a x } \mathbb { E } _ { \mathbf { x } \sim p _ { r } } \left[ U ( \mathbf { x } ; \theta ) \right] - \log \int \frac { e ^ { U ( \mathbf { x } ; \theta ) } } { q _ { \phi } ( \mathbf { x } ; \omega ) } q _ { \phi } ( \mathbf { x } ; \omega ) \mathrm { d } \mathbf { x } } \\ & { \displaystyle \leq \operatorname* { m a x } \mathbb { E } _ { \mathbf { x } \sim p _ { r } } \left[ U ( \mathbf { x } ; \theta ) \right] - \mathbb { E } _ { \mathbf { x } \sim q _ { \phi } ( \mathbf { x } ; \omega ) } \left[ \log \frac { e ^ { U ( \mathbf { x } ; \theta ) } } { q _ { \phi } ( \mathbf { x } ; \omega ) } \right] } \\ & { \displaystyle = \operatorname* { m a x } \mathbb { E } _ { \mathbf { x } \sim p _ { r } } \left[ U ( \mathbf { x } ; \theta ) \right] - \mathbb { E } _ { \mathbf { x } \sim q _ { \phi } ( \mathbf { x } ; \omega ) } \left[ U ( \mathbf { x } ; \theta ) \right] - \mathbb { E } _ { \mathbf { x } \sim q _ { \phi } ( \mathbf { x } ; \omega ) } \left[ \log q _ { \phi } ( \mathbf { x } ; \omega ) \right] . } \end{array}
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
This results in the same objective form as WGAN except that our model does not restrict $U ( \mathbf { x } ; \pmb { \theta } )$ to be 1-Lipschitz functions and the objective has an extra constant term $\mathbb { E } _ { \mathbf { x } \sim q _ { \phi } ( \mathbf { x } ; \omega ) } \left[ \log q _ { \phi } ( \mathbf { x } ; \omega ) \right]$ w.r.t. $\pmb \theta$ .
|
| 382 |
+
|
| 383 |
+
Now we prove Proposition 4.
|
| 384 |
+
|
| 385 |
+
Proof of Proposition 4. First it is clear that the equality in (16) is achieved if and only if
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
q _ { \phi } ( \mathbf { x } ; \omega ) = p _ { \theta } ( \mathbf { x } ) \propto e ^ { U ( \mathbf { x } ; \theta ) } .
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
From the description in Section 4 and (16), we know that $\pmb { \theta }$ and $\phi$ share the same objective function, which is an upper bound of the MLE in (16).
|
| 392 |
+
|
| 393 |
+
Furthermore, based on the property of continuous-time flows (or formally Theorem 2), we know that $q _ { \phi }$ is learned such that $q _ { \phi } p _ { \theta }$ in the limit of $h 0$ (or alternatively, we could achieve this by using a decreasing-step-size sequence in a numerical method, as proved in Chen et al. (2015)). When $q _ { \phi } = p _ { \theta }$ , the equality in (16) is achieved, leading to the MLE. □
|
| 394 |
+
|
| 395 |
+
# D ADDITIONAL EXPERIMENTS
|
| 396 |
+
|
| 397 |
+
# D.1 CALCULATING THE TESTING ELBO FOR MACVAE
|
| 398 |
+
|
| 399 |
+
We follow the method in $\mathrm { P u }$ et al. (2017a) for calculating the ELBO for a test data $\mathbf { x } _ { * }$ . First, after distilling the CTF into the inference network $q _ { \phi }$ , we have that the ELBO can be represented as
|
| 400 |
+
|
| 401 |
+
$$
|
| 402 |
+
\begin{array} { r } { \log p ( \mathbf { x } _ { * } ) \geq \mathbb { E } _ { q _ { \phi } } \left[ \log p _ { \theta } ( \mathbf { x } _ { * } , \mathbf { z } _ { * } ) \right] - \mathbb { E } _ { q _ { \phi } } \left[ \log q _ { \phi } \right] . } \end{array}
|
| 403 |
+
$$
|
| 404 |
+
|
| 405 |
+
The expectation is approximated with samples $\{ \mathbf { z } _ { * j } \} _ { j = 1 } ^ { M }$ with $\mathbf { z } _ { \ast j } = f _ { \phi } ( \mathbf { x } _ { \ast } , \zeta _ { j } )$ , and $\zeta _ { j } \sim q _ { 0 } ( \zeta )$ the standard isotropic normal. Here $f _ { \phi }$ represents the deep neural network in the inference network. Note $q _ { \phi } ( \mathbf { z } _ { * } )$ is not readily obtained. To evaluate it, we use the density transformation formula: $\begin{array} { r } { q _ { \phi } \mathopen { } \mathclose \bgroup \left( \mathbf { z } _ { * } \aftergroup \egroup \right) \stackrel { } { = } q _ { 0 } \mathopen { } \mathclose \bgroup \left( \zeta \aftergroup \egroup \right) \mathopen { } \mathclose \bgroup \left| \mathrm { d e t } \frac { \partial f _ { \phi } \mathopen { } \mathclose \bgroup \left( \mathbf { x } _ { * } , \zeta \aftergroup \egroup \right) } { \partial \zeta } \aftergroup \egroup \right| ^ { - 1 } . } \end{array}$
|
| 406 |
+
|
| 407 |
+
# D.2 NETWORK ARCHITECTURE
|
| 408 |
+
|
| 409 |
+
The architecture of the generator of MacGAN is given in Table 1.
|
| 410 |
+
|
| 411 |
+
Table 1: Architecture of generator in MacGAN
|
| 412 |
+
|
| 413 |
+
<table><tr><td>Output Size</td><td>Architecture</td></tr><tr><td>100×1</td><td>100 ×10Linear,BN,ReLU</td></tr><tr><td>256×8×8</td><td>512 × 4 × 4 deconv,256 5 × 5 kernels,ReLU, strike 2, BN</td></tr><tr><td>128 ×16 ×16</td><td>256 × 8 × 8 deconv,128 5 × 5 kernels,ReLU, strike 2,BN</td></tr><tr><td>3× 32 × 32</td><td>128 × 16 × 16 deconv,3 5 × 5 kernels,Tanh,strike 2</td></tr></table>
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
Figure 7: Generated images for MNIST datasets with MacGAN (top) and SteinGAN (bottom).
|
| 417 |
+
|
| 418 |
+
# D.3 ADDITIONAL RESULTS
|
| 419 |
+
|
| 420 |
+
Additional experimental results are given in Figure 7 – 12.
|
| 421 |
+
|
| 422 |
+
# D.4 ROBUSTNESS OF THE DISCRETIZATION STEPSIZE
|
| 423 |
+
|
| 424 |
+
To test the impact of the discretization stepsize $h$ in (6), following SteinGAN Feng et al. (2017), we test MacGAN on the MNIST dataset, where ee use a simple Gaussian-Bernoulli Restricted Boltzmann Machines as the energy-based model. We adopt the annealed importance sampling method to evaluate
|
| 425 |
+
|
| 426 |
+

|
| 427 |
+
Figure 8: Generated images for CelebA datasets with MacGAN.
|
| 428 |
+
|
| 429 |
+
log-likelihoods Feng et al. (2017). We vary $h$ in $\{ 6 e - 4 , 2 . 4 e - 3 , 3 . 6 e - 3 , 6 e - 3 , 1 e - 2 , 1 . 5 e - 2 \}$ . The trend of log-likelihoods is plotted in Figure 13. We can see that log-likelihoods do not change a lot within the chosen stepsize interval, demonstrating the robustness of $h$ .
|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
Figure 13: Log-likelihoods vs discretization stepsize for MacGAN on MNIST.
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
Figure 9: Generated images for CIFAR-10 datasets with MacGAN.
|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
Figure 10: Generated images for CelebA datasets with SteinGAN.
|
| 439 |
+
|
| 440 |
+

|
| 441 |
+
Figure 11: Generated images for CIFAR-10 datasets with SteinGAN.
|
| 442 |
+
|
| 443 |
+

|
| 444 |
+
Figure 12: Generated images with a random walk on the $\omega$ space for CelebA datasets with MacGAN, $\omega _ { t } \overline { { = \omega _ { t - 1 } + 0 . 0 2 \times \mathrm { r a n d } ( [ - 1 , 1 ] ) } }$ .
|
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/rke3TJrtPS/rke3TJrtPS.md
ADDED
|
@@ -0,0 +1,653 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PROJECTION-BASED CONSTRAINEDPOLICY OPTIMIZATION
|
| 2 |
+
|
| 3 |
+
Tsung-Yen Yang Princeton University ty3@princeton.edu
|
| 4 |
+
|
| 5 |
+
Justinian Rosca Siemens Corporation, Corporate Technology justinian.rosca@siemens.com
|
| 6 |
+
|
| 7 |
+
Karthik Narasimhan Princeton University karthikn@princeton.edu
|
| 8 |
+
|
| 9 |
+
Peter J. Ramadge Princeton University ramadge@princeton.edu
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
We consider the problem of learning control policies that optimize a reward function while satisfying constraints due to considerations of safety, fairness, or other costs. We propose a new algorithm, Projection-Based Constrained Policy Optimization (PCPO). This is an iterative method for optimizing policies in a two-step process: the first step performs a local reward improvement update, while the second step reconciles any constraint violation by projecting the policy back onto the constraint set. We theoretically analyze PCPO and provide a lower bound on reward improvement, and an upper bound on constraint violation, for each policy update. We further characterize the convergence of PCPO based on two different metrics: $L ^ { 2 }$ norm and Kullback-Leibler divergence. Our empirical results over several control tasks demonstrate that PCPO achieves superior performance, averaging more than 3.5 times less constraint violation and around $15 \%$ higher reward compared to state-of-the-art methods.1
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Recent advances in deep reinforcement learning (RL) have demonstrated excellent performance on several domains ranging from games like Go (Silver et al., 2017) and StarCraft (AlphaStar, 2019) to robotic control (Levine et al., 2016). In these settings, agents are allowed to explore the entire state space and experiment with all possible actions during training. However, in many realworld applications such as self-driving cars and unmanned aerial vehicles, considerations of safety, fairness and other costs prevent the agent from having complete freedom to explore. For instance, an autonomous car, while optimizing its driving policies, must not take any actions that could cause harm to pedestrians or property (including itself). In effect, the agent is constrained to take actions that do not violate a specified set of constraints on state-action pairs. In this work, we address the problem of learning control policies that optimize a reward function while satisfying predefined constraints.
|
| 18 |
+
|
| 19 |
+
The problem of policy learning with constraints is more challenging since directly optimizing for the reward, as in Q-Learning (Mnih et al., 2013) or policy gradient (Sutton et al., 2000), will usually violate the constraints. One approach is to incorporate constraints into the learning process by forming a constrained optimization problem. Then perform policy updates using a conditional gradient descent with line search to ensure constraint satisfaction (Achiam et al., 2017). However, the base optimization problem can become infeasible if the current policy violates the constraints. Another approach is to add a hyperparameter weighted copy of the constraints to the objective function (Tessler et al., 2018). However, this incurs the cost of extensive hyperparameter tuning.
|
| 20 |
+
|
| 21 |
+
To address the above issues, we propose projection-based constrained policy optimization (PCPO). This is an iterative algorithm that performs policy updates in two stages. The first stage maximizes reward using a trust region optimization method (e.g., TRPO (Schulman et al., 2015a)) without constraints. This might result in a new intermediate policy that does not satisfy the constraints. The second stage reconciles the constraint violation (if any) by projecting the policy back onto the constraint set, i.e., choosing the policy in the constraint set that is closest to the selected intermediate policy. This allows efficient updates to ensure constraint satisfaction without requiring a line search (Achiam et al., 2017) or adjusting a weight (Tessler et al., 2018). Further, due to the projection step, PCPO offers efficient recovery from infeasible (i.e., constraint-violating) states (e.g., due to approximation errors), which existing methods do not handle well.
|
| 22 |
+
|
| 23 |
+
We analyze PCPO theoretically and derive performance bounds for the algorithm. Specifically, based on information geometry and policy optimization theory, we construct a lower bound on reward improvement, and an upper bound on constraint violations for each policy update. We find that with a relatively small step size for each policy update, the worst-case constraint violation and reward degradation are tolerable. We further analyze two distance measures for the projection step onto the constraint set. We find that the convergence of PCPO is affected by the smallest and largest singular values of the Fisher information matrix used during training. By observing these singular values, we can choose the appropriate projection best suited to the problem.
|
| 24 |
+
|
| 25 |
+
Empirically, we compare PCPO with state-of-the-art algorithms on four different control tasks, including two Mujoco environments with safety constraints introduced by Achiam et al. (2017) and two traffic management tasks with fairness constraints introduced by Vinitsky et al. (2018). In all cases, the proposed algorithm achieves comparable or superior performance to prior approaches, averaging more reward with fewer cumulative constraint violations. For instance, across the above tasks, PCPO achieves 3.5 times fewer constraint violations and around $15 \%$ more reward. This demonstrates the ability of PCPO robustly learn constraint-satisfying policies, and represents a step towards reliable deployment of RL in real problems.
|
| 26 |
+
|
| 27 |
+
# 2 PRELIMINARIES
|
| 28 |
+
|
| 29 |
+
We frame our policy learning as a constrained Markov Decision Process (CMDP) (Altman, 1999), where policies will direct the agent to maximize the reward while minimizing the cost. We define CMDP as the tuple $< S , A , T , R , C >$ , where $s$ is the set of states, $\mathcal { A }$ is the set of actions that the agent can take, $T : S \times A \times S [ 0 , 1 ]$ is the transition probability of the CMDP, $R : S \times \mathcal { A } \mathbb { R }$ is the reward function, and $C : S \times \mathcal { A } \mathbb { R }$ is the cost function. Given the agent’s current state $s$ , the policy $\pi ( a | s ) : { \mathcal { S } } \to A$ selects an action $a$ for the agent to take. Based on $s$ and $a$ , the agent transits to the next state (denoted by $s ^ { \prime }$ ) according to the state transition model $T ( s ^ { \prime } | s , a )$ , and receives the reward and pays the cost, denoted by $R ( s , a )$ and $C ( s , a )$ , respectively.
|
| 30 |
+
|
| 31 |
+
We aim to learn a policy $\pi$ that maximizes a cumulative discounted reward, denoted by
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
J ^ { R } ( \pi ) \doteq \mathbb { E } _ { \tau \sim \pi } \big [ \sum _ { { t = 0 } } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) \big ] ,
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
while satisfying constraints, i.e., making a cumulative discounted cost constraint below a desired threshold $h$ , denoted by
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
J ^ { C } ( \pi ) \doteq \mathbb { E } _ { \tau \sim \pi } \big [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } C ( s _ { t } , a _ { t } ) \big ] \le h ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\gamma$ is the discount factor, $\tau$ is the trajectory $( \tau = ( s _ { 0 } , a _ { 0 } , s _ { 1 } , \cdot \cdot \cdot ) )$ , and $\tau \sim \pi$ is shorthand for showing that the distribution over the trajectory depends on $\pi : s _ { 0 } \sim \mu , a _ { t } \sim \pi ( a _ { t } | s _ { t } ) , s _ { t + 1 } \sim$ $T ( s _ { t + 1 } | s _ { t } , a _ { t } )$ , where $\mu$ is the initial state distribution.
|
| 44 |
+
|
| 45 |
+
Kakade & Langford (2002) give an identity to express the performance of policy $\pi ^ { \prime }$ in terms of the advantage function over another policy $\pi$ :
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
J ^ { R } ( \pi ^ { \prime } ) - J ^ { R } ( \pi ) = \frac { 1 } { 1 - \gamma } { \mathbb E } _ { s \sim d ^ { \pi ^ { \prime } } } [ A _ { R } ^ { \pi } ( s , a ) ] ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $d ^ { \pi }$ is the discounted future state distribution, denoted by $\begin{array} { r } { d ^ { \pi } ( s ) \doteq ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } P ( s _ { t } = } \end{array}$ $s | \pi )$ , and $A _ { R } ^ { \pi } ( s , a )$ is the reward advantage function, denoted by $A _ { R } ^ { \pi } ( s , a ) ~ \doteq ~ Q _ { R } ^ { \pi } ( s , a ) \ -$ $V _ { R } ^ { \pi } ( s )$ R. Here $\begin{array} { r } { Q _ { R } ^ { \pi } ( s , a ) \ \doteq \ \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) | s _ { 0 } \ = \ s , a _ { 0 } \ = \ a \right] } \end{array}$ Ris the discounted cumulative reward obtained by the policy $\pi$ given the initial state $s$ and action $a$ , and $V _ { R } ^ { \pi } ( s ) \doteq$ $\begin{array} { r } { \mathbb { E } _ { \tau \sim \pi } \big [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) | s _ { 0 } ~ = ~ s \big ] } \end{array}$ is the discounted cumulative reward obtained by the policy $\pi$ given the initial state $s$ . Similarly, we have the cost advantage function $A _ { C } ^ { \pi } ( s , a ) \ =$ $Q _ { C } ^ { \pi } ( s , a ) - V _ { C } ^ { \pi } ( s )$ , where $\begin{array} { r } { Q _ { C } ^ { \pi } ( s , a ) \doteq \mathbb { E } _ { \tau \sim \pi } \bigl [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } C ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \bigr ] } \end{array}$ , and $V _ { C } ^ { \pi } ( s ) \doteq$ $\begin{array} { r } { \mathbb { E } _ { \tau \sim \pi } \big [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } C ( s _ { t } , a _ { t } ) | s _ { 0 } = s \big ] } \end{array}$ .
|
| 52 |
+
|
| 53 |
+
# 3 PROJECTION-BASED CONSTRAINED POLICY OPTIMIZATION
|
| 54 |
+
|
| 55 |
+
To robustly learn constraint-satisfying policies, we develop PCPO – a trust region method that performs policy updates corresponding to reward improvement, followed by projections onto the constraint set. PCPO, inspired by projected gradient descent, is composed of two steps for each update, a reward improvement step and a projection step (This is illustrated in Fig. 1).
|
| 56 |
+
|
| 57 |
+
Reward Improvement Step. First, we optimize the reward function by maximizing the reward advantage function $A _ { R } ^ { \pi } ( s , a )$ subject to a Kullback-Leibler (KL) divergence constraint. This constraints the intermediate policy $\pi ^ { k + \frac { 1 } { 2 } }$ to be within a $\delta$ -neighbourhood of $\mathit { \Pi } _ { \pi ^ { k } }$ :
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 1: Update procedures for PCPO. In step one (red arrow), PCPO follows the reward improvement direction in the trust region (light green). In step two (blue arrow), PCPO projects the policy onto the constraint set (light orange).
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { r l } { \pi ^ { k + \frac { 1 } { 2 } } = \arg \operatorname* { m a x } } & { \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } [ A _ { R } ^ { \pi ^ { k } } ( s , a ) ] } \\ { \mathrm { s . t . ~ } } & { \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi | | \pi ^ { k } ) [ s ] \right] \le \delta . } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
This update rule with the trust region, $\{ \pi : \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \big [ D _ { \mathrm { K L } } ( \pi | | \pi ^ { k } ) [ s ] \big ] \leq \delta \}$ , is called Trust Region Policy Optimization (TRPO) (Schulman et al., 2015a). It constraints the policy changes to a divergence neighborhood and guarantees reward improvement.
|
| 67 |
+
|
| 68 |
+
Projection Step. Second, we project the intermediate policy $\pi ^ { k + \frac { 1 } { 2 } }$ onto the constraint set by minimizing a distance measure $D$ between $\pi ^ { k + \frac { 1 } { 2 } }$ and $\pi$ :
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\begin{array} { r l } { \pi ^ { k + 1 } = \underset { \pi } { \arg \operatorname* { m i n } } } & { D ( \pi , \pi ^ { k + \frac { 1 } { 2 } } ) } \\ { \mathrm { s . t . } } & { J ^ { C } ( \pi ^ { k } ) + \mathbb { E } _ { \underset { a \sim \pi } { s \sim d ^ { \pi ^ { k } } } } [ A _ { C } ^ { \pi ^ { k } } ( s , a ) ] \leq h . } \end{array}
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
The projection step ensures that the constraint-satisfying policy $\pi ^ { k + 1 }$ is close to $\pi ^ { k + \frac { 1 } { 2 } }$ . We consider two distance measures $D$ : $L ^ { 2 }$ norm and KL divergence. In contrast, using KL divergence projection in the probability distribution space allows us to provide provable guarantees for PCPO.
|
| 75 |
+
|
| 76 |
+
# 3.1 PERFORMANCE BOUND FOR PCPO WITH KL DIVERGENCE PROJECTION
|
| 77 |
+
|
| 78 |
+
In safety-critical applications such as autonomous cars, one cares about how worse the performance of a system evolves when applying a learning algorithm. To this end, for PCPO with KL divergence projection, we analyze the worst-case performance degradation for each policy update when the current policy $\pi ^ { k }$ satisfies the constraint. The following theorem provides a lower bound on reward improvement, and an upper bound on constraint violation for each policy update.
|
| 79 |
+
|
| 80 |
+
Theorem 3.1 (Worst-case Bound on Updating Constraint-satisfying Policies). Define $\epsilon _ { R } ^ { \pi ^ { k + 1 } } \doteq$ max $\left| \mathbb { E } _ { a \sim \pi ^ { k + 1 } } \left[ A _ { R } ^ { \pi ^ { k } } ( s , a ) \right] \right|$ , a nd $\epsilon _ { C } ^ { \pi ^ { k + 1 } } \doteq \operatorname* { m a x } _ { s } \left| \mathbb { E } _ { a \sim \pi ^ { k + 1 } } [ A _ { C } ^ { \pi ^ { k } } ( s , a ) ] \right|$ . If the current policy $\pi ^ { k }$ satisfies the constraint, then under $K L$ divergence projection, the lower bound on reward improvement, and upper bound on constraint violation for each policy update are
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
J ^ { R } ( \pi ^ { k + 1 } ) - J ^ { R } ( \pi ^ { k } ) \ge - \frac { \sqrt { 2 \delta } \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } , a n d J ^ { C } ( \pi ^ { k + 1 } ) \le h + \frac { \sqrt { 2 \delta } \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $\delta$ is the step size in the reward improvement step.
|
| 87 |
+
|
| 88 |
+
Proof. See the supplemental material.
|
| 89 |
+
|
| 90 |
+
Theorem 3.1 indicates that if $\delta$ is small, the worst-case performance degradation is tolerable.
|
| 91 |
+
|
| 92 |
+
Due to approximation errors or the random initialization of policies, PCPO may have a constraintviolating update. Theorem 3.1 does not give the guarantee on updating a constraint-violating policy. Hence we analyze worst-case performance degradation for each policy update when the current policy $\pi ^ { k }$ violates the constraint. The following theorem provides a lower bound on reward improvement, and an upper bound on constraint violation for each policy update.
|
| 93 |
+
|
| 94 |
+
Themax $\epsilon _ { R } ^ { \pi ^ { k + 1 } } \dot { = }$ $\left| \mathbb { E } _ { a \sim \pi ^ { k + 1 } } [ A _ { R } ^ { \pi ^ { k } } ( s , a ) ] \right| , \epsilon _ { C } ^ { \pi ^ { k + 1 } } \doteq \operatorname* { m a x } _ { s } \left| \mathbb { E } _ { a \sim \pi ^ { k + 1 } } [ A _ { C } ^ { \pi ^ { k } } ( s , a ) ] \right| , b ^ { + } \doteq \operatorname* { m a x } ( 0 , J ^ { C } ( \pi ^ { k } ) + \pi ^ { k + 1 } ) .$ $\alpha _ { \mathrm { { K L } } } \doteq \frac { 1 } { 2 a ^ { T } H ^ { - 1 } a }$ 12aT H−1a , where a is the gradient of the cost advantage function and H is the Hessian of the $K L$ divergence constraint. If the current policy $\pi ^ { k }$ violates the constraint, then under $K L$ divergence projection, the lower bound on reward improvement and the upper bound on constraint violation for each policy update are
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\begin{array} { c } { { J ^ { R } ( \pi ^ { k + 1 } ) - J ^ { R } ( \pi ^ { k } ) \geq - \displaystyle \frac { \sqrt { 2 ( \delta + { b ^ { + } } ^ { 2 } \alpha _ { \mathrm { K L } } ) } \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } , } } \\ { { a n d J ^ { C } ( \pi ^ { k + 1 } ) \leq h + \displaystyle \frac { \sqrt { 2 ( \delta + { b ^ { + } } ^ { 2 } \alpha _ { \mathrm { K L } } ) } \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } } } \end{array}
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $\delta$ is the step size in the reward improvement step.
|
| 101 |
+
|
| 102 |
+
Proof. See the supplemental material.
|
| 103 |
+
|
| 104 |
+
Theorem 3.2 indicates that when the policy has greater constraint violation $b ^ { + }$ increases), its worstcase performance degradation increases. Note that Theorem 3.2 reduces to Theorem 3.1 if the current policy $\pi ^ { k }$ satisfies the constraint $\begin{array} { r } { B ^ { + } = 0 } \end{array}$ ). The proofs of Theorem 3.1 and Theorem 3.2 follow from the fact that the projection of the policy is non-expansive, i.e., the distance between the projected policies is smaller than that of the unprojected policies. This allows us to measure it and bound the KL divergence between the current policy and the new policy.
|
| 105 |
+
|
| 106 |
+
# 4 PCPO UPDATES
|
| 107 |
+
|
| 108 |
+
For a large neural network policy with many parameters, it is impractical to directly solve for the PCPO update in Problem 2 and Problem 3 due to the computational cost. However, with a small step size $\delta$ , we can approximate the reward function and constraints with a first order expansion, and approximate the KL divergence constraint in the reward improvement step, and the KL divergence measure in the projection step with a second order expansion. We now make several definitions:
|
| 109 |
+
|
| 110 |
+
$\pmb { g } \doteq \nabla _ { \pmb { \theta } } \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } a \sim \pi } [ A _ { R } ^ { \pi ^ { k } } ( s , a ) ]$ is the gradient of the reward advantage function, $\begin{array} { r } { \pmb { a } \doteq \nabla _ { \pmb { \theta } } \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } a \sim \pi } [ A _ { C } ^ { \pi ^ { k } } ( s , a ) ] } \end{array}$ is the gradient of the cost advantage function, $\begin{array} { r } { H _ { i , j } \doteq \frac { \partial ^ { 2 } \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \big \lfloor D _ { \mathrm { K L } } ( \pi | | \pi ^ { k } ) [ s ] \big \rfloor } { \partial \pmb { \theta } _ { j } \partial \pmb { \theta } _ { j } } } \end{array}$ is the Hessian of the KL divergence constraint ( $\pmb { H }$ is also called the Fisher information matrix. It is symmetric positive semi-definite), $b \doteq J ^ { C } ( \pi ^ { k } ) - h$ is the constraint violation of the policy $\pi ^ { k }$ , and $\pmb { \theta }$ is the parameter of the policy.
|
| 111 |
+
|
| 112 |
+
Reward Improvement Step. We linearize the objective function at $\pi ^ { k }$ subject to second order approximation of the KL divergence constraint in order to obtain the following updates:
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { r l } { \pmb { \theta } ^ { k + \frac { 1 } { 2 } } = \underset { \pmb { \theta } } { \arg \operatorname* { m a x } } } & { \pmb { g } ^ { T } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) } \\ { \mathrm { s . t . } } & { \frac { 1 } { 2 } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) ^ { T } \pmb { H } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) \leq \delta . } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
# Algorithm 1 Projection-Based Constrained Policy Optimization (PCPO)
|
| 119 |
+
|
| 120 |
+
Initialize policy $\pi ^ { 0 } = \pi ( \theta ^ { 0 } )$
|
| 121 |
+
for $k = 0 , 1 , 2 , \cdots$ do Run $\pi ^ { k } = \pi ( \theta ^ { k } )$ and store trajectories in $\mathcal { D }$ Compute ${ \mathbf { } } g , a , H$ , and $b$ using $\mathcal { D }$ Obtain $\pmb { \theta } ^ { k + 1 }$ using update in Eq. (6) Empty $\mathcal { D }$
|
| 122 |
+
|
| 123 |
+
Projection Step. If the projection is defined in the parameter space, we can directly use $L ^ { 2 }$ norm projection. On the other hand, if the projection is defined in the probability space, we can use KL divergence projection. This can be approximated through the second order expansion. Again, we linearize the cost constraint at $\pi ^ { k }$ . This gives the following update for the projection step:
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\begin{array} { r l } { \pmb { \theta } ^ { k + 1 } = \underset { \pmb { \theta } } { \arg \operatorname* { m i n } } } & { \frac { 1 } { 2 } ( \pmb { \theta } - \pmb { \theta } ^ { k + \frac { 1 } { 2 } } ) ^ { T } \pmb { L } ( \pmb { \theta } - \pmb { \theta } ^ { k + \frac { 1 } { 2 } } ) } \\ { \mathrm { s . t . } } & { \pmb { a } ^ { T } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) + b \leq 0 , } \end{array}
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
where $L = I$ for $L ^ { 2 }$ norm projection, and ${ L = H }$ for KL divergence projection. One may argue that using linear approximation to the constraint set is not enough to ensure constraint satisfaction since the real constraint set is maybe non-convex. However, if the step size $\delta$ is small, then the linearization of the constraint set is accurate enough to locally approximate it.
|
| 130 |
+
|
| 131 |
+
We solve Problem (4) and Problem (5) using convex programming (See the supplemental material for the derivation). For each policy update, we have
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\pmb { \theta } ^ { k + 1 } = \pmb { \theta } ^ { k } + \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } H ^ { - 1 } g - \operatorname* { m a x } \left( 0 , \frac { \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } a ^ { T } H ^ { - 1 } g + b } { a ^ { T } L ^ { - 1 } a } \right) L ^ { - 1 } a .
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
We assume that $\pmb { H }$ does not have 0 as an eigenvalue and hence it is invertible. PCPO requires to invert $\pmb { H }$ , which is impractical for huge neural network policies. Hence we use the conjugate gradient method (Schulman et al., 2015a). Algorithm 1 shows the pseudocode. (See supplemental material for a discussion of the tradeoff between the approximation error and computational efficiency of the conjugate gradient method.)
|
| 138 |
+
|
| 139 |
+
Analysis of PCPO Update Rule. For a problem including multiple constraints, we can extend the update in Eq. (6) by using alternating projections. This approach finds a solution in the intersection of multiple constraint sets by sequentially projecting onto each of the sets. The update rule in Eq. (6) shows that the difference between PCPO with KL divergence and $L ^ { 2 }$ norm projections is the cost update direction, leading to a difference in reward improvement. These two projections converge to different stationary points with different convergence rates related to the smallest and largest singular values of the Fisher information matrix shown in Theorem 4.1. For our analysis, we make the following assumptions: we minimize the negative reward objective function $f : \mathbb { R } ^ { n } \mathbb { R }$ (We follow the convention of the literature that authors typically minimize the objective function). The function $f$ is $L$ -smooth and twice continuously differentiable over the closed and convex constraint set $\mathcal { C }$ .
|
| 140 |
+
|
| 141 |
+
Theorem 4.1 (Reward Improvement Under $L ^ { 2 }$ Norm and KL Divergence Projections). Let $\eta \doteq \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } }$ in Eq. (6), where $\delta$ is the step size for reward improvement, $\textbf { { g } }$ is the gradient of $f$ , and $\pmb { H }$ is the Fisher information matrix. Let $\sigma _ { \mathrm { m a x } } ( H )$ be the largest singular value of $\pmb { H }$ , and $\textbf { \em a }$ be the gradient of cost advantage function in Eq. (6). Then PCPO with $K L$ divergence projection converges to a stationary point either inside the constraint set or in the boundary of the constraint set. In the latter case, the Lagrangian constraint $\mathbf { \delta } _ { \mathbf { \delta g } } = - \alpha \mathbf { \delta a } , \alpha \geq 0$ holds. Moreover, at step $k + 1$ the objective value satisfies
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
f ( \pmb { \theta } ^ { k + 1 } ) \leq f ( \pmb { \theta } ^ { k } ) + | | \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } | | _ { - \frac { 1 } { \eta } \pmb { H } + \frac { L } { 2 } \pmb { I } } ^ { 2 } .
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
PCPO with $L ^ { 2 }$ norm projection converges to a stationary point either inside the constraint set or in the boundary of the constraint set. In the latter case, the Lagrangian constraint $\pmb { H } ^ { - 1 } \pmb { g } = - \alpha \pmb { a } , \alpha \geq$
|
| 148 |
+
|
| 149 |
+
0 holds. If $\sigma _ { \mathrm { m a x } } ( \pmb { H } ) \leq 1$ , then a step $k + 1$ objective value satisfies
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
f ( \pmb { \theta } ^ { k + 1 } ) \leq f ( \pmb { \theta } ^ { k } ) + ( \frac { L } { 2 } - \frac { 1 } { \eta } ) | | \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } | | _ { 2 } ^ { 2 } .
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
Proof. See the supplemental material.
|
| 156 |
+
|
| 157 |
+
Theorem 4.1 shows that in the stationary point $\textbf { { g } }$ is a line that points to the opposite direction of $\textbf { \em a }$ . Further, the improvement of the objective value is affected by the singular value of the Fisher information matrix. Specifically, the objective of $\mathrm { K L }$ divergence projection decreases when $\frac { L \eta } { 2 } I \prec$ $\pmb { H }$ , implying that $\begin{array} { r } { \sigma _ { \mathrm { m i n } } ( { \cal H } ) > \frac { L \eta } { 2 } } \end{array}$ . And the objective of $L ^ { 2 }$ norm projection decreases when $\eta \ : <$ $\frac { 2 } { L }$ , implying that condition number of $\pmb { H }$ is upper bounded: $\frac { \sigma _ { \mathrm { m a x } } ( { H } ) } { \sigma _ { \mathrm { m i n } } ( { H } ) } ~ < ~ \frac { 2 | | g | | _ { 2 } ^ { 2 } } { L ^ { 2 } \delta }$ . Observing the singular values of the Fisher information matrix allows us to adaptively choose the appropriate projection and hence achieve objective improvement. In the supplemental material, we further use an example to compare the optimization trajectories and stationary points of KL divergence and $L ^ { 2 }$ norm projections.
|
| 158 |
+
|
| 159 |
+
# 5 RELATED WORK
|
| 160 |
+
|
| 161 |
+
Policy Learning with Constraints. Learning constraint-satisfying policies has been explored in the context of safe RL (Garcia & Fernandez, 2015). The agent learns policies either by (1) exploration of the environment (Achiam et al., 2017; Tessler et al., 2018; Chow et al., 2017) or (2) through expert demonstrations (Ross et al., 2011; Rajeswaran et al., 2017; Gao et al., 2018). However, using expert demonstrations requires humans to label the constraint-satisfying behavior for every possible situation. The scalability of these rule-based approaches is an issue since many real autonomous systems such as self-driving cars and industrial robots are inherently complex. To overcome this issue, PCPO uses the first approach in which the agent learns by trial and error. To prevent the agent from having constraint-violating behavior during exploring the environment, PCPO uses the projection onto the constraint set to ensure constraint satisfaction throughout learning.
|
| 162 |
+
|
| 163 |
+
Constraint satisfaction by Projections. Using a projection onto a constraint set has been explored for general constrained optimization in other contexts. For example, Akrour et al. (2019) projects the policy from a parameter space onto the constraint. This ensures the updated policy stays close to the previous policy. In contrast, we examine constraints that are defined in terms of states and actions. Similarly, Chow et al. (2019) proposes $\theta$ -projection. This approach projects the policy parameters $\theta$ onto the constraint set. However, no provide provable guarantees are provided. Moreover, the
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 2: Update procedures for CPO (Achiam et al., 2017). CPO computes the update by simultaneously considering the trust region (light green) and the constraint set (light orange). CPO becomes infeasible when these two sets do not intersect.
|
| 167 |
+
|
| 168 |
+
problem is formulated by adding the weighted constraint to the reward objective function. Since the weight must be tuned, this incurs the cost of hyperparameter tuning. In contrast, PCPO eliminates the cost of the hyperparameter tuning, and provides provable guarantees on learning constraintsatisfying policies.
|
| 169 |
+
|
| 170 |
+
Comparison to CPO (Achiam et al., 2017). Perhaps the closest work to ours is the approach of Achiam et al. (2017), who proposes the constrained policy optimization (CPO) algorithm to solve the following:
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
\theta ^ { k + 1 } = \underset { \theta } { \mathrm { a r g } \mathrm { m a x } } g ^ { T } ( \theta - \theta ^ { k } ) \quad \mathrm { s . t . } \frac { 1 } { 2 } ( \theta - \theta ^ { k } ) ^ { T } H ( \theta - \theta ^ { k } ) \leq \delta , \ a ^ { T } ( \theta - \theta ^ { k } ) + b \leq 0 .
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
CPO simultaneously considers the trust region and the constraint, and uses the line search to select a step size (This is illustrated in Fig. 2). The update rule of CPO becomes infeasible when the current policy violates the constraint $( b > 0$ ). CPO recovers by replacing Problem (7) with an update to purely decrease the constraint value: $\pmb { \theta } ^ { k + 1 } = \pmb { \theta } ^ { k } - \sqrt { \frac { 2 \delta } { \pmb { a } ^ { T } \pmb { H } ^ { - 1 } \pmb { a } } } \pmb { H } ^ { - 1 } \pmb { a }$ . This update rule may lead to a slow progress in learning constraint-satisfying policies. In contrast, PCPO first optimizes the reward and uses the projection to satisfy the constraint. This ensures a feasible solution, allowing the agent to improve the reward while ensuring constraint satisfaction simultaneously.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 3: The gather, circle, grid and bottleneck tasks. (a) Gather task: the agent is rewarded for gathering green apples but is constrained to collect a limited number of red fruit (Achiam et al., 2017). (b) Circle task: the agent is rewarded for moving in a specified wide circle, but is constrained to stay within a safe region smaller than the radius of the circle (Achiam et al., 2017). (c) Grid task: the agent controls the traffic lights in a grid road network and is rewarded for high throughput but constrained to let lights stay red for at most 7 consecutive seconds (Vinitsky et al., 2018). (d) Bottleneck task: the agent controls a set of autonomous vehicles (shown in red) in a traffic merge situation and is rewarded for achieving high throughput but constrained to ensure that human-driven vehicles (shown in white) have low speed for no more than 10 seconds (Vinitsky et al., 2018).
|
| 180 |
+
|
| 181 |
+
# 6 EXPERIMENTS
|
| 182 |
+
|
| 183 |
+
Tasks. We compare the proposed algorithm with existing approaches on four control tasks in total: two tasks with safety constraints ((a) and (b) in Fig. 3), and two tasks with fairness constraints ((c) and (d) in Fig. 3). These tasks are briefly described in the caption of Fig. 3. The first two tasks – Gather and Circle – are Mujoco environments with state space constraints introduced by Achiam et al. (2017). The other two tasks – Grid and Bottleneck – are traffic management problems where the agent controls either a traffic light or a fleet of autonomous vehicles. This is especially challenging since the dimensions of state and action spaces are larger, and the dynamics of the environment are inherently complex.
|
| 184 |
+
|
| 185 |
+
Baselines. We compare PCPO with four baselines outlined below.
|
| 186 |
+
|
| 187 |
+
(1) Constrained Policy Optimization (CPO) (Achiam et al., 2017).
|
| 188 |
+
|
| 189 |
+
(2) Primal-dual Optimization (PDO) (Chow et al., 2017). In PDO, the weight (dual variables) is learned based on the current constraint satisfaction. A PDO policy update solves:
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
\pmb { \theta } ^ { k + 1 } = \underset { \pmb { \theta } } { \arg \operatorname* { m a x } } \quad \pmb { g } ^ { T } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) + \lambda ^ { k } \pmb { a } ^ { T } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) ,
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
where $\lambda ^ { k }$ is updated using $\lambda ^ { k + 1 } = \lambda ^ { k } + \beta ( J ^ { C } ( \pi ^ { k } ) - h )$ . Here $\beta$ is a fixed learning rate.
|
| 196 |
+
|
| 197 |
+
(3) Fixed-point Policy Optimization (FPO). A variant of PDO that solves Eq. (8) using a constant $\lambda$
|
| 198 |
+
|
| 199 |
+
(4) Trust Region Policy Optimization (TRPO) (Schulman et al., 2015a). The TRPO policy update is an unconstrained one:
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\begin{array} { r } { \pmb { \theta } ^ { k + 1 } = \pmb { \theta } ^ { k } + \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } H ^ { - 1 } \pmb { g } . } \end{array}
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
Note that TRPO ignores any constraints. We include it to serve as an upper bound baseline on the reward performance.
|
| 206 |
+
|
| 207 |
+
Since the main focus is to compare PCPO with the state-of-the-art algorithm, CPO, PDO and FPO are not shown in the ant circle, ant gather, grid and bottleneck tasks for clarity.
|
| 208 |
+
|
| 209 |
+
Experimental Details. For the gather and circle tasks we test two distinct agents: a point-mass $( S ~ \overset { \cdot } { \subseteq } ~ \mathbb { R } ^ { 9 } , A ~ \subseteq ~ \mathbb { R } ^ { 2 } )$ , and an ant robot $( S \subseteq \mathbb { R } ^ { 3 2 } , A \subseteq \mathbb { R } ^ { 8 } )$ . The agent in the grid task is $S \subseteq$ $\mathbb { R } ^ { 1 5 6 }$ , $A \subseteq \mathbb { R } ^ { 4 }$ , and the agent in bottleneck task is $S \subseteq \mathbb { R } ^ { 1 4 1 } , A \subseteq \mathbb { R } ^ { \tilde { 2 } 0 }$ . For the simulations in the gather and circle tasks, we use a neural network with two hidden layers of size (64, 32) to represent
|
| 210 |
+
|
| 211 |
+

|
| 212 |
+
Figure 4: The values of the discounted reward and the undiscounted constraint value (the total number of constraint violation) along policy updates for the tested algorithms and task pairs. The solid line is the mean and the shaded area is the standard deviation, over five runs. The dashed line in the cost constraint plot is the cost constraint threshold $h$ . The curves for baseline oracle, TRPO, indicate the reward and constraint violation values when the constraint is ignored. (Best viewed in color, and the legend is shared across all the figures.)
|
| 213 |
+
|
| 214 |
+
Gaussian policies. For the simulations in the grid and bottleneck tasks, we use a neural network with two hidden layers of size (16, 16) and (50,25) to represent Gaussian policies, respectively. In the experiments, since the step size is small, we reuse the Fisher information matrix of the reward improvement step in the KL projection step to reduce the computational cost. The step size $\delta$ is set to $\mathrm { \dot { 1 } 0 ^ { - 4 } }$ for all tasks and all tested algorithms. For each task, we conduct 5 runs to get the mean and standard deviation for both the reward and the constraint value over the policy updates. The experiments are implemented in rllab (Duan et al., 2016), a tool for developing and evaluating RL algorithms. See the supplemental material for the details of the experiments.
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
Figure 5: The value of the discounted reward versus the cumulative constraint value for the tested algorithms and task pairs. See the supplemental material for learning curves in the other tasks. PCPO achieves less constraint violation under the same reward improvement compared to the other algorithms.
|
| 218 |
+
|
| 219 |
+
Overall Performance. The learning curves of the discounted reward and the undiscounted constraint value (the total number of constraint violation) over policy updates are shown for all tested algorithms and tasks in Fig. 4. The dashed line in the constraint figure is the cost constraint threshold $h$ . The curves for baseline oracle, TRPO, indicate the reward and constraint value when the constraint is ignored. Overall, we find that PCPO is able to improve the reward while having the fastest constraint satisfaction in all tasks. In particular, PCPO is the only algorithm that learns constraintsatisfying policies across all the tasks. Moreover we observe that (1) CPO has more constraint violation than PCPO, (2) PDO is too conservative in optimizing the reward, and (3) FPO requires a significant effort to select a good value of $\lambda$ .
|
| 220 |
+
|
| 221 |
+
We also observe that in Grid and Bottleneck task, there is slightly more constraint violation than the easier task such as point circle and point gather. This is due to complexity of the policy behavior and non-convexity of the constraint set. However, even with a linear approximation of the constraint set, PCPO still outperforms CPO with $8 5 . 1 5 \%$ and 5.42 times less constraint violation in Grid and Bottleneck task, respectively.
|
| 222 |
+
|
| 223 |
+
These observations suggest that projection step in PCPO drives the agent to learn the constraintsatisfying policy within few policy updates, giving PCPO an advantage in applications. To show that PCPO achieves the same reward with less constraint violation, we examine the reward versus the cumulative constraint value for the tested algorithms in point circle and point gather task shown in Fig. 5. We observe that PCPO outperforms CPO significantly with 66 times and 15 times less constraint violation under the same reward improvement in point circle and point gather tasks, respectively. This observation suggests that PCPO enables the agent to cautiously explore the environment under the constraints.
|
| 224 |
+
|
| 225 |
+
Comparison of PCPO with KL Divergence vs. $L ^ { 2 }$ Norm Projections. We observe that PCPO with $\bar { L } ^ { 2 }$ norm projection is more constraint-satisfying than PCPO with KL divergence projection. In addition, PCPO with $L ^ { 2 }$ norm projection tends to have reward fluctuation (point circle, ant circle, and ant gather tasks), while with KL divergence projection tends to have more stable reward improvement (all the tasks).
|
| 226 |
+
|
| 227 |
+
The above observations indicate that since the gradient of constraint is not multiplied by the Fisher information matrix, the gradient of the constraint is not aligned with the gradient of the reward. This reduces the reward improvement. However, when the Fisher information matrix is ill-conditioned or not well-estimated, especially in a high dimensional policy space, a bad constraint update direction may hinder constraint satisfaction (ant circle, ant gather, grid and bottleneck tasks). In addition, since the stationary points of KL divergence and $L ^ { 2 }$ norm projections are different, they converge to policies with different reward (observe that PCPO with $L ^ { \bar { 2 } }$ norm projection has higher reward than the one with KL divergence projection around 2250 iterations in ant circle task, and has less reward in point gather task).
|
| 228 |
+
|
| 229 |
+
Discussion of PDO and FPO. For the PDO baseline, we see that its constraint values fluctuate especially in the point circle task. This phenomena suggests that PDO is not able to adjust the weight $\bar { \lambda ^ { k } }$ quickly enough to meet the constraint threshold, which hinders the efficiency of learning constraint-satisfying policies. If the learning rate $\beta$ is too big, the agent will be too conservative in improving the reward. For FPO, we also see that it learns near constraint-satisfying policies with slightly larger reward improvement compared to PDO. However, in practice FPO requires a lot of engineering effort to select a good value of $\lambda$ . Since PCPO requires no hyperparameter tuning, it has the advantage of robustly learning constraint-satisfying policies over PDO and FPO.
|
| 230 |
+
|
| 231 |
+
# 7 CONCLUSION
|
| 232 |
+
|
| 233 |
+
We address the problem of finding constraint-satisfying policies. The proposed algorithm – projection-based constrained policy optimization (PCPO) – optimizes for the reward function while using the projections to ensure constraint satisfaction. This update rule allows PCPO to maintain the feasibility of the optimization problem of each update, addressing the issue of state-of-the-art approaches. The algorithm achieves comparable or superior performance to state-of-the-art approaches in terms of reward improvement and constraint satisfaction in all cases. We further analyze the convergence of PCPO, and find that certain tasks may prefer either KL divergence projection or $L ^ { 2 }$ norm projection. Future work will consider the following: (1) examining the Fisher information matrix to iteratively prescribe the choice of projection for policy update, and hence robustly learn constraint-satisfying policies with more reward improvement, and (2) using expert demonstration or other domain knowledge to reduce the sample complexity.
|
| 234 |
+
|
| 235 |
+
# ACKNOWLEDGMENTS
|
| 236 |
+
|
| 237 |
+
The authors would like to thank the anonymous reviewers and the area chair for their comments.
|
| 238 |
+
Tsung-Yen Yang thanks Siemens Corporation, Corporate Technology for their support.
|
| 239 |
+
|
| 240 |
+
# REFERENCES
|
| 241 |
+
|
| 242 |
+
Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In Proceedings of International Conference on Machine Learning, pp. 22–31, 2017.
|
| 243 |
+
|
| 244 |
+
Riad Akrour, Joni Pajarinen, Gerhard Neumann, and Jan Peters. Projections for approximate policy iteration algorithms. In Proceedings of International Conference on Machine Learning, pp. 181– 190, 2019.
|
| 245 |
+
|
| 246 |
+
AlphaStar. Alphastar: Mastering the real-time strategy game starcraft ii, 2019. URL https://deepmind.com/blog/article/ alphastar-mastering-real-time-strategy-game-starcraft-ii.
|
| 247 |
+
|
| 248 |
+
Eitan Altman. Constrained Markov decision processes, volume 7. CRC Press, 1999.
|
| 249 |
+
|
| 250 |
+
Yinlam Chow, Mohammad Ghavamzadeh, Lucas Janson, and Marco Pavone. Risk-constrained reinforcement learning with percentile risk criteria. Journal of Machine Learning Research, 18(1): 6070–6120, 2017.
|
| 251 |
+
|
| 252 |
+
Yinlam Chow, Ofir Nachum, Aleksandra Faust, Mohammad Ghavamzadeh, and Edgar DuenezGuzman. Lyapunov-based safe policy optimization for continuous control. arXiv preprint arXiv:1901.10031, 2019.
|
| 253 |
+
|
| 254 |
+
Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In Proceedings of International Conference on Machine Learning, pp. 1329–1338, 2016.
|
| 255 |
+
|
| 256 |
+
Yang Gao, Ji Lin, Fisher Yu, Sergey Levine, and Trevor Darrell. Reinforcement learning from imperfect demonstrations. arXiv preprint arXiv:1802.05313, 2018.
|
| 257 |
+
|
| 258 |
+
Javier Garcia and Fernando Fernandez. A comprehensive survey on safe reinforcement learning. Journal of Machine Learning Research, 16(1):1437–1480, 2015.
|
| 259 |
+
|
| 260 |
+
Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In Proceedings of International Conference on Machine Learning, pp. 267–274, 2002.
|
| 261 |
+
|
| 262 |
+
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(1):1334–1373, 2016.
|
| 263 |
+
|
| 264 |
+
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.
|
| 265 |
+
|
| 266 |
+
Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. arXiv preprint arXiv:1709.10087, 2017.
|
| 267 |
+
|
| 268 |
+
Stephane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and struc- ´ tured prediction to no-regret online learning. In Proceedings of International Conference on Artificial Intelligence and Statistics, pp. 627–635, 2011.
|
| 269 |
+
|
| 270 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of International Conference on Machine Learning, pp. 1889– 1897, 2015a.
|
| 271 |
+
|
| 272 |
+
John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015b.
|
| 273 |
+
|
| 274 |
+
Jonathan R. Shewchuk. An introduction to the conjugate gradient method without the agonizing pain, 1994.
|
| 275 |
+
|
| 276 |
+
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, 2017.
|
| 277 |
+
|
| 278 |
+
Richard S. Sutton, David A. McAllester, Satinder P. Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in Neural Information Processing Systems, pp. 1057–1063, 2000.
|
| 279 |
+
|
| 280 |
+
Chen Tessler, Daniel J. Mankowitz, and Shie Mannor. Reward constrained policy optimization. arXiv preprint arXiv:1805.11074, 2018.
|
| 281 |
+
|
| 282 |
+
Eugene Vinitsky, Aboudy Kreidieh, Luc Le Flem, Nishant Kheterpal, Kathy Jang, Fangyu Wu, Richard Liaw, Eric Liang, and Alexandre M. Bayen. Benchmarks for reinforcement learning in mixed-autonomy traffic. In Proceedings of Conference on Robot Learning, pp. 399–409, 2018.
|
| 283 |
+
|
| 284 |
+
# S SUPPLEMENTARY MATERIALS
|
| 285 |
+
|
| 286 |
+
# S.1 PROOF OF THEOREM 3.1: PERFORMANCE BOUND ON UPDATING THE CONSTRAINT-SATISFYING POLICY
|
| 287 |
+
|
| 288 |
+
To prove the policy performance bound when the current policy is feasible (i.e., constraintsatisfying), we prove the KL divergence between $\pi ^ { k }$ and $\pi ^ { k + \ 1 }$ for the KL divergence projection. We then prove our main theorem for the worst-case performance degradation.
|
| 289 |
+
|
| 290 |
+
Lemma S.1. If the current policy $\pi ^ { k }$ satisfies the constraint, the constraint set is closed and convex, the KL divergence constraint for the first step is ${ \mathbb E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + \frac { 1 } { 2 } } | | \pi ^ { k } ) [ s ] \right] \le \delta$ , where $\delta$ is the step size in the reward improvement step, then under $K L$ divergence projection, we have
|
| 291 |
+
|
| 292 |
+
$$
|
| 293 |
+
\begin{array} { r } { \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] \le \delta . } \end{array}
|
| 294 |
+
$$
|
| 295 |
+
|
| 296 |
+
Proof. By the Bregman divergence projection inequality, $\pi ^ { k }$ being in the constraint set, and $\pi ^ { k + 1 }$ being the projection of the $\pi ^ { k + \frac { 1 } { 2 } }$ onto the constraint set, we have
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
\begin{array} { r l } & { \mathbb { E } _ { s \sim d ^ { \pi k } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k } | | \pi ^ { k + \frac { 1 } { 2 } } ) [ s ] \right] \geq \mathbb { E } _ { s \sim d ^ { \pi k } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k } | | \pi ^ { k + 1 } ) [ s ] \right] + \mathbb { E } _ { s \sim d ^ { \pi k } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k + \frac { 1 } { 2 } } ) [ s ] \right] } \\ & { \Rightarrow \delta \geq \mathbb { E } _ { s \sim d ^ { \pi k } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k } | | \pi ^ { k + \frac { 1 } { 2 } } ) [ s ] \right] \geq \mathbb { E } _ { s \sim d ^ { \pi k } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k } | | \pi ^ { k + 1 } ) [ s ] \right] . } \end{array}
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
The derivation uses the fact that KL divergence is always greater than zero. We know that KL divergence is asymptotically symmetric when updating the policy within a local neighbourhood. Thus, we have
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
\delta \geq \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + \frac { 1 } { 2 } } | | \pi ^ { k } ) [ s ] \right] \geq \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] .
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
Now we use Lemma S.1 to prove our main theorem.
|
| 309 |
+
|
| 310 |
+
Theorem S.2. Define maxs Ea∼πk+1 [AπkR (s, a)], and πk+1C = $\operatorname* { m a x } _ { s } \left| \mathbb { E } _ { a \sim \pi ^ { k + 1 } } \left[ A _ { C } ^ { \pi ^ { k } } ( s , a ) \right] \right|$ . If the current policy $\pi ^ { k }$ satisfies the constraint, then under the $K L$ divergence projection, the lower bound on reward improvement, and upper bound on constraint violation for each policy update are
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
J ^ { R } ( \pi ^ { k + 1 } ) - J ^ { R } ( \pi ^ { k } ) \geq - \frac { \sqrt { 2 \delta } \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } , a n d J ^ { C } ( \pi ^ { k + 1 } ) \leq h + \frac { \sqrt { 2 \delta } \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } ,
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
where $\delta$ is the step size in the reward improvement step.
|
| 317 |
+
|
| 318 |
+
Proof. By the theorem in Achiam et al. (2017) and Lemma S.1, we have the following reward degradation bound for each policy update:
|
| 319 |
+
|
| 320 |
+
$$
|
| 321 |
+
\begin{array} { r l } & { J ^ { R } ( \pi ^ { k + 1 } ) - J ^ { R } ( \pi ^ { k } ) \geq \displaystyle \frac { 1 } { 1 - \gamma } \mathbb { E } _ { \underset { a \sim \pi ^ { k + 1 } } { s \sim d ^ { \pi ^ { k } } } } \left[ A _ { R } ^ { \pi ^ { k } } ( s , a ) - \frac { 2 \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { 1 - \gamma } \sqrt { \frac { 1 } { 2 } D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] } \right] } \\ & { \geq \displaystyle \frac { 1 } { 1 - \gamma } \mathbb { E } _ { \underset { a \sim \pi ^ { k + 1 } } { s \sim d ^ { \pi ^ { k } } } } \left[ - \frac { 2 \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { 1 - \gamma } \sqrt { \frac { 1 } { 2 } D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] } \right] } \\ & { \geq - \frac { \sqrt { 2 \delta } \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } . } \end{array}
|
| 322 |
+
$$
|
| 323 |
+
|
| 324 |
+
Again, we have the following constraint violation bound for each policy update:
|
| 325 |
+
|
| 326 |
+
$$
|
| 327 |
+
J ^ { C } ( \pi ^ { k } ) + \frac { 1 } { 1 - \gamma } \mathbb { E } _ { { s \sim } d ^ { \pi ^ { k } } } \Big [ A _ { R } ^ { \pi ^ { k } } ( s , a ) \Big ] \le h ,
|
| 328 |
+
$$
|
| 329 |
+
|
| 330 |
+
and
|
| 331 |
+
|
| 332 |
+
$$
|
| 333 |
+
J ^ { C } ( \pi ^ { k + 1 } ) - J ^ { C } ( \pi ^ { k } ) \leq \frac { 1 } { 1 - \gamma } \mathbb { E } _ { \underset { s \sim \pi ^ { k + 1 } } { s \sim d ^ { \pi ^ { k } } } } \left[ A _ { C } ^ { \pi ^ { k } } ( s , a ) + \frac { 2 \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { 1 - \gamma } \sqrt { \frac { 1 } { 2 } D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] } \right] .
|
| 334 |
+
$$
|
| 335 |
+
|
| 336 |
+
Combining Eq. (9) and Eq. (10), we have
|
| 337 |
+
|
| 338 |
+
$$
|
| 339 |
+
\begin{array} { r l } & { J ^ { C } ( \pi ^ { k + 1 } ) \leq h + \displaystyle \frac { 1 } { 1 - \gamma } \mathbb { E } _ { { s \sim } d ^ { \pi ^ { k } } } \Big [ \frac { 2 \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { 1 - \gamma } \sqrt { \frac { 1 } { 2 } D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] } \Big ] } \\ & { \quad \quad \leq h + \displaystyle \frac { \sqrt { 2 \delta } \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } . } \end{array}
|
| 340 |
+
$$
|
| 341 |
+
|
| 342 |
+
# S.2 PROOF OF THEOREM 3.2: PERFORMANCE BOUND ON UPDATING THE CONSTRAINT-VIOLATING POLICY
|
| 343 |
+
|
| 344 |
+
To prove the policy performance bound when the current policy is infeasible (i.e., constraintviolating), we prove the KL divergence between $\pi ^ { k }$ and $\pi ^ { k + 1 }$ for the $\mathrm { K L }$ divergence projection. We then prove our main theorem for the worst-case performance degradation.
|
| 345 |
+
|
| 346 |
+
Lemma S.3. If the current policy $\pi ^ { k }$ violates the constraint, the constraint set is closed and convex, the KL divergence constraint for the first step is $\mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \big [ D _ { \mathrm { K L } } ( \pi ^ { k + \frac { 1 } { 2 } } | | \pi ^ { k } ) [ s ] \big ] \le \delta$ , where $\delta$ is the step size in the reward improvement step, then under the $\bar { K L }$ divergence projection, we have
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\begin{array} { r } { \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] \le \delta + { b ^ { + } } ^ { 2 } \alpha _ { \mathrm { K L } } , } \end{array}
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
where $\begin{array} { r } { \alpha _ { \mathrm { { K L } } } \doteq \frac 1 { 2 a ^ { T } H ^ { - 1 } a } } \end{array}$ , $\textbf { \em a }$ is the gradient of the cost advantage function, . $\pmb { H }$ is the Hessian of the $K L$ divergence constraint, and $b ^ { + } \doteq \operatorname* { m a x } ( 0 , J ^ { C } ( \pi ^ { k } ) - h )$ .
|
| 353 |
+
|
| 354 |
+
Proof. We define the sublevel set of cost constraint function for the current infeasible policy $\pi ^ { k }$ :
|
| 355 |
+
|
| 356 |
+
$$
|
| 357 |
+
\begin{array} { r } { L ^ { \pi ^ { k } } = \{ \pi \mid J ^ { C } ( \pi ^ { k } ) + \mathbb { E } _ { \underset { a \sim \pi } { s \sim d ^ { \pi ^ { k } } } } [ A _ { C } ^ { \pi ^ { k } } ( s , a ) ] \leq J ^ { C } ( \pi ^ { k } ) \} . } \end{array}
|
| 358 |
+
$$
|
| 359 |
+
|
| 360 |
+
This implies that the current policy $\pi ^ { k }$ lies in $L ^ { \pi ^ { k } }$ , and $\pi ^ { k + \frac { 1 } { 2 } }$ is projected onto the constraint set: $\{ \pi \mid J ^ { C } ( \pi ^ { k } ) + \mathbb { E } _ { \stackrel { s \sim d ^ { \pi ^ { k } } } { a \sim \pi } } [ A _ { C } ^ { \pi ^ { k } } ( { \bar { s } } , a ) ] { \overset { \cdot } { \leq } } h \}$ . Next, we define the policy $\pi _ { l } ^ { k + 1 }$ as the projection of $\pi ^ { k + \frac { 1 } { 2 } }$ onto $L ^ { \pi ^ { k } }$ .
|
| 361 |
+
|
| 362 |
+
By the Three-point Lemma, for these three polices $\pi ^ { k } , \pi ^ { k + 1 }$ , and $\pi _ { l } ^ { k + 1 }$ , with $\textstyle \varphi ( { \pmb x } ) \doteq \sum _ { i } x _ { i } \log x _ { i }$ (this is illustrated in Fig. 6), we have
|
| 363 |
+
|
| 364 |
+
$$
|
| 365 |
+
\begin{array} { r l } { \delta \geq \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi _ { l } ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] = \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] } & { } \\ { - \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi _ { l } ^ { k + 1 } ) [ s ] \right] } & { } \\ { + \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ ( \nabla \varphi ( \pi ^ { k } ) - \nabla \varphi ( \pi _ { l } ^ { k + 1 } ) ) ^ { T } ( \pi ^ { k + 1 } - \pi _ { l } ^ { k + 1 } ) [ s ] \right] } & { } \\ { \Rightarrow \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] \leq \delta + \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi _ { l } ^ { k + 1 } ) [ s ] \right] } & { } \\ { - \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ ( \nabla \varphi ( \pi ^ { k } ) - \nabla \varphi ( \pi _ { l } ^ { k + 1 } ) ) ^ { T } ( \pi ^ { k + 1 } - \pi _ { l } ^ { k + 1 } ) [ s ] \right] . } & { } \end{array}
|
| 366 |
+
$$
|
| 367 |
+
|
| 368 |
+
The inequality $\mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi _ { l } ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] \le \delta$ comes from that $\pi ^ { k }$ and $\pi _ { l } ^ { k + 1 }$ are in $L ^ { \pi ^ { k } }$ , and Lemma S.1.
|
| 369 |
+
|
| 370 |
+
If the constraint violation of the current policy $\pi ^ { k }$ is small, i.e., $b ^ { + }$ is small, $\mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi _ { l } ^ { k + 1 } ) [ s ] \right]$ can be approximated by the second order expansion. By the
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 6: Update procedures for PCPO when the current policy $\pi ^ { k }$ is infeasible. $\pi _ { l } ^ { k + 1 }$ is the projection of $\pi ^ { k + \frac { 1 } { 2 } }$ onto the sublevel set of the constraint set. We find the KL divergence between $\pi ^ { k }$ and $\pi ^ { k + 1 }$ .
|
| 374 |
+
|
| 375 |
+
update rule in Eq. (6), we have
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\begin{array} { l } { \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi _ { l } ^ { k + 1 } ) [ s ] \right] \approx \frac { 1 } { 2 } ( \theta ^ { k + 1 } - \theta _ { l } ^ { k + 1 } ) ^ { T } H ( \theta ^ { k + 1 } - \theta _ { l } ^ { k + 1 } ) } \\ { = \frac { 1 } { 2 } \Big ( \frac { b ^ { + } } { a ^ { T } H ^ { - 1 } a } H ^ { - 1 } a \Big ) ^ { T } H \Big ( \frac { b ^ { + } } { a ^ { T } H ^ { - 1 } a } H ^ { - 1 } a \Big ) } \\ { = \frac { b ^ { + 2 } } { 2 a ^ { T } H ^ { - 1 } a } } \\ { = b ^ { + ^ { 2 } } \alpha _ { \mathrm { K L } } , } \end{array}
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
$\begin{array} { r } { \alpha _ { \mathrm { K L } } \doteq \frac { 1 } { 2 a ^ { T } H ^ { - 1 } a } } \end{array}$
|
| 382 |
+
|
| 383 |
+
And since $\delta$ is small, we have $\nabla \varphi ( \pi ^ { k } ) - \nabla \varphi ( \pi _ { l } ^ { k + 1 } ) \approx \mathbf { 0 }$ given $s$ . Thus, the third term in Eq. (11) can be eliminated.
|
| 384 |
+
|
| 385 |
+
Combining Eq. (11) and Eq. (12), we have
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
\begin{array} { r } { \mathbb { E } _ { s \sim d ^ { \pi ^ { k } } } \left[ D _ { \mathrm { K L } } ( \pi ^ { k + 1 } | | \pi ^ { k } ) [ s ] \right] \le \delta + { b ^ { + } } ^ { 2 } \alpha _ { \mathrm { K L } } . } \end{array}
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
Now we use Lemma S.3 to prove our main theorem.
|
| 392 |
+
|
| 393 |
+
$\epsilon _ { R } ^ { \pi ^ { k + 1 } } \doteq \operatorname* { m a x } _ { s } \big | \mathbb { E } _ { a \sim \pi ^ { k + 1 } } [ A _ { R } ^ { \pi ^ { k } } ( s , a ) ] \big | , \epsilon _ { C } ^ { \pi ^ { k + 1 } } \doteq \operatorname* { m a x } _ { s } \big | \mathbb { E } _ { a \sim \pi ^ { k + 1 } } [ A _ { C } ^ { \pi ^ { k } } ( s , a ) ] \big | ,$ $b ^ { + } \doteq \operatorname* { m a x } ( 0 , J ^ { C } ( \pi ^ { k } ) - h )$ $\begin{array} { r } { \alpha _ { \mathrm { { K L } } } \doteq \frac 1 { 2 a ^ { T } H ^ { - 1 } a } } \end{array}$ $^ { a }$ function and $\pmb { H }$ is the Hessian of the $K L$ divergence constraint. If the current policy $\pi ^ { k }$ violates the constraint, then under the $K L$ divergence projection, the lower bound on reward improvement and the upper bound on constraint violation for each policy update are
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
\begin{array} { r } { J ^ { R } ( \pi ^ { k + 1 } ) - J ^ { R } ( \pi ^ { k } ) \geq - \frac { \sqrt { 2 ( \delta + { b ^ { + } } ^ { 2 } \alpha _ { \mathrm { K L } } ) } \gamma \epsilon _ { R } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } , } \\ { a n d J ^ { C } ( \pi ^ { k + 1 } ) \leq h + \frac { \sqrt { 2 ( \delta + { b ^ { + } } ^ { 2 } \alpha _ { \mathrm { K L } } ) } \gamma \epsilon _ { C } ^ { \pi ^ { k + 1 } } } { ( 1 - \gamma ) ^ { 2 } } , } \end{array}
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
where $\delta$ is the step size in the reward improvement step.
|
| 400 |
+
|
| 401 |
+
Proof. Following the same proof in Theorem S.2, we complete the proof.
|
| 402 |
+
|
| 403 |
+
Note that the bounds we obtain for the infeasibe case; to the best of our knowledge, are new results.
|
| 404 |
+
|
| 405 |
+
S.3 PROOF OF ANALYTICAL SOLUTION TO PCPO
|
| 406 |
+
|
| 407 |
+
Theorem S.5. Consider the PCPO problem. In the first step, we optimize the reward:
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\begin{array} { r l } { \pmb { \theta } ^ { k + \frac { 1 } { 2 } } = \underset { \pmb { \theta } } { \arg \operatorname* { m a x } } } & { \pmb { g } ^ { T } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) } \\ { s . t . } & { \frac { 1 } { 2 } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) ^ { T } \pmb { H } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) \leq \delta , } \end{array}
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
and in the second step, we project the policy onto the constraint set:
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
\begin{array} { r l } { \pmb { \theta } ^ { k + 1 } = \underset { \pmb { \theta } } { \arg \operatorname* { m i n } } } & { \frac { 1 } { 2 } ( \pmb { \theta } - \pmb { \theta } ^ { k + \frac { 1 } { 2 } } ) ^ { T } \pmb { L } ( \pmb { \theta } - \pmb { \theta } ^ { k + \frac { 1 } { 2 } } ) } \\ { s . t . } & { \pmb { a } ^ { T } ( \pmb { \theta } - \pmb { \theta } ^ { k } ) + b \leq 0 , } \end{array}
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
where $g , a , \theta \in \mathbb { R } ^ { n } , b , \delta \in \mathbb { R } , \delta > 0$ , and $H , L \in \mathbb { R } ^ { n \times n } , L = H$ if using the $K L$ divergence projection, and ${ L = I }$ if using the $L ^ { 2 }$ norm projection. When there is at least one strictly feasible point, the optimal solution satisfies
|
| 420 |
+
|
| 421 |
+
$$
|
| 422 |
+
\pmb { \theta } ^ { k + 1 } = \pmb { \theta } ^ { k } + \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { H } ^ { - 1 } g - \operatorname* { m a x } ( 0 , \frac { \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { a } ^ { T } \pmb { H } ^ { - 1 } g + b } { \pmb { a } ^ { T } L ^ { - 1 } \pmb { a } } ) L ^ { - 1 } \pmb { a } ,
|
| 423 |
+
$$
|
| 424 |
+
|
| 425 |
+
assuming that $\pmb { H }$ is invertible to get a unique solution.
|
| 426 |
+
|
| 427 |
+
Proof. For the first problem, since $\pmb { H }$ is the Fisher Information matrix, which automatically guarantees it is positive semi-definite. Hence it is a convex program with quadratic inequality constraints. Hence if the primal problem has a feasible point, then Slaters condition is satisfied and strong duality holds. Let $\pmb { \theta } ^ { * }$ and $\lambda ^ { * }$ denote the solutions to the primal and dual problems, respectively. In addition, the primal objective function is continuously differentiable. Hence the Karush-Kuhn-Tucker (KKT) conditions are necessary and sufficient for the optimality of $\pmb { \theta } ^ { * }$ and $\lambda ^ { * }$ . We now form the Lagrangian:
|
| 428 |
+
|
| 429 |
+
$$
|
| 430 |
+
\mathcal { L } ( \pmb \theta , \lambda ) = - \pmb { g } ^ { T } ( \pmb \theta - \pmb \theta ^ { k } ) + \lambda \bigg ( \frac 1 2 ( \pmb \theta - \pmb \theta ^ { k } ) ^ { T } \pmb { H } ( \pmb \theta - \pmb \theta ^ { k } ) - \delta \bigg ) .
|
| 431 |
+
$$
|
| 432 |
+
|
| 433 |
+
And we have the following KKT conditions:
|
| 434 |
+
|
| 435 |
+
$$
|
| 436 |
+
\begin{array} { r l } { - g + \lambda ^ { * } H \pmb { \theta } ^ { * } - \lambda ^ { * } H \pmb { \theta } ^ { k } = 0 \quad } & { \nabla _ { \theta } \mathcal { L } ( \pmb { \theta } ^ { * } , \lambda ^ { * } ) = 0 } \\ { \frac { 1 } { 2 } ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) ^ { T } H ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) - \delta = 0 \quad } & { \nabla _ { \lambda } \mathcal { L } ( \pmb { \theta } ^ { * } , \lambda ^ { * } ) = 0 } \\ { \frac { 1 } { 2 } ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) ^ { T } H ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) - \delta \leq 0 \quad } & { \mathrm { p r i m a l ~ c o n s t r a i n t s } } \\ { \lambda ^ { * } \geq 0 \quad } & { \mathrm { d u a l ~ c o n s t r a i n t s } } \\ { \lambda ^ { * } \left( \frac { 1 } { 2 } ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) ^ { T } H ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) - \delta \right) = 0 \quad } & { \mathrm { c o m p l e m e n t a r y ~ s l a c k n e s s } } \end{array}
|
| 437 |
+
$$
|
| 438 |
+
|
| 439 |
+
By Eq. (13), we have $\pmb { \theta } ^ { * } = \pmb { \theta } ^ { k } + \textstyle \frac { 1 } { \lambda ^ { * } } \pmb { H } ^ { - 1 } \pmb { g }$ . And by plugging Eq. (13) into Eq. (14), we have $\begin{array} { r } { \lambda ^ { * } = \sqrt { \frac { g ^ { T } H ^ { - 1 } g } { 2 \delta } } } \end{array}$ gT H−1g2δ . Hence we have our optimal solution:
|
| 440 |
+
|
| 441 |
+
$$
|
| 442 |
+
\pmb { \theta } ^ { k + \frac { 1 } { 2 } } = \pmb { \theta } ^ { \ast } = \pmb { \theta } ^ { k } + \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { H } ^ { - 1 } \pmb { g } ,
|
| 443 |
+
$$
|
| 444 |
+
|
| 445 |
+
which also satisfies Eq. (15), Eq. (16), and Eq. (17).
|
| 446 |
+
|
| 447 |
+
Following the same reasoning, we now form the Lagrangian of the second problem:
|
| 448 |
+
|
| 449 |
+
$$
|
| 450 |
+
\mathcal { L } ( \pmb \theta , \lambda ) = \frac { 1 } { 2 } ( \pmb \theta - \pmb \theta ^ { k + \frac { 1 } { 2 } } ) ^ { T } L ( \pmb \theta - \pmb \theta ^ { k + \frac { 1 } { 2 } } ) + \lambda ( \mathbf { \alpha } ^ { T } ( \pmb \theta - \pmb \theta ^ { k } ) + b ) .
|
| 451 |
+
$$
|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
Figure 7: The projection onto the convex set with $\pmb { \theta } ^ { \prime } \in \mathcal { C }$ and $\theta ^ { * } = \mathrm { P r o j } _ { \mathcal { C } } ^ { L } ( \theta )$ .
|
| 455 |
+
|
| 456 |
+
And we have the following KKT conditions:
|
| 457 |
+
|
| 458 |
+
$$
|
| 459 |
+
\begin{array} { r l } { L \theta ^ { * } - L \theta ^ { k + \frac { 1 } { 2 } } + \lambda ^ { * } \pmb { a } = 0 \quad } & { \nabla _ { \theta } \mathcal { L } ( \pmb { \theta } ^ { * } , \lambda ^ { * } ) = 0 } \\ { \pmb { a } ^ { T } ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) + b = 0 \quad } & { \nabla _ { \lambda } \mathcal { L } ( \pmb { \theta } ^ { * } , \lambda ^ { * } ) = 0 } \\ { \pmb { a } ^ { T } ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) + b \leq 0 \quad } & { \mathrm { p r i m a l ~ c o n s t r a i n t s } } \\ { \lambda ^ { * } \geq 0 \quad } & { \mathrm { d u a l ~ c o n s t r a i n t s } } \\ { \lambda ^ { * } ( \pmb { a } ^ { T } ( \pmb { \theta } ^ { * } - \pmb { \theta } ^ { k } ) + b ) = 0 \quad } & { \mathrm { c o m p l e m e n t a r y ~ s l a c k n e s s } } \end{array}
|
| 460 |
+
$$
|
| 461 |
+
|
| 462 |
+
By Eq. (19), we have $\pmb { \theta } ^ { * } = \pmb { \theta } ^ { k + 1 } + \lambda ^ { * } \pmb { L } ^ { - 1 } \pmb { a }$ . And by plugging Eq. (19) into Eq. (20) and Eq. (22), we have $\begin{array} { r } { \lambda ^ { * } = \operatorname* { m a x } ( 0 , \frac { { { a } ^ { T } ( \pmb { \theta } ^ { k + \frac { 1 } { 2 } } - \pmb { \theta } ^ { k } ) } + b } { a { \cal L } ^ { - 1 } a } ) } \end{array}$ . Hence we have our optimal solution:
|
| 463 |
+
|
| 464 |
+
$$
|
| 465 |
+
\pmb \theta ^ { k + 1 } = \pmb \theta ^ { * } = \pmb \theta ^ { k + \frac { 1 } { 2 } } - \operatorname* { m a x } ( 0 , \frac { \pmb a ^ { T } ( \pmb \theta ^ { k + \frac { 1 } { 2 } } - \pmb \theta ^ { k } ) + b } { \pmb a ^ { T } \pmb L ^ { - 1 } \pmb a ^ { T } } ) \pmb L ^ { - 1 } \pmb a ,
|
| 466 |
+
$$
|
| 467 |
+
|
| 468 |
+
which also satisfies Eq. (21) and Eq. (23). Hence by Eq. (18) and Eq. (24), we have
|
| 469 |
+
|
| 470 |
+
$$
|
| 471 |
+
\pmb { \theta } ^ { k + 1 } = \pmb { \theta } ^ { k } + \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { H } ^ { - 1 } g - \operatorname* { m a x } ( 0 , \frac { \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { a } ^ { T } H ^ { - 1 } g + b } { \pmb { a } ^ { T } L ^ { - 1 } \pmb { a } } ) L ^ { - 1 } \pmb { a } .
|
| 472 |
+
$$
|
| 473 |
+
|
| 474 |
+
# S.4 PROOF OF THEOREM 4.1: STATIONARY POINTS OF PCPO WITH THE KL DIVERGENCE AND $L ^ { 2 }$ NORM PROJECTIONS
|
| 475 |
+
|
| 476 |
+
For our analysis, we make the following assumptions: we minimize the negative reward objective function $f : \mathbb { R } ^ { n } \mathbb { R }$ (We follow the convention of the literature that authors typically minimize the objective function). The function $f$ is $L$ -smooth and twice continuously differentiable over the closed and convex constraint set $\mathcal { C }$ . We have the following lemma to characterize the projection and for the proof of Theorem S.7. (See Fig. 7 for semantic illustration.)
|
| 477 |
+
|
| 478 |
+
Lemma S.6. For any $\pmb \theta$ , $\theta ^ { * } = \mathrm { P r o j } _ { \mathcal { C } } ^ { L } ( \theta )$ if and only $i f ( \pmb \theta - \pmb \theta ^ { * } ) ^ { T } \pmb { L } ( \pmb \theta ^ { \prime } - \pmb \theta ^ { * } ) \leq 0 , \forall \pmb \theta ^ { \prime } \in \mathcal { C }$ , where $\operatorname* { P r o j } _ { \mathcal { C } } ^ { L } ( \pmb { \theta } ) \doteq \arg \operatorname* { m i n } _ { \pmb { \theta } ^ { \prime } \in \mathcal { C } } | | \pmb { \theta } - \pmb { \theta } ^ { \prime } | | _ { L } ^ { 2 }$ , and ${ \pmb { L } } = { \pmb { H } }$ if using the $K L$ divergence projection, and $L = I \ i f$ using the $L ^ { 2 }$ norm projection.
|
| 479 |
+
|
| 480 |
+
Proof. $( \Rightarrow )$ Let $\theta ^ { * } = \mathrm { P r o j } _ { \mathcal { C } } ^ { L } ( \theta )$ for a given $\pmb \theta \notin \mathcal { C }$ , $\pmb { \theta } ^ { \prime } \in \mathcal { C }$ be such that $\theta ^ { \prime } \neq \theta ^ { * }$ , and $\alpha \in ( 0 , 1 )$ . Then we have
|
| 481 |
+
|
| 482 |
+
$$
|
| 483 |
+
\begin{array} { c } { | | \theta - \theta ^ { * } | | _ { L } ^ { 2 } \leq | | \theta - \left( \theta ^ { * } + \alpha ( \theta ^ { \prime } - \theta ^ { * } ) \right) | | _ { L } ^ { 2 } } \\ { = | | \theta - \theta ^ { * } | | _ { L } ^ { 2 } + \alpha ^ { 2 } | | \theta ^ { \prime } - \theta ^ { * } | | _ { L } ^ { 2 } - 2 \alpha ( \theta - \theta ^ { * } ) ^ { T } L ( \theta ^ { \prime } - \theta ^ { * } ) } \\ { \Rightarrow ( \theta - \theta ^ { * } ) ^ { T } L ( \theta ^ { \prime } - \theta ^ { * } ) \leq \displaystyle \frac { \alpha } { 2 } | | \theta ^ { \prime } - \theta ^ { * } | | _ { L } ^ { 2 } . } \end{array}
|
| 484 |
+
$$
|
| 485 |
+
|
| 486 |
+
Since the right hand side of Eq. (25) can be made arbitrarily small for a given $\alpha$ , and hence we have:
|
| 487 |
+
|
| 488 |
+
$$
|
| 489 |
+
( \pmb \theta - \pmb \theta ^ { * } ) ^ { T } \pmb L ( \pmb \theta ^ { \prime } - \pmb \theta ^ { * } ) \leq 0 , \forall \pmb \theta ^ { \prime } \in \mathcal { C } .
|
| 490 |
+
$$
|
| 491 |
+
|
| 492 |
+
$( \Leftarrow )$ Let $\theta ^ { \ast } \in \mathcal { C }$ be such that $( \pmb \theta - \pmb \theta ^ { * } ) ^ { T } \pmb L ( \pmb \theta ^ { \prime } - \pmb \theta ^ { * } ) \leq 0 , \forall \pmb \theta ^ { \prime } \in \mathcal { C }$ . We show that $\pmb { \theta } ^ { * }$ must be the optimal solution. Let $\pmb { \theta } ^ { \prime } \in \mathcal { C }$ and $\pmb { \theta } ^ { \prime } \neq \pmb { \theta } ^ { * }$ . Then we have
|
| 493 |
+
|
| 494 |
+
$$
|
| 495 |
+
\begin{array} { r l } & { \| \theta - \theta ^ { \prime } \| _ { L } ^ { 2 } - \| \theta - \theta ^ { * } \| _ { L } ^ { 2 } = \| \theta - \theta ^ { * } + \theta ^ { * } - \theta ^ { \prime } \| _ { L } ^ { 2 } - \| \theta - \theta ^ { * } \| _ { L } ^ { 2 } } \\ & { \qquad = \| \theta - \theta ^ { * } \| _ { L } ^ { 2 } + \| \theta ^ { \prime } - \theta ^ { * } \| _ { L } ^ { 2 } - 2 ( \theta - \theta ^ { * } ) ^ { T } L ( \theta ^ { \prime } - \theta ^ { * } ) - | | \theta - \theta ^ { * } | | _ { L } ^ { 2 } } \\ & { \qquad > 0 } \\ & { \qquad \Rightarrow \| \theta - \theta ^ { \prime } \| _ { L } ^ { 2 } > \| \theta - \theta ^ { * } \| _ { L } ^ { 2 } . } \end{array}
|
| 496 |
+
$$
|
| 497 |
+
|
| 498 |
+
Hence, $\pmb { \theta } ^ { * }$ is the optimal solution to the optimization problem, and $\theta ^ { * } = \mathrm { P r o j } _ { \mathcal { C } } ^ { L } ( \theta )$
|
| 499 |
+
|
| 500 |
+
Based on Lemma S.6, we have the following theorem.
|
| 501 |
+
|
| 502 |
+
Theorem S.7. Let $\eta \doteq \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } }$ in Eq. (6), where $\delta$ is the step size for reward improvement, $\textbf { { g } }$ is the gradient of $f$ , $\pmb { H }$ is the Fisher information matrix. Let $\sigma _ { \mathrm { m a x } } ( H )$ be the largest singular value of $\pmb { H }$ , and a be the gradient of cost advantage function in Eq. (6). Then PCPO with the $K L$ divergence projection converges to stationary points with $\mathbf { \Delta } _ { \mathbf { { g } } } \in - \mathbf { \Delta } \mathbf { { a } }$ (i.e., the gradient of $f$ belongs to the negative gradient of the cost advantage function). The objective value changes by
|
| 503 |
+
|
| 504 |
+
$$
|
| 505 |
+
f ( \pmb { \theta } ^ { k + 1 } ) \leq f ( \pmb { \theta } ^ { k } ) + | | \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } | | _ { - \frac { 1 } { \eta } \pmb { H } + \frac { L } { 2 } \pmb { I } } ^ { 2 } .
|
| 506 |
+
$$
|
| 507 |
+
|
| 508 |
+
PCPO with the $L ^ { 2 }$ norm projection converges to stationary points with $\pmb { H } ^ { - 1 } \pmb { g } \in \mathbb { - } \pmb { a }$ (i.e., the product of the inverse of $\pmb { H }$ and gradient of $f$ belongs to the negative gradient of the cost advantage function). If $\sigma _ { \operatorname* { m a x } } ( \pmb { H } ) \le 1$ , then the objective value changes by
|
| 509 |
+
|
| 510 |
+
$$
|
| 511 |
+
f ( \pmb { \theta } ^ { k + 1 } ) \leq f ( \pmb { \theta } ^ { k } ) + ( \frac { L } { 2 } - \frac { 1 } { \eta } ) | | \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } | | _ { 2 } ^ { 2 } .
|
| 512 |
+
$$
|
| 513 |
+
|
| 514 |
+
Proof. The proof of the theorem is based on working in a Hilbert space and the non-expansive property of the projection. We first prove stationary points for PCPO with the KL divergence and $\bar { L } ^ { 2 }$ norm projections, and then prove the change of the objective value.
|
| 515 |
+
|
| 516 |
+
When in stationary points $\pmb { \theta } ^ { * }$ , we have
|
| 517 |
+
|
| 518 |
+
$$
|
| 519 |
+
\begin{array} { r l } & { \pmb { \theta } ^ { * } = \pmb { \theta } ^ { * } - \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { H } ^ { - 1 } \pmb { g } - \operatorname* { m a x } ( 0 , \frac { \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { a } ^ { T } H ^ { - 1 } \pmb { g } + b } { \pmb { a } ^ { T } L ^ { - 1 } \pmb { a } } ) L ^ { - 1 } \pmb { a } . } \\ & { \Leftrightarrow \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { H } ^ { - 1 } \pmb { g } = - \operatorname* { m a x } ( 0 , \frac { \sqrt { \frac { 2 \delta } { g ^ { T } H ^ { - 1 } g } } \pmb { a } ^ { T } H ^ { - 1 } \pmb { g } + b } { \pmb { a } ^ { T } L ^ { - 1 } \pmb { a } } ) L ^ { - 1 } \pmb { a } } \\ & { \Leftrightarrow H ^ { - 1 } \pmb { g } \in - L ^ { - 1 } \pmb { a } . } \end{array}
|
| 520 |
+
$$
|
| 521 |
+
|
| 522 |
+
For the $\mathrm { K L }$ divergence projection $\mathbf { \nabla } \mathbf { L } = \mathbf { \nabla } H _ { \mathbf { \nabla } }$ ), Eq. (28) boils down to $\pmb { { g } } \in - \pmb { { a } }$ , and for the $L ^ { 2 }$ norm projection $\mathbf { \delta L } = \mathbf { I } .$ ), Eq. (28) is equivalent to $\pmb { H } ^ { - 1 } \pmb { g } \in - \pmb { a }$ .
|
| 523 |
+
|
| 524 |
+
Now we prove the second part of the theorem. Based on Lemma S.6, for the KL divergence projection, we have
|
| 525 |
+
|
| 526 |
+
$$
|
| 527 |
+
\begin{array} { r l r } & { } & { ( \pmb { \theta } ^ { k } - \pmb { \theta } ^ { k + 1 } ) ^ { T } \pmb { H } ( \pmb { \theta } ^ { k } - \eta \pmb { H } ^ { - 1 } \pmb { g } - \pmb { \theta } ^ { k + 1 } ) \leq 0 } \\ & { } & { \Rightarrow g ^ { T } ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) \leq - \cfrac { 1 } { \eta } \vert \vert \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } \vert \vert _ { \pmb { H } } ^ { 2 } . } \end{array}
|
| 528 |
+
$$
|
| 529 |
+
|
| 530 |
+
By Eq. (29), and $L$ -smooth continuous function $f$ , we have
|
| 531 |
+
|
| 532 |
+
$$
|
| 533 |
+
\begin{array} { l } { f ( { \theta } ^ { k + 1 } ) \le f ( { \theta } ^ { k } ) + g ^ { T } ( { \theta } ^ { k + 1 } - { \theta } ^ { k } ) + \displaystyle \frac { L } { 2 } | | { \theta } ^ { k + 1 } - { \theta } ^ { k } | | _ { 2 } ^ { 2 } } \\ { \le f ( { \theta } ^ { k } ) - \displaystyle \frac { 1 } { \eta } | | { \theta } ^ { k + 1 } - { \theta } ^ { k } | | _ { H } ^ { 2 } + \displaystyle \frac { L } { 2 } | | { \theta } ^ { k + 1 } - { \theta } ^ { k } | | _ { 2 } ^ { 2 } } \\ { = f ( { \theta } ^ { k } ) + ( { \theta } ^ { k + 1 } - { \theta } ^ { k } ) ^ { T } ( - \displaystyle \frac { 1 } { \eta } H + \displaystyle \frac { L } { 2 } I ) ( { \theta } ^ { k + 1 } - { \theta } ^ { k } ) } \\ { \quad = f ( { \theta } ^ { k } ) + | | { \theta } ^ { k + 1 } - { \theta } ^ { k } | | _ { - \frac { 1 } { \eta } H + \frac { L } { 2 } I } ^ { 2 } . } \end{array}
|
| 534 |
+
$$
|
| 535 |
+
|
| 536 |
+
For the $L ^ { 2 }$ norm projection, we have
|
| 537 |
+
|
| 538 |
+
$$
|
| 539 |
+
\begin{array} { r } { ( \pmb \theta ^ { k } - \pmb \theta ^ { k + 1 } ) ^ { T } ( \pmb \theta ^ { k } - \eta \pmb H ^ { - 1 } \pmb g - \pmb \theta ^ { k + 1 } ) \leq 0 } \\ { \Rightarrow g ^ { T } \pmb H ^ { - 1 } ( \pmb \theta ^ { k + 1 } - \pmb \theta ^ { k } ) \leq - \displaystyle \frac { 1 } { \eta } | | \pmb \theta ^ { k + 1 } - \pmb \theta ^ { k } | | _ { 2 } ^ { 2 } . } \end{array}
|
| 540 |
+
$$
|
| 541 |
+
|
| 542 |
+
By Eq. (30), $L$ -smooth continuous function $f$ , and if $\sigma _ { \mathrm { m a x } } ( \pmb { H } ) \leq 1$ , we have
|
| 543 |
+
|
| 544 |
+
$$
|
| 545 |
+
\begin{array} { l } { f ( \pmb \theta ^ { k + 1 } ) \leq f ( \pmb \theta ^ { k } ) + \pmb g ^ { T } ( \pmb \theta ^ { k + 1 } - \pmb \theta ^ { k } ) + \displaystyle \frac { L } { 2 } | | \pmb \theta ^ { k + 1 } - \pmb \theta ^ { k } | | _ { 2 } ^ { 2 } } \\ { \leq f ( \pmb \theta ^ { k } ) + ( \displaystyle \frac { L } { 2 } - \frac { 1 } { \eta } ) | | \pmb \theta ^ { k + 1 } - \pmb \theta ^ { k } | | _ { 2 } ^ { 2 } . } \end{array}
|
| 546 |
+
$$
|
| 547 |
+
|
| 548 |
+
To see why we need the assumption of $\sigma _ { \mathrm { m a x } } ( \pmb { H } ) \leq 1$ , we define $\pmb { H } = \pmb { U } \pmb { \Sigma } \pmb { U } ^ { T }$ as the singular value decomposition of $\pmb { H }$ with $\mathbf { \Delta } \mathbf { u } _ { i }$ being the column vector of $U$ . Then we have
|
| 549 |
+
|
| 550 |
+
$$
|
| 551 |
+
\begin{array} { r l } { { g ^ { T } H ^ { - 1 } ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) = \pmb { g } ^ { T } U \Sigma ^ { - 1 } U ^ { T } ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) } } \\ & { \quad = \pmb { g } ^ { T } ( \sum _ { i } \frac { 1 } { \sigma _ { i } ( H ) } \pmb { u } _ { i } \pmb { u } _ { i } ^ { T } ) ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) } \\ & { \quad = \sum _ { i } \frac { 1 } { \sigma _ { i } ( H ) } \pmb { g } ^ { T } ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) . } \end{array}
|
| 552 |
+
$$
|
| 553 |
+
|
| 554 |
+
If we want to have
|
| 555 |
+
|
| 556 |
+
$$
|
| 557 |
+
g ^ { T } ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) \leq g ^ { T } H ^ { - 1 } ( \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } ) \leq - \frac { 1 } { \eta } | | \pmb { \theta } ^ { k + 1 } - \pmb { \theta } ^ { k } | | _ { 2 } ^ { 2 } ,
|
| 558 |
+
$$
|
| 559 |
+
|
| 560 |
+
then every singular value $\sigma _ { i } ( H )$ of $\pmb { H }$ needs to be smaller than 1, and hence $\sigma _ { \operatorname* { m a x } } ( \pmb { H } ) \le 1$ , which justifies the assumption we use to prove the bound. □
|
| 561 |
+
|
| 562 |
+
To make the objective value for PCPO with the KL dside of Eq. (26) needs to be negative. Hence we hav ${ \frac { L \eta } { 2 } } I \prec H$ jection improv, implying that $\begin{array} { r } { \sigma _ { \mathrm { m i n } } ( \mathbf { H } ) > \frac { L \eta } { 2 } } \end{array}$ d. $L ^ { 2 }$ norm projection improves, the right hand side of Eq. (27) needs to be negative. Hence we have $\begin{array} { r } { \eta < { \frac { 2 } { L } } } \end{array}$ , implying that
|
| 563 |
+
|
| 564 |
+
$$
|
| 565 |
+
\begin{array} { r l } & { \eta = \sqrt { \frac { 2 \hat { g } } { g ^ { \prime } H ^ { - 1 } - g } } < \frac { 2 } { L } } \\ & { \frac { 2 \hat { g } } { g ^ { \prime } H ^ { - 1 } - g } < \frac { 4 } { L ^ { 2 } } } \\ & { \frac { g ^ { \prime } H ^ { - 1 } - g } { 2 } > \frac { 2 } { L ^ { 2 } } } \\ & { \frac { 2 ^ { 2 } H ^ { - 1 } - g } { 2 } > \frac { 2 } { L ^ { 2 } } } \\ & { \frac { L ^ { 2 } \hat { g } } { 2 } < g ^ { \prime } H ^ { - 1 } . } \\ & { \leq | | g | | _ { L ^ { 1 } } | | H ^ { - 1 } g | | _ { L ^ { 1 } } } \\ & { \leq | | g | | | _ { L ^ { 1 } } | | H ^ { - 1 } g | | | _ { L ^ { 1 } } } \\ & { = c _ { \mathrm { m a x } } ( H ^ { - 1 } ) | | g | | _ { L ^ { 2 } } ^ { 2 } } \\ & { = { \mathcal { O } } _ { \mathrm { m a x } } ( H ^ { 1 } ) | | ^ { 2 } . } \\ & { { \mathcal { O } } _ { \mathrm { m a x } } ( H ^ { 1 } ) > \frac { 2 } { 2 } | g | | _ { L ^ { 2 } } ^ { 2 } . } \end{array}
|
| 566 |
+
$$
|
| 567 |
+
|
| 568 |
+
By the definition of the condition number and Eq. (31), we have
|
| 569 |
+
|
| 570 |
+
$$
|
| 571 |
+
\begin{array} { r l } & { \qquad \frac { 1 } { \sigma _ { \mathrm { m i n } } ( H ) } < \frac { 2 | | g | | _ { 2 } ^ { 2 } } { L ^ { 2 } \delta } } \\ & { \Rightarrow \frac { \sigma _ { \mathrm { m a x } } ( H ) } { \sigma _ { \mathrm { m i n } } ( H ) } < \frac { 2 | | g | | _ { 2 } ^ { 2 } \sigma _ { \mathrm { m a x } } ( H ) } { L ^ { 2 } \delta } } \\ & { \qquad \leq \frac { 2 | | g | | _ { 2 } ^ { 2 } } { L ^ { 2 } \delta } , } \end{array}
|
| 572 |
+
$$
|
| 573 |
+
|
| 574 |
+
which justifies what we discuss.
|
| 575 |
+
|
| 576 |
+
# S.5 ADDITIONAL COMPUTATIONAL EXPERIMENTS
|
| 577 |
+
|
| 578 |
+
# S.5.1 IMPLEMENTATION DETAILS
|
| 579 |
+
|
| 580 |
+
For detailed explanation of the task in Achiam et al. (2017), please refer to the appendix of Achiam et al. (2017). For detailed explanation of the task in Vinitsky et al. (2018), please refer to Vinitsky et al. (2018).
|
| 581 |
+
|
| 582 |
+
We use neural networks that take the input of state, and output the mean and variance to be the Gaussian policy in all experiments. For the simulations in the gather and circle tasks, we use a neural network with two hidden layers of size (64, 32). For the simulations in the grid and bottleneck tasks, we use a neural network with two hidden layers of size (16, 16) and (50, 25), respectively. We use tanh as the activation function of the neural network.
|
| 583 |
+
|
| 584 |
+
We use GAE- $\lambda$ approach (Schulman et al., 2015b) to estimate $A _ { R } ^ { \pi } ( s , a )$ and $A _ { C } ^ { \pi } ( s , a )$ . For the simulations in the gather and circle tasks, we use neural network baselines with the same architecture and activation functions as the policy networks. For the simulations in the grid and bottleneck tasks, we use linear baselines.
|
| 585 |
+
|
| 586 |
+
The hyperparameters of each task for all algorithms are as follows (PC: point circle, PG: point gather, AC: ant circle, AG: ant gather, Gr: grid, and BN: bottleneck tasks):
|
| 587 |
+
|
| 588 |
+
<table><tr><td>Parameter</td><td>PC</td><td>PG</td><td>AC</td><td>AG</td><td>Gr</td><td>BN</td></tr><tr><td>discount factor y</td><td>0.995</td><td>0.995</td><td>0.995</td><td>0.995</td><td>0.999</td><td>0.999</td></tr><tr><td>step size δ</td><td>10-4</td><td>10-4</td><td>10-4</td><td>10-4</td><td>10-4</td><td>10-4</td></tr><tr><td>AGAE</td><td>0.95</td><td>0.95</td><td>0.95</td><td>0.95</td><td>0.97</td><td>0.97</td></tr><tr><td>BAE</td><td>1.0</td><td>1.0</td><td>0.5</td><td>0.5</td><td>0.5</td><td>1.0</td></tr><tr><td>Batch size</td><td>50,000</td><td>50,000</td><td>100,000</td><td>100,000</td><td>10,000</td><td>25.000</td></tr><tr><td>Rollout length</td><td>50</td><td>15</td><td>500</td><td>500</td><td>400</td><td>500</td></tr><tr><td>Cost constraint threshold h</td><td>5</td><td>0.1</td><td>10</td><td>0.2</td><td>0</td><td>0</td></tr></table>
|
| 589 |
+
|
| 590 |
+
Note that we do not use a learned model to predict the probability of entering an undesirable state within a fixed time horizon as CPO did for cost shaping.
|
| 591 |
+
|
| 592 |
+
# S.5.2 EXPERIMENT RESULTS
|
| 593 |
+
|
| 594 |
+
To examine the performance of the algorithms with different metrics, we provide the learning curves of the cumulative constraint value over policy update, and the reward versus the cumulative constraint value for the tested algorithms and task pairs in Section 6 shown in Fig. 8. The second metric enables us to compare the reward difference under the same number of cumulative constraint violation.
|
| 595 |
+
|
| 596 |
+
Overall, we find that,
|
| 597 |
+
|
| 598 |
+
(a) CPO has more cumulative constraint violation than PCPO.
|
| 599 |
+
(b) PCPO with $L ^ { 2 }$ norm projection has less cumulative constraint violation than KL divergence projection except for the point circle and point gather tasks. This observation suggests that the Fisher information matrix is not well-estimated in the high dimensional policy space, leading to have more constraint violation.
|
| 600 |
+
(c) PCPO has more reward improvement compared to CPO under the same number of cumulative constraint violation in point circle, point gather, ant circle, ant gather, and bottleneck task.
|
| 601 |
+
|
| 602 |
+
# S.5.3 CPO WITHOUT LINE SEARCH
|
| 603 |
+
|
| 604 |
+
Due to approximation errors, CPO performs line search to check whether the updated policy satisfies the trust region and cost constraints. To understand the necessity of line search in CPO, we conducted the experiment with and without line search shown in Fig. 9. The step size $\delta$ is set to 0.01. We find that CPO without line search tends to (1) have large reward variance especially in the point circle task, and (2) learn constraint-satisfying policies slightly faster. These observations suggest that line search is more conservative in optimizing the policies since it usually take smaller steps. However, we conjecture that if using smaller $\delta$ , the effect of line search is not significant.
|
| 605 |
+
|
| 606 |
+

|
| 607 |
+
Figure 8: The values of the cumulative constraint value over policy update, and the reward versus the cumulative constraint value for the tested algorithms and task pairs. The solid line is the mean and the shaded area is the standard deviation, over five runs. The curves for baseline oracle, TRPO, indicate the performance when the constraint is ignored. (Best viewed in color, and the legend is shared across all the figures.)
|
| 608 |
+
|
| 609 |
+
# S.5.4 THE TASKS WITH HARDER CONSTRAINTS
|
| 610 |
+
|
| 611 |
+
To understand the stability of PCPO and CPO when deployed in more constraint-critical tasks, we increase the difficulty of the task by setting the constraint threshold to zero and reduce the safe area. The learning curve of discounted reward and constraint value over policy updates are shown in Fig. 10.
|
| 612 |
+
|
| 613 |
+
We observe that even with more difficult constraint, PCPO still has more reward improvement and constraint satisfaction than CPO, whereas CPO needs more feasible recovery steps to satisfy the constraint. In addition, we observe that PCPO with $L ^ { 2 }$ norm projection has high constraint variance in point circle task, suggesting that the reward update direction is not well aligned with the cost update direction. We also observe that PCPO with $L ^ { 2 }$ norm projection converges to a bad local optimum in terms of reward in point gather task, suggesting that in order to satisfy the constraint, the cost update direction destroys the reward update direction.
|
| 614 |
+
|
| 615 |
+

|
| 616 |
+
Figure 9: The values of the reward and the constraint value for the tested algorithms and task pairs. The solid line is the mean and the shaded area is the standard deviation, over five runs. The dash line in the cost constraint plot is the cost constraint threshold $h$ . Line search helps to stabilize the training. (Best viewed in color)
|
| 617 |
+
|
| 618 |
+

|
| 619 |
+
Figure 10: The values of the reward and the constraint value for the tested algorithms and task pairs. The solid line is the mean and the shaded area is the standard deviation, over five runs. The dash line in the cost constraint plot is the cost constraint threshold $h$ . PCPO with KL divergence projection is the only one that can satisfy the constraint with the highest reward. (Best viewed in color)
|
| 620 |
+
|
| 621 |
+

|
| 622 |
+
Figure 11: The values of the reward and the constraint value for the tested algorithms and task pairs. The solid line is the mean and the shaded area is the standard deviation, over five runs. The dash line in the cost constraint plot is the cost constraint threshold $h$ . The curves for baseline oracle, TRPO, indicate the reward and constraint violation values when the constraint is ignored. We only use $1 \%$ of samples compared to the previous simulations for each policy update. PCPO still satisfies the constraints quickly even when the constraint set is not well-estimated. (Best viewed in color)
|
| 623 |
+
|
| 624 |
+
# S.5.5 SMALLER BATCH SAMPLES
|
| 625 |
+
|
| 626 |
+
To learn policies under constraints, PCPO and CPO require to have a good estimation of the constraint set. However, PCPO may project the policy onto the space that violates the constraint due to the assumption of approximating the constraint set by linear half space constraint. To understand whether the estimation accuracy of the constraint set affects the performance, we conducted the experiments with batch sample size reducing to $1 \%$ of the previous experiments (only 500 samples for each policy update) shown in Fig. 11.
|
| 627 |
+
|
| 628 |
+
We find that smaller training samples affects the performance of the algorithm, creating more reward and cost fluctuation. However, we observe that even with smaller training samples, PCPO still has more reward improvement and constraint satisfaction than CPO.
|
| 629 |
+
|
| 630 |
+
# S.6 ANALYSIS OF THE APPROXIMATION ERROR AND THE COMPUTATIONAL COST OF THE CONJUGATE GRADIENT METHOD
|
| 631 |
+
|
| 632 |
+
In the Grid task, we observe that PCPO with KL divergence projection does worse in reward than TRPO, which is expected since TRPO ignores constraints. However, TRPO actually outperforms PCPO with KL divergence projection in terms of constraint, which is unexpected since by trying to consider the constraint, PCPO with KL divergence projection has made constraint satisfaction worse.
|
| 633 |
+
|
| 634 |
+
The reason for this observation is that the Fisher information matrix is ill-conditioned, i.e., the condition number $\lambda _ { \operatorname* { m a x } } ( { H } ) / \lambda _ { \operatorname* { m i n } } ( { H } )$ $\lambda _ { \mathrm { m a x } }$ is the largest eigenvalue of the matrix) of the Fisher information matrix is large, causing conjugate gradient method that computes constraint update direction ${ \pmb { H } } ^ { - 1 } { \pmb { a } }$ with small number of iteration output the inaccurate approximation. Hence the inaccurate approximation of ${ \pmb { H } } ^ { - 1 } { \pmb { a } }$ cause PCPO with KL divergence projection have more constraint violation than TRPO.
|
| 635 |
+
|
| 636 |
+

|
| 637 |
+
Figure 12: (1) The values of the reward and the constraint, (2) the condition number of the Fisher information matrix, and (3) the approximation error of the constraint update direction over training epochs with the conjugate gradient method’s iteration of 10 and 20, respectively. The one with larger number of iteration has more constraint satisfaction since it has more accurate approximation. (Best viewed in color)
|
| 638 |
+
|
| 639 |
+
To solve this issue, one can have more epochs of conjugate gradient method. This is because that the convergence of conjugate gradient method is controlled by the condition number (Shewchuk, 1994); the larger the condition number is, the more epochs the algorithm needs to get accurate approximation. In our experiments, we set the number of iteration of conjugate gradient method to be 10 to tradeoff between the computational efficiency and the accuracy across all tested algorithms and task pairs.
|
| 640 |
+
|
| 641 |
+
To verify our observation, we compare the condition number of the Fisher information matrix, and the approximation error of the constraint update direction over training epochs with different number of iteration of the conjugate gradient method shown in Fig. 12.
|
| 642 |
+
|
| 643 |
+
We observe that the Fisher information matrix is ill-conditioned, and the one with larger number of iteration has less error and more constraint satisfaction. This observation confirms our discussion.
|
| 644 |
+
|
| 645 |
+
# S.7 COMPARISON OF OPTIMIZATION PATHS OF PCPO WITH KL DIVERGENCE AND $L ^ { 2 }$ NORM PROJECTIONS
|
| 646 |
+
|
| 647 |
+
Theorem 4.1 states that a stationary point of PCPO with KL divergence projection is different from the one of PCPO with $L ^ { 2 }$ norm projection. See Fig. 13 for illustration. To compare both stationary points, we consider the following example shown in Fig. 14. We maximize a non-convex function ${ \bf \dot { \boldsymbol { f } } } ( { \bf \boldsymbol { x } } ) = { \bf \boldsymbol { x } } ^ { T } \mathrm { d i a g } ( { \bf y } ) { \bf x }$ subject to the constraint ${ \pmb x } ^ { T } { \bf 1 } \leq - 1$ , where $\pmb { y } = [ 5 , - 1 ] ^ { T }$ , and 1 is an all-one vector. An optimal solution to this constrained optimization problem is infinity. Fig. 14(a) shows the update direction that combines the objective and the cost constraint update directions for both projections. It shows that PCPO with KL divergence projection has stationary points with $\mathbf { \pmb { g } } \in - { \pmb { a } }$ in the boundary of the constraint set (observe that the update direction is zero for PCPO with KL divergence projection at $\pmb { x } = [ 0 . 7 5 , - 1 . 7 5 ] ^ { T }$ , $[ 0 . 2 5 , - 1 . 2 \bar { 5 } ] ^ { T }$ , and $[ - 0 . 2 5 , - 0 . 7 5 ] ^ { T } )$ ), whereas PCPO with $\overline { { L } } ^ { 2 }$ norm projection does not have stationary points in the boundary of the constraint set. Furthermore, Fig. 14(b) shows the optimization paths for both projections with one initial starting point. It shows that starting at the initial point $[ 0 . 5 , - 2 . 0 ] ^ { T }$ , PCPO with KL divergence projection with the initial point $[ 0 . 5 , - \bar { 2 } . 0 ] ^ { T }$ converges to a local optimum, whereas $L ^ { 2 }$ norm projection converges to infinity. However, the above example does not necessary means that PCPO with $L ^ { 2 }$ norm projection always find a better optimum. For example, if the gradient direction of the objective is zero in the constraint set or in the boundary, then both projections may converge to the same stationary point.
|
| 648 |
+
|
| 649 |
+

|
| 650 |
+
Figure 13: The semantic overview of stationery points of PCPO. The red dashed lines are negative directions of normal cones, and the green dashed lines are objective update directions. The objective update direction in an stationary point is belong to the negative normal cone.
|
| 651 |
+
|
| 652 |
+

|
| 653 |
+
Figure 14: The policy update direction that combines the objective and the constraint update directions of each point (top), and the optimization path of PCPO with KL divergence and $\bar { L } ^ { 2 }$ norm projections with the initial point $[ 0 . 5 , \dot { - } 2 . 0 ] ^ { T }$ (below). The red star is the initial point, the red arrows are the optimization paths, and the region that is below to the black line is the constraint set. We see that both projections converge to different solutions.
|
md/train/rke41hC5Km/rke41hC5Km.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GENERATING REALISTIC STOCK MARKET ORDERSTREAMS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We propose an approach to generate realistic and high-fidelity stock market data based on generative adversarial networks. We model the order stream as a stochastic process with finite history dependence, and employ a conditional Wasserstein GAN to capture history dependence of orders in a stock market. We test our approach with actual market and synthetic data on a number of different statistics, and find the generated data to be close to real data.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Financial markets are among the most well-studied and closely watched complex multiagent systems in existence. Well-functioning financial markets are critical to the operation of a complex global economy, and small changes in the efficiency or stability of such markets can have enormous ramifications. Accurate modeling of financial markets can support improved design and regulation of these critical institutions. There is a vast literature on financial market modeling, though still a large gap between the state-of-art and the ideal. Analytic approaches provide insight through highly stylized model forms. Agent-based models accommodate greater dynamic complexity, and are often able to reproduce “stylized facts” of real-world markets (LeBaron, 2006). Currently lacking, however, is a simulation capable of producing market data at high fidelity and high realism. Our aim is to develop such a model, to support a range of market design and analysis problems. This work provides a first step, learning a high-fidelity generator from real stock market data streams.
|
| 12 |
+
|
| 13 |
+
Our main contribution is an approach to produce stock market data that is close to real market data, using a Wasserstein generative adversarial network (WGAN) (Arjovsky et al., 2017). There are many challenges that we overcome as part of this contribution. The first is how to represent a stream of stock market orders as data that can be used in a WGAN. Towards this end, we assume the stock market data stream to arise from a stochastic process with finite (but long) memory dependence. The stochastic process view also makes precise the conditional distribution that the generator is learning as well the joint distribution that the critic of the WGAN distinguishes by estimating the earth-mover distance.
|
| 14 |
+
|
| 15 |
+
The second main challenge is the design of the network architecture. We choose a conditional WGAN to capture the history dependence of the stochastic process, with both the generator and critic conditional on history of orders and the time of day. A single LSTM layer is used to summarize the history succinctly. The internal architecture of both the generator and critic uses a standard convolutional structure. The generator outputs the next stock market order as well as how this order changes the active orders in the market. Part of the generator output, which updates the active market orders, is produced using a pre-trained network to approximate the deterministic buy and sell order matching in the stock market.
|
| 16 |
+
|
| 17 |
+
Finally, we experiment with synthetic and real market data. The synthetic data is produced using a stock market simulator that has been used in several agent-based financial studies. The real data was obtained from OneMarketData, a financial data provider and publisher of the OneTick database product. We evaluate the generated data using various statistics such as the distribution of price and quantity of orders, inter-arrival times of orders, and the best bid and best ask evolution over time. We find the generated data matches the corresponding statistics in real data (simulated or actual stock market) closely.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Visual representation and evolution of a limit order book.
|
| 21 |
+
|
| 22 |
+
# 2 RELATED WORK AND BACKGROUND
|
| 23 |
+
|
| 24 |
+
WGAN is a popular and well-known variant of GANs (Goodfellow et al., 2014). Most prior work on generation of sequences using GANs has been in the domain of text generation (Press et al., 2017; Zhang et al., 2017). However, since the space of word representations is not continuous, the semantics change with nearby word representation, and given a lack of agreement on the metrics for measuring goodness of sentences, producing good quality text using GANs is still an active area of research. Stock market data does not suffer from this representation problem but the history dependence for stock markets can be much longer than for text generation. In a sequence of recent papers, Xiao et al. (2017; 2018) have introduced GAN-based methods for generating point processes. The proposed methods generate the time for when the next event will occur. The authors have also explored the use of these techniques to generate the time for transaction events in stock markets. Our problem is richer as we aim to generate the actual limit orders including time, order type, price, and quantity information.
|
| 25 |
+
|
| 26 |
+
Deep neural networks and machine learning techniques have been used on financial data mostly for prediction of transaction price (Hiransha et al., 2018; Bao et al., 2017; Qian, 2017) and for prediction of actual returns (Abe & Nakayama, 2018). As stated, our goal is not market prediction per se, but rather market modeling. Whereas the problems of learning to predict and generate may overlap (e.g., both aim to capture regularity in the domain), the evaluation criteria and end product are quite distinct.
|
| 27 |
+
|
| 28 |
+
The stock market is a venue where equities or stocks of publicly held companies are traded. Nearly all stock markets follow the continuous double auction (CDA) mechanism (Friedman, 1993). Traders submit bids, or limit orders, specifying the maximum price at which they would be willing to buy a specified quantity of a security, or the minimum price at which they would be willing to sell a quantity.1 The order book is a store that maintains the set of active orders: those submitted but not yet transacted or canceled. CDAs are continuous in the sense that when a new order matches an existing (incumbent) order in the order book, the market clears immediately and the trade is executed at the price of the incumbent order—which is then removed from the order book. Orders may be submitted at any time, and a buy order matches and transacts with a sell order when the limits of both parties can be mutually satisfied. For example, as shown in Figure 1 if a limit buy order with price $\$ 10.01$ and quantity 100 arrives and the order book has the best offered sell price at $\$ 10.01$ with quantity 100 then the arriving order matches an incumbent exactly. However, the next buy order does not match any sell, and the following sell order partially matches what is then the best buy in the order book.
|
| 29 |
+
|
| 30 |
+
The limit order book maintains the current active orders in the market (or the state of the market), which can be described in terms of the quantity offered to buy or sell across the range of price levels. Each order arrival changes the market state, recorded as an update to the order book. After processing any arrived order every buy price level is higher than all sell price levels, and the best bid refers to the lowest buy price level and the best ask refers to the highest sell price level. See Figure 1 for an illustration. The order book is often approximated by few (e.g., ten) price levels above the best bid and ten price levels below the best ask; as these prices are typically the ones that dictate the transactions in the market. There are various kinds of traders in a stock market, ranging from individual investors to large investing firms. Thus, there is a wide variation in the nature of orders submitted for a security. We aim to generate orders for a security in aggregate (not per agent) that is close to the aggregate orders generated in a real market. We focus on generating orders and do not attempt to generate transactions in the stock market. This is justified as the CDA mechanism is deterministic and transactions can be determined exactly given a stream of orders.
|
| 31 |
+
|
| 32 |
+
# 3 STOCK-GAN
|
| 33 |
+
|
| 34 |
+
# 3.1 STOCK MARKET ORDERS AS A STOCHASTIC PROCESS
|
| 35 |
+
|
| 36 |
+
We model stock market orders as a stochastic process. Recall that a stochastic process is a collection of random variables indexed by a set of numbers. We view the stock market orders for a given chunk of time of day $\Delta { \sf t }$ as a collection of vector valued random variable $\{ { \bf x } _ { i } \} _ { i \in N }$ indexed by the limit order sequence number in $N = \{ 1 , \ldots , n \}$ . The components of the random vector $\mathbf { x } _ { i }$ include the time interval ${ \mathrm { d } } _ { i }$ , type of order $\mathbf { t } _ { i }$ , limit order price $\mathsf { p } _ { i }$ , limit order quantity $\mathbf { q } _ { i }$ , and the best bid ${ \mathrm { a } } _ { i }$ and best ask $\mathsf { b } _ { i }$ . The time interval ${ \mathrm { d } } _ { i }$ specifies the difference in time between the current order $i$ and previous order $i - 1$ (in precision of milliseconds); the range of ${ \mathrm { d } } _ { i }$ is finite. The type of order can be buy, sell, cancel buy, or cancel sell (represented in two bits). The price and quantity are restricted to lie within finite bounds. The price range is discretized in units of US cents and the quantity range is discretized in units of the equity (non-negative integers). The best bid and best ask are limit orders themselves and are specified by price and quantity. Observe that we assume the stochastic process depends on the discrete time of day $\Delta { \sf t }$ , which we will make explicit in the next paragraph. We divide the time in a day into 25 equal intervals and $\Delta { \sf t }$ refers to the index of the interval. A visual representation of $\mathbf { x } _ { i }$ is shown in Figure 2(a).
|
| 37 |
+
|
| 38 |
+
Following the terminology prevalent for stochastic processes, the above process is discrete time and discrete space (note that discrete time in this terminology here refers to the discreteness of the index set $N$ ). We assume a finite history dependence of the current output $\mathbf { x } _ { i }$ , that is, $P ( \mathbf { x } _ { i } \mid$ $\mathbf { x } _ { i - 1 } , \hdots , \Delta \mathrm { t } ) = P ( \mathbf { x } _ { i } \mid \mathbf { x } _ { i - 1 } , \hdots , \mathbf { x } _ { i - m } , \Delta \mathrm { t } )$ . Such dependence is justified by the observation that recent orders mostly determine the transactions and transaction price in the market as orders that have been in the market for long either get transacted or canceled. Further, the best bid and best ask serves as an (approximate) sufficient statistic for events beyond the history length $m$ . While this process is not a Markov chain, it forms what is known as a higher order Markov chain, which implies that the process given by $\mathbf { y } _ { i } = ( \mathbf { x } _ { i } , \ldots , \mathbf { x } _ { i - m + 1 } )$ is a Markov chain for any given time interval $\Delta { \sf t }$ . We assume that this chain formed by $\mathbf { y } _ { i }$ has a stationary distribution (i.e., it is irreducible and positive recurrent). A Markov chain is a stationary stochastic process if it starts with its stationary distribution. After some initial mixing time, the Markov chain does reach its stationary distribution, thus, we assume that the process is stationary by throwing away some initial data for the day. Also, for the jumps across two time intervals $\Delta { \sf t }$ , we assume the change in stationary distribution is small and hence the mixing happens very quickly. A stationary process means that $P ( \mathbf { x } _ { i } , \ldots , \mathbf { x } _ { i - m + 1 } \mid$ $\Delta \mathfrak { t } ,$ ) has the same distribution for any $i$ . In practice we do not know $m$ . However, we can assume a larger history length $k + 1 > m$ , and then it is straightforward to check that $\mathbf { y } _ { t } = ( \mathbf { x } _ { i } , \ldots , \mathbf { x } _ { i - k } )$ is a Markov chain and the claims above hold with $m - 1$ replaced by $k$ . We choose $k = 2 0$ .
|
| 39 |
+
|
| 40 |
+
# 3.2 WGAN ARCHITECTURE AND WORKING
|
| 41 |
+
|
| 42 |
+
Given the above stochastic process view of the problem, we design a conditional WGAN with a recurrent architecture to learn the real conditional distribution $P _ { r } ( \mathbf { x } _ { i } \mid \mathbf { x } _ { i - 1 } , \ldots , \mathbf { x } _ { i - k } , \Delta { \mathrm { t } } )$ . We use the subscript $r$ to refer to real distributions and the subscript $g$ to refer to generated distributions. The real data $\pmb { x } _ { 1 } , \pmb { x } _ { 2 } , \ldots$ is a realization of the stochastic process. It is worth noting that even though $P ( \mathbf { x } _ { i } , \ldots , \mathbf { x } _ { i - k } \mid \Delta \mathbf { t } )$ has the same distribution for any $i$ , the realized real data sequence $\pmb { x } _ { i } , \ldots . \pmb { x } _ { i - k }$ is correlated with any overlapping sequnce $\pmb { x } _ { i + k ^ { \prime } } , \dotsc . . . \pmb { x } _ { i - k + k ^ { \prime } }$ for $k \geq k ^ { \prime } \geq - \bar { k }$ . Our data points for training (stated in detail in the next paragraph) are sequences $\pmb { x } _ { i } , \ldots . \pmb { x } _ { i - k }$ , and to ensure independence in a batch we make sure that the sequences chosen in a batch are sufficiently far apart.
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
Figure 2: Stock-GAN architecture
|
| 46 |
+
|
| 47 |
+
Architecture: The architecture is shown in Figure 2. Our proposed WGAN is conditional (Mirza & Osindero, 2014) with both the generator and critic conditioned on a $k$ length history and the time interval $\Delta t$ . The history is condensed to one vector using a single LSTM layer. This vector and some uniform noise is fed to a fully connected layer layer followed by a convolutional structure. The generator outputs the next $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ (realization of $\mathbf { x } _ { i }$ ) and the critic outputs one real number. Note that when training both generator and critic are fed history from real data, but when the generator executes after training it is fed its own generated data as history. As stated earlier, the generator output includes the best bid and ask. As the best bid and ask can be inferred deterministically from the current order and the previous best bid and ask (for most orders), we use another neural network (with frozen weights during GAN training) to output the best bid and ask. We call this the CDA network. The CDA network is trained separately using a standard MSE loss (see Appendix C).
|
| 48 |
+
|
| 49 |
+
Critic details: When fed real data, the critic can be seen as a function $c _ { w }$ of $\begin{array} { r l } { s _ { i } } & { { } = } \end{array}$ $( { \pmb x } _ { i } , \dots , { \pmb x } _ { i - k } , \Delta t )$ , where $w$ are the weights of the critic network. As argued earlier, samples in a bfor (wi h that are chosen from resamples fed to the critic, the ten price levels determ paced at le estimates utput orde $k$ i.i.d. samples of . When fed gene ten levels), by si $P _ { r }$ . Thened dataar rea$m$ $\begin{array} { r } { \frac { 1 } { m } \sum _ { i = 1 } ^ { m } c _ { w } ( \pmb { s } _ { i } ) ^ { * } } \end{array}$ $E _ { \mathbf { s } \sim P _ { r } } ( c _ { w } ( \mathbf { s } ) )$
|
| 50 |
+
soning $\begin{array} { r } { \frac { 1 } { m } \sum _ { i = 1 } ^ { \hat { m } } c _ { w } ( \pmb { s } _ { i } ) } \end{array}$ estimates $E _ { \mathbf { s } \sim P _ { g } } ( c _ { w } ( \mathbf { s } ) )$ when the samples are sufficiently apart (recall that the history is always real data). Thus, the critic computes the Wasserstein distance between the joint distributions $P _ { r } ( \mathbf { x } _ { i } , . . . , \mathbf { x } _ { i - k } , \Delta \mathrm { t } )$ and $P _ { g } ( \mathbf { x } _ { i } , . . . , \mathbf { x } _ { i - k } , \Delta \mathrm { t } )$ . Further, we use a gradient penalty term in the loss function for the critic instead of clipping weights as proposed in the original WGAN paper (Arjovsky et al., 2017) because of the better performance as revealed in prior work (Gulrajani et al., 2017).
|
| 51 |
+
|
| 52 |
+
Generator details: The generator learns the conditional distribution $P _ { g } ( \mathbf { x } _ { i } \mid \mathbf { x } _ { i - 1 } , \ldots , \mathbf { x } _ { i - k } , \Delta { \mathrm { t } } )$ . Along with the real history, the generator represents the distribution $P _ { g } ( \mathbf { x } _ { i } , . . . , \mathbf { x } _ { i - k } , \Delta \mathrm { t } ) = P _ { g } ( \mathbf { x } _ { i } \mid$ $\mathbf { x } _ { i - 1 } , \hdots , \mathbf { x } _ { i - k } , \Delta { \mathrm { t } } ) P _ { r } ( \bar { \mathbf { x } _ { i - 1 } } , \hdots , \mathbf { x } _ { i - k } , \Delta { \mathrm { t } } )$ .
|
| 53 |
+
|
| 54 |
+
The loss functions used is the standard WGAN loss function with a gradient penalty term (Gulrajani et al., 2017). The critic is trained 100 times in each iteration and as already stated, the notable part in constructing the training data is that for each mini-batch the sequence of orders chosen (including history) is far away from any other sequence in that mini-batch (see Appendix C for code snippets).
|
| 55 |
+
|
| 56 |
+
# 4 EXPERIMENTAL RESULTS
|
| 57 |
+
|
| 58 |
+
We apply and evaluate Stock-GAN on two types of data sets composed of orders from an agentbased market simulator and from a real stock market, respectively. We describe each data set in detail and then compare key metrics and distributions of our generated orders with ground truth orders from the agent-based simulator and real stock markets.
|
| 59 |
+
|
| 60 |
+
# 4.1 SYNTHETIC AND REAL DATA
|
| 61 |
+
|
| 62 |
+
Synthetic data: We first evaluate Stock-GAN on synthetic orders generated from an agent-based market simulator. Previously adopted to study a variety of issues in financial markets (e.g., market making and manipulation), the simulator captures stylized facts of the complex financial market with specified stochastic processes and distributions (Wellman & Wah, 2017). We briefly describe the market simulator below.
|
| 63 |
+
|
| 64 |
+
In the simulation, the market operates over a finite time horizon. Agents enter and reenter the market according to a Poisson process with an arrival rate of 0.005. On each arrival these traders submit a limit order to the market (replacing their previous order, if any), indicating the price at which they are willing to buy or sell a single unit of the security. The market environment is populated by 32 traders, representing investors. Each investor has an individual valuation for the security made up of private and common components. The common component is represented by a fundamental value, which can be viewed as the intrinsic value of the security. This fundamental value varies over time according to a mean-reverting stochastic process. The private component of value captures the preference contribution of the individual agent’s reason for trading this security at the current time (e.g., investment, liquidity, diversification). The private valuations are drawn from a specified distribution at the start of a simulation. The common and private components are effectively added together to determine each agents valuation of the security. Agents accrue private value on each transaction, and at the end of the trading horizon evaluate their accumulated inventory on the basis of a prediction of the end-time fundamental. Given the market mechanism and valuation model for the simulation, investors pursue their trading objectives by executing a trading strategy in that environment. A popular trading strategy we adopt in the simulator is the zero-intelligence (ZI) strategy (Farmer et al., 2005). The ZI trader shades its bid from its current valuation of the stock by a random offset. We use about 300,000 orders generated by the simulator as our synthetic data. The price output by the simulator is normalized to lie in the interval $[ - 1 , 1 ]$ .
|
| 65 |
+
|
| 66 |
+
Real data: We obtained real limit-order streams from OneMarketData, who provided access for our research to their OneTick database for selected time periods and securities. The provided data streams comprise order submissions and cancellations across multiple exchanges at millisecond granularity. In experiments, we evaluate in the performance of Stock-GAN on two securities: a small capitalization stock, Patriot National (PN), and a large capitalization stock, Alphabet Inc (GOOG). The two stocks differ in several key aspects, including investment sector, market activity intensity, price range, liquidity etc., and thus their order patterns represent distinct dynamic processes. By training Stock-GAN with historical data for individual stocks, we can generate limit-order streams that capture key characteristics of each.
|
| 67 |
+
|
| 68 |
+
Relative to our simulated agent-based market, the real market limit orders tend be very noisy including many orders at extreme prices far from the range where transactions occur. Since our interest is primarily on behavior that can affect market outcomes, we focus on limit orders in the relevant range near the best bid and ask. Specifically, in a preprocessing step, we eliminate limit orders that never appear within ten levels of the best bid and ask prices. In the experiment reported here, we use historical real market data of PN during one trading day in August 2016, and GOOG during one trading day in August 2017. After preprocessing, the PN daily order stream has about 20,000 orders and GOOG has about 230,000.
|
| 69 |
+
|
| 70 |
+
# 4.2 EVALUATION STATISTICS
|
| 71 |
+
|
| 72 |
+
We generate a number of orders equal to the number of real orders used to train the WGAN. We evaluate our generated order stream in comparison to real data using the following statistics:
|
| 73 |
+
|
| 74 |
+
1. Price. Distribution over price for the day’s limit orders, by order type.
|
| 75 |
+
2. Quantity. Distribution over quantity for the day’s limit orders, by order type.
|
| 76 |
+
3. Inter-arrival time. Distribution over inter-arrival durations for the day’s limit orders, by
|
| 77 |
+
order type.
|
| 78 |
+
4. Intensity evolution. Number of orders for consecutive 1000-second chunks of time.
|
| 79 |
+
5. Best bid/ask evolution. Changes in the best bid and ask over time as new orders arrive.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 3: Simulated, PN, and GOOG submitted buy-order statistics.
|
| 83 |
+
|
| 84 |
+
A note on cancellation: In our generation process, cancellation type orders are not contingent on the order book. We use a heuristic which is to match the generated cancellation order to the closest priced order in the book. Cancellations that are too far from any existing order to be a plausible match are ignored.
|
| 85 |
+
|
| 86 |
+
# 4.3 RESULTS
|
| 87 |
+
|
| 88 |
+
In describing our results, “real” refers to simulated or actual stock market data and “fake” refers to generated data. Figure 3 presents statistics on buy orders for the three cases when the real data is simulated, PN, or GOOG. For simulated data, the price and inter-arrival distribution matches the real distribution quite closely. The quantity for the simulated data is always one, which is also trivially captured in the generated data. For PN and GOOG, the quantity distribution misses out on some peaks but gets most of the peaks in the real distribution. The inter-arrival time distribution matches quite closely (note that the axis has been scaled for inter-arrival time to highlight the peaks and show the full range of time). The price distribution matches closely for GOOG, but is slightly off for PN, which could be due to the low amount of data for PN.
|
| 89 |
+
|
| 90 |
+
Figure 4 presents statistics on sell orders for the three cases when the real data is simulated, PN, or GOOG. The results for sell orders are quite similar to buy orders. Results for cancellations are included in the appendix.
|
| 91 |
+
|
| 92 |
+
Figure 5 presents order intensity as a function of time (number of orders in every chunk of 1000 secs normalized by max number) for the simulated, PN, and GOOG markets. As in the graphs for other statistics, generated WGAN results are compared with the measured intensities in the real data. The intensities show similar trends, though for the real markets there is significant variation. The differences are particularly large for PN, likely due to the relatively smaller magnitude of trading volume for that stock.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 4: Simulated, PN, and GOOG submitted sell-order statistics.
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 5: Intensity of market activities that include all types of orders across the trading period.
|
| 99 |
+
|
| 100 |
+
In Figure 6, we show the change in best buy/ask as a function of time for the simulated, PN, and GOOG markets. The generated results looks similar to real data in range and variation over time for simulated data. The similarity to real best bid/ask is better for GOOG than PN, which could possibly be due to more data available for GOOG.
|
| 101 |
+
|
| 102 |
+
Quantitative measures: The figures till now show that the price distribution appears like a normal distribution and the inter-arrival time appears like a geometric distribution (geometric is discrete version of exponential). We fit these standard distributions to the real price and inter-arrival distribution and compare the total variation (TV) distance between the real and fitted vs real and generated
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
|
| 106 |
+
(a) Simulated best bids and asks.
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
|
| 110 |
+
(b) Real PN best bids and asks.
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
|
| 114 |
+
(c) Real GOOG best bids and asks.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
|
| 118 |
+
(d) Fake best bids and asks.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
|
| 122 |
+
(e) Fake PN best bids and asks.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
(f) Fake GOOG best bids and asks.
|
| 126 |
+
|
| 127 |
+
Figure 6: Best bid and ask evolution across order book state changes.
|
| 128 |
+
|
| 129 |
+
<table><tr><td rowspan="2">TV distance between</td><td colspan="2">Simulated</td><td colspan="2">PN</td><td colspan="2">GOOG</td></tr><tr><td>Price</td><td>IA</td><td>Price</td><td>IA</td><td>Price</td><td>IA</td></tr><tr><td>Real and Fitted (buy)</td><td>0.4910</td><td>0.8457</td><td>1.3449</td><td>1.0571</td><td>1.0573</td><td>1.2953</td></tr><tr><td>Real and Generated (buy)</td><td>0.7439</td><td>0.2847</td><td>1.6828</td><td>0.2373</td><td>1.0614</td><td>0.3631</td></tr><tr><td>Real and Fitted (sell)</td><td>0.4968</td><td>0.8516</td><td>1.5453</td><td>0.9912</td><td>1.0546</td><td>1.3869</td></tr><tr><td>Real and Generated (sell)</td><td>0.8246</td><td>0.2025</td><td>1.4813</td><td>0.2477</td><td>1.1572</td><td>0.3286</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Table 1: TV distance comparisons between fitted and generated distribution. IA means inter-arrival.
|
| 132 |
+
|
| 133 |
+
distributions. The quantity distribution does not appear like any standard distribution, hence we do not evaluate it by fitting. The results in Table 1 show that the generated price distribution is almost as close to the real one as the fitted price distribution. The generated inter-arrival distribution is much closer to the real one than the fitted price distribution. A point to note is that the actual price and quantity is a stochastic process with dependence on history, thus, the fitted distributions will not be helpful in generating the correct intensities or best bid and best ask evolution.
|
| 134 |
+
|
| 135 |
+
A note on architectural choices: Various parts of our architecture were developed iteratively to improve the results that we obtained in a previous iteration. The input of $\Delta \mathbf { t }$ to the generator and critic is critical to get the time trend in the intensity for the GOOG stock. The CDA network and the best bid and ask in history was added to improve the results for best bid/ask variation over time.
|
| 136 |
+
|
| 137 |
+
Comparision with baseline: We also implemented a variational recurrent generative network but found its performance to be worse than our approach (shown in Appendix B).
|
| 138 |
+
|
| 139 |
+
# 5 CONCLUSION
|
| 140 |
+
|
| 141 |
+
Our results reveal that GANs can be used to simulate a stock market. While our results are promising, there are open issues that provide for further research material. One experimental aspect is to try different size of the network in the WGAN, possibly dependent on the data size of the given stock and testing with many different variety of stocks. Another open research issue is to output cancellations in a more intelligent manner than the heuristic approach we use now. Overall, our work provides fertile ground for future research at the intersection of deep learning and finance.
|
| 142 |
+
|
| 143 |
+
# REFERENCES
|
| 144 |
+
|
| 145 |
+
Masaya Abe and Hideki Nakayama. Deep learning for forecasting stock returns in the cross-section. In Pacific-Asia Conference on Knowledge Discovery and Data Mining, pp. 273–284, 2018.
|
| 146 |
+
|
| 147 |
+
Fred´ eric Abergel, Anana Marouane, Anirban Chakraborti, Aymen Jedidi, and Ioane Muni Toke. ´ Limit Order Books. Cambridge University Press, 2016.
|
| 148 |
+
|
| 149 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In 34th International Conference on Machine Learning, pp. 214–223, 2017.
|
| 150 |
+
|
| 151 |
+
Wei Bao, Jun Yue, and Yulei Rao. A deep learning framework for financial time series using stacked autoencoders and long-short term memory. PLOS One, 12(7):e0180944, 2017.
|
| 152 |
+
|
| 153 |
+
Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015.
|
| 154 |
+
|
| 155 |
+
J. Doyne Farmer, Paolo Patelli, and Ilija I. Zovko. The predictive power of zero intelligence in financial markets. Proceedings of the National Academy of Sciences, 102:2254–2259, 2005.
|
| 156 |
+
|
| 157 |
+
Daniel Friedman. The double auction market institution: A survey. The Double Auction Market Institutions, Theories and Evidence, Addison Wesley, 1993.
|
| 158 |
+
|
| 159 |
+
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.
|
| 160 |
+
|
| 161 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of Wasserstein GANs. In Advances in Neural Information Processing Systems, pp. 5767–5777, 2017.
|
| 162 |
+
|
| 163 |
+
M. Hiransha, E. A. Gopalakrishnan, Vijay Krishna Menon, and K. P. Soman. NSE stock market prediction using deep-learning models. Procedia Computer Science, 132:1351 – 1362, 2018. International Conference on Computational Intelligence and Data Science.
|
| 164 |
+
|
| 165 |
+
Blake LeBaron. Agent-based computational finance. In Leigh Tesfatsion and Kenneth L. Judd (eds.), Handbook of Computational Economics. Elsevier, 2006.
|
| 166 |
+
|
| 167 |
+
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
|
| 168 |
+
|
| 169 |
+
Ofir Press, Amir Bar, Ben Bogin, Jonathan Berant, and Lior Wolf. Language generation with recurrent generative adversarial networks without pre-training. arXiv preprint arXiv:1706.01399, 2017.
|
| 170 |
+
|
| 171 |
+
Xin-Yao Qian. Financial series prediction: Comparison between precision of time series models and machine learning methods. arXiv preprint arXiv:1706.00948, 2017.
|
| 172 |
+
|
| 173 |
+
Michael P. Wellman and Elaine Wah. Strategic agent-based modeling of financial markets. Russell Sage Foundation Journal of the Social Sciences, 3(1):104–119, 2017.
|
| 174 |
+
|
| 175 |
+
Shuai Xiao, Mehrdad Farajtabar, Xiaojing Ye, Junchi Yan, Le Song, and Hongyuan Zha. Wasserstein learning of deep generative point process models. In Advances in Neural Information Processing Systems, pp. 3247–3257, 2017.
|
| 176 |
+
|
| 177 |
+
Shuai Xiao, Hongteng Xu, Junchi Yan, Mehrdad Farajtabar, Xiaokang Yang, Le Song, and Hongyuan Zha. Learning conditional generative models for temporal point processes. In 32nd AAAI Conference on Artificial Intelligence, 2018.
|
| 178 |
+
|
| 179 |
+
Yizhe Zhang, Zhe Gan, Kai Fan, Zhi Chen, Ricardo Henao, Dinghan Shen, and Lawrence Carin. Adversarial feature matching for text generation. arXiv preprint arXiv:1706.03850, 2017.
|
| 180 |
+
|
| 181 |
+
# A ADDITIONAL RESULTS
|
| 182 |
+
|
| 183 |
+
Below we show results for buy order cancellation and sell order cancellation using the exact same measures as for the buy and sell orders in the main paper. The results also are similar to buy or sell results earlier.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 7: Simulated, PN, and GOOG cancelled buy orders statistics.
|
| 187 |
+
|
| 188 |
+

|
| 189 |
+
Figure 8: Simulated, PN and GOOG sell cancel orders.
|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
Figure 9: Simulated, PN, and GOOG submitted buy-order statistics using recurrent VAE.
|
| 193 |
+
|
| 194 |
+

|
| 195 |
+
Figure 10: Intensity of market activities for GOOG using recurrent VAE.
|
| 196 |
+
|
| 197 |
+
# B VARIATIONAL RECURRENT NEURAL NETWORK
|
| 198 |
+
|
| 199 |
+
We use the variational recurrent network as another baseline generative model. The architecture is exactly same as the work Chung et al. (2015). We used the code available at https: //github.com/phreeza/tensorflow-vrnn, but modified it. Our modification was to enable not forcing the output to be Gaussian as done in Chung et al. (2015), as those produced much worse results. Instead, we use a MSE loss. We also modified the input size, etc. to make the neural network structure compatible with our problem. The exact change to the code changing the loss function is shown below:
|
| 200 |
+
|
| 201 |
+
kl loss $=$ tf kl gaussgauss ( enc mu , enc sigma , prior mu , prior sigma )
|
| 202 |
+
# we replace the maximium likelihood loss with the mse loss below
|
| 203 |
+
mse loss $=$ tf.losses. mean squared error (y, dec rho )
|
| 204 |
+
return tf. reduce mean ( kl loss $^ +$ mse loss )
|
| 205 |
+
|
| 206 |
+
The results in Figure 9 for GOOG buy order only and in Figure 10 for all types of GOOG orders shows that the entropy of the output is high (when comparing price and inter-arrival distributions) and the performance is worse than our GAN. In particular, the generated (fake) price distribution is wider than the real one (or the one generated by the GAN). The generated inter-arrival distribution is almost uniform over the discrete time points and not concentrated at 0. The quantity distribution matches the real one, somewhat similarly like our GAN approach, but it generates some negative values unlike our GAN approach (which could be discarded). The intensity distribution is also somewhat close to the real intensity. The results are similar for other types of orders.
|
| 207 |
+
|
| 208 |
+
# C CODE SNIPPETS
|
| 209 |
+
|
| 210 |
+
Here we present codes snippets that show the architecture of the GAN. First, we start with the CDA network that is trained independently with MSE loss:
|
| 211 |
+
|
| 212 |
+
$$
|
| 213 |
+
{ \mathrm { i n p u t } } _ { \mathrm { - } } { \mathrm { h i s } } \ = \ { \mathrm { I n p u t } } \left( { \mathrm { s h a p e } } { = } ( 8 \ , ) \right)
|
| 214 |
+
$$
|
| 215 |
+
|
| 216 |
+
${ \sf G } = { \sf G }$ Sequential (name $= ^ { \ast }$ discriminator’)
|
| 217 |
+
G.add(Dense ( $2 5 6 * 3$ , input dim $^ { = 8 }$ ))
|
| 218 |
+
G.add( BatchNormalization ())
|
| 219 |
+
G.add( Activation (’relu’))
|
| 220 |
+
G.add(Reshape ((16 , 16, 3)))
|
| 221 |
+
G.add(Conv2D (128 ,(3 ,3) , padding $=$ ’same’))
|
| 222 |
+
G.add( BatchNormalization ())
|
| 223 |
+
G.add( Activation (’relu’))
|
| 224 |
+
G.add(Conv2D (64, (3,3), padding $=$ ’same’))
|
| 225 |
+
G.add( BatchNormalization ())
|
| 226 |
+
G.add( Activation (’relu’))
|
| 227 |
+
G.add(Conv2D (32 ,(3 ,3) , padding $=$ ’same’))
|
| 228 |
+
G.add( BatchNormalization ())
|
| 229 |
+
G.add( Activation (’relu’))
|
| 230 |
+
G.add(Flatten ())
|
| 231 |
+
G.add(Dense (4))
|
| 232 |
+
output vec $=$ G( input his )
|
| 233 |
+
self.net $=$ Model(inputs $=$ input his , outputs $=$ output vec )
|
| 234 |
+
optimizer $=$ Adam (0.0001)
|
| 235 |
+
self.net.compile( optimizer $=$ optimizer , loss $=$ ’mean squared error ’)
|
| 236 |
+
self.net.summary ()
|
| 237 |
+
|
| 238 |
+
Input LSTM structure for both Generator and Critic are shown below
|
| 239 |
+
|
| 240 |
+
########### Input for both Generator and Critic #######################
|
| 241 |
+
# history orders of shape (self.historyLength , self.orderLength)
|
| 242 |
+
history $=$ Input(shape $=$ (self.historyLength , self. orderLength ), name $=$ ’history full ’)
|
| 243 |
+
# current time slot: Integer , from 0 to 23
|
| 244 |
+
history input $=$ Input(shape $=$ (1,), name $=$ ’history time ’)
|
| 245 |
+
# noise input of shape (self.noiseLength)
|
| 246 |
+
noise input 1 $=$ Input(shape $=$ (self.noiseLength ,), name $=$ ’noise input 1 ’)
|
| 247 |
+
|
| 248 |
+
# Real order of shape((self.mini batch size ,self.orderLength) truth input $=$ Input(shape $=$ (self. mini batch size ,\ self.orderLength ,1), name $=$ ’truth input ’)
|
| 249 |
+
|
| 250 |
+
# lstm at Generator to extract history orders features lstm output $=$ LSTM(self. lstm out length )( history)
|
| 251 |
+
|
| 252 |
+
# lstm at Critic to extract history orders features lstm output h $=$ LSTM(self. lstm out length ,name $=$ ’lstm critic ’)( history)
|
| 253 |
+
|
| 254 |
+
# concatenate history features with noise gen input $=$ Concatenate (axi $\mathsf { s } = - 1 \mathsf { \bar { . } }$ )([history input , lstm output , noise input 1 ])
|
| 255 |
+
|
| 256 |
+
The Generator structure is shown below, which includes the trained CDA network
|
| 257 |
+
|
| 258 |
+
# Output: gen output 1 , shape(self.mini batch size ,self.orderLength − 4)
|
| 259 |
+
dropout $= ~ 0 . 5$
|
| 260 |
+
${ \sf G \_ 1 } =$ Sequential (name $=$ ’generator 1 ’)
|
| 261 |
+
G 1 .add(Dense ((self.orderLength −4)∗self. mini batch size $\ast 1 \otimes \otimes$ , \ input dim $=$ self. noiseLength $^ +$ self. lstm out length $^ +$ 1))
|
| 262 |
+
G 1 .add( BatchNormalization ())
|
| 263 |
+
G 1 .add( Activation (’relu’))
|
| 264 |
+
G 1 .add(Reshape ((int(self. mini batch size ), int(self. orderLength − 4), 100)))
|
| 265 |
+
G 1 .add( UpSampling2D ())
|
| 266 |
+
G 1 .add(Dropout(dropout ))
|
| 267 |
+
G 1 .add( UpSampling2D ())
|
| 268 |
+
G 1 .add( Conv2DTranspose (32, 32, padding $=$ ’same’))
|
| 269 |
+
G 1 .add( BatchNormalization ())
|
| 270 |
+
G 1 .add( Activation (’relu’))
|
| 271 |
+
G 1 .add( Conv2DTranspose (16 ,32 , padding $=$ ’same’))
|
| 272 |
+
G 1 .add( BatchNormalization ())
|
| 273 |
+
G 1 .add( Activation (’relu’))
|
| 274 |
+
G 1 .add( Conv2DTranspose (8, 32, padding $=$ ’same’))
|
| 275 |
+
G 1 .add( BatchNormalization ())
|
| 276 |
+
G 1 .add( Activation (’relu’))
|
| 277 |
+
G 1 .add( MaxPooling2D ((2 ,2)))
|
| 278 |
+
G 1 .add( Conv2DTranspose (1, 32, padding $=$ ’same’))
|
| 279 |
+
G 1 .add( Activation (’tanh’))
|
| 280 |
+
G 1 .add( MaxPooling2D ((2 ,2)))
|
| 281 |
+
|
| 282 |
+
gen output $\mathbf { \Sigma } _ { - 1 } ~ = ~ \mathsf { G } _ { - } 1$ ( gen input )
|
| 283 |
+
|
| 284 |
+
#CDA network(train offline)
|
| 285 |
+
#Input: cda input , shape(self.mini batch size , 8)
|
| 286 |
+
#Output: gen output 2 , shape(self.mini batch size , 4)
|
| 287 |
+
$\begin{array} { r l } { \mathsf { G } _ { - } 2 } & { { } = } \end{array}$ Sequential (name $=$ ’orderbook gen’)
|
| 288 |
+
G 2 .add(Dense ( $2 5 6 * 3$ , input dim $^ { = 8 }$ ))
|
| 289 |
+
G 2 .add( BatchNormalization ())
|
| 290 |
+
G 2 .add( Activation (’relu’))
|
| 291 |
+
G 2 .add(Reshape ((16 , 16, 3)))
|
| 292 |
+
G 2 .add(Conv2D (128 ,(3 ,3) , padding $=$ ’same’))
|
| 293 |
+
G 2 .add( BatchNormalization ())
|
| 294 |
+
G 2 .add( Activation (’relu’))
|
| 295 |
+
G 2 .add(Conv2D (64, (3,3), padding $=$ ’same’))
|
| 296 |
+
G 2 .add( BatchNormalization ())
|
| 297 |
+
G 2 .add( Activation (’relu’))
|
| 298 |
+
G 2 .add(Conv2D (32 ,(3 ,3) , padding $=$ ’same’))
|
| 299 |
+
G 2 .add( BatchNormalization ())
|
| 300 |
+
G 2 .add( Activation (’relu’))
|
| 301 |
+
G 2 .add(Flatten ())
|
| 302 |
+
G 2 .add(Dense (4))
|
| 303 |
+
# extract the last best bid/ask from history as the history of CDA
|
| 304 |
+
orderbook history $=$ Lambda(lambda $\mathbf { x } : ~ \mathbf { x } \left[ : \right. , - 1 , 5 : \left. \right]$ , output shape $=$ (4 ,))( history)
|
| 305 |
+
# gen output 1 is output of generator
|
| 306 |
+
gen output reshaped $=$ Reshape ((self.orderLength −4,))( gen output 1 )
|
| 307 |
+
# remove time as it is not needed for CDA network
|
| 308 |
+
gen output without time $= ~ \backslash$
|
| 309 |
+
|
| 310 |
+
Lambda(lambda x $\therefore \mathbf { x } \left[ : , 1 : \right]$ , output shape $=$ (4 ,))( gen output reshaped ) cda input $=$ Concatenate (axi $\ S = 1$ )([ gen output without time , orderbook history ]) gen output $\_ 2 \ = \ \mathsf { G } \_ 2$ ( cda input )
|
| 311 |
+
|
| 312 |
+
#Output of Generator , shape(self.mini batch size , self.orderLength) concatentated # with output of the CDA network to get final output
|
| 313 |
+
|
| 314 |
+
gen output $=$ Concatenate (axis $^ { } = 2$ )([ gen output 1 ,\ Reshape ((self. mini batch size , 4, 1))( generator output 2 )])
|
| 315 |
+
|
| 316 |
+
The structure of the critic is shown below ############# Critic ##################
|
| 317 |
+
|
| 318 |
+
# Input of Critic , merge history input , lstm output h and gen output/truth input discriminator input fake $=$ ( Concatenate (axis $^ { = 2 }$ ) \
|
| 319 |
+
|
| 320 |
+
([ Reshape ((1, 1 ,1))( history input ), \ Reshape ((1, self. lstm out length ,1))( lstm output h ), gen output ]))
|
| 321 |
+
discriminator input truth $=$ Concatenate (axis $^ { = 2 }$ ) \ ([ Reshape ((1, 1 ,1))( history input ), \ Reshape ((1, self. lstm out length ,1))( lstm output h ), truth input ])
|
| 322 |
+
#random−weighted average of real and generated samples − following
|
| 323 |
+
# Improved WGAN work
|
| 324 |
+
averaged samples $=$ RandomWeightedAverage ()\ ([ discriminator input fake , discriminator input truth ])
|
| 325 |
+
#Critic
|
| 326 |
+
#Input: discriminator input fake/discriminator input truth
|
| 327 |
+
#Ouput: score
|
| 328 |
+
$\boldsymbol { \mathrm { ~ D ~ } } =$ Sequential (name=’discriminator’)
|
| 329 |
+
D.add(Conv2D (512 ,(3 ,3) , padding=’same’, input shape $=$ (self. mini batch size , \ self. orderLength $^ +$ self. lstm out length $+ 1$ ,1)))
|
| 330 |
+
D.add( Activation (’relu’))
|
| 331 |
+
D.add(Conv2D (256 , (3,3), padding $=$ ’same’))
|
| 332 |
+
D.add( Activation (’relu’))
|
| 333 |
+
D.add(Conv2D (128 ,(3 ,3) , padding $=$ ’same’))
|
| 334 |
+
D.add( Activation (’relu’))
|
| 335 |
+
D.add(Flatten ())
|
| 336 |
+
D.add(Dense (1))
|
| 337 |
+
|
| 338 |
+
#self.D = D
|
| 339 |
+
|
| 340 |
+
discriminator output fake $=$ D( discriminator input fake ) discriminator output truth $=$ D( discriminator input truth ) averaged samples output $=$ D( averaged samples )
|
| 341 |
+
|
| 342 |
+
# #Def gradient penalty loss
|
| 343 |
+
|
| 344 |
+
partial gp loss $=$ partial(self. gradient penalty loss , averaged samples $=$ averaged samples , gradient penalty weight $^ { = 1 }$ )
|
| 345 |
+
partial gp loss . n a m e $=$ ’gradient penalty
|
| 346 |
+
|
| 347 |
+
The full model
|
| 348 |
+
|
| 349 |
+
############## Model Definition ############### self.gen $=$ Model(inputs ${ } , { } = { }$ [ history input ,history , noise input 1 ], outputs $=$ gen output ) #Model Truth:
|
| 350 |
+
|
| 351 |
+
self. model truth $=$ Model(inputs $=$ [ history input ,history , noise input 1 , truth input ], outputs ${ } _ { 1 } = { }$ [ discriminator output fake , discriminator output truth ,\ averaged samples output ])
|
| 352 |
+
|
| 353 |
+
#Model Fake:
|
| 354 |
+
self. model fake $=$ Model(inputs $=$ [ history input ,history , noise input 1 ],\ outputs $=$ discriminator output fake )
|
| 355 |
+
#Optimizer
|
| 356 |
+
optimizer $=$ Adam (0.0001 , beta $_ - 1 = 0 . 5$ , beta $\mathbf { \Omega } _ { - } 2 = \ \Theta \cdot \mathbf { \Omega } 9 \mathbf { \dot { \Omega } } .$ )
|
| 357 |
+
#Compile Models
|
| 358 |
+
#Generator
|
| 359 |
+
self.gen.compile( optimizer $=$ optimizer , loss $=$ ’binary crossentropy’)
|
| 360 |
+
self.gen.summary ()
|
| 361 |
+
#Model Truth − Generator is not trainable here
|
| 362 |
+
for layer in self. model truth .layers: layer. trainable $=$ False
|
| 363 |
+
self. model truth . get layer (name $=$ ’discriminator’). trainable $=$ True
|
| 364 |
+
self. model truth . get layer (name $=$ ’lstm critic ’). trainable $=$ True
|
| 365 |
+
self. model truth .compile( optimizer $=$ optimizer , loss $=$ [self. w loss ,self. w loss , partial gp loss ])
|
| 366 |
+
#Model Fake − critic is not trainable here
|
| 367 |
+
for layer in self. model fake .layers: layer. trainable $=$ True
|
| 368 |
+
self. model fake . get layer (name $=$ ’discriminator’). trainable $=$ False
|
| 369 |
+
self. model fake . get layer (name $=$ ’lstm critic ’). trainable $=$ False
|
| 370 |
+
self. model fake .compile( optimizer $=$ optimizer , loss $=$ self. w loss )
|
| 371 |
+
#print summary
|
| 372 |
+
self. model fake .summary ()
|
| 373 |
+
self. model truth .summary ()
|